@Phm78: Not sure which of these two options you actually want, so here's a description of each.
VFO, modulated by a mix of PWM & LFO frequency:
Configure one waveform object where you control the pulseWidth() (identified as your PWM object, started with
begin(WAVEFORM_PULSE)
). Configure a second waveform object where you control the frequency (identified as your LFO object, started with
begin(WAVEFORM_SINE)
, or whatever type of modulation you want). Feed the outputs from these two objects into a mixer, then take the output from that mixer & use that as the modulation input into a third waveform object (identified as your VFO object, started with
begin(WAVEFORM_SQUARE)[/ICODE, or whatever primary type of oscillation you want]). Now you have a PWM and/or frequency modulated oscillator, where you should have complete control over the PWM modulation rate (using the [ICODE]frequency()
control of the PWM object), the LFO modulation rate (using the
frequency()
control of the LFO object), as well as the level of each using the mixer control capabilities.
VFO, modulated by an LFO whose frequency is PWM modulated:
Configure one waveform object where you control the pulseWidth() (identified as your PWM object, started with
begin(WAVEFORM_PULSE)
). Configure a second waveform object where you control the frequency (identified as your LFO object, started with
begin(WAVEFORM_SINE)
, or whatever type of modulation you want) feeding the output from the PWM object into the modulation input of the LFO object. Feed the output from the LFO object into the modulation input of a third waveform object (identified as your VFO object, started with
begin(WAVEFORM_SQUARE)[/ICODE, or whatever primary type of oscillation you want]). Now you have a PWM modulated LFO, which is then modulating your VFO oscillator, where you should have complete control over the PWM modulation rate (using the [ICODE]frequency()
control of the PWM object), the primary LFO modulation rate (using the
frequency()
control of the LFO object).
NOTE: I prefer to use the
AudioSynthWaveformModulated
for all oscillators (LFOs, VFOs, etc.). That way, I can add modulation to any objects in the future, making it very easy as design of my synthesizer & its capabilities evolve over time.
Hope that helps . . .
Mark J Culross
KD5RXT