| 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 tabmorphak.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 |
giSine ftgen 0, 0, 8193, 10, 1 ; sine wave |
| 17 |
giSquare ftgen 0, 0, 8193, 7, 1, 4096, 1, 0, -1, 4096, -1 ; square wave |
| 18 |
giTri ftgen 0, 0, 8193, 7, 0, 2048, 1, 4096, -1, 2048, 0 ; triangle wave |
| 19 |
giSaw ftgen 0, 0, 8193, 7, 1, 8192, -1 ; sawtooth wave, downward slope |
| 20 |
|
| 21 |
instr 1 |
| 22 |
|
| 23 |
iamp = .7 |
| 24 |
aindex phasor 110 ; read table value at this index |
| 25 |
kweightpoint expon 0.001, p3, 1 ; using the weightpoint to morph between two tables exponentially |
| 26 |
ktabnum1 = p4 ; first wave, it morphs to |
| 27 |
ktabnum2 = p5 ; the second wave |
| 28 |
asig tabmorphak aindex, kweightpoint, ktabnum1,ktabnum2, giSine, giSquare, giTri, giSaw |
| 29 |
asig = asig*iamp |
| 30 |
outs asig, asig |
| 31 |
|
| 32 |
endin |
| 33 |
</CsInstruments> |
| 34 |
<CsScore> |
| 35 |
|
| 36 |
i1 0 5 0 1 ;from sine to square wave |
| 37 |
i1 6 5 2 3 ;from triangle to saw |
| 38 |
e |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |
| 41 |
|