Debian Codegraph @

src/Examples/FLOSS Manual Examples/03 Csound Language/03F04_Midi_triggered_events.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -Ma -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 giSine ftgen 0, 0, 2^10, 10, 1
12 massign 0, 1; assigns all midi channels to instr 1
13
14 instr 1
15 iFreq cpsmidi ;gets frequency of a pressed key
16 iAmp ampmidi 8 ;gets amplitude and scales 0-8
17 iRatio random .9, 1.1 ;ratio randomly between 0.9 and 1.1
18 aTone foscili .1, iFreq, 1, iRatio/5, iAmp+1, giSine ;fm
19 aEnv linenr aTone, 0, .01, .01 ; avoiding clicks at the note-end
20 outs aEnv, aEnv
21 endin
22
23 </CsInstruments>
24 <CsScore>
25 f 0 36000; play for 10 hours
26 e
27 </CsScore>
28 </CsoundSynthesizer>
29 ;example by joachim heintz