Debian Codegraph @

src/Examples/FLOSS Manual Examples/07 MIDI/07C05_MidiControlComplex.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -Ma -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 1
9 0dbfs = 1
10
11 giCos ftgen 0,0,2^12,11,1 ; a cosine wave
12 initc7 1,1,1 ; initialize controller to its maximum level
13
14 instr 1
15 iNum notnum ; read in midi note number
16 iAmp ampmidi 0.1 ; read in note velocity - range 0 to 0.2
17 kVol ctrl7 1,1,0,1 ; read in CC 1, chn 1. Re-range from 0 to 1
18 kPortTime linseg 0,0.001,0.01 ; create a value that quickly ramps up to 0.01
19 kVol portk kVol, kPortTime ; create filtered version of kVol
20 aVol interp kVol ; create an a-rate version of kVol.
21 iRange = 2 ; pitch bend range in semitones
22 iMin = 0 ; equilibrium position
23 kPchBnd pchbend iMin, 2*iRange ; pitch bend in semitones (range -2 to 2)
24 kPchBnd portk kPchBnd,kPortTime; create a filtered version of kPchBnd
25 aEnv linsegr 0,0.005,1,0.1,0 ; amplitude envelope with release stage
26 kMul aftouch 0.4,0.85 ; read in aftertouch
27 kMul portk kMul,kPortTime ; create a filtered version of kMul
28 ; create an audio signal using the 'gbuzz' additive synthesis opcode
29 aSig gbuzz iAmp*aVol*aEnv,cpsmidinn(iNum+kPchBnd),70,0,kMul,giCos
30 out aSig ; audio to output
31 endin
32
33 </CsInstruments>
34
35 <CsScore>
36 </CsScore>
37 <CsoundSynthesizer>
38 ;example by Iain McCurdy