Mod wheel smoother


#1

Hi Folks,

Im doing some phasemodulation stuff on my midi modwheel.
this is working, but when i turn the wheel, it cracks.

my idea is, that this is caused by the limitation of midi values (127) which causes a staircase function (step function).
Has anybody an idea how to smooth those values? i tried to fit the attack / decay code from the SamplerVoice Class for this purpose, to smooth the new values with multiplication, but it did not get it working…

By the way, when I turn the mod wheel while no note is being played, the new value is not stored anywhere. is there an easy way to get access to the last modwheelvalue, to write it in the startNote method of the samplerVoice class? (in the startNote method you have only access to currentPitchWheelPosition…)

and an off-topic question, just because im interested: in which frequency the processBlock method in the PluginProcessor is getting called? is numSamples fixed and defined by the host?

thanks a lot for helping me,

greetz equinox


#2

just use a lowpass filter to interpolate the values.
out = inf+out(1-f);

and use a rather low frequency. this should get rid of smoothness problems resulting from three different causes:

  1. midi quantization (as you’ve said)
  2. graphics low rate update
  3. buffer size (depending on your architecture)

one thing tho, if you are making a synth and using polyphony you may want to reset the filter when a voice starts or you will turn knobs and hear them interpolating on note starts


#3

thanks for your help!

I tried to process the samples with the IIRFilter Class after the “while (–numSamples >=0)” loop in the RenderNextBlock method and it seems to sound better (except of the missing overtones), but is still cracking. i used a cutoff frequency of 1000.

So I filtered the whole outputBuffer…

Did I understand you right? or which exact data do you mean for filtering?

could you explain this code:
out = inf+out(1-f);
didnt get it, sorry…

thanks again,

equinox


#4

What he means is to apply a filter to the values coming from the mod wheel, not the audio data.


#5

Exactly. And you’ll want to use a low cutoff, like 10 Hz or so.


#6

yeeeeeeeaha, got it!

I used an AudioSampleBuffer with numSamples = 2 and a IIRFilter with, as u said, a cutoff frequency of 10Hz.
the newValue out of controllerMoved() is used as the second value for the Filter, to function like an aim for the first value which is calculated every loop in renderNextBlock.

thanks a lot!

Greetz equinox