| 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 gen07.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 ;use GEN07 to alter frequency |
| 17 |
|
| 18 |
ifn = p4 ;use different GEN07 tables |
| 19 |
kcps init 10/p3 ;index ftable 10 times over the duration of entire note |
| 20 |
kndx phasor kcps |
| 21 |
ixmode = 1 ;normalize index data |
| 22 |
kfrq tablei kndx, ifn, ixmode |
| 23 |
kfrq = kfrq*1000 ;scale |
| 24 |
asig poscil .8, 1220+kfrq, 1 ;add to frequency |
| 25 |
outs asig, asig |
| 26 |
|
| 27 |
endin |
| 28 |
</CsInstruments> |
| 29 |
<CsScore> |
| 30 |
f 1 0 8192 10 1 ;sine wave |
| 31 |
f 2 0 1024 7 0 512 1 0 -1 512 0 ;sawtooth up and down |
| 32 |
f 3 0 1024 7 1 512 1 0 -1 512 -1 ;square |
| 33 |
f 4 0 1024 7 1 1024 -1 ;saw down |
| 34 |
|
| 35 |
i 1 0 2 2 |
| 36 |
i 1 + 2 3 |
| 37 |
i 1 + 1 4 |
| 38 |
e |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |