Debian Codegraph @

examples/musical/Mandel_Daughtrey.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;RT audio out
5 ;-iadc ;;;uncomment -iadc for RT audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o Mandel_Daughtrey.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 ; example by Scott Daughtrey [ST Music]
12
13 sr = 44100
14 ksmps = 32
15 nchnls = 2
16 0dbfs = 1
17
18 seed 0 ; different random result at each run
19
20 gaRvbL init ; initialize global reverb
21 gaRvbR init
22 ; table is 5th mode of Hungarian Minor Scale
23 giNotes ftgen 0, 0, 0, 2, 6.07, 6.08, 6.11, 7.00, 7.02, 7.03, 7.06, \
24 7.07, 7.08, 7.11, 8.00, 8.02, 8.03, 9.06, \
25 8.07, 8.08, 8.11, 9.00, 9.02, 9.03, 9.06, \
26 9.07
27
28 instr Trigger
29 kTrig = gausstrig(1, 1.85, 1.5) ; randomly trigger mandel opcode and timing of note production
30 kX = trandom(kTrig, -1.6, 0) ; randomly select X coordinates
31 kY = randomh(0, 1.2, 10) ; randomly select Y coordinates
32 kIter, kOutrig mandel kTrig, kX, kY, 21 ; set range of iterations between 0-21
33 schedkwhen kOutrig, 0, 0, "Mandel", 0, .7, p4, kIter ; trigger Mandel instr and send relevant parameters
34 endin
35
36 instr Mandel
37 iNote = table(p5, giNotes, 0, 0, 0) ; table uses mandel iterations to select indexed notes from giNotes ftable
38 iFreq = cpspch(iNote+p4) ; convert notes to cps
39 if iFreq == 10.07 then
40 iFreq = 7.07
41 endif
42 iRand = random(.5, .99) ; randomize amplitude and pluck position (iPlk)
43 aSig = wgpluck2(iRand, .3*iRand, iFreq, .2, .3)
44 iPan = random(.2, .8) ; randomize pan position
45 aL, aR pan2 aSig, iPan ; pan each note
46 outs aL, aR ; output stereo signal
47 gaRvbL += aL*.3 ; send a little to global reverb channels
48 gaRvbR += aR*.3
49 endin
50
51 instr Reverb ; reverb instrument
52 aL, aR reverbsc gaRvbL, gaRvbR, .93, 2^14
53 outs aL, aR
54 clear gaRvbL, gaRvbR
55 endin
56
57 </CsInstruments>
58 <CsScore>
59 i"Trigger" 0 3600 0
60 i . .1 3600 1
61 i"Reverb" 0 3606
62 e
63 </CsScore>
64 </CsoundSynthesizer>