Debian Codegraph @

examples/syncphasor.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in
5 -odac -iadc ;;;RT audio I/O
6 ; For Non-realtime ouput leave only the line below:
7 ; -o abs.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 instr 1
12 ; Use two syncphasors - one is the "master",
13 ; the other the "slave"
14
15 ; master's frequency determines pitch
16 imastercps = cpspch(p4)
17 imaxamp = 10000
18
19 ; the slave's frequency affects the timbre
20 kslavecps line imastercps, p3, imastercps * 3
21
22 ; the master "oscillator"
23 ; the master has no sync input
24 anosync init 0.0
25 am, async syncphasor imastercps, anosync
26
27 ; the slave "oscillator"
28 aout, as syncphasor kslavecps, async
29
30 adeclick linseg 0.0, 0.05, 1.0, p3 - 0.1, 1.0, 0.05, 0.0
31
32 ; Output the slave's phase value which is a rising
33 ; sawtooth wave. This produces aliasing, but hey, this
34 ; this is just an example ;)
35
36 out aout * adeclick * imaxamp
37 endin
38
39 </CsInstruments>
40 <CsScore>
41
42 i1 0 1 7.00
43 i1 + 0.5 7.02
44 i1 + . 7.05
45 i1 + . 7.07
46 i1 + . 7.09
47 i1 + 2 7.06
48
49 e
50
51 </CsScore>
52 </CsoundSynthesizer>