6:52 am

May 2, 2019

Hi Will/all,

I am currently designing a filter plugin for Ableton Live based on the RBJ cookbook, and am trying to wrap my head around how to implement an LFO to automate the filter frequency.

Here's my thought process so far:

- I have two variables, LFO rate (ranging from 0.02Hz to 20Hz) and LFO depth (ranging from 0 to 1). These will determine the frequency and amplitude of the LFO sine wave [Asin(2*pi*f*t)]

- A = LFO depth, f = LFO rate and t will be a position in time that will determine the value that the LFO function will output

- The value outputted by the LFO function will be multiplied by frequency, producing different frequency values over a certain range (LFO depth) at a certain speed (LFO rate)

- I believe I need to take the *absolute* value of the LFO signal's output, as multiplying a negative output by frequency will produce a negative frequency, which doesn't make any sense.

- I also have a 'switch' control to turn the LFO on or off. This outputs a 0 or a 1.

I initially thought wrapping this LFO function in a for loop would be the way to go, but I actually need the LFO to run indefinitely, so I think a while loop (while LFO = on) makes sense.

However, I still need a value for 't' in my sine wave equation, and I can't figure out how to determine this. In a real, voltage-controlled LFO, t would be a continuous function rather than discrete values.

My thought is that I can include a for loop within the while loop like so:

for (float i = 0; i < ??; ++i) {

yt = abs(m_f_LFODepth * sin(2 * PI * m_f_LFORate * i));

return yt;

}

}

But I'm not sure what my upper range for i would be. I'm not even sure that this would cause the LFO values to be outputted indefinitely, or whether it would simply run once.

Any pointers in the right direction? I recall your FX book had plugins which made use of LFOs, but unfortunately I no longer have access to book as I've graduated

10:33 am

July 11, 2017

You could just use a simple Oscillator. If you don't have Wills books you could look at the Maximillian libraries .https://github.com/micknoise/Maximilian

They have some very basic OSC you could use as a LFO.

2:23 pm

April 3, 2014

Hi Tom 🙂

Tom_1 said

Hi Will/all,

I am currently designing a filter plugin for Ableton Live based on the RBJ cookbook, and am trying to wrap my head around how to implement an LFO to automate the filter frequency.

Here's my thought process so far:

- I have two variables, LFO rate (ranging from 0.02Hz to 20Hz) and LFO depth (ranging from 0 to 1). These will determine the frequency and amplitude of the LFO sine wave [Asin(2*pi*f*t)]

- A = LFO depth, f = LFO rate and t will be a position in time that will determine the value that the LFO function will output

- The value outputted by the LFO function will be multiplied by frequency, producing different frequency values over a certain range (LFO depth) at a certain speed (LFO rate)

I think here is your misconception: you probably don't want to multiply the "frequency" directly but an offset to that frequency. The "Frequency" of the LFO is not related to the "Frequency" of the filter you want it to modulate.

- I believe I need to take the *absolute* value of the LFO signal's output, as multiplying a negative output by frequency will produce a negative frequency, which doesn't make any sense.

- I also have a 'switch' control to turn the LFO on or off. This outputs a 0 or a 1.

I initially thought wrapping this LFO function in a for loop would be the way to go, but I actually need the LFO to run indefinitely, so I think a while loop (while LFO = on) makes sense.

No, at least not for a single sample. For a single sample you will also most probably only have one value from the LFO. You "drive" the LFO only one sample at a time.

However, I still need a value for 't' in my sine wave equation, and I can't figure out how to determine this. In a real, voltage-controlled LFO, t would be a continuous function rather than discrete values.

The t depends on the samplerate. For 44100 Hz one sample is basically 1/44100 which is roughly 0.023 milliseconds.

My thought is that I can include a for loop within the while loop like so:

while (m_f_LFOOnOff = 1) {for (float i = 0; i < ??; ++i) {

yt = abs(m_f_LFODepth * sin(2 * PI * m_f_LFORate * i));

return yt;

}

}

This code snippet will always return 0. Most modern compilers will also issue a warning or even an error for the non-conditional return statement inside the for loop.

But I'm not sure what my upper range for i would be. I'm not even sure that this would cause the LFO values to be outputted indefinitely, or whether it would simply run once.

Any pointers in the right direction? I recall your FX book had plugins which made use of LFOs, but unfortunately I no longer have access to book as I've graduated

Buy the book 😉 Maybe you can get your hands on a cheaper or second-hand "first edition" book when the second edition is out (which at least in germany is announced for the end of may).

Cheers,

Tom

Most Users Ever Online: 55

Currently Online:

11 Guest(s)

Currently Browsing this Page:

1 Guest(s)

Top Posters:

Skyler: 48

Derek: 46

Frodson: 45

Peter: 41

clau_ste: 39

Gwen: 32

TheSmile: 30

JimmyM: 30

EZB: 24

lppier: 23

Member Stats:

Guest Posters: 1

Members: 545

Moderators: 1

Admins: 4

Forum Stats:

Groups: 12

Forums: 35

Topics: 550

Posts: 2186

Newest Members:

Callum, Tom_1, G Slenkovich, vstvault, mikkyboy, Jon, Keesh, nightenlight, Ben, Third AudioModerators: W Pirkle: 276

Administrators: Tom: 68, JD Young: 80, Will Pirkle: 0, W Pirkle: 276