View PULSE.rb
#Sonic Pi3 PULSE-leds workout by Robin Newman, August 2017
#requires the python script to be running to communicate with PULSE-leds
#This requires the python library python-osc to be loaded
#Which can be done with the command: sudo pip3 install python-osc
#Then run the server with python3
#Finally start this program running in Sonic Pi3
#Each vertical column of LEDS corresponds to notes with a different synth
#The higher the pitch of the note, the higher up the column is the illuminated LED
#Every so often the LEDS are "cleared" to a different background colour
View 8NotePolyphonicSetup.rb
#8 note polyphony gated synth setup program
#by Robin Newman, August 2017
#Set initial states for polyphonic synth
set :vm1,0
set :vm2,0
set :vm3,0
set :vm4,0
set :vm5,0
set :vm6,0
set :vm7,0
View index.xml
<?xml version="1.0" encoding="UTF-8"?><layout version="15" mode="1" orientation="vertical"><tabpage name="bmM=" scalef="0.0" scalet="1.0" ><control name="eHkx" x="429" y="95" w="220" h="220" color="red" scalef="0.0" scalet="1.0" type="multixy" inverted_x="false" inverted_y="false" ></control><control name="eHky" x="433" y="690" w="220" h="220" color="red" scalef="0.0" scalet="1.0" type="multixy" inverted_x="false" inverted_y="false" ></control><control name="ZW5hYmxlMg==" x="431" y="942" w="45" h="45" color="green" scalef="0.0" scalet="1.0" type="push" local_off="false" ></control><control name="a2lsbDI=" x="323" y="942" w="45" h="45" color="red" scalef="0.0" scalet="1.0" type="push" local_off="false" ></control><control name="bXV0ZTI=" x="532" y="942" w="45" h="45" color="yellow" scalef="0.0" scalet="1.0" type="push" local_off="false" ></control><control name="dW5tdXRlMg==" x="643" y="942" w="45" h="45" color="green" scalef="0.0" scalet="1.0" type="push" local_off="false" ></control><control name="azI=" x="3
#!/usr/bin/env python3
#ps3 wireless controller interface by Robin Newman July 2017
#converts controller inputs to OSC messages
#which can be output to Sonic Pi 3, running on the local computer, or on an external machine
#rtested with ps3 "afterglow" wireless controller, dongle in Pi usb socket
#needs sudo apt-get install joystick after sudo apt-get update
#also needs sudo pip3 install python-osc
#Version 2. Modified to ensure clean exit on Ubuntu
import subprocess,pygame,sys
#!/usr/bin/env python3 written by Robin Newman, July 2017
#Provides the "glue" to enable the GPIO on Raspberry Pi
#to communicate with Sonic Pi. Sonic Pi can control LEDs etc,and receive
#input from devices like push buttons connected to GPIO pins
#Sonic Pi can be running either on the Raspberry Pi,
#or on an external networked computer
#The program requires gpiod daemon to be running. Yu can install this with
#sudo apt-get update followed by sudo apt-get install pigpio if you don't have it
View HelmWithPercussion.rb
#Sonic Pi 3.0 Example showing midi out, live_audio in
#synchronised drum track and use of at to control volumes
#written by Robin Newman, July 2017
use_debug false
use_osc_logging false
use_midi_logging false
use_bpm 100
#st up rhythm tracks and volumes 0->9
set :bass_rhythm,ring(9, 0, 9, 0, 0, 0, 0, 0, 9, 0, 0, 3, 0, 0, 0, 0)
set :snare_rhythm,ring(0, 0, 0, 0, 9, 0, 0, 2, 0, 1, 0, 0, 9, 0, 0, 1)
View FrereJaquesOSCwithGetSet.rb
#Frere Jaques played on Sonic Pi 3.0 entirely using OSC messages
use_osc "localhost",4559
set :tempo,t #use set to store values that will be passed to live_loops
use_bpm t
p=0.2;m=0.5;f=1 # volume settings
#store data using set function so that it can be retrieved in live_loops
set :notes,(ring :c4,:d4,:e4,:c4,:c4,:d4,:e4,:c4,:e4,:f4,:g4,:e4,:f4,:g4,:g4,:a4,:g4,:f4,:e4,:c4,:g4,:a4,:g4,:f4,:e4,:c4,:c4,:g3,:c4,:c4,:g3,:c4)
set :durations,(ring 1,1,1,1,1,1,1,1 ,1,1,2,1,1,2, 0.5,0.5,0.5,0.5,1,1,0.5,0.5,0.5,0.5,1,1, 1,1,2,1,1,2)
View RhythmAndTB303.rb
#rhythmicTB303 by Robin Newman, July 2017. (Requires SP 3)
#based on an idea by Xav Riley
nv="/nv" #set up to use nv to transfer note using get and set
killit="/killit" #set up to use killit to transfer true or false using get and set
set killit,false #used to stop live_loops at the end
duration = 120 #desired duration for whole piece (min 20)
with_fx :level,amp: 0 do |vl| #control volume level during the piece (max 0.5)
at 0 {control vl,amp: 0.5,amp_slide: 10} #10second increase of volume 0 -> 0.5
at duration-10 {control vl,amp: 0,amp_slide: 10}#start fade out 10 secs before end
View SP_LiveAudio.rb
#example using new live_audio and buffer recording features in SP midi-alpha7 and midi_alpha8
#by Robin Newman, June 2017
use_bpm 120
r2=2**(1.0/12) #scale factor to increase pitch by 1 semitone
Track=1 #track number for recording (using 4 buffers here)

This program runs on Sonic Pi midi version. It works on SP 2.12-midi-alpha6 released recently to patreon subscribers of Sam Aaron see It also requires the program TouchOSC which is available for iPad or iPhone users at a very modest price. The TouchOSC file required to run this program is contained in the file index.xml To produce the TouchOSC file, download the raw file index.xml, right click it and select the Compress function. Rename the resulting file SPlissajous.touchosc and say Yes when it asks if you want to change the file extension. Open the file using the TouchOSC editor and download it to your iPad or other compatible device using the sync function. The layout is designed to fit on an iPhone or iPad. The SPlissajousTouchOSC.rb file should be downloaded and opened or pasted into a blank Sonic Pi buffer.