Pass >1 control to FX block

Morning peeps,
Is there a way to pass more than one control to a with_fx block; the following works fine:

with_fx :echo, phase: 0.025, mix: 0 do |mix|
  # how to get 2 opts into the block??
  live_loop :glix do
    tick
    
    play 36, release: 0.2
    
    control mix, mix: (ring 1, 0, 0, 0).look
    
    sleep 0.25
  end
end

But if I try to add control for phase, for example:

with_fx :echo, phase: 0.025, mix: 0 do |mix, phase|
  # how to get 2 opts into the block??
  live_loop :glix do
    tick
    
    play 36, release: 0.2
    
    control mix, mix: (ring 1, 0, 0, 0).look
    
    sleep 0.25
  end
end

Sonic Pi throws the error “with_fx must only accept 0 or 1 args”.

I suppose I could put the fx into a separate function (using define do/end), and pass the opts that way, but that would duplicate the fx wrapper with each pass.

Many thanks
PD-Pi

I think the opt refers to the whole fx. You specify what to control with mix: or phase:bit use just one pointer.

with_fx :echo, phase: 0.025, mix: 0 do |k|
  # how to get 2 opts into the block??
  live_loop :glix do
    tick
    
    play 36, release: 0.2
    
    control k, mix: (ring 1, 0, 0, 0).look
    control k,phase: (ring 0.025,0.030,0.040).look
    sleep 0.25
  end
end
1 Like

Of course! thanks for the clear explanation

(this works SOOO well with my solenoid samples collection), very much glitchy goodness).

PD-Pi