| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac -M0 --midi-key-cps=4 --midi-velocity-amp=5 ;;;realtime audio out and realtime midi in, midi key cps is routed to p4 and velocity to p5 |
| 5 |
; For Non-realtime ouput leave only the line below: |
| 6 |
; -o midic21.wav -W ;;; for file output any platform |
| 7 |
</CsOptions> |
| 8 |
<CsInstruments> |
| 9 |
|
| 10 |
; by tgrey - 2020 |
| 11 |
|
| 12 |
sr = 44100 |
| 13 |
ksmps = 32 |
| 14 |
nchnls = 2 |
| 15 |
0dbfs = 1 |
| 16 |
|
| 17 |
instr 1 |
| 18 |
; This example expects MIDI controller input on channel 1 |
| 19 |
; run, play a note and move your midi controllers 1, 7, and 10 to see results |
| 20 |
ictlno1= 1 ; = cc #1 midi mod wheel (course tuning) |
| 21 |
ictlno2= 7 ; = cc #7 midi volume (fine tuning) |
| 22 |
ictlno3= 10 ; = cc #10 midi pan (extremely fine tuning) |
| 23 |
|
| 24 |
; max range is 4 octaves: (2^4) = 16 |
| 25 |
imax = 16 |
| 26 |
|
| 27 |
; read all 3 controllers, scaling them between 1 and imax |
| 28 |
kTune midic21 ictlno1, ictlno2, ictlno3, 1, imax |
| 29 |
printk2 kTune |
| 30 |
|
| 31 |
; generate tones |
| 32 |
asig oscili p5, p4*kTune |
| 33 |
aref oscili p5, p4 |
| 34 |
|
| 35 |
; combine detuned tone and reference tone |
| 36 |
; creates a beat effect from the detune |
| 37 |
asig=(asig+aref)*.5 |
| 38 |
|
| 39 |
outs asig, asig |
| 40 |
endin |
| 41 |
</CsInstruments> |
| 42 |
<CsScore> |
| 43 |
; run for 60 seconds |
| 44 |
f0 60 |
| 45 |
e |
| 46 |
</CsScore> |
| 47 |
</CsoundSynthesizer> |