| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in |
| 5 |
-odac -iadc ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o lorenz.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
kr = 44100 |
| 14 |
ksmps = 1 |
| 15 |
nchnls = 2 |
| 16 |
|
| 17 |
; Instrument #1 - a lorenz system in 3D space. |
| 18 |
instr 1 |
| 19 |
; Create a basic tone. |
| 20 |
kamp init 25000 |
| 21 |
kcps init 1000 |
| 22 |
ifn = 1 |
| 23 |
asnd oscil kamp, kcps, ifn |
| 24 |
|
| 25 |
; Figure out its X, Y, Z coordinates. |
| 26 |
ksv init 10 |
| 27 |
krv init 28 |
| 28 |
kbv init 2.667 |
| 29 |
kh init 0.0003 |
| 30 |
ix = 0.6 |
| 31 |
iy = 0.6 |
| 32 |
iz = 0.6 |
| 33 |
iskip = 1 |
| 34 |
ax1, ay1, az1 lorenz ksv, krv, kbv, kh, ix, iy, iz, iskip |
| 35 |
|
| 36 |
; Place the basic tone within 3D space. |
| 37 |
kx downsamp ax1 |
| 38 |
ky downsamp ay1 |
| 39 |
kz downsamp az1 |
| 40 |
idist = 1 |
| 41 |
ift = 0 |
| 42 |
imode = 1 |
| 43 |
imdel = 1.018853416 |
| 44 |
iovr = 2 |
| 45 |
aw2, ax2, ay2, az2 spat3d asnd, kx, ky, kz, idist, \ |
| 46 |
ift, imode, imdel, iovr |
| 47 |
|
| 48 |
; Convert the 3D sound to stereo. |
| 49 |
aleft = aw2 + ay2 |
| 50 |
aright = aw2 - ay2 |
| 51 |
|
| 52 |
outs aleft, aright |
| 53 |
endin |
| 54 |
|
| 55 |
|
| 56 |
</CsInstruments> |
| 57 |
<CsScore> |
| 58 |
|
| 59 |
; Table #1 a sine wave. |
| 60 |
f 1 0 16384 10 1 |
| 61 |
|
| 62 |
; Play Instrument #1 for 5 seconds. |
| 63 |
i 1 0 5 |
| 64 |
e |
| 65 |
|
| 66 |
|
| 67 |
</CsScore> |
| 68 |
</CsoundSynthesizer> |