| 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 gen32.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 |
itmp ftgen 1, 0, 16384, 7, 1, 16384, -1 ; sawtooth |
| 17 |
itmp ftgen 2, 0, 8192, 10, 1 ; sine |
| 18 |
itmp ftgen 5, 0, 4096, -32, -2, 1.5, 1.0, 0.25, 1, 2, 0.5, 0, 1, 3, -0.25, 0.5 ; mix tables |
| 19 |
itmp ftgen 6, 0, 16384, 20, 3, 1 ; window |
| 20 |
; generate band-limited waveforms |
| 21 |
inote = 0 |
| 22 |
loop0: |
| 23 |
icps = 440 * exp(log(2) * (inote - 69) / 12) ; one table for |
| 24 |
inumh = sr / (2 * icps) ; each MIDI note number |
| 25 |
ift = int(inote + 256.5) |
| 26 |
itmp ftgen ift, 0, 4096, -30, 5, 1, inumh |
| 27 |
inote = inote + 1 |
| 28 |
if (inote < 127.5) igoto loop0 |
| 29 |
|
| 30 |
instr 1 |
| 31 |
|
| 32 |
kcps expon 20, p3, 16000 |
| 33 |
kft = int(256.5 + 69 + 12 * log(kcps / 440) / log(2)) |
| 34 |
kft = (kft > 383 ? 383 : kft) |
| 35 |
a1 phasor kcps |
| 36 |
a1 tableikt a1, kft, 1, 0, 1 |
| 37 |
outs a1*.5, a1*.5 |
| 38 |
endin |
| 39 |
|
| 40 |
instr 2 |
| 41 |
|
| 42 |
kcps expon 20, p3, 16000 |
| 43 |
kft = int(256.5 + 69 + 12 * log(kcps / 440) / log(2)) |
| 44 |
kft = (kft > 383 ? 383 : kft) |
| 45 |
kgdur limit 10 / kcps, 0.1, 1 |
| 46 |
a1 grain2 kcps, 0.02, kgdur, 30, kft, 6, -0.5 |
| 47 |
outs a1*.08, a1*.08 |
| 48 |
|
| 49 |
endin |
| 50 |
</CsInstruments> |
| 51 |
<CsScore> |
| 52 |
t 0 60 |
| 53 |
|
| 54 |
i 1 0 10 |
| 55 |
i 2 12 10 |
| 56 |
e |
| 57 |
</CsScore> |
| 58 |
</CsoundSynthesizer> |
| 59 |
|