| 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 subinstr.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
kr = 4410 |
| 14 |
ksmps = 10 |
| 15 |
nchnls = 1 |
| 16 |
|
| 17 |
; Instrument #1 - Creates a basic tone. |
| 18 |
instr 1 |
| 19 |
; Print the value of p4, should be equal to |
| 20 |
; Instrument #2's iamp field. |
| 21 |
print p4 |
| 22 |
|
| 23 |
; Print the value of p5, should be equal to |
| 24 |
; Instrument #2's ipitch field. |
| 25 |
print p5 |
| 26 |
|
| 27 |
; Create a tone. |
| 28 |
asig oscils p4, p5, 0 |
| 29 |
|
| 30 |
out asig |
| 31 |
endin |
| 32 |
|
| 33 |
|
| 34 |
; Instrument #2 - Demonstrates the subinstr opcode. |
| 35 |
instr 2 |
| 36 |
iamp = 20000 |
| 37 |
ipitch = 440 |
| 38 |
|
| 39 |
; Use Instrument #1 to create a basic sine-wave tone. |
| 40 |
; Its p4 parameter will be set using the iamp variable. |
| 41 |
; Its p5 parameter will be set using the ipitch variable. |
| 42 |
abasic subinstr 1, iamp, ipitch |
| 43 |
|
| 44 |
; Output the basic tone that we have created. |
| 45 |
out abasic |
| 46 |
endin |
| 47 |
|
| 48 |
|
| 49 |
</CsInstruments> |
| 50 |
<CsScore> |
| 51 |
|
| 52 |
; Table #1, a sine wave. |
| 53 |
f 1 0 16384 10 1 |
| 54 |
|
| 55 |
; Play Instrument #2 for one second. |
| 56 |
i 2 0 1 |
| 57 |
e |
| 58 |
|
| 59 |
|
| 60 |
</CsScore> |
| 61 |
</CsoundSynthesizer> |