Controlling FX

It is also possible to control FX, although this is achieved in a slightly different way:

with_fx :reverb do |r|
  play 50
  sleep 0.5
  control r, mix: 0.7
  play 55
  sleep 1
  control r, mix: 0.9
  sleep 1
  play 62
end

Instead of using a variable, we use the goalpost parameters of the do/end block. Inside the | bars, we need to specify a unique name for our running FX which we then reference from the containing do/end block. This behaviour is identical to using parameterised functions.

Now go and control some synths and FX!