Cabbage Logo
Back to Cabbage Site

Gradually change the oscillator’s output from one waveform to another

As the title says I would like to gradually change the oscillator’s output from one waveform to another, rather than simply switching from for example a triangle to a square wave.

This is for a project where I am trying to recreate a Synth, below is a copy and paste from the manual.

Unlike most synths, which simply switch between basic waveforms, the Sub Phatty allows you
to gradually change the oscillator’s output from one waveform to another, so it can generate
something partway between a sawtooth and a square wave, for example. We refer to such controls as
continuously variable because there are no discrete steps between settings.

So far I had something like this,
iMode = chnget:i(“Mode”)
aOSC1 vco2 p5, p4, iMode //where mode can be 10 for square wave, 12 for triangle etc…

That was fine for switching from one to another. So to achieve something in between waveforms I began looking into using gentables but am unsure of what parameters I would need to control to gradually change between waveforms.

In short, I am pretty lost and just need pointing in the right direction on how to go about this.

Welcome @I_Am_Lorde, nice moniker! So what you can try here is setting up two vco2 opcode, with each one using a different wave shape. Then simply mix between the two, i.e,

;waveMix slider moves between 0 and 1
kWaveMix chnget "waveMix"
aWave1 vco2 ...
aWave2 vco2 ...
aMix = (aWave1*kWaveMix)+aWave2*(1-kWaveMix)

You could also use the ntrpol opcode. It might make things a little cleaner.

1 Like

Thanks Rory, that’s exactly what i needed :slight_smile:

I also recommend the squinewave opcode.
If you run the attached example, choose ‘squinewave’ in the ‘source’ combobox, then you can play around with its parameters and see and hear how it works.
Oscilloscope.csd (31.3 KB)

1 Like