| 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_named.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 "basic_tone" - Creates a basic tone. |
| 18 |
instr basic_tone |
| 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 #1 - Demonstrates the subinstr opcode. |
| 35 |
instr 1 |
| 36 |
iamp = 20000 |
| 37 |
ipitch = 440 |
| 38 |
|
| 39 |
; Use the "basic_tone" named instrument to create a |
| 40 |
; basic sine-wave tone. |
| 41 |
; Its p4 parameter will be set using the iamp variable. |
| 42 |
; Its p5 parameter will be set using the ipitch variable. |
| 43 |
abasic subinstr "basic_tone", iamp, ipitch |
| 44 |
|
| 45 |
; Output the basic tone that we have created. |
| 46 |
out abasic |
| 47 |
endin |
| 48 |
|
| 49 |
|
| 50 |
</CsInstruments> |
| 51 |
<CsScore> |
| 52 |
|
| 53 |
; Table #1, a sine wave. |
| 54 |
f 1 0 16384 10 1 |
| 55 |
|
| 56 |
; Play Instrument #1 for one second. |
| 57 |
i 1 0 1 |
| 58 |
e |
| 59 |
|
| 60 |
|
| 61 |
</CsScore> |
| 62 |
</CsoundSynthesizer> |