Debian Codegraph @

examples/spdist.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;realtime audio out
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o spdist.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 0dbfs = 1
14 nchnls = 4
15
16 ga1 init 0
17 ga2 init 0
18 ga3 init 0
19 ga4 init 0
20
21 instr 1 ;uses GEN28 file "move2", as found in /manual/examples
22
23 ifreq = 1
24 kx init 0
25 ky init 0
26 ktime line 0, 5.6, 5.6 ;same time as in table 1 (="move2")
27 kdist spdist 1, ktime, kx, ky
28 kfreq = (ifreq*340) / (340 + kdist) ;calculate doppler shift
29 printk2 kdist ;print distance values
30 asig diskin2 "flute.aiff", kfreq, 0, 1 ;sound source is looped
31 a1, a2, a3, a4 space asig, 1, ktime, .1, kx, ky ;use table 1 = GEN28
32 ar1, ar2, ar3, ar4 spsend ;send to reverb
33
34 ga1 = ga1+ar1
35 ga2 = ga2+ar2
36 ga3 = ga3+ar3
37 ga4 = ga4+ar4
38 outq a1, a2, a3, a4
39
40 endin
41
42 instr 99 ; reverb instrument
43
44 a1 reverb2 ga1, 2.5, .5
45 a2 reverb2 ga2, 2.5, .5
46 a3 reverb2 ga3, 2.5, .5
47 a4 reverb2 ga4, 2.5, .5
48 outq a1, a2, a3, a4
49
50 ga1=0
51 ga2=0
52 ga3=0
53 ga4=0
54
55 endin
56 </CsInstruments>
57 <CsScore>
58 f1 0 0 28 "move2" ;from left front and left rear to the middle in front
59
60 i 1 0 5.6 ;same time as ktime
61 i 99 0 10 ;keep reverb active
62 e
63 </CsScore>
64 </CsoundSynthesizer>