| 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 times_complex.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
;by joachim heintz and rory walsh |
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
giWave ftgen 0, 0, 1024, 10, 1, .5, .25 |
| 17 |
|
| 18 |
instr again |
| 19 |
|
| 20 |
instance = p4 |
| 21 |
;reset the duration of this instance |
| 22 |
iDur rnd31 5, 3 ;shorter values are more probable |
| 23 |
iDur = abs(iDur) + 0.2 |
| 24 |
p3 = iDur |
| 25 |
;trigger the effect instrument of this instance |
| 26 |
event_i "i", "fx_processor", 0, iDur, instance |
| 27 |
;print the status quo |
| 28 |
kTime times |
| 29 |
prints "instance = %d, start = %f, duration = %f\n", instance, i(kTime), iDur |
| 30 |
;make sound |
| 31 |
iamp active 1 ;scale amplitudes |
| 32 |
iOct random 5, 10 ;find pitch |
| 33 |
aEnv transeg 0, 0.02, 0, 1/iamp, p3-0.02, -6, 0 ;output envelope |
| 34 |
aSend poscil aEnv, cpsoct(iOct), giWave ;audio signal |
| 35 |
;send signal to effect instrument |
| 36 |
Sbus sprintf "audio_%d", instance ;create unique software bus |
| 37 |
chnset aSend/2, Sbus ;send audio on this bus |
| 38 |
;get the last k-cycle of this instance and trigger the successor in it |
| 39 |
kLast release |
| 40 |
schedkwhen kLast, 0, 0, "again", 0, 1, instance+1 |
| 41 |
endin |
| 42 |
|
| 43 |
instr fx_processor |
| 44 |
;apply feedback delay to the above instrument |
| 45 |
iwhich = p4 ;receive instance number ... |
| 46 |
Sbus sprintf "audio_%d", iwhich ; ... and related software bus |
| 47 |
audio chnget Sbus ;receive audio on this bus |
| 48 |
irvbtim random 1, 5 ;find reverb time |
| 49 |
p3 = p3+irvbtim ;adjust instrument duration |
| 50 |
iltptmL random .1, .5 ;find looptime left ... |
| 51 |
iltptmR random .1, .5 ;...and right |
| 52 |
ipan random 0, 1 ; pan and ... |
| 53 |
imix random 0, 1 ;... mix audio |
| 54 |
aL,aR pan2 audio, ipan ;create stereo |
| 55 |
awetL comb aL, irvbtim, iltptmL ;comb filter |
| 56 |
awetR comb aR, irvbtim, iltptmR |
| 57 |
aoutL ntrpol aL, awetL, imix ;wet-dry mix |
| 58 |
aoutR ntrpol aR, awetR, imix |
| 59 |
outs aoutL/2, aoutR/2 |
| 60 |
endin |
| 61 |
|
| 62 |
</CsInstruments> |
| 63 |
<CsScore> |
| 64 |
i "again" 0 1 1 |
| 65 |
|
| 66 |
e 3600 |
| 67 |
</CsScore> |
| 68 |
</CsoundSynthesizer> |
| 69 |
|