Synth params accept Procs


#1

I discovered that Sonic Pi will resolve any synth param that is a Proc. This can be a powerful abstraction if used judiciously. I think this is probably an undocumented/unsupported feature, but it’s quite useful.

For example, this works:

random_amp = -> () { [0.1, 0.3, 0.7].choose }

with_synth :piano do
  play :c3, { amp: random_amp }
end

I use this a lot.