Debian Codegraph @

src/Examples/FLOSS Manual Examples/05 Sound Modification/05B13_udo_ambisonics2D_4.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 --env:SSDIR+=../../SourceMaterials -odac -m0
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 8
10 0dbfs = 1
11
12 #include "../../SourceMaterials/ambisonics2D_udos.txt"
13
14 ; distance encoding
15 ; with any distance (includes zero and negative distance)
16
17 opcode ambi2D_enc_dist_n, 0, aikk
18 asnd,iorder,kaz,kdist xin
19 kaz = $M_PI*kaz/180
20 kaz = (kdist < 0 ? kaz + $M_PI : kaz)
21 kdist = abs(kdist)+0.0001
22 kgainW = taninv(kdist*1.5707963) / (kdist*1.5708) ;pi/2
23 kgainHO = (1 - exp(-kdist))*kgainW
24 kk = iorder
25 asndW = kgainW*asnd
26 asndHO = kgainHO*asndW
27 c1:
28 zawm cos(kk*kaz)*asndHO,2*kk-1
29 zawm sin(kk*kaz)*asndHO,2*kk
30 kk = kk-1
31
32 if kk > 0 goto c1
33 zawm asndW,0
34
35 endop
36
37 zakinit 17, 1
38
39 instr 1
40 asnd rand p4
41 ;asnd soundin "/Users/user/csound/ambisonic/violine.aiff"
42 kaz line 0,p3,p5*360 ;turns around p5 times in p3 seconds
43 kdist line p6,p3,p7
44 ambi2D_enc_dist_n asnd,8,kaz,kdist
45 endin
46
47 instr 10
48 a1,a2,a3,a4,
49 a5,a6,a7,a8 ambi2D_decode 8,0,45,90,135,180,225,270,315
50 outc a1,a2,a3,a4,a5,a6,a7,a8
51 zacl 0,16
52 endin
53
54 </CsInstruments>
55 <CsScore>
56 f1 0 32768 10 1
57 ; amp turns dist1 dist2
58 i1 0 4 1 0 2 -2
59 ;i1 0 4 1 1 1 1
60 i10 0 4
61 </CsScore>
62 </CsoundSynthesizer>
63 ;example by martin neukom