| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime 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 tableikt.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 |
instr 1 |
| 17 |
|
| 18 |
ilowfn = p4 ;lowest ftable wave |
| 19 |
ihighfn = p5 ;highest ftable wave |
| 20 |
|
| 21 |
kswpenv line 1, p3, 0 ;sweep envelope, calculate current table pair and interpolation amount |
| 22 |
inumtables = ihighfn - ilowfn ;1 less than number of tables |
| 23 |
kfn1 = int(kswpenv*inumtables) + ilowfn |
| 24 |
printks "play table no: %d\n", 1, kfn1 |
| 25 |
kfn2 = kfn1 + 1 |
| 26 |
kinterp = frac(kswpenv*inumtables) |
| 27 |
ixmode = 1 ;read tables with phasor |
| 28 |
aphase phasor 40 |
| 29 |
asig tableikt aphase, kfn1, ixmode ;normalized index |
| 30 |
if kswpenv == 1.0 kgoto skipfn2 ;if kfn1 is last table, there is no kfn2 |
| 31 |
asig2 tableikt aphase, kfn2, ixmode |
| 32 |
skipfn2: |
| 33 |
amix ntrpol asig, asig2, kinterp ;interpolate between tables and output |
| 34 |
outs amix*.5, amix*.5 |
| 35 |
|
| 36 |
endin |
| 37 |
</CsInstruments> |
| 38 |
<CsScore> |
| 39 |
f 1 0 16384 10 1 |
| 40 |
f 2 0 16384 10 1 .5 |
| 41 |
f 3 0 16384 1 "fox.wav" 0 0 0 ;a sample |
| 42 |
f 4 0 16384 10 1 .5 .3 .25 .2 .16 .14 .125 .111 ;sawtooth |
| 43 |
f 5 0 16384 10 1 .4 .3 .25 .2 |
| 44 |
f 6 0 16384 10 1 .3 .3 .25 .2 .16 |
| 45 |
f 7 0 16384 10 1 1 1 1 .7 .5 .3 .1 ;pulse |
| 46 |
f 8 0 16384 1 "drumsMlp.wav" 0 0 0 ;a sample |
| 47 |
|
| 48 |
i 1 0 10 1 8 |
| 49 |
e |
| 50 |
</CsScore> |
| 51 |
</CsoundSynthesizer> |
| 52 |
|