Creating a sync track with a sample playing


I’m very new here and try using Sonic Pi for one purpose, for now.

I want to create a sync track to send to some hardware, which plays a sample 24 times per beat.

I got to the point where I have Sonic Pi syncing with Ableton Link, I can play my sample in a loop but am unsure about the 24 times per beat bit.

What would be a reliable way to do what I want? As simple as possible?

Thank you!

I’m not sure if I understand exactly, but if you sleep for a 24th of a beat in your loop, then the loop will run 24 times per beat. Does this do what you want:

live_loop :beat do
  sample :the_sample
  sleep 1.0 / 24
1 Like

Thanks! That’s close to what I thought, didn’t know I could to 1.0 / 24. Will try!

Just listening to the output in a headphone (couldn’t try using the signal for sync yet), it is not constant. Could there be timing issues/streaming issues? Is there something to do for steady output and streaming?

I tried it myself and the timing seemed pretty steady - I couldn’t hear any variation. Are you using wired headphones? If they are bluetooth it’s possible they could be introducing some timing fluctuations.

1 Like

No I use an RME soundcard, wired headphones into it. Should be solid. I’ll try on my music machine later.

I now tried in the real world case I was intending. The receiving device in an ERM Multiclock, which generates MIDI clock based on that sample playback.

Using Sonic Pi this way, I can see the tempo varying around the target tempo. When I do the same in say Ableton Live, it is steady.

That may be also caused by the fact that I use an ASIO driver for my RME UCX soundcard in Ableton Live, while I haven’t found that option in Sonic Pi (did I miss it?), so it’s using and WDM driver, for the same soundcard.

It could be the driver. I don’t use Sonic Pi on Windows, but this thread might be helpful: [SOLVED] Select ASIO Driver?

Thanks a lot for your help @emlyn , I appreciate!

1 Like