Debian Codegraph @

examples/resonz.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 resonz.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 /* Written by Sean Costello */
12 ; Orchestra file for resonant filter sweep of a sawtooth-like waveform.
13 ; The outputs of reson, resonr, and resonz are scaled by coefficients
14 ; specified in the score, so that each filter can be heard on its own
15 ; from the same instrument.
16
17 sr = 44100
18 kr = 4410
19 ksmps = 10
20 nchnls = 1
21
22 instr 1
23
24 idur = p3
25 ibegfreq = p4 ; beginning of sweep frequency
26 iendfreq = p5 ; ending of sweep frequency
27 ibw = p6 ; bandwidth of filters in Hz
28 ifreq = p7 ; frequency of gbuzz that is to be filtered
29 iamp = p8 ; amplitude to scale output by
30 ires = p9 ; coefficient to scale amount of reson in output
31 iresr = p10 ; coefficient to scale amount of resonr in output
32 iresz = p11 ; coefficient to scale amount of resonz in output
33
34 ; Frequency envelope for reson cutoff
35 kfreq linseg ibegfreq, idur * .5, iendfreq, idur * .5, ibegfreq
36
37 ; Amplitude envelope to prevent clicking
38 kenv linseg 0, .1, iamp, idur - .2, iamp, .1, 0
39
40 ; Number of harmonics for gbuzz scaled to avoid aliasing
41 iharms = (sr*.4)/ifreq
42
43 asig gbuzz 1, ifreq, iharms, 1, .9, 1 ; "Sawtooth" waveform
44 ain = kenv * asig ; output scaled by amp envelope
45 ares reson ain, kfreq, ibw, 1
46 aresr resonr ain, kfreq, ibw, 1
47 aresz resonz ain, kfreq, ibw, 1
48
49 out ares * ires + aresr * iresr + aresz * iresz
50
51 endin
52
53
54 </CsInstruments>
55 <CsScore>
56
57 /* Written by Sean Costello */
58 f1 0 8192 9 1 1 .25 ; cosine table for gbuzz generator
59
60 i1 0 10 1 3000 200 100 4000 1 0 0 ; reson output with bw = 200
61 i1 10 10 1 3000 200 100 4000 0 1 0 ; resonr output with bw = 200
62 i1 20 10 1 3000 200 100 4000 0 0 1 ; resonz output with bw = 200
63 i1 30 10 1 3000 50 200 8000 1 0 0 ; reson output with bw = 50
64 i1 40 10 1 3000 50 200 8000 0 1 0 ; resonr output with bw = 50
65 i1 50 10 1 3000 50 200 8000 0 0 1 ; resonz output with bw = 50
66 e
67
68
69 </CsScore>
70 </CsoundSynthesizer>