Debian Codegraph @

examples/pdhalfy.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 pdhalfy.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 instr 5
17
18 idur = p3
19 iamp = p4
20 ifreq = p5
21 iamtinit = p6 ; initial amount of phase distortion
22 iatt = p7 ; attack time
23 isuslvl = p8 ; sustain amplitude
24 idistdec = p9 ; time for distortion amount to reach zero
25 itable = p10
26
27 idec = idistdec - iatt
28 irel = .05
29 isus = idur - (idistdec + irel)
30
31 aenv linseg 0, iatt, 1.0, idec, isuslvl, isus, isuslvl, irel, 0, 0, 0
32 kamount linseg -iamtinit, idistdec, 0.0, idur-idistdec, 0.0
33 aosc phasor ifreq
34 apd pdhalfy aosc, kamount
35 aout tablei apd, itable, 1
36
37 outs aenv*aout*iamp, aenv*aout*iamp
38 endin
39
40 </CsInstruments>
41 <CsScore>
42 f1 0 16385 10 1 ; sine
43 f3 0 16385 9 1 1 270 ; inverted cosine
44
45 ; descending "just blues" scale
46
47 ; pdhalfy with cosine table
48 t 0 100
49 i5 0 .333 .6 512 1.0 .02 0.5 .12 3
50 i. + . . 448 <
51 i. + . . 384 <
52 i. + . . 358.4 <
53 i. + . . 341.33 <
54 i. + . . 298.67 <
55 i. + 2 . 256 0.5
56 s
57
58 ; pdhalfy with sine table
59 t 0 100
60 i5 0 .333 .6 512 1.0 .001 0.1 .07 1
61 i. + . . 448 <
62 i. + . . 384 <
63 i. + . . 358.4 <
64 i. + . . 341.33 <
65 i. + . . 298.67 <
66 i. + 2 . 256 0.5
67 e
68 </CsScore>
69 </CsoundSynthesizer>