LFO using waveform object

Status
Not open for further replies.

ulonix

Member
Hi All,

I want to have an LFO to modulate the pitch of the waveform object or the volume of it(via the mixer).
I know you can do this with the sine-fm osc, but i need it to be a waveform object because i have more waveform types.

Here's what i know:

-I can use a waveform object as LFO and use values lower to 20hz
-I can control the Rate(frequency) with a knob. The intensity value could be controlled by hooking the OSC to a mixer and i play with the volume controlled by another knob

Here is what I don't know:

-Read the data of the LFO (perhaps using AudioRecordQueue ?)
-After i get this data, should i multiply these captured values to the Waveform object frequency?
-If the LFO is running how do i call this to read every few ms?

I know i've asked this before in other threads but i think there's a few people wanting to do this via the audio lib.

Thank you for your time

Cheers
 
Last edited:
Since i wrote this post i was able to do AMP - Volume modulation.

I used a multiply object, connected to the main synth signal and to a mixer with a dc object and a waveform object. Got some help over there on the internet.
Both running at an amplitude of 0.5.
I post this if anyone needs it.

If anyone has any tips regarding pitch modulation, please share your thoughts.

Screen Shot 2017-01-02 at 16.16.56.png
 
Last edited:
Paul,

What about creating a hardware LFO?
What kind of circuit can produce a sine or pulse with an amplitude control so I can later read it somehow with teensy via the analog Inputs or the ADC?
 
Pulses are not well suited for LFOs, the modulation will not be "musical". I'd rapidly design and use a state variable filter around the two halves of a LM13700 with infinite Q as a sine-cosine oscillator. There should be enough examples on the net. It was a current thing in the late eighties.
 
What about creating a hardware LFO?
What kind of circuit can produce a sine or pulse with an amplitude control so I can later read it somehow with teensy via the analog Inputs or the ADC?

Well, first to directly answer your question, this kind of circuit is called a Digital to Analog Converter, or DAC. But I'm guessing you already knew that? You're probably also aware Teensy 3.2 has one DAC and Teensy 3.5 & 3.6 have two DACs.

As for the rest of your message, there's just so much to unpack here. Maybe best to start a new thread specifically about this project, to slow down and start from the beginning. I'm guessing you're looking at some sort of eurorack-style modulay synthesizer controller? Maybe one that learns waveforms using the ADC? Or maybe not... that's just wild guessing on my part about what you're really wanting to do. Please, start a new thread for this, and explain in detail with context about the actual application.
 
Well, first to directly answer your question, this kind of circuit is called a Digital to Analog Converter, or DAC. But I'm guessing you already knew that? You're probably also aware Teensy 3.2 has one DAC and Teensy 3.5 & 3.6 have two DACs.

As for the rest of your message, there's just so much to unpack here. Maybe best to start a new thread specifically about this project, to slow down and start from the beginning. I'm guessing you're looking at some sort of eurorack-style modulay synthesizer controller? Maybe one that learns waveforms using the ADC? Or maybe not... that's just wild guessing on my part about what you're really wanting to do. Please, start a new thread for this, and explain in detail with context about the actual application.

I'm currently using a Teensy 3.2 and using the DAC for audio output (have a capacitor and probably will build a filter for unwanted frequencies).
The dac is used for the synth output, I do not have an AudioShield.
I just want to create an external LFO that can be read by teensy to control osc freq of a Waveform object , because it looks like it is not possible to do it via code for now.

I will start another thread regarding this matter.

Thanks for your help
 
Last edited:
Except for the FM sine, all the waveform objects can only be changed in frequency by calling the control functions from Arduino. Those are only able to change the frequency once for each audio update, which is 128 samples or approx 2.9 ms of sound.

This same limitation exists in the library regardless of whether you write code to call the frequency change function or bring in another signal on the ADC. Either way, it's still the same limitations in the audio lib.
 
Except for the FM sine, all the waveform objects can only be changed in frequency by calling the control functions from Arduino. Those are only able to change the frequency once for each audio update, which is 128 samples or approx 2.9 ms of sound.

This same limitation exists in the library regardless of whether you write code to call the frequency change function or bring in another signal on the ADC. Either way, it's still the same limitations in the audio lib.

Paul,

I think you mentioned this in another thread. I wouldn't mind if it's every 2.9 ms (going through the adc or internally) I just want to learn how to take the oscillator data (lfo) read it and then apply those values to the freq of my oscillator. I don't mind if it's perfect, just wanted to know if someone could give me a few hints and perhaps a basic snippet on how to get started. This is for learning purposes only
 
I wouldn't mind if it's every 2.9 ms (going through the adc or internally)

I explained my method of doing this here:

https://forum.pjrc.com/threads/3291...th-the-LFO-(Audiolibrary)?p=120592#post120592

It does require at least two outputs from the Teensy. If you are using a T3.2 without an audio adaptor, it still might be possible to sent the LFO out via PWM on a digital pin, but I have not tried this.

I made a short video of my synth breadboard in operation. It was recorded in a single take using an old Panasonic still camera in video mode. The audio is not great since it goes through the camera's mic, but the LFO modulating the waveform objects can be heard around the 3 minute mark.

https://www.youtube.com/watch?v=gWf8Ohfw9EU&feature=youtu.be
 
I've added an FM input to the waveform object. You can get it here.
https://github.com/BleepLabs/Audio

All you need to do is patch it manually as it's not in the tool. For example:
Code:
AudioConnection          patchCord3(waveform1, 0, waveform2, 0);
AudioConnection          patchCord1(waveform2, 0, i2s1, 0);


The code works well but could probably be simpler. It doesn't take much more memory or processor time, though.

I've been meaning to put this on git. Thanks for reminding me!
Also in my fork is a variable tape delay, smooth s&h / bit crush, digital combine distortion, bandlimited wavetables and a granular effect.
 
Cool, so if merged, that would remove the need for FM sine entirely. Much better to have FM on all waveforms.
 
I've added an FM input to the waveform object. You can get it here.
https://github.com/BleepLabs/Audio

All you need to do is patch it manually as it's not in the tool. For example:
Code:
AudioConnection          patchCord3(waveform1, 0, waveform2, 0);
AudioConnection          patchCord1(waveform2, 0, i2s1, 0);


I've been meaning to put this on git. Thanks for reminding me!
Also in my fork is a variable tape delay, smooth s&h / bit crush, digital combine distortion, bandlimited wavetables and a granular effect.


Thanks John-mike,
I'm trying to do it with my sketch but looks i can't make it work
Plus i don't know what to do with this part:

AudioConnection patchCord1(waveform2, 0, i2s1, 0);

That's the waveform object that's we are applying FM right?, it could be routed to a mixer or something else so we could hear it

I'm trying this:

AudioConnection patchCord20(wave_lfo, 0, waveform4, 0);

This is my audio diagram

Screen Shot 2017-01-08 at 16.06.26.png
 
Last edited:
Okay, wait...
Maybe i'm still using the original audio library!

Should i just replace synth_waveform.cpp and synth_waveform.h from the original one?

thanks
 
Should i just replace synth_waveform.cpp and synth_waveform.h from the original one?

I tried that, then added synthwaveform.md also. It breaks more than it fixes since it was built from an earlier version. Arbitrary and reverse sawtooth waveforms are not supported, so I commented their use out of my synth, but still got lots of compiler errors. My attempts at messing with the library code only made things worse, so I reverted back to my functional hardware method for now. I am not a programmer, so I'll wait for the real coders to make it work.
 
OK, the Big Dumb Blonde One wasn't going to give up without at least blowing up some parts.......That usually only happens when I turn on the big power supplies and play with vacuum tubes, but that's a different forum.

I dragged out my Teensy 3.2 breadboard from last May. It has a T3.2, an audio adaptor, 3 rotary encoders, 12 pots, and 3 push buttons. It now works like a Mini Moog with the vibrato ported internally, no ADC in use at all.

I copied the existing Audio library to a new folder and called it Audio2. I left the existing audio library alone, and worked with Audio2. In Audio2 I renamed Audio.h -> Audio2.h. I deleted synth_waveform.cpp, synth_waveform.h and synthwaveform.md. I then copied those three files from the Bleep version on github. I created this setup in the audio tool, and added patchcords 13,14,and 15 manually. I also included Audio2.h and NOT audio.h. Arbitrary and reverse sawtooth waveforms are not supported so don't use them.


#include <Audio2.h>
#include <Encoder.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>


Encoder dialright(24, 25);
Encoder dialmiddle(20, 21);
Encoder dialleft(32, 33);


// GUItool: begin automatically generated code
AudioSynthWaveform waveform4; //xy=103,298.79998779296875
AudioSynthWaveform waveform3; //xy=315.7499465942383,343.99999237060547
AudioSynthWaveform waveform1; //xy=318.7499694824219,245.99999237060547
AudioSynthWaveform waveform2; //xy=318.74999237060547,290.9999771118164
AudioSynthWaveformDc dc1; //xy=323.74993896484375,424.0000305175781
AudioEffectEnvelope envelope2; //xy=489.7500457763672,419.9999694824219
AudioMixer4 mixer1; //xy=492.7499542236328,302.9999771118164
AudioFilterStateVariable filter1; //xy=654.7498931884766,308.9999694824219
AudioMixer4 mixer2; //xy=796.7500152587891,316.00011444091797
AudioEffectEnvelope envelope1; //xy=949.7499694824219,394.9999465942383
AudioOutputI2S i2s1; //xy=1128.7501220703125,403.0000915527344
AudioConnection patchCord1(waveform3, 0, mixer1, 2);
AudioConnection patchCord2(waveform1, 0, mixer1, 0);
AudioConnection patchCord3(waveform2, 0, mixer1, 1);
AudioConnection patchCord4(dc1, envelope2);
AudioConnection patchCord5(envelope2, 0, filter1, 1);
AudioConnection patchCord6(mixer1, 0, filter1, 0);
AudioConnection patchCord7(filter1, 0, mixer2, 0);
AudioConnection patchCord8(filter1, 1, mixer2, 1);
AudioConnection patchCord9(filter1, 2, mixer2, 2);
AudioConnection patchCord10(mixer2, envelope1);
AudioConnection patchCord11(envelope1, 0, i2s1, 0);
AudioConnection patchCord12(envelope1, 0, i2s1, 1);
AudioConnection patchCord13(waveform4, 0, waveform1, 0);
AudioConnection patchCord14(waveform4, 0, waveform2, 0);
AudioConnection patchCord15(waveform4, 0, waveform3, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=707.7498779296875,470.99996185302734
// GUItool: end automatically generated code


Vibrato.jpg
 
Status
Not open for further replies.
Back
Top