What does time mean in Sonic Pi?

@samaaron I am so sorry!!

My computer is old, - and my sonic pi code became too complex for it. This is 90% of the problem right there, on my (pc hardware) side. Imagine a non-professional, cheap midi setup ontop of that. The issue was getting it in sync with hardware sequencer. This issue did not feel like a sonic pi problem - more like a hardware/software/interface-problem in general with lag and so on… sonic Pi is awesome! But old pc with code too complex and jitter = not the masterclock I wanted it to be.

I tried a simple setup / experiment before I kinda gave up on that idea (because I needed another more stable solution):
Korg Monologue got a built-in 16 step sequencer. In theory - When a note hits - the sequencer starts to step thru the 16-step sequence / or restart/transpose it, when it’s already running. So, I wanted Sonic Pi to send a random note at step 1. to just hit on step 1. I was not able to to this in sync with sonic pi serving the clock. reliably. without adjusting delays and so on… The flashy step sequencer on the monologue would show jerky motion and/or overstep a lot. Got similar experiences with other hardware, especially chea midiinterfaces (?) and volcas. but will test that for sure again - with other midi interfaces, just to get an update on that issue for myself - and so I dont spread mis-information about sonic Pi!

It kinda worked. But was not ‘reliable’ as the clock. And thats more of a general PC-problem, than a specific sonic pi problem. I would expect every other midi program / daw to give similar experiences on similar hardware.

SonicPi is like a swiss knife: It reads and does everything i want, when want it. Its like the hidden dagger to stab somone with. But I needed a rock to lean on. And my PC was not able to deliver.

Hey @ninn,

no need to apologise :slight_smile:

| completely agree that a simple dedicated hardware microcontroller generating MIDI clock ticks is always going to be more reliable than a sophisticated CPU which is not just generating MIDI clock ticks, but also managing an operating system kernel, multiplexing many, many simultaneous threads of execution. This is before we even start to discuss the design decisions behind CPUs which recently have all focussed on increasing throughput and not on reducing latency and jitter.

However, all that said Sonic Pi should be a pretty rock solid clock even on old hardware.

I don’t fully get what you were trying to do though. Could you share the code? Were you able to reproduce the exact experiment with hardware MIDI signals and get it working as expected?

I’m imagining your code might have been something like this:

live_loop :foo do
  midi_note_on (scale :e1, :minor_pentatonic).choose
  16.times do
    midi_clock_beat
    sleep 1
  end
end

However, I might have completely misunderstood what you were trying to do :slight_smile:

@samaaron exactly. that idea, yes. but several different algorithms iirc, with cues on other loops, or so. but basicly this, as simple as possible, yes. I will recreate & videotape the experiment, just to be sure.

My master clocks (teensy) never stop. My Computer stops from time to time, whatever the reason may be.

1 Like

Have been running sonic pi on raspberry 4 for 24h now. It does exactly what i wanted it to do, no problems. sending jerky clock or running out-of-sync seems to be vanished. I am running the 3.2.2 deb, - neither the nice win10pc at work, nor the old macbook at home can compete with a this good performance.

1 Like

@ninn that’s good to hear. Can I ask how you are using the clock - what’s it driving and how you’ve got it set up?

@soxsa Raspberry usb to monologue. That drives beatstep pro and alike. Do you need a test done?

1 Like

Have you tried either of these doing the same thing with the same version of sonic pi running the same code?

This is really informative, thank you for posting. What is the black console that you pull up at times that shows everything happening while the code is running?