Csound Csound-dev Csound-tekno Search About

[Csnd] how to map different midi events to different instruments?

Date2007-11-22 16:11
Fromjoakim@verona.se
Subject[Csnd] how to map different midi events to different instruments?
Hello,

I would like to make a drum machine that works like a midi drum
machine.

I have some instrument called kick, highhat, etc.

I want to map these to different noteon events on channel 10.

The following code fails to achieve this:

... instrument definitions ...
;  midi map drums
#define mapdrumtokey(drumname'drumkey) #
  if idruminstr = $drumkey then
    prints "drum enabled $drumname"
    schedkwhen  1,  0, 0,  "$drumname", 0,  1, 1
  endif
#
instr 1
   idruminstr   notnum
   prints  "istr 1 triggered,  notnum=%d", idruminstr

$mapdrumtokey(kick'47)
$mapdrumtokey(snare'48)
$mapdrumtokey(hihat'49)

endin




-- 
Joakim Verona