# Can't get \_slide functions working

**URL:** <https://in-thread.sonic-pi.net/t/cant-get-slide-functions-working/7613>\
**Category:** Support, Help & Resources\
**Created:** [March 7, 2023, 10:23pm UTC](https://in-thread.sonic-pi.net/t/cant-get-slide-functions-working/7613 "2023-03-07T22:23:34Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [March 10, 2023, 10:23pm UTC](https://in-thread.sonic-pi.net/t/cant-get-slide-functions-working/7613/4 "2023-03-10T22:23:31Z")

</div>

The problem is that each time you press run a new with\_fx wrapper created. However you are not altering live\_loop :drums and so its code is not reevaluated and the new lpf reference is not the same as the one the live\_loop is using.  
The solution I use is to alter the program as below, and to comment out the line after the first run, before you rerun with an altered set:t in the control2 loop. That way the value of :lp is set only once and the correct value of lpf is use for the control. Its a bit finnicky to do but works.

Or you can change the live\_loop :control2 to receive data from an external OSC call, which can be generated either from a simple program in a different Sonic Pi buffer which you run, or from a program like TouchOSC (well worth purchasing) which can send the data from a smart phone or tablet

There are several other discussions on this topic which is raised quite often. See [here](https://in-thread.sonic-pi.net/t/basic-question-about-sliding-controls/6870) and [here](https://in-thread.sonic-pi.net/t/live-loops-inside-of-fx-with-control-capabilities/2269)

solution 1

```ruby
use_bpm 110

live_loop :control2 do
  set :t, 100
  sleep 0.25
end

with_fx :rlpf, cutoff: get[:t] do |lpf|
  set :lp,lpf #comment this line after first run BEFORE running again
#you will need to uncomment it if you alter live_loop :drums1 OR if you press stop
#before running as if for the first time.
  live_loop :drums1 do
    sample :loop_amen, beat_stretch: 4
    sleep 2
    control get(:lp), cutoff: get[:t]
    puts get[:t]
    sleep 2
    2.times do
      sample :loop_amen, beat_stretch: 4
      sleep 4
    end
  end

```

solution 2 EDIT initial value of :t now set and extraneous . removed from 90. in osc send program

```ruby
#run in first buffer

use_bpm 110
set :t,100 #set an initial value for :t. OR run the osc send program once before running this to set it
live_loop :control2 do
  use_real_time
  n= sync "/osc*/cutoff"
  set :t,n[0]
end

with_fx :rlpf, cutoff: get[:t] do |lpf|
  live_loop :drums1 do
    sample :loop_amen, beat_stretch: 4
    sleep 2
    control lpf, cutoff: get[:t]
    puts get[:t]
    sleep 2
    2.times do
      sample :loop_amen, beat_stretch: 4
      sleep 4
    end
  end
end

```

Run program below in a separate buffer whenever you want to change the cutoff value

```ruby
use_osc "localhost",4560

osc "/cutoff", 90 # alter the 90 to whatever value you want (max 120)

```

---

_[View the full topic](https://in-thread.sonic-pi.net/t/cant-get-slide-functions-working/7613)._
