diff options
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> |