PDA

View Full Version : Controlling oscillator frequency with the LFO (Audiolibrary)



johanbilen
02-05-2016, 01:56 PM
Hi, I would like a LFO to control an oscillators frequency, creating a vibrato effect, but the oscillator has no frequency control input like the StateVariableFilter has. Is there a workaround for this?

PaulStoffregen
02-05-2016, 02:00 PM
The sine_fm object does have a frequency control input.

The generic waveform object does not. Perhaps this will be added someday? It's on the wish-list of features....

PaulStoffregen
02-05-2016, 02:02 PM
If you haven't watched the tutorial video (https://www.youtube.com/watch?v=wqt55OAabVs), please do so!

Perhaps skip to 25:04 for the oscillators part, if you don't have 48 minutes for the whole video. LFO control of frequency is demonstrated in the video!

johanbilen
02-05-2016, 03:34 PM
Thanks Paul, great to hear that it's already on the wish-list, modulation of oscillator frequency is a important component in building a basic synthesizer (which I am) so I'm looking forward to it perhaps being implemented in future revision of this already excellent audio library. I'm a novice programmer, but in the mean time I'll try to write a LFO function of my own, using wavetables.

PaulStoffregen
02-05-2016, 06:58 PM
Did you watch the video?

Today we do have this modulation, but the only limitation is the signal to be modulated must be a sine wave. The LFO doing the modulation can be sawtooth or any other, and indeed a LFO acting as 5 different waveform shapes is demonstrated in the video.

johanbilen
02-06-2016, 03:05 PM
Yes, I did watch the video and understand that it is possible to modulate sine wave frequency using different waveforms. However I want to be able to modulate the frequency of several different waveforms, ie vibrato. The project I'm working is a programmable monophonic synthesizer.

ulonix
10-25-2016, 12:55 AM
I'm also looking for this one, i want to control the waveform osc pitch, could it be possible to do this by reading an analog input that generates this?
How difficult is to modify the sine_fm source to create other waveforms??
Cheers

johanbilen
10-26-2016, 08:11 PM
Hi ulonix, modulating the frequency of sine_fm worked well but I wanted to be able to modulate different waveforms so I ended up writing my own LFO function using wavetables instead.

ulonix
10-26-2016, 08:13 PM
Hi ulonix, modulating the frequency of sine_fm worked well but I wanted to be able to modulate different waveforms so I ended up writing my own LFO function using wavetables instead.

Do you have an example on how to do this? i don't have much experience writing wavetables or anything like it.

Thanks

tubelab.com
10-26-2016, 09:57 PM
I have FM modulation of all of the waveforms working in my synth. I wanted my synth to be compatible with the 1V/oct standard used in most modular stuff so I spent nearly forever figuring out how to make the waveforms respond to 1V/oct. This is not needed for basic modulation.

Build your LFO using a waveform, wave table, or even a sequencer that steps through a list of variables. Apply the output to the internal DAC in the Teensy. Take the analog voltage output from the DAC, run it through a low pass filter (series resistor, cap to ground) to remove noise and aliasing products. We now have an analog LFO output voltage that can be applied to the mod input of any analog modular VCO. We now need to make the Teensy waveforms respond to modulation.

Connect the LPF output to your MOD wheel (pot) and run the pot's wiper back into an A/D input on the teensy, using the circuit shown in the ADC audio input section in the Audio System Design Tool, or something similar to provide an AC coupled input centered around a DC voltage. Do not use the ADC audio in, use the ordinary analog read function since every synth ever made will need to read some pots (done inside the main loop). It is fast enough for LFO modulation. Read the A/D input value with no mod applied (the number represented by the DC bias applied to your MOD INPUT pin). Put this converter reading function (analogRead) inside your main program loop. In the software that you use to send a frequency to the VCO, subtract this number from the frequency, then add the number returned by the A/D converter to the frequency before sending it to the waveform (waveformFrequency) in your main loop. When there is no modulation applied to the A/D input, the two numbers will be the same resulting in no change in frequency. As the MOD wheel is rolled up the A/D number will begin to change in response to the LFO, resulting in a changing frequency output from the waveform generator. You may need to scale the levels of the modulation. This can be done in hardware or software, whatever is easiest for you.

ulonix
10-27-2016, 12:11 AM
I have FM modulation of all of the waveforms working in my synth. I wanted my synth to be compatible with the 1V/oct standard used in most modular stuff so I spent nearly forever figuring out how to make the waveforms respond to 1V/oct. This is not needed for basic modulation.

Build your LFO using a waveform, wave table, or even a sequencer that steps through a list of variables. Apply the output to the internal DAC in the Teensy. Take the analog voltage output from the DAC, run it through a low pass filter (series resistor, cap to ground) to remove noise and aliasing products. We now have an analog LFO output voltage that can be applied to the mod input of any analog modular VCO. We now need to make the Teensy waveforms respond to modulation.

Connect the LPF output to your MOD wheel (pot) and run the pot's wiper back into an A/D input on the teensy, using the circuit shown in the ADC audio input section in the Audio System Design Tool, or something similar to provide an AC coupled input centered around a DC voltage. Do not use the ADC audio in, use the ordinary analog read function since every synth ever made will need to read some pots (done inside the main loop). It is fast enough for LFO modulation. Read the A/D input value with no mod applied (the number represented by the DC bias applied to your MOD INPUT pin). Put this converter reading function (analogRead) inside your main program loop. In the software that you use to send a frequency to the VCO, subtract this number from the frequency, then add the number returned by the A/D converter to the frequency before sending it to the waveform (waveformFrequency) in your main loop. When there is no modulation applied to the A/D input, the two numbers will be the same resulting in no change in frequency. As the MOD wheel is rolled up the A/D number will begin to change in response to the LFO, resulting in a changing frequency output from the waveform generator. You may need to scale the levels of the modulation. This can be done in hardware or software, whatever is easiest for you.

What if i'm already using the Dac output from teensy?(i don't have the audioshield)??. Is it possible to just have a function that internally modulates the frequency of the osc?

tubelab.com
10-27-2016, 02:38 AM
I am using the audio shield for audio output and audio input. The DAC is for LFO.

I would assume that the same method could be used to numerically modulate the waveform generators. It would be possible to code a numerical LFO, or as mentioned build one that scans through a wave table at a variable speed. Since I am far more at home with hardware than with software, if I had the same constraints, I would just build a hardware LFO and connect it to one of the A/D inputs and follow my path from the A/D input to modulating the waveform generator.

My current synthesizer setup is a mix of mostly analog hardware, several modules in two different formats, and a PC running a DAW and several software synths from Arturia and others. There will be a stand alone Teensy synth or two and several modules for a big modular, including a couple that use vacuum tubes, in my future. The Teensy synth stuff is the first real software project that I have done in several years.