Cabbage Logo
Back to Cabbage Site

Midi opcodes


Cabbage+Csound works very well with both following code:

iAmp ampmidi
iFreq cpsmidi
aOut vco2 iAmp, iFreq


aOut vco2 p5,p4

Is there a preferred way. ?
I read the thread Understandig how Cabbage/Csound works Btw, this thread would deserve to be among the tutorials :slight_smile:

This also leads me to another question : how to keep a sound level acceptable (not too low and not too loud) after a several effects and filters ? My question is much more about how to do it than the opcodes themselves (should I balance after each step ?, or let things go and balance at the end with a reference signal ?)

thank you for your help

Neither is really preferred, it just comes down to personal preference.

–midi-key-cps=4 --midi-velocity-amp=5 are useful if want to mix MIDI input with events for the same instrument from the Csound score. If you’ve no intention of writing score events, then the MIDI opcodes are nice, as some of them offer additional built-in features, such as alternative tunings, velocity curves etc.

A cheap and dirty way of gaining some headroom with a complex orchestra that is overloading is to just increase the 0dbfs value. To me this feels like cheating so I think it’s better to build in a master gain control using a global variable that is applied to all outputs though. Personally I’m not a fan of overusing the balance opcode as it generally ends up working like a compressor and I feel compressors should be applied later in DAWs.

@iainmccurdy : thank you a lot ! I feel less guilty for using both solutions.

Now I understand also why balance opcode let a strange “ear” feeling after being used 3 or 4 times in a row…I suppose that is a compressor effect.

Now I will rather use a gain on each stage of filter.