| 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 floor.wav -W ;;; for file output any platform |
| 8 |
|
| 9 |
; By Stefano Cucchi 2024 |
| 10 |
</CsOptions> |
| 11 |
<CsInstruments> |
| 12 |
|
| 13 |
sr = 44100 |
| 14 |
ksmps = 32 |
| 15 |
0dbfs = 1 |
| 16 |
nchnls = 2 |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
gkrandom randomh 1, 45, 300, 2, 3 ; generate some random numbers |
| 21 |
gkrandomFLOOR = floor (gkrandom) ; take the integer part |
| 22 |
gkrandomFRAC = frac (gkrandom) ; take the fractional part |
| 23 |
|
| 24 |
endin |
| 25 |
|
| 26 |
instr 10 |
| 27 |
|
| 28 |
ktrigger metro 4 |
| 29 |
kmintim = 0 |
| 30 |
kmaxnum = 10 |
| 31 |
kinsnum = 20 |
| 32 |
kwhen = 0 |
| 33 |
kdur = ktrigger*0.25 |
| 34 |
schedkwhen ktrigger, kmintim, kmaxnum, kinsnum, kwhen, kdur |
| 35 |
|
| 36 |
endin |
| 37 |
|
| 38 |
instr 20 |
| 39 |
|
| 40 |
irandomFLOOR = i(gkrandomFLOOR) |
| 41 |
irandomFRAC = i(gkrandomFRAC) |
| 42 |
|
| 43 |
; Use the integer part to control the number of harmonics of every note |
| 44 |
; after converting (k) value to (i) |
| 45 |
prints "generated value = %f\n", i(gkrandom) |
| 46 |
prints "--> floor value = %d\n", irandomFLOOR |
| 47 |
a1 buzz 0.5, 120, irandomFLOOR, 1 |
| 48 |
|
| 49 |
kenvelope linseg 0, p3*0.1, 1, p3*0.8, 1, p3*0.1, 0 |
| 50 |
|
| 51 |
a1 = a1*kenvelope |
| 52 |
|
| 53 |
aL, aR pan2 a1, irandomFRAC, 1 ; use the fractional part to control the pan position |
| 54 |
outs aL, aR |
| 55 |
|
| 56 |
endin |
| 57 |
|
| 58 |
</CsInstruments> |
| 59 |
<CsScore> |
| 60 |
|
| 61 |
f 1 0 16384 10 1 |
| 62 |
|
| 63 |
i 1 0 10 |
| 64 |
i 10 0 10 |
| 65 |
e |
| 66 |
</CsScore> |
| 67 |
</CsoundSynthesizer> |