Live slide control the rate/beat_stretch of a sample (50-100$) for solution

Hi guys!
is it possible to slide the rate of a sample during a live loop?
would it be possibnle to implement an fx which changes the rate, that would be dope

Hello @holz,

You will notice that the documentation does not show the rate: opt as being slidable, so no, it has no corresponding _slide opt. There was an attempt to build in such a thing early on in Sonic Pi’s development, but there seemed to be issues with unwanted sound artefacts when sliding the rate.

It is possible there is an implementation of some sort that may work, somehow… but exploring for such a solution has not been a high priority for us. It would be awesome to be able to slide the rate without unwanted side effects though, agreed!

maybe with a ramp similar to this? i will investigate :wink:
also i saw the beat_stretch has a slide option but i can´t figure out, how to change the sample indipendently, without adding sleep tiime to the live loop and the rate/beat_stretch needs to be live adjusable.

kick_volume = (line 0, 1.0, inclusive: true, steps: 10).ramp


live_loop :kick do
  sample :bd_tek, amp: kick_volume.tick
  
  sleep 1
end

Sure, you can indeed simulate a slide to some degree that way :+1:

1 Like

I need a way to live slide control the rate/beat_stretch of a sample, without changing the live loops sleep time where the sample is in.

(If the solution works well i would really pay up to 100 bucks for the effort)

like here:



set_mixer_control! lpf_slide: 5, lpf: 120, amp: 5

live_loop :metronom do
  sleep 1
  
end

with_fx :slicer, phase_slide: 0.125, phase: 0.125, pulse_width: 0.5, pulse_width_slide: 0.125, mix: 1 do |slice|
  with_fx :pitch_shift, pitch: 1, pitch_slide: 2 do |pit|
    with_fx :tanh, krunch: 0.1, krunch_slide: 3 do |kek|
      
      
      live_loop :löl, sync: :metronom do
        
        
        if tick(:firsttime) == 0 then
          
          set :slice, slice
          set :pit, pit
          set :kek, kek
          
        end
        
        
        #b = a + 0.1 # a + 0.1 slice length
        #b = a + (ring 0.1, 0.2, 0.3).choose # a + random slice length
        #set :rate_r, (ring 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.6, 0.7, 0.8, 0.9).tick
        
        
        tick # - only 1 tick per live_loop possible, so .look at rings
        
        a = (ring  0 ,   0,    0  ,  0).look #sequencer
        b = (ring   1,    1,   1,    1).look
        
        sample :loop_amen, start: a, finish: b, rate: 1
        
        sleep sample_duration :loop_amen, start: a, finish: b
        
      end
    end
  end
end


live_loop :kek1, sync: :löl do # - :Kek1 starts with :löl does not sync again , follows its own timing
  # sync :löl # - :kek stays in sync with : lol all the time
  sleep 3
  control get[:kek], krunch: 15, mix: 0
  sleep 3
  control get[:kek], krunch: 1, mix: 0
  sleep 3
  control get[:kek], krunch: 15, mix: 0
  
end


live_loop :slice1, sync: :löl do
  sync :löl
  slice = get[:slice]
  sleep 2
  control slice, phase: 0.125, pulse_width: 0.5, mix: 1, smooth: 0.2, mix: 0
  sleep 2
  control slice, phase: 0.125, pulse_width: 0.5, mix: 1, smooth: 0.2, mix: 0
  sleep 2
  control slice, phase: 0.125, pulse_width: 0.5, mix: 1, smooth: 0.2, mix: 0
  sleep 2
  
end


live_loop :pit1,  sync: :löl do
  #sync :löl
  pit = get[:pit]
  sleep 2
  control pit, pitch: 1, mix: 0
  sleep 2
  control pit, pitch: -5, mix: 0
  sleep 2
  control pit, pitch: 5, mix: 0
  sleep 2
  
end

IIRC, beat_stretch: falls under the same category as rate: and does not allow sliding. I’m not sure that what you saw was a slide opt for it - can you point me to where you were looking?

well i think i mistake that one… i thought i read about it, but it doesn´t exist, i already tried ^^

I think the solution depends on whether you need a long slide or just a quick jump. You could imitate a quick jump with a amp slide on two distinct rates. If you need a long slide and without audible artifacts, then it probably has to be done in a SC UGen to make it fast enough, since it would involve resampling.

edit or maybe with the FFT UGens but I don’t see them exposed in SP

1 Like

That sounds interesting. Sam has already said that he’d be interested if there was a way to make rate slidable for the sample command without having weird clicking noises at the end of the playback. Would love to chat more if you have a reasonable idea of the general approach :smiley: (I can open a separate discussion)

1 Like

Well i don´t quite understand :stuck_out_tongue_winking_eye: that´s why i would pay for the solution^^ honestly i need a quick and a long slide

From what I can remember from when I was working on the synths, sliding the sample wasn’t something that could be achieved whilst giving the ability to play sub sections of the sample at various (constant) rates. I think the best solution for sliding the rate dynamically is an alternative sample playing synth designed specifically to enable sliding.

A solution to this would therefore likely require the design and implementation of a new SuperCollider synth, its corresponding synth metadata (arg checkers and docs) in addition to some new syntax to trigger it in a similar way to how sample currently works.

Perhaps sample_synth :slidable, "/path/to/audio.wav"

This is definitely not something that I’ll be able to look into in the short term (at least until v3.3 is out) but I’d be happy to see others pick this up if they have the time and energy.

1 Like

Thanks for the reply, well then i put that to rest for now :slight_smile: