| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;RT 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 chebyshevpoly.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
|
| 15 |
; time-varying mixture of first six harmonics |
| 16 |
instr 1 |
| 17 |
; According to the GEN13 manual entry, |
| 18 |
; the pattern + - - + + - - for the signs of |
| 19 |
; the chebyshev coefficients has nice properties. |
| 20 |
|
| 21 |
; these six lines control the relative powers of the harmonics |
| 22 |
k1 line 1.0, p3, 0.0 |
| 23 |
k2 line -0.5, p3, 0.0 |
| 24 |
k3 line -0.333, p3, -1.0 |
| 25 |
k4 line 0.0, p3, 0.5 |
| 26 |
k5 line 0.0, p3, 0.7 |
| 27 |
k6 line 0.0, p3, -1.0 |
| 28 |
|
| 29 |
; play the sine wave at a frequency of 256 Hz with amplitude = 1.0 |
| 30 |
ax oscili 1, 256, 1 |
| 31 |
|
| 32 |
; waveshape it |
| 33 |
ay chebyshevpoly ax, 0, k1, k2, k3, k4, k5, k6 |
| 34 |
|
| 35 |
; avoid clicks, scale final amplitude, and output |
| 36 |
adeclick linseg 0.0, 0.05, 1.0, p3 - 0.1, 1.0, 0.05, 0.0 |
| 37 |
outs ay * adeclick * 10000, ay * adeclick * 10000 |
| 38 |
endin |
| 39 |
|
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
f1 0 32768 10 1 ; a sine wave |
| 43 |
|
| 44 |
i1 0 5 |
| 45 |
e |
| 46 |
|
| 47 |
</CsScore> |
| 48 |
</CsoundSynthesizer> |