| 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 gen04.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 ;sine wave |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
ihertz = cpspch(p4) |
| 21 |
ipkamp = p5 |
| 22 |
iwsfn = p6 ;waveshaping function |
| 23 |
inmfn = p7 ;normalization function |
| 24 |
agate linen 1, .01, p3, .1 ;overall amp envelope |
| 25 |
kctrl linen .9, 2, p3, 2 ;waveshaping index control |
| 26 |
aindex poscil kctrl/2, ihertz, gisine ;sine wave to be distorted |
| 27 |
asignal tablei .5+aindex, iwsfn, 1 ;waveshaping |
| 28 |
knormal tablei 1/kctrl, inmfn , 1 ;amplitude normalization |
| 29 |
outs asignal*knormal*ipkamp*agate, asignal*knormal*ipkamp*agate |
| 30 |
|
| 31 |
endin |
| 32 |
</CsInstruments> |
| 33 |
<CsScore> |
| 34 |
f1 0 64 21 6 ;Gaussian (random) distribution |
| 35 |
f2 0 33 4 1 1 ;normalizing function with midpoint bipolar offset |
| 36 |
|
| 37 |
s |
| 38 |
; st dur pch amp wsfn inmfn |
| 39 |
i1 0 4 6.00 .7 1 2 |
| 40 |
i1 4 . 7.00 . |
| 41 |
i1 8 . 8.00 . |
| 42 |
;------------------------------------------------------------------------------------- |
| 43 |
f3 0 1025 13 1 1 0 5 0 5 0 10 ;Chebyshev algorithm |
| 44 |
f4 0 513 4 3 1 ;normalizing function with midpoint bipolar offset |
| 45 |
s |
| 46 |
; st dur pch amp wsfn inmfn |
| 47 |
i1 0 4 6.00 .9 3 4 |
| 48 |
i1 4 . 7.00 . |
| 49 |
i1 8 . 8.00 . |
| 50 |
e |
| 51 |
</CsScore> |
| 52 |
</CsoundSynthesizer> |
| 53 |
|