Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: Controlling oscillator frequency with the LFO (Audiolibrary)

  1. #1

    Controlling oscillator frequency with the LFO (Audiolibrary)

    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?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,115
    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....

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,115
    If you haven't watched the tutorial video, 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!

  4. #4
    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.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,115
    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.

  6. #6
    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.

  7. #7
    Member
    Join Date
    Aug 2016
    Location
    Santiago, Chile
    Posts
    22
    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
    Last edited by ulonix; 10-25-2016 at 12:34 PM.

  8. #8
    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.

  9. #9
    Member
    Join Date
    Aug 2016
    Location
    Santiago, Chile
    Posts
    22
    Quote Originally Posted by johanbilen View Post
    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

  10. #10
    Member
    Join Date
    Jun 2016
    Location
    rural West Virginia
    Posts
    62
    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.

  11. #11
    Member
    Join Date
    Aug 2016
    Location
    Santiago, Chile
    Posts
    22
    Quote Originally Posted by tubelab.com View Post
    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?

  12. #12
    Member
    Join Date
    Jun 2016
    Location
    rural West Virginia
    Posts
    62
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •