outkpb — Sends MIDI pitch-bend messages at k-rate.


Sends MIDI pitch-bend messages at k-rate.


outkpb kchn, kvalue, kmin, kmax


kchn -- MIDI channel number (1-16)

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))

outkpb (k-rate pitch-bend output) sends pitch-bend messages. 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.


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

Example 726. Example of the outkpb 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
-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 outkpb.wav -W ;;; for file output any platform

sr = 44100
ksmps = 10
nchnls = 2

instr 1

ikey notnum 
ivel  veloc

kpch linseg 100, 1, 0	;vary in 1 second
kpb = int(kpch)		;whole numbers only
outkpb 1, kpb, 0, 127	;(= pitchbend)
midion 1, ikey, ivel	;of external synth

f0 30


See also

MIDI Message Output


Author: Gabriel Maldonado

New in Csound version 3.47

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