Debian Codegraph @

examples/spat3d_stereo.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in No messages
5 -odac -iadc -d ;;;RT audio I/O
6 ; For Non-realtime ouput leave only the line below:
7 ; -o spat3d_stereo.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 /* Written by Istvan Varga */
12 sr = 48000
13 kr = 1000
14 ksmps = 48
15 nchnls = 2
16
17 /* room parameters */
18
19 idep = 3 /* early reflection depth */
20
21 itmp ftgen 1, 0, 64, -2, \
22 /* depth1, depth2, max delay, IR length, idist, seed */ \
23 idep, 48, -1, 0.01, 0.25, 123, \
24 1, 21.982, 0.05, 0.87, 4000.0, 0.6, 0.7, 2, /* ceil */ \
25 1, 1.753, 0.05, 0.87, 3500.0, 0.5, 0.7, 2, /* floor */ \
26 1, 15.220, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* front */ \
27 1, 9.317, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* back */ \
28 1, 17.545, 0.05, 0.87, 5000.0, 0.8, 0.7, 2, /* right */ \
29 1, 12.156, 0.05, 0.87, 5000.0, 0.8, 0.7, 2 /* left */
30
31 instr 1
32
33 /* some source signal */
34
35 a1 phasor 150 ; oscillator
36 a1 butterbp a1, 500, 200 ; filter
37 a1 = taninv(a1 * 100)
38 a2 phasor 3 ; envelope
39 a2 mirror 40*a2, -100, 5
40 a2 limit a2, 0, 1
41 a1 = a1 * a2 * 9000
42
43 kazim line 0, 2.5, 360 ; move sound source around
44 kdist line 1, 10, 4 ; distance
45
46 ; convert polar coordinates
47 kX = sin(kazim * 3.14159 / 180) * kdist
48 kY = cos(kazim * 3.14159 / 180) * kdist
49 kZ = 0
50
51 a1 = a1 + 0.000001 * 0.000001 ; avoid underflows
52
53 imode = 1 ; change this to 3 for 8 spk in a cube,
54 ; or 1 for simple stereo
55
56 aW, aX, aY, aZ spat3d a1, kX, kY, kZ, 1.0, 1, imode, 2, 2
57
58 aW = aW * 1.4142
59
60 ; stereo
61 ;
62 aL = aW + aY /* left */
63 aR = aW - aY /* right */
64
65 ; quad (square)
66 ;
67 ;aFL = aW + aX + aY /* front left */
68 ;aFR = aW + aX - aY /* front right */
69 ;aRL = aW - aX + aY /* rear left */
70 ;aRR = aW - aX - aY /* rear right */
71
72 ; eight channels (cube)
73 ;
74 ;aUFL = aW + aX + aY + aZ /* upper front left */
75 ;aUFR = aW + aX - aY + aZ /* upper front right */
76 ;aURL = aW - aX + aY + aZ /* upper rear left */
77 ;aURR = aW - aX - aY + aZ /* upper rear right */
78 ;aLFL = aW + aX + aY - aZ /* lower front left */
79 ;aLFR = aW + aX - aY - aZ /* lower front right */
80 ;aLRL = aW - aX + aY - aZ /* lower rear left */
81 ;aLRR = aW - aX - aY - aZ /* lower rear right */
82
83 outs aL, aR
84
85 endin
86
87
88 </CsInstruments>
89 <CsScore>
90
91 /* Written by Istvan Varga */
92 i 1 0 10
93 e
94
95
96 </CsScore>
97 </CsoundSynthesizer>