| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages |
| 5 |
-odac -iadc -d ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o planet.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 planet oribiting in 3D space. |
| 18 |
instr 1 |
| 19 |
; Create a basic tone. |
| 20 |
kamp init 5000 |
| 21 |
kcps init 440 |
| 22 |
ifn = 1 |
| 23 |
asnd oscil kamp, kcps, ifn |
| 24 |
|
| 25 |
; Figure out its X, Y, Z coordinates. |
| 26 |
km1 init 0.5 |
| 27 |
km2 init 0.35 |
| 28 |
ksep init 2.2 |
| 29 |
ix = 0 |
| 30 |
iy = 0.1 |
| 31 |
iz = 0 |
| 32 |
ivx = 0.5 |
| 33 |
ivy = 0 |
| 34 |
ivz = 0 |
| 35 |
ih = 0.0003 |
| 36 |
ifric = -0.1 |
| 37 |
ax1, ay1, az1 planet km1, km2, ksep, ix, iy, iz, \ |
| 38 |
ivx, ivy, ivz, ih, ifric |
| 39 |
|
| 40 |
; Place the basic tone within 3D space. |
| 41 |
kx downsamp ax1 |
| 42 |
ky downsamp ay1 |
| 43 |
kz downsamp az1 |
| 44 |
idist = 1 |
| 45 |
ift = 0 |
| 46 |
imode = 1 |
| 47 |
imdel = 1.018853416 |
| 48 |
iovr = 2 |
| 49 |
aw2, ax2, ay2, az2 spat3d asnd, kx, ky, kz, idist, \ |
| 50 |
ift, imode, imdel, iovr |
| 51 |
|
| 52 |
; Convert the 3D sound to stereo. |
| 53 |
aleft = aw2 + ay2 |
| 54 |
aright = aw2 - ay2 |
| 55 |
|
| 56 |
outs aleft, aright |
| 57 |
endin |
| 58 |
|
| 59 |
|
| 60 |
</CsInstruments> |
| 61 |
<CsScore> |
| 62 |
|
| 63 |
; Table #1 a sine wave. |
| 64 |
f 1 0 16384 10 1 |
| 65 |
|
| 66 |
; Play Instrument #1 for 10 seconds. |
| 67 |
i 1 0 10 |
| 68 |
e |
| 69 |
|
| 70 |
|
| 71 |
</CsScore> |
| 72 |
</CsoundSynthesizer> |