HISE Logo Forum
    • Categories
    • Register
    • Login

    Loris applyFilter doesn't seem to work

    Scheduled Pinned Locked Moved Scripting
    1 Posts 1 Posters 74 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      Unless I'm not shaping the data object correctly for the filter?

      // using time in seconds (default)
      
      // pitch shift works (example from the Loris docs)
      var pitchShiftData = [[0.0, 0], [0.2,  0], [0.4,  300], [0.4, -300], [0.6, 0]];
      lorisManager.process(file, "shiftPitch", data);
      
      // doesn't work, just mutes the output
      var filterData = [[0.0, 0], [0.2,  0], [0.4,  1], [0.4, .5], [0.6, 0]];
      lorisManager.process(file, "applyFilter", filterData);
      
      // also doesn't work, same result
      var filterData = [[0.0, 0], [0.2,  0], [0.4,  20000], [0.4, 10000], [0.6, 0]];
      lorisManager.process(file, "applyFilter", filterData);
      

      Edit - here's the source code for it:

      if (command == ProcessIds::applyFilter)
      {
      	juce::ScopedValueSetter<TimeDomainType> svs(options.currentDomainType, TimeDomainType::Frequency);
      
      	auto env = createEnvelopeFromJSON(data);
      
      	for (auto& l : list) // for each partial
      	{
      		for (auto& p : *l) // i assume this is the envelope
      		{
      			for (auto& b : p) // for each breakpoint in the envelope
      			{
      				auto freq = breakpoint_getFrequency(&b); // "returns the frequency of the specified breakpoint"
      				auto gain = linearEnvelope_valueAt(env, freq); // "returns the interpolated value of this linearEnvelope at the specified time"
      
      				gain *= breakpoint_getAmplitude(&b); // "returns the absolute amplitude of the specified breakpoint"
      
      				breakpoint_setAmplitude(&b, gain); // "assigns a new (absolute) amplitude to the specified breakpoint"
      			}
      		}
      	}
      
      	destroyLinearEnvelope(env);
      	return true;
      }
      

      Shouldn't the linearEnvelope_valueAt function be taking a time value, not a frequency? Or is that being handled by the ScopedValueSetter?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      23

      Online

      1.7k

      Users

      11.8k

      Topics

      102.3k

      Posts