Page 1 of 1
key follow formula
Posted: Wed Jun 10, 2015 12:45 pm
by Logado
Can somebody tell formula.
I thought that there just pitch multiplied by the coefficient. But I began to compare realized that there a little more complex.
Re: key follow formula
Posted: Wed Jun 10, 2015 2:23 pm
by tulamide
Key follow means, that, for example, a filter will adjust its cutoff according to the octave steps from the reference note.
Mostly the reference note is middle C, so if a note plays 1 octave higher (and key follow is at 100%) the filter will open up to double the cutoff frequency.
reference is C3, note played is C4, lowpass is set to 1 kHz, follow key is at 100% --> the filter will open up to 2kHz
reference is C3, note played is C2, lowpass is set to 1 kHz, follow key is at 100% --> the filter will open up to 500 Hz
reference is C3, note played is F#2, lowpass is set to 1 kHz, follow key is at 100% --> the filter will open up to 1.5 kHz
That said, and if pitch is the midi note number, it should work with
cutoff + ((pitch - 60) / 12 * cutoff * fkdepth)
where fkdepth is a percentage value in the range [0, 1], for the strength of the follow key function
Re: key follow formula
Posted: Wed Jun 10, 2015 2:31 pm
by Logado
thank you, understood
Re: key follow formula
Posted: Sun Jun 14, 2015 1:52 pm
by tulamide
Hey Logado,
I made a big mistake (that also nobody else seem to have noticed). It leads to the change being made absolute rather than relative!
Here is the corrected, relative version:
Code: Select all
cutoff = 1000 #a cutoff frequency like from a filter
reference = 60.0 #To what midi note does the function refer to (middle c = 60)
pitch = 60.0 #The current pitch as midi note
fkdepth = 1.0 #The strength of the follow-key-function
f = 0.0
oct = (pitch / 12.0) - (reference / 12)
if oct < 0
f = 1 / (oct.abs * 2)
elsif oct == 0
f = 1.0
else
f = oct.abs * 2
end
result = cutoff * (f * fkdepth)
Re: key follow formula
Posted: Sun Jun 14, 2015 4:24 pm
by Logado
I think it works well now. But if keyfollow set to zero filter is always closed. I need to add сlassic dry/wet mix?
Re: key follow formula
Posted: Sun Jun 14, 2015 6:11 pm
by Nubeat7
yes if depth is 0% , cutoff knob should set the the filter
why not do all the calculation in the pitch range
so it would be cutoff(pitch) = (pitch - reference)*depth+cutoff(pitch)
and then convert the range from pitch to 0..1
its like in the stock module just that you also subtract the reference octave from the pitch
Re: key follow formula
Posted: Sun Jun 14, 2015 6:41 pm
by Logado
I'm happy

Re: key follow formula
Posted: Sun Jun 14, 2015 8:22 pm
by tulamide
Yes, that was a second absolute-relative error I made. Thanks Nubeat, for correcting it

I never saw a key follow funtion in the stock modules. So It was all from my head. Maybe that is an excuse?

Re: key follow formula
Posted: Sun Jun 14, 2015 9:21 pm
by Logado
tulamide wrote:Yes, that was a second absolute-relative error I made. Thanks Nubeat, for correcting it

I never saw a key follow funtion in the stock modules. So It was all from my head. Maybe that is an excuse?

Do not worry, you guided me on the right path.

Re: key follow formula
Posted: Sun Jun 14, 2015 10:25 pm
by Nubeat7
don't mind tulamide, its an interesting thread, i never invested that much thoughts and your explanation makes it very clear i think its also a good thing to do it with a reference octave!