Skip to content

outkc

Sends MIDI controller messages at k-rate.

Syntax

outkc kchn, knum, kvalue, kmin, kmax

Performance

kchn -- MIDI channel number (1-16)

knum -- controller number (0-127 for example 1 = ModWheel; 2 = BreathControl etc.)

kvalue -- floating point value

kmin -- minimum floating point value (converted in MIDI integer value 0)

kmax -- maximum floating point value (converted in MIDI integer value 127 (7 bit))

outkc (k-rate MIDI controller output) sends controller messages to MIDI OUT device. It works only with MIDI instruments which recognize them. It can drive a different value of a parameter for each note currently active.

It can scale the k-value floating-point argument according to the kmin and kmax values. For example: set kmin = 1.0 and kmax = 2.0. When the kvalue argument receives a 2.0 value, the opcode will send a 127 value to the MIDI OUT device. When the kvalue argument receives a 1.0 value, it will send a 0 value. k-rate opcodes send a message each time the MIDI converted value of argument kvalue changes.

Examples

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

Example of the outkc opcode.
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac -Q1 -M0  ;;;realtime audio out and midi in and out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o outkc.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2

instr 1

ikey notnum 
ivel  veloc

kcut linseg 100, .5, 20         ;vary controller in .5 second
kbrt = int(kcut)                ;whole numbers only
outkc 1, 74, kbrt, 0, 127       ;controller 74 (= brightness)
midion 1, ikey, ivel            ;of external synth

endin
</CsInstruments>
<CsScore>
f0 30   ;runs 30 seconds

e
</CsScore>
</CsoundSynthesizer>

See also

MIDI Message Output

Credits

Author: Gabriel Maldonado
Italy

New in Csound version 3.47

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