| 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 midic14.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 and 7 to see results |
| 20 |
ictlno1= 1 ; = cc #1 midi mod wheel (course tuning) |
| 21 |
ictlno2= 7 ; = cc #7 midi volume (fine tuning) |
| 22 |
|
| 23 |
; max range is 3 octaves: (2^3) = 8 |
| 24 |
imax = 8 |
| 25 |
|
| 26 |
; read both controllers, scaling them between 1 and imax |
| 27 |
kTune midic14 ictlno1, ictlno2, 1, imax |
| 28 |
printk2 kTune |
| 29 |
|
| 30 |
; generate tones |
| 31 |
asig oscili p5, p4*kTune |
| 32 |
aref oscili p5, p4 |
| 33 |
|
| 34 |
; combine detuned tone and reference tone |
| 35 |
; creates a beat effect from the detune |
| 36 |
asig=(asig+aref)*.5 |
| 37 |
|
| 38 |
outs asig, asig |
| 39 |
endin |
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
; run for 60 seconds |
| 43 |
f0 60 |
| 44 |
e |
| 45 |
</CsScore> |
| 46 |
</CsoundSynthesizer> |