Hey all! I was trying another approach, based on @paul1's code. Since everything uses numerical indices, the parameters work nicely with arrays.
These are the necessary definitions
-- Parameters
let fmamp op = pF ("amp" ++ show op)
fmratio op = pF ("ratio" ++ show op)
fmdetune op = pF ("detune" ++ show op)
fmmod opa opb = pF ("mod" ++ show opa ++ show opb)
fmegrate op step = pF ("egrate" ++ show op ++ show step)
fmeglevel op step = pF ("eglevel" ++ show op ++ show step)
fmfeedback = pF "feedback"
-- Array functions
let fmparam function = foldr (#) (gain 1) . zipWith function [1..]
lfma = fmparam fmamp
lfmr = fmparam fmratio
lfmd = fmparam fmdetune
lfmer op = fmparam (fmegrate op)
lfmel op = fmparam (fmeglevel op)
lfmm opa = fmparam (fmmod opa) -- didn't test, should work
And this is how you use it:
d1 $ stut 2 0.7 0.125 $ s "superfm"
|+| note (arp "pinkyup" "[0,4,8,12] [0,3,7,11]" )
# fmfeedback 1
# fmdetune 2 1
# lfmel 1 [1, 0.5, 0, 0] -- EG Level (Operator 1)
# lfmer 1 [10, 0.1, 0.1, 1] -- EG Rate (Operator 1)
# lfmel 2 [1, 0, 0, 0] -- EG Level (Operator 2)
# lfmer 2 [1, 0.3, 0.7, 1] -- EG Rate (Operator 2)
# lfmel 3 [1,0.2,0,1] -- EG Level (Operator 3)
# lfmer 3 [10,0.5,0.4,1] -- EG Rate (Operator 3)
# lfma [1, 1, 0, 0, 0, 1] -- Amps (Operators 1..6)
# lfmr [1, 0.26, 0.5] -- Ratios (Operators 1..3)
Sorry about the names, they're very confusing right now. Also, big shoutout @loopier , great job with this SynthDef
edit: the (gain 1)
on fmparam
is a placeholder - I couldn't find a neutral ControlMap
function (like id
)
edit2: adding lfmm
for the fmmod
function