Debian Codegraph @

examples/massign.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac -+rtmidi=virtual -M0 ;;;realtime audio out and realtime midi in
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ;-o massign.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 giengine fluidEngine
17 ; soundfont path to manual/examples
18 isfnum fluidLoad "19Trumpet.sf2", giengine, 1
19 fluidProgramSelect giengine, 1, isfnum, 0, 56
20
21 massign 0,0 ;disable triggering of all instruments on all channels, but
22 massign 12,10 ;assign instr. 10 to midi channel 12
23 massign 3,30 ;assign instr. 30 to midi channel 3
24
25 instr 10 ; soundfont only on midi channel 12
26
27 mididefault 60, p3
28 midinoteonkey p4, p5 ; in midi notes
29 ikey init p4
30 ivel init p5
31 fluidNote giengine, 1, ikey, ivel
32 endin
33
34 instr 30 ; FM-oscilator only on midi channel 3
35
36 mididefault 60, p3
37 midinoteoncps p4, p5 ; in Hertz
38 icps init p4
39 iamp init p5
40 iamp = iamp/127
41 kenv madsr 0.5, 0, 1, 0.5
42 asig foscil iamp*kenv, icps, 1, 1.414, 2, 1
43 outs asig, asig
44 endin
45
46 instr 99 ; output sound from fluidengine
47
48 imvol init 7
49 aL, aR fluidOut giengine
50 outs aL*imvol, aR*imvol
51 endin
52 </CsInstruments>
53 <CsScore>
54 ; sine
55 f 1 0 16384 10 1
56
57 i 10 0 2 60 100 ;one note on the trumpet in midi and...
58 i 30 2 2 220 80 ;one FM note in Hz
59 i 99 0 60 ;stay active for 60 sec.
60 e
61
62 </CsScore>
63 </CsoundSynthesizer>