Dear community,
I want to allocate two different sounds to different midi-keys.
My aim
is to get one sound for the black and another sound for the white
keys.
I've started with the following code which works.
But my question is:
Is the maybe a more confortabe way to do this? If I use my method the if
condition would be very long!
Here is my
code:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma
-m0d
</CsOptions>
;
==============================================
<CsInstruments>
sr
= 44100
nchnls =
2
0dbfs = 1
gisine ftgen 0,0,2^13,
10, 1
alwayson 1
massign 0, 1
instr 1
iamp ampmidi
0.2
icps
cpsmidi
inotnum
notnum
iatt =
0.01
idur =
3
irel = 0.1
aenv linsegr
0,iatt,1,idur,0,irel,0
inotnum = inotnum %
12
if ( (inotnum == 1) || (inotnum == 3) || (inotnum ==
6) || (inotnum == 8) || (inotnum == 10) )
then
aout rand
aenv*iamp
else
aout
poscil aenv*iamp,icps
endif
outs aout, aout
endin
</CsInstruments>
;
==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>