I want a LFO object to be a control input into the Volume object that the oscillators feed into (via a panner for each oscillator and one filter object). Here is an example of the initialisation of one of the 4 oscillators I'm creating...

const oscillator = new Tone.OmniOscillator();
const volume = new Tone.Volume();
oscillator.chain(new Tone.Panner(-0.8), new Tone.Filter(1200, 'lowpass'), vol , Tone.Destination);
lfo.connect(volume);

The oscillators work fine, as does the panning and filtering objects. However, I have the frequency, min and max of the LFO exposed in a UI, but changing the values on those don't seem to effect the noise at all? This is the setup im going for in input to output form -

OCS1 OSC2 OSC3 OSC4 (all with panners)
feeding into 
FILTER
feeding into 
VOLUME <- LFO
feeding into 
DESTINATION/OUTPUT

Am I missing something? I've tried to change ordering of when i attach the LFO to the volume object and making it before and after the oscillator chain, but to no avail. Also, original I was using LFO.start and LFO.stop when I turn on the oscillators, but that just seemed to seem the LFO signal straight to the audio channel, which isnt' right (although I don't really see how I can use a LFO without turning it on!!).

any help much appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

The LFO needs to connect to the volume's volume property.

oscillator = new Tone.Oscillator(220, "sine");
var filter = new Tone.Filter(1200, "lowpass");
var vol = new Tone.Volume();

// Example of LFO for lowpass filter.
var lfo = new Tone.LFO(4, 200, 1200); // hertz, min, max
lfo.connect(filter.frequency);
lfo.start();

// Example of LFO for volume.
var lfo2 = new Tone.LFO(0.1, -100, 0); // hertz, min, max
lfo2.connect(vol.volume);
lfo2.start();


oscillator.chain(filter, vol);
oscillator.start();
vol.toDestination();

Here's a working CodePen: https://codepen.io/joeweiss/pen/JjWvdmL?editors=0011