Debian Codegraph @

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

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -Ma -odac
4 ; activate all midi inputs and real-time audio output
5 </CsOptions>
6 <CsInstruments>
7 sr = 44100
8 ksmps = 32
9 nchnls = 1
10 0dbfs = 1
11
12 giSine ftgen 0,0,2^12,10,1 ; a sine wave
13 initc7 1,1,1 ; initialize CC 1 on chan. 1 to its max level
14
15 instr 1
16 iCps cpsmidi ; read in midi pitch in cycles-per-second
17 iAmp ampmidi 1 ; read in key velocity. Rescale to be from 0 to 1
18 kVol ctrl7 1,1,0,1 ; read in CC 1, chan 1. Rescale to be from 0 to 1
19 aSig poscil iAmp*kVol, iCps, giSine ; an audio oscillator
20 out aSig ; send audio to output
21 endin
22
23 </CsInstruments>
24 <CsScore>
25 </CsScore>
26 <CsoundSynthesizer>
27 ;example by Iain McCurdy