FX Automation (reverb, echo etc)

How to automate phase parameter ?

live_loop :foo do
  with_fx :echo, phase: 0.2 do
    use_synth :blade
    play 60, release: 0.1
    sleep 1
  end
end

YIf you mean how can you change it in a program while it is running here are some ways.

defonce :setp do #set a value for :p ONCE on first run after Sonic Pi powers up
  set :p,0.2
end

live_loop :foo do # here is your live loop
#each time it runs fx is set up with :phase = current value in get(:p)
  with_fx :echo, phase: get(:p) do 
    use_synth  :blade
    play 60, release: 0.1
    sleep 1
  end
end

#now follow three methods of control
#first uses a midi "knob" on a controller

live_loop :phaseMidi do
  b=sync "/midi/usb_oxygen_8_v2/3/1/control_change"  #I used my midi keyboard. Substitute your controller
  if b[0]==91 #my controlleer k=knob affects control channel 91
    set :p,0.05+b[1]/127.0*0.15 #set value of :p according to knob position between 0.05 and 0.2
  end
end

#this liveloop uses an incoming OSC message to effect the contriol
live_loop :phaseOsc do
  b=sync "/osc/Main/fader*" #my osc message (from TouncOSC) was addressed to "/main/fader2"
#note "/osc" at beginning added by Sonic Pi and wild card * so any /Main/fader works eg fader3
  puts b[0]
  set :p,0.05+b[0]*0.15 #update value stored in :p
end

#easiest manual control, uncomment next line and run
#set :p, 0.1 #uncomment to set phase to 0.1 when you next run

#manual control this thread increases then decreases the pahse each time the program is run
#comment #stop to get it to work
in_thread do
  stop
  l=line(0.05,0.25,steps: 10)
  l.length.times do |i|
    set :p,l[i]
    sleep 2
  end
  sleep 2
  l=line(0.25,0.05,steps: 10)
  l.length.times do |i|
    set :p,l[i]
    sleep 2
  end
end

EDIT. I changed the code above as Actually I didn’t use the lv control variable and removed it.

All three methods of control midi osc and manual can be active at once. The latest to change wins
defonce may be unfamiliar to you. It executes the code set :p,0.2 ONCE the first time the program is run, but not thereafter until Sonic Pi is restarted.

2 Likes

Very cool method with OSC faders. Could you tell me how to bind parameters with OSC
Im using Sound Stage Control
https://osc.ammd.net/
And can I control three parameters with one fader? The use of slides opts also helps. But I have not quite figured out how they work. Thank. Nice.

with_fx :gverb , mix: 0 , mix_slide: 5 do |s|
  sample "C:/CNTRL_Sylenth_ArenaBreakdownSynth_Cm_Dry.wav" ##|  any loop that lasts 4 seconds or more.
  sleep 1
  control s, mix: 0.8
end

It depends on what you’re doing but I always like using tick and look:

live_loop :automation do
  phase = (line 0.2, 1, steps: 8)
  
  with_fx :echo, phase: phase.tick do
    sample :bd_fat
  end
  
  sleep 1
end