Sonic Pi v4.1.0 'Phase' - Now available for macOS and Windows

The release of v4 of Sonic Pi introduced the ability to change the tempo of live running code to an external beat. This is possible either by setting the tempo manually to a specific BPM (Beats Per Minute) or by using the Tap Tempo button to tap along to an external rhythm. However, even when you do this, it’s quite likely that things still don’t sound quite right as there’s a good chance that the two rhythms are out of phase despite being at the same tempo. This release introduces a new feature - Global Time Warp which lets you shift the phase of Sonic Pi’s timing back or forward up to 250 milliseconds to let you align it with an external rhythm.

Taking a quick step back, what does it mean for two rhythms to be out of phase and why is it a problem? Imagine you had two metronomes ticking away. If one has a higher tempo than the other, then one will be ticking faster than the other. This can be fixed by setting the tempos to be the same. However, unless they were both started at exactly the same time, they both wont be ticking at the same time. Instead, one will tick, then the other, then the first, then the second, etc. The second will always be a little later than the first and as they are at the same tempo, they will never catch up with each other, they will always tick at different times. This is called being out of phase. When two rhythms are out of phase it can sound very messy. Therefore, being able to get rhythms to start at exactly the same time is really important to being able to jam together and for it to sound good.

The new Global Time Warp control lets you shift the timing of all triggered synths, MIDI and OSC messages forwards or backwards by a specified time in milliseconds. You can either slide a slider or type in a specific time to adjust the phase of Sonic Pi’s timing to match the phase of an external rhythm.

This means you can now easily jam to an external track - first by tapping out the tempo and then by shifting the phase using the new Global Time Warp controls until it sounds right. This is essentially what DJs do when they mix tracks together in a live set - only now you can layer coded rhythms, basslines and riffs on top of external music with code. This is not only a great way to perform live, but it’s also a wonderful way to practice - by jamming along to music you love.

In addition to this, the accuracy of the Tap Tempo functionality has been improved in addition to UI tweaks to all the metronome controls.

Have fun jamming in phase to external music and take your live coding collaborations to the next level!

GUI

  • New Global Time Warp controls. This lets you adjust the timing of all scheduled events (synths, samples, MIDI and OSC) forwards or backwards up to 250 milliseconds. This is important for matching the phase of an external rhythm.
  • Improved Tap Tempo logic aimed towards increased BPM detection accuracy and speed.
  • BPM scrubber and new Global Time Warp scrubber now respond to mouse wheel changes.

Improvements

  • Clearly specify in the tutorial that user-defined function names should start with a lower case letter. Therefore use define :foo rather than define :Foo.

Translations

  • Minor improvements to the Indonesian, Korean Portuguese (Brazil) and Russian translations.

Bugfixes

  • The duration: opt for midi_clock_beat has been fixed.
  • Fix scsynth_opts and scsynth_opts_override options in the ~/.sonic-pi/config/audio-settings.toml config file.
  • Audio output via external soundcards on macOS should now work without requiring audio inputs to be enabled in the GUI.
  • current_debug now correctly returns true if logging/debug is enabled (the default). Previously it reported the inverse.
  • Minor improvements to documentation layout.

Releases

macOS 10.15 (Catalina)+
Link Sonic-Pi-for-Mac-x64-v4-1-0.dmg
Size 129M
MD5 bb20d0d723236028c4b1cee2961c812c
SHA256 cf3cee887ddfe9e436b48167116e17e21a1b57fbce685697fc77b0736305d67a
Windows 10/11 x64
Link Sonic-Pi-for-Win-x64-v4-1-0.msi
Size 203M
MD5 12d85ccf447a9f87e06cc03cde2976cc
SHA256 46a3756d15884becfa6195d12ce63715117b2fc9cd7053e19358d58f422b23c0
Raspberry Pi OS (Bullseye) 64 bit
Link sonic-pi_4.1.0_1_bullseye.arm64.deb
Size 92M
MD5 25a4f9bcdaef3bbfc8db070802d6b881
SHA256 e0683aa68cab0d15270cabe7f51b0a8d12056a093f5fd6ca2a598a288e8f8654
Raspberry Pi OS (Bullseye) 32 bit
Link sonic-pi_4.1.0_1_bullseye.armhf.deb
Size 88M
MD5 5a23a7dd6fa112a15b9795ef0c73f091
SHA256 a5caf041b02d721c35b8ea01623881c0c3636f918f3d76457e6afa5962af16cb
3 Likes

Hi @samaaron

Indeed it’s just a slider :slight_smile: to adjust to get in phase.

image

Well done !

1 Like

This is really useful :-). But the range of +/- 250 ms only covers all possible phases if the BPM is 120 or higher. I was thinking that it might be useful to increase the range to +/- 500 ms, to cover the complete phase range for BPMs down to the default 60?

Yeah, I totally it would be nice to have a longer range. However, it’s not really technically feasible to go back more than 250ms due to the internal timing mechanism. Making things even later, of course, is feasible - although that would mean a non-symmetric slider (say -250ms → 750ms). I’ll experiment!

1 Like

GUI - set global time warp range to -250 → 999 · sonic-pi-net/sonic-pi@41dee22 (github.com)