midiroute
Route a midi channel to an instrument name
Syntax
Usage
midiroute works similar to massign, however no explicit midi to pfield assignments are required in instruments.
Velocity is always mapped to p4.
Pitch is used as an index into gi_CurrentScale with 60 (middle C)) mapped to 0 in gi_CurrentScale. This in turn is converted to cps and mapped to p5 in the destination instrument.
Arguments
ichan -- Midi channel to assign to instrument (1 - 16)
Sinsname-- String name of named instrument
iinsnum -- Instrument number
Example
midi.orc
| midi.orc |
|---|
| giS1 = 73 ;; Slider mapped to CC# 73 (attack rate)
giS2 = 75 ;; Slider mapped to CC# 75 (decay rate)
giP9 = 17 ;; Pot 9 mapped to CC# 17 (fm index)
;; HARDWARE mappings. Adjust for your midi device.
opcode bassfm,a,kkk
kamp, kpit, kmod xin
kfmndx = 100*(2^kmod)/kpit ;richer harmonics with lower frequencies
kmndx = kfmndx * transeg:k(1,limit(abs(p3),0.5,7),-3,0.25)
aenv = mxadsr:a(0.007,0,1,0.2,0,0.1)
ares foscili kamp,kpit,1,1,kmndx,-1
xout ares*aenv
endop
;; a bass tone generator.
midiroute 1, "bass"
;; map midi channel 1 to the bass instrument.
instr bass
ares bassfm p4,sclbend(p5, gSmidi_pb_channel), mctrl(giP9,p6)
ares declickr ares, mctrl_i(giS1,0.0015)*1.5,mctrl_i(giS2,0.0015)*1.5
;; Using declick as an envelope control.
send ares
endin
|