Hello, I just wanted to record my experience with trying to get sensors and other externals working with Sonic Pi, in case anyone here is trying similar.
I want to see how Sonic Pi can be used for interactives. Have been playing with Glover (gestural), bela, teensy, Arduino, picos, trying to learn about MIDI mapping.
I’ve been slogging for over a year with Windows. I could get Novation circuits to work but not much else. Finally thanks to grant help, I got a Mcb**k. Blimey, the difference is unbelievable. You plug the device in and it finds it.
This is v exciting and opens a lot of doors. But I wanted to report because despite huge effort, I’ve been unable to progress much with Windows. If you’re in the same boat, it may be that it’s not entirely you, it’s also your computer. I resisted getting one (actually couldn’t afford it), but can’t deny it does music connectivity better.
I’m a beginner coder and hope this might be helpful to anyone interested in interactives, wearables, capacitive touch and connecting to Sonic Pi.
Also interested in connecting with anyone into this area. I can now go back to Robin’s earlier advice and tutorials and hopefully get things working. Thanks!
Good to hear you got it working. I think all that stuff can be made to work on Windows, given enough free time, still it can be more effective to try Mac or even Ubuntu (which doesn’t require new hardware). I still have a 2015 MacBook Pro which is only worth 3 or 400 bucks these days, but it has proper usb ports, good keyboard and runs Sonic pi among others quite well. So a used Mac can be quite a good option too (I wouldn’t go for anything older than 10 years tho)
I’m also interested in the external sensors and whatnot. I recently started working with microcontrollers (esp32 namely) and realized how much would be possible (turning any kind of sensor into OSC messages), and for not much money at all. I’m still thinking about it but happy to discuss ideas.
I’ve been doing most of my composing on Linux and I found that routing audio, midi and osc messages around was easiest on Linux. I have a 2019 MacBook Pro now but so far it’s been a pretty frustrating experience. I did managed to setup an automation track in Ardour on the Mac to control things in Sonic Pi, then from Sonic Pi send midi to Surge XT in an Ardour track. On my Linux machine I had multiple :sound_out_stereo effects around live loops sending every live loop to a different track in ardour but I didn’t manage to set that up on my mac yet. I’ve been using Linux almost exclusively for music over 20 years now, even switched fully professionally (I’m a software programmer) 7 years ago so I’m sure it’s just me having to get used to the new eco system. That being said, I can tell MacOS is the prime target for Sonic Pi because it just feels better, less paper cuts like weird shortcuts (or having to compile it yourself like I did a few times to get the latest stuff on Linux).
Just for hacking around I still believe Linux is king, with a bit of scripting (shell scripts or python) you can glue anything to whatever. I had this coloured ball tracking script that send out osc messages so you could play drums in Sonic Pi by waving a green ball around in front of a webcam. Would probable work on Windows and Mac as well so probably not a good example
Thanks @maedoc sorry for late reply, work deadlines. Good point about older macs - I’ve not been familiar enough with them to make the leap but now getting used to keyboard. (where are the start/end-of-page keys? aggh)
V happy to discuss ideas - Sam said new beta has more OSC integration, am just looking at Touch Designer with beginner bemusement. Recent experiments with glover/leapmotion, have got some handwaving interaction going with Sonic Pi. As @R2L says, once you can glue things together, anything is possible Will give it another go over the w/e. Maybe Zoom catchup at some point?
This is superbasic but as far as I’ve got, pretty exciting when it flickered into life. What have you tried with esp32?
use_bpm 100
set :glov_1_active, false
set :glov_2_active, false
set :glov_3_active, false
live_loop :glov_sequence do
use_real_time
note, velocity = sync "/midi:glover:1/note_on"
if note = 60
set :glov_1_active, true
set :glov_2_active, false
set :glov_3_active, false
elsif note = 62
set :glov_1_active, false
set :glov_2_active, true
set :glov_3_active, false
elsif note = 64
set :glov_1_active, false
set :glov_2_active, false
set :glov_3_active, true
end
end
live_loop :glov_1 do
use_synth :piano
if get (:glov_1_active)
play (scale :c5, :minor_pentatonic).choose, release: 0.5
sleep 0.5
else
sleep 0.1
end
end
live_loop :glove_2 do
use_synth :blade
if get (:glov_2_active)
play (scale :e4, :major_pentatonic).choose, release: 0.5
sleep 0.5
else
sleep 0.1
end
end
live_loop :glov_3 do
use_synth :beep
if get (:glove_3_active)
play (scale :a3, :dorian).choose, release: 0.5
sleep 0.5
else
sleep 0.1
end
end
type or paste code here
Thanks @R2L - playing drums by waving a green ball is exactly what’s exciting but my scripting and script glue skills still beginner I got one of yon MIDI balls a while back (instagram predictive product placement knows me too well) but had to return it because of latency issues with android. Hopefully they’ve solved it now.
Linux sounds v good if you have the skills - need another lifetime to get to grips with it so will see what’s possible with current setup. If anyone has patches for Sonic Pi + [insert external item] they’d be happy to share as a starting point, that would be great.
Here’s one for Circuit Tracks (small userfriendly sequencer). It might seem strange to link this to Sonic Pi but I want to try to get faders/knobs working. Frustrated at not having more time to play around!
use_bpm 20
midi_start clock: true
use_midi_defaults port: "circuit_tracks_midi", channel: 1
live_loop :sync_loop do
midi_clock_beat
sleep 1
end
live_loop :chordy do
midi port: "circuit_tracks_midi", channel: 10
[1, 3, 6, 4].each do |d|
(range -4, 3).each do |i|
play_chord (chord_degree :iii, :a, :major, 3, invert: i), channel: 2
sleep 1
end
end
end