Skip to content

Instantly share code, notes, and snippets.

@emlyn
Last active April 30, 2021 21:11
Show Gist options
  • Save emlyn/0d1c1e6afebbe1b818b9e3f9fd265c5f to your computer and use it in GitHub Desktop.
Save emlyn/0d1c1e6afebbe1b818b9e3f9fd265c5f to your computer and use it in GitHub Desktop.
Sonic Pi Soundboard controlled from your phone
  • Install Control on your phone (for Android, but it, or something similar, is probably available for iOS).
  • Run it, tap on "menu", then "Destinations", and then the "+" symbol. For the destination URL enter the IP address of your computer running Sonic Pi, and for the destination port enter 5005, then click "Add".
  • In your terminal, run the soundboard.sh script (or just copy and paste the last line). This listens on a public port and forwards any UDP packets to Sonic Pi (because Sonic Pi only listens on localhost).
  • Copy and paste the soundboard.rb code into a Sonic Pi buffer and run it.
  • In the Control app, tap on "Interfaces" and select "Monome Emulation".
  • Tap the grid, and you should hear sounds.
  • The sliders adjust volume and low-pass cutoff.
set_sched_ahead_time! 0.01
with_fx :lpf do |fx|
live_loop :sample do
x, y, i = sync "/mlr/press"
if i > 0
g = sample_groups[x]
s = sample_names(g)[y]
puts x, y, g, s
sample s
end
end
live_loop :amp do
a = sync "/slider1"
control fx, amp: 2*a[0]
end
live_loop :cutoff do
a = sync "/slider2"
control fx, cutoff: 50 + 70*a[0]
end
end
#!/bin/bash
nc -u -l 5005 >/dev/udp/127.0.0.1/4559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment