Debian Codegraph @

examples/ftchnls.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;realtime audio out
5 ; For Non-realtime ouput leave only the line below:
6 ; -o ftchnls.wav -W ;;; for file output any platform
7 </CsOptions>
8 <CsInstruments>
9
10 ; by Menno Knevel 2022
11
12 sr = 44100
13 ksmps = 32
14 nchnls = 2
15 0dbfs = 1
16
17 instr 1
18
19 ichnls = ftchnls(p4)
20 prints "\nnumber of channels = %d\n\n", ichnls
21
22 if (ichnls == 1) then
23 asigL loscil3 .8, 1, p4, 1 ; sample loops between 1 and end loop point at 2 secs.
24 asigR = asigL
25 elseif (ichnls == 2) then
26 asigL, asigR loscil3 .8, 1, p4, 1 ; sample loops between 2 and end loop point at 3 secs.
27 else ; safety precaution if not mono or stereo
28 asigL = 0
29 asigR = 0
30 endif
31 outs asigL, asigR
32
33 endin
34 </CsInstruments>
35 <CsScore>
36 f 1 0 0 1 "drumsMlp.wav" 0 0 0
37 f 2 0 0 1 "drumsSlp.wav" 0 0 0
38
39 i 1 0 3 1 ;mono file
40 i 1 + 8 2 ;stereo file
41 e
42 </CsScore>
43 </CsoundSynthesizer>