Polyrhythmic Drum Generator for Sonic Pi

PolyRhythmicDrum Generator for Sonic Pi. Driven using a TouchOSC interface screen running on an iPad. The Sonic Pi program works fine on a Pi3, but requires Sonic Pi3. 30 min video on youtube in three parts. Part1 shows it working, part 2 gives more detailed insight and part3. shows how TouchOSC screen is linked to Sonic Pi.

Gist with full code is at

2 Likes

Hi @robin.newman,

that’s a nice thing you did build. I guess, it was a lot of work!

Actually it didn’t take too long, as I had used several of the techniques employed in previous projects. I find that TouchOSC is a fantastic addition to Sonic Pi if you want to explore things such as this, as it makes it very easy to alter parameters. It’s a bit like live coding with a graphical interface instead of altering the code directly. It’s also very easy to alter and modify the interface as required.
One very useful technique employed uses the undocumented get_event function in Sonic PI. This enable you to use wild cards when matching events from a bank of switches or sliders using only one live loop, and using data from get_event to find out what the actual wild card character was that triggered the event. Without this the program would get very unwieldy. Basically having triggered an osc match you use for example
b = sync “/osc/dm/slot//1"
in a live_loop to detect changes in a bank of switches
then get_event("/osc/dm/slot/
/1”)
returns
#<SonicPi::CueEvent:[[1513859270.435339, 0, #<SonicPi::ThreadId [-1]>, 0, 0.0, 60.0], “/osc/dm/slot/7/1”, [1.0]]
and by doing manipulation on this you can extrract that this was triggered by slot 7 being selected, determining the value of the “*” in the address which caused the match.
This is done, in that case by the function getSlotSwitch in my code.

Hi @robin.newman,

yes, I also think it is a brilliant tool and complements Sonic Pi very well. I am still working on my Live Looper and will release a stable version as soon as possible (I did some tests jamming with a friend and need to check and adjust things…).

In some cases while making music with Sonic Pi I find it very convenient to have an easy to use touch interface (especially while recording and playing back) and to separate control tasks from textbased live coding.

It is also brilliant because you can adjust the interface as it suits you and also very easily update the layout on your end device. Another thing: You can create a layout group to easily switch layouts (especially if you are using it on a smartphone with restricted layout space like me).

I am looking forward to explore more use cases … Actually you were the one to get me going! Thanks especially for your documentation work, which makes things accessible for others!

PS.: Next time I am working on it I will check out get_event.