| 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 centroid.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, 16384, 10, 1 |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
ktrig init 1 ;calculate centroid |
| 21 |
a1 oscil3 0.5, p4, giSine ;of the sine wave |
| 22 |
k1 centroid a1, ktrig, 16384 |
| 23 |
asig oscil3 0.5, k1, giSine |
| 24 |
printk2 k1 ;print & compare: |
| 25 |
outs a1, asig ;left = original, right = centroid signal |
| 26 |
|
| 27 |
endin |
| 28 |
</CsInstruments> |
| 29 |
<CsScore> |
| 30 |
|
| 31 |
i1 0 2 20 |
| 32 |
i1 + 2 200 |
| 33 |
i1 + 2 2000 |
| 34 |
e |
| 35 |
|
| 36 |
</CsScore> |
| 37 |
</CsoundSynthesizer> |
| 38 |
|