| 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 gen03.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 |
;example by Russell Pinkston - Univ. of Texas (but slightly modified) |
| 16 |
|
| 17 |
gisine ftgen 1, 0, 16384, 10, 1 ;sine wave |
| 18 |
|
| 19 |
instr 1 |
| 20 |
|
| 21 |
ihertz = cpspch(p4) |
| 22 |
ipkamp = p5 |
| 23 |
iwsfn = p6 ;waveshaping function |
| 24 |
inmfn = p7 ;normalization function |
| 25 |
aenv linen 1, .01, p3, .1 ;overall amp envelope |
| 26 |
actrl linen 1, 2, p3, 2 ;waveshaping index control |
| 27 |
aindex poscil actrl/2, ihertz, gisine ;sine wave to be distorted |
| 28 |
asignal tablei .5+aindex, iwsfn, 1 ;waveshaping |
| 29 |
anormal tablei actrl, inmfn,1 ;amplitude normalization |
| 30 |
asig = asignal*anormal*ipkamp*aenv |
| 31 |
asig dcblock2 asig ;get rid of possible DC |
| 32 |
outs asig, asig |
| 33 |
|
| 34 |
endin |
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
; first four notes are specific Chebyshev polynomials using gen03. The values were obtained from Dodge page 147 |
| 38 |
|
| 39 |
f4 0 513 3 -1 1 0 1 ; First-order Chebyshev: x |
| 40 |
f5 0 257 4 4 1 ; Normalizing function for fn4 |
| 41 |
|
| 42 |
f6 0 513 3 -1 1 -1 0 2 ; Second-order Chebyshev: 2x2 - 1 |
| 43 |
f7 0 257 4 6 1 ; Normalizing function for fn6 |
| 44 |
|
| 45 |
f8 0 513 3 -1 1 0 -3 0 4 ; Third-order Chebyshev: 4x3 - 3x |
| 46 |
f9 0 257 4 8 1 ; Normalizing function for fn8 |
| 47 |
|
| 48 |
f10 0 513 3 -1 10 0 -7 0 56 0 -112 0 64 ; Seventh-order Chebyshev: 64x7 - 112x5 + 56x3 - 7x |
| 49 |
f11 0 257 4 10 1 ; Normalizing function for fn10 |
| 50 |
|
| 51 |
f12 0 513 3 -1 1 5 4 3 2 2 1 ; a 4th order polynomial function over the x-interval -1 to 1 |
| 52 |
f13 0 257 4 12 1 ; Normalizing function for fn12 |
| 53 |
|
| 54 |
; five notes with same fundamental, different waveshape & normalizing functions |
| 55 |
; pch amp wsfn nmfn |
| 56 |
i1 0 3 8.00 .7 4 5 |
| 57 |
i1 + . . . 6 7 |
| 58 |
i1 + . . . 8 9 |
| 59 |
i1 + . . . 10 11 |
| 60 |
i1 + . . . 12 13 |
| 61 |
|
| 62 |
e |
| 63 |
</CsScore> |
| 64 |
</CsoundSynthesizer> |
| 65 |
|