# Midi opcodes

**URL:** <https://forum.cabbageaudio.com/t/midi-opcodes/590>\
**Category:** Tutorial Requests\
**Created:** [19 June 2017 20:29 UTC](https://forum.cabbageaudio.com/t/midi-opcodes/590 "2017-06-19T20:29:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [19 June 2017 20:29 UTC](https://forum.cabbageaudio.com/t/midi-opcodes/590/1 "2017-06-19T20:29:52Z")

</div>

Hello,

Cabbage+Csound works very well with both following code:

> iAmp ampmidi  
> iFreq cpsmidi  
> aOut vco2 iAmp, iFreq

and

> aOut vco2 p5,p4

Is there a preferred way. ?  
I read the thread [Understandig how Cabbage/Csound works](http://forum.cabbageaudio.com/t/understandig-how-cabbage-csound-works/219) Btw, this thread would deserve to be among the tutorials 🙂

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

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [19 June 2017 21:43 UTC](https://forum.cabbageaudio.com/t/midi-opcodes/590/2 "2017-06-19T21:43:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [20 June 2017 05:37 UTC](https://forum.cabbageaudio.com/t/midi-opcodes/590/3 "2017-06-20T05:37:13Z")

</div>

@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.
