Cabbage Logo
Back to Cabbage Site


Very simple subtractive synth
certainly you can improve! :grin:

Thanks Rory and Iain


Cabbtractive.csd (13.1 KB)


Very nice. The butterlp filters are quite nice. I never think of using them. I usually always reach for the lpf18 with has a nice distortion parameter built in. Did you try out other filters?

Hi Rory,

many thanks. I tried the statevar filter, but I did not like: I seem unstable.
With this project, I wanted to understand the opcodes-flowchart interaction-structure for a possible subtractive synthesizer, just to deepen.
But I have difficulty in understanding how to control the filter cutoff by multiple sources: Cutoff knob + Envelope + key-Track + Velocity amount they are possible signals for cutoff: I do not understand how to mix them, merge or add…
If cutoff knob is set to 0 -> 15000, adding other values​​, I’ll go out of the filter range … :disappointed_relieved:


the madsr opcode don’t like me: the envelope that generates, is unnatural and not detailed. Iain has created a very nice example to help people like me understand how to build a good ADSR, but it’s too complicated for me. My ADSR don’t have a good initial attack phase.

The next study will be dedicated to fill these gaps.

See next time, and thanks a lot!


Instead of adding, multiply. Fro example:

kCutOff chnget "cuttOff"; range 0-22050
kFilterEnv madsr .1, .5, .5, .1; filter_env
aFilter butterlp aSignal, kFilterEnv*kCutOff

If you have your cut off slider set to max you’re envelope will also go to max, but bring it down and your envelop will also reduce in amplitude. You know what I mean?

One could write a book about envelopes. You can’t go wrong studying Iain’s code!

Hi Rory,

your code is correct, similar at my Cabbtractive code:

; Amount filter envelope
kenv2 = (kenv2 * 56) * kenvamt ; envelope control with amount: range 0->56 (MIDI)
kenv2 cpsmidinn kenv2 + kcut ; envelope + cutoff knob: range (0->56) + (-40 -> 80) (MIDI)

but if I would to add another signal to control the cutoff:


0->50 (MIDI Note) envelope +
0->77 (MIDI Note) knob cutoff =

127 -> maximum range that all filters accept in yours cutoff input port

for example: I would like to add a velocity to control the cutoff with amount, how implement his range?

kvel = velocity * amount -> velocity = (0->127) * (0 -> 1)

Final code:

kenv2 = (kenv2 * 50) * kenvamt ; envelope control with amount: range 0->50 (MIDI)
kenv2 cpsmidinn kenv2 + kcut + kvel

if: kenv2 sustain == 1 && kenvamt == 1 && kcut == 77 && kvel == 127

the cutoff signal is equal to ((1 * 50) * 1) + 77 + 127 = 254

when cpsmidinn convert 254, the filter crashing…

where did I miss?


let me explain with an example:

1° - lowers the speaker volume
2° - open this example and move the mod-wheel: over 249 the filter crashes…
if I add the values, this is the result, but if I multiply these values, I controlled the cutoff with the mod…

I don’t understand… (… and if I use 3 or 4 signals? how mix them?)

multiple signals at cutoff.csd (1.7 KB)


You get those issues because kmod+kcutoff is going above half the sample rate. Or at least that’s how I would see it. I’m still not clear on what you are trying to do, but if you want to map a variable taht stays between 0 and 128 to another range you can do something like this, where kValue at this point will always be between 0 and 128, and kRange is the new range, say 10000 for example.

kValue = (kValue/128)*kRange

I’m still not sure if I’m answering your question :confused:



Test the new csd : the key was in the limit opcode. I hope to be on the right track :wink:

Many thanks for your support, and sorry for my english!!!


multiple signals at cutoff.csd (2.0 KB)

Glad you got it sorted! Don’t worry about your English, so long we exercise some patience we’ll get through to each other!

Thanks for sharing this. I enjoyed trying it out the sound wasn’t totally what I was expecting. I particularly like the individual pulse width modulation lfos on each oscillator as you can create quite a thick sound this way.
I use the butterlp filter quite a lot when I want something that doesn’t draw attention to itself quite as much as some of the resonant ones. It has a slight bug though: when modulating its cutoff quickly at k-rate it will produce artifacts as this value is not interpolated internally as it is in other filters. I filed a ticket and John acknowledged it but I don’t think it got dealt with. You can hear this at the start and end of notes if you set the filter envelope attack and release times to low values. I think this can solved by interpolating the cutoff frequency to a-rate. Another filter you could try is clfilt which can also implement a butterworth lowpass filter (without the artifacts!).
I am getting a tuning problem - i.e. the keyboard doesn’t follow equal temperament - which is caused by the way you add pitch bend values:
kcps1 = kcps1 + kpb
kpb needs to be added to your note numbers and not your cycles-per-second values.
I like your interesting waveshaping use of limit. I normally just use this for limting control values and I wouldn’t have thought of this usage.
Thanks, Iain


many thanks for all! I think to rewrite Cabbtractive changing:

  • the filter, (lpf18, this has the resonance, suggested by Rory );
  • the oscillators: i would like to implement oscili with 3 different tables: saw, square, tri (no PW…), VCO don’t like me;
  • adding a final compressor;
  • adding Filter Key-Track and Velocity sensivity (both with amount)… (I try…)
  • redesign the interface.



Cabbtractive1.1; the changelog is in the .zip file… (58.0 KB)


Nice! Some nice presets too.