diff options
author | Richard Knight <q@1bpm.net> | 2021-08-25 22:18:18 +0100 |
---|---|---|
committer | Richard Knight <q@1bpm.net> | 2021-08-25 22:18:18 +0100 |
commit | 5f084737a2899d2765432d672c6ef608e6203e14 (patch) | |
tree | a6410439f25dce28fab4d8fe12f40d79b5de76e3 /examples/2-random_params.csd | |
parent | 38c0b050496563ed2d2d347f3fd7c122d8c9d5b6 (diff) | |
download | csound-opl-5f084737a2899d2765432d672c6ef608e6203e14.tar.gz csound-opl-5f084737a2899d2765432d672c6ef608e6203e14.tar.bz2 csound-opl-5f084737a2899d2765432d672c6ef608e6203e14.zip |
examples update
Diffstat (limited to 'examples/2-random_params.csd')
-rw-r--r-- | examples/2-random_params.csd | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/examples/2-random_params.csd b/examples/2-random_params.csd index 37b951d..266406e 100644 --- a/examples/2-random_params.csd +++ b/examples/2-random_params.csd @@ -2,30 +2,35 @@ <CsOptions> -odac </CsOptions> -; ============================================== <CsInstruments> +/* + csound-opl example 2 + Parametric instrument modification with randomisation -sr = 44100 + Richard Knight 2021 : examples are licensed as public domain equivalent : http://unlicense.org/ + +*/ + +sr = 44100 kr = 4410 -nchnls = 2 -0dbfs = 1 +nchnls = 2 +0dbfs = 1 seed 0 instr main - giopl, aL, aR opl 0 + ; synthesiser + giopl, aL, aR opl outs aL, aR + ; play a note each second kmetro metro 1 schedkwhen kmetro, 0, 0, 2, 0, 1 + ; randomise instrument parameters, but always set as four operator iop1, iop2, iop3, iop4 oplinstrument giopl, int:k(random:k(0, 2)), int:k(random:k(0, 2)), random:k(0, 7), random:k(0, 7), 1, 1, int:k(random:k(0, 2)), int:k(random:k(0, 2)) - - ; level, keyscale, attack, decay - kattack init 2 - kdecay init 13 -;0 -15 freq mult + ; randomise all of the operators oploperator iop1, random:k(60, 63), random:k(0, 3), random:k(0, 15), random:k(0, 15), random:k(0, 15), random:k(0, 1), random:k(0, 7), 0, random:k(0, 2), random:k(0, 2), random:k(0, 2), random:k(0, 2) oploperator iop2, random:k(60, 63), random:k(0, 3), random:k(0, 15), random:k(0, 15), random:k(0, 15), random:k(0, 1), random:k(0, 7), 0, random:k(0, 2), random:k(0, 2), random:k(0, 2), random:k(0, 2) oploperator iop3, random:k(60, 63), random:k(0, 3), random:k(0, 15), random:k(0, 15), random:k(0, 15), random:k(0, 1), random:k(0, 7), 0, random:k(0, 2), random:k(0, 2), random:k(0, 2), random:k(0, 2) @@ -33,24 +38,15 @@ instr main endin +; play a random note from the array instr 2 inotes[] fillarray 48, 52, 53, 57 inote = inotes[int(random(0, lenarray(inotes)-1))]+24 oplnote giopl, 0, inote, 120 endin -instr 3 - inote = 48+24 - oplnote giopl, 1, inote, 120 - oplnote giopl, 1, inote+4, 120 - oplnote giopl, 1, inote+5, 120 - oplnote giopl, 1, inote+9, 120 -endin - - </CsInstruments> -; ============================================== <CsScore> i"main" 0 3600 </CsScore> |