| 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 tablei.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 |
seed 0 ;generate new values every time the instr is played |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
ifn = p4 |
| 21 |
isize = p5 |
| 22 |
ithresh = 0.5 |
| 23 |
|
| 24 |
itemp ftgen ifn, 0, isize, 21, 2 |
| 25 |
|
| 26 |
iwrite_value = 0 |
| 27 |
i_index = 0 |
| 28 |
|
| 29 |
loop_start: |
| 30 |
iread_value ptablei i_index, ifn |
| 31 |
|
| 32 |
if iread_value > ithresh then |
| 33 |
iwrite_value = 1 |
| 34 |
else |
| 35 |
iwrite_value = -1 |
| 36 |
endif |
| 37 |
ptableiw iwrite_value, i_index, ifn |
| 38 |
loop_lt i_index, 1, isize, loop_start |
| 39 |
turnoff |
| 40 |
|
| 41 |
endin |
| 42 |
|
| 43 |
instr 2 |
| 44 |
|
| 45 |
ifn = p4 |
| 46 |
isize = ftlen(ifn) |
| 47 |
prints "Index\tValue\n" |
| 48 |
|
| 49 |
i_index = 0 |
| 50 |
loop_start: |
| 51 |
ivalue tablei i_index, ifn |
| 52 |
prints "%d:\t%f\n", i_index, ivalue |
| 53 |
|
| 54 |
loop_lt i_index, 1, isize, loop_start ;read table 1 with our index |
| 55 |
|
| 56 |
aout oscili .5, 100, ifn ;use table to play the polypulse |
| 57 |
outs aout, aout |
| 58 |
|
| 59 |
endin |
| 60 |
</CsInstruments> |
| 61 |
<CsScore> |
| 62 |
i 1 0 1 100 16 |
| 63 |
i 2 0 2 100 |
| 64 |
e |
| 65 |
</CsScore> |
| 66 |
</CsoundSynthesizer> |