| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;RT audio out |
| 5 |
;-iadc ;;;uncomment -iadc if RT audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o connect.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
/* Written by Michael Gogins */ |
| 12 |
; Initialize the global variables. |
| 13 |
sr = 44100 |
| 14 |
ksmps = 32 |
| 15 |
nchnls = 2 |
| 16 |
|
| 17 |
; Connect up the instruments to create a signal flow graph. |
| 18 |
|
| 19 |
connect "SimpleSine", "leftout", "Reverberator", "leftin" |
| 20 |
connect "SimpleSine", "rightout", "Reverberator", "rightin" |
| 21 |
|
| 22 |
connect "Moogy", "leftout", "Reverberator", "leftin" |
| 23 |
connect "Moogy", "rightout", "Reverberator", "rightin" |
| 24 |
|
| 25 |
connect "Reverberator", "leftout", "Compressor", "leftin" |
| 26 |
connect "Reverberator", "rightout", "Compressor", "rightin" |
| 27 |
|
| 28 |
connect "Compressor", "leftout", "Soundfile", "leftin" |
| 29 |
connect "Compressor", "rightout", "Soundfile", "rightin" |
| 30 |
|
| 31 |
; Turn on the "effect" units in the signal flow graph. |
| 32 |
|
| 33 |
alwayson "Reverberator", 0.91, 12000 |
| 34 |
alwayson "Compressor" |
| 35 |
alwayson "Soundfile" |
| 36 |
|
| 37 |
instr SimpleSine |
| 38 |
ihz = cpsmidinn(p4) |
| 39 |
iamplitude = ampdb(p5) |
| 40 |
print ihz, iamplitude |
| 41 |
; Use ftgenonce instead of ftgen, ftgentmp, or f statement. |
| 42 |
isine ftgenonce 0, 0, 4096, 10, 1 |
| 43 |
a1 oscili iamplitude, ihz, isine |
| 44 |
aenv madsr 0.05, 0.1, 0.5, 0.2 |
| 45 |
asignal = a1 * aenv |
| 46 |
; Stereo audio outlet to be routed in the orchestra header. |
| 47 |
outleta "leftout", asignal * 0.25 |
| 48 |
outleta "rightout", asignal * 0.75 |
| 49 |
endin |
| 50 |
|
| 51 |
instr Moogy |
| 52 |
ihz = cpsmidinn(p4) |
| 53 |
iamplitude = ampdb(p5) |
| 54 |
; Use ftgenonce instead of ftgen, ftgentmp, or f statement. |
| 55 |
isine ftgenonce 0, 0, 4096, 10, 1 |
| 56 |
asignal vco iamplitude, ihz, 1, 0.5, isine |
| 57 |
kfco line 200, p3, 2000 |
| 58 |
krez init 0.9 |
| 59 |
asignal moogvcf asignal, kfco, krez, 100000 |
| 60 |
; Stereo audio outlet to be routed in the orchestra header. |
| 61 |
outleta "leftout", asignal * 0.75 |
| 62 |
outleta "rightout", asignal * 0.25 |
| 63 |
endin |
| 64 |
|
| 65 |
instr Reverberator |
| 66 |
; Stereo input. |
| 67 |
aleftin inleta "leftin" |
| 68 |
arightin inleta "rightin" |
| 69 |
idelay = p4 |
| 70 |
icutoff = p5 |
| 71 |
aleftout, arightout reverbsc aleftin, arightin, idelay, icutoff |
| 72 |
; Stereo output. |
| 73 |
outleta "leftout", aleftout |
| 74 |
outleta "rightout", arightout |
| 75 |
endin |
| 76 |
|
| 77 |
instr Compressor |
| 78 |
; Stereo input. |
| 79 |
aleftin inleta "leftin" |
| 80 |
arightin inleta "rightin" |
| 81 |
kthreshold = 25000 |
| 82 |
icomp1 = 0.5 |
| 83 |
icomp2 = 0.763 |
| 84 |
irtime = 0.1 |
| 85 |
iftime = 0.1 |
| 86 |
aleftout dam aleftin, kthreshold, icomp1, icomp2, irtime, iftime |
| 87 |
arightout dam arightin, kthreshold, icomp1, icomp2, irtime, iftime |
| 88 |
; Stereo output. |
| 89 |
outleta "leftout", aleftout |
| 90 |
outleta "rightout", arightout |
| 91 |
endin |
| 92 |
|
| 93 |
instr Soundfile |
| 94 |
; Stereo input. |
| 95 |
aleftin inleta "leftin" |
| 96 |
arightin inleta "rightin" |
| 97 |
outs aleftin, arightin |
| 98 |
endin |
| 99 |
|
| 100 |
</CsInstruments> |
| 101 |
<CsScore> |
| 102 |
; Not necessary to activate "effects" or create f-tables in the score! |
| 103 |
; Overlapping notes to create new instances of instruments. |
| 104 |
i "SimpleSine" 1 5 60 85 |
| 105 |
i "SimpleSine" 2 5 64 80 |
| 106 |
i "Moogy" 3 5 67 75 |
| 107 |
i "Moogy" 4 5 71 70 |
| 108 |
;6 extra seconds after the performance |
| 109 |
e 12 |
| 110 |
</CsScore> |
| 111 |
</CsoundSynthesizer> |