midion2 — Sends noteon and noteoff messages to the MIDI OUT port.


Sends noteon and noteoff messages to the MIDI OUT port when triggered by a value different than zero.


midion2 kchn, knum, kvel, ktrig


kchn -- MIDI channel (1-16)

knum -- MIDI note number (0-127)

kvel -- note velocity (0-127)

ktrig -- trigger input signal (normally 0)

Similar to midion, this opcode sends noteon and noteoff messages to the MIDI out port, but only when ktrig is non-zero. This opcode is can work together with the output of the trigger opcode.


Here is an example of the midion2 opcode. It uses the file midion2.csd.

Example 483. Example of the midion2 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
 -M0 -Q1 ;;;midi in and midi out

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

kcps line 3, p3, .1	
klf  lfo 1, kcps, 3	;use a unipolar square to trigger
ktr  trigger klf, 1, 1	;from 3 times to .1 time per sec.
     midion2 1, 60, 100, ktr


i 1 0 20

See Also

moscil, midion, noteon, noteoff, noteondur, noteondur2


Author: Gabriel Maldonado

New in Csound version 3.492

Thanks goes to Rasmus Ekman for pointing out the correct MIDI channel and controller number ranges.