Debian Codegraph @

examples/loopsegp.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 loopsegp.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 1
17 ktrig metro 22/8 ; triggers used to generate new direction values
18 kdir trandom ktrig,-2.99,2.99
19 kdir = 0.5*int(kdir) ; kdir will either -1, -0.5, 0, 0.5 or 1
20 ; kphase - looping pointer
21 kphase phasor kdir
22 ; a loop sequence of midi note numbers and durations
23 knote loopsegp kphase, 40,1,40,0, 43,1,43,0, 49,2,48,0, \
24 47,1,47,0, 46,1,46,0, 46,1,47,0, 49,1,49,0, 43,1,43,0, 46,1,46,0, 40,1,39,0
25 kmul rspline 0.1,0.8,0.5,5 ; modulation of buzz tone
26 asig gbuzz 0.2, cpsmidinn(knote), 30, 3, kmul, 1 ; buzz tone
27 outs asig, asig
28
29 schedkwhen ktrig,0,0,2,0,0.1 ; play metronome
30 endin
31
32 instr 2 ; metronome
33 acps expon 180+rnd(40),p3,50
34 aamp expon 0.05+rnd(0.05),p3,0.001
35 asig poscil aamp-0.001,acps,2
36 outs asig,asig
37 endin
38
39 </CsInstruments>
40 <CsScore>
41 ; cosine wave.
42 f 1 0 16384 11 1
43 ; sine wave.
44 f 2 0 16384 10 1
45
46 i 1 0 360 0.25
47
48 e
49 </CsScore>
50 </CsoundSynthesizer>