Debian Codegraph @

src/Examples/FLOSS Manual Examples/02 Quick Start/02C01_Midi_Keybd_in.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -+rtmidi=portmidi -Ma -odac
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 2
10 0dbfs = 1
11
12 massign 0, 1 ;assign all MIDI channels to instrument 1
13
14 instr 1
15 iCps cpsmidi ;get the frequency from the key pressed
16 iAmp ampmidi 0dbfs * 0.3 ;get the amplitude
17 aOut poscil iAmp, iCps ;generate a sine tone
18 outs aOut, aOut ;write it to the output
19 endin
20
21 </CsInstruments>
22 <CsScore>
23 </CsScore>
24 </CsoundSynthesizer>
25 ;Example by Andrés Cabrera