Skip to content

Instantly share code, notes, and snippets.


Robin Newman rbnpi

  • Near Peterborough
View GitHub Profile
rbnpi / JazzeupInversions.rb
Last active Aug 11, 2020
JazzedupInversions plays with a sequence of chord inversions in Sonic Pi. Hear it on
View JazzeupInversions.rb
#JazzedupInversions by Robin Newman, August 2020
#started playing with chord inversions and ended up with this.
use_bpm 60 #initial tempo
with_fx :reverb, room: 0.8,mix: 0.7 do
with_fx :ixi_techno,mix: 0.4 do
live_loop :arps do
#code to speed up and slow down tempo again
bpmchange=((knit 2,20)+(knit -4,10)).tick(:speed)
use_bpm current_bpm + bpmchange
rbnpi / GoodBadUgly-RF.rb
Last active Jul 13, 2020
The Good the Bad and the Ugly theme by Ennio Morricone on Sonic Pi (play using run_file command) Listen at
View GoodBadUgly-RF.rb
#coded by Robin Newman, July 2020
#use run_file "path/to/GoodBadUgly-RF.rb"
with_fx :reverb, room: 0.8 do
use_synth :pluck
with_fx :compressor,amp: 2 do
rbnpi / recordplaybackmidi.rb
Last active Apr 27, 2020
Experimental program to record realtime midi input in Sonic Pi and subsequently play it back. Video on youtube
View recordplaybackmidi.rb
#program to record realtime midi input,and then replay it.
#records midi input from say a keyboard, saving data into array tlist
#this can then be replayed. Records, note pitch, time started,
#velocity of key and note duration.
#coded by Robin Newman April 2020
uncomment do #comment to record, uncomment to replay
puts tlist.length
puts tlist
rbnpi / PachabelCanon-RF.rb
Last active Apr 20, 2020
Sonic Pi plays Pachabel's Canon. Four versions for 1 or 4 computers. See video on
View PachabelCanon-RF.rb
#arranged for 1 computer running Sonic-Pi. Use run-file "/path/to/PachableCanon.rb"
#as the file is too long to fit in a Sonic Pi buffer
use_bpm 45
use_synth :blade
with_fx :reverb,room: 0.8 do
rbnpi / OdeToJoyBASS.rf
Created Apr 18, 2020
Sonic Pi plays Ode to Joy. Three versions.
View OdeToJoyBASS.rf
#arranged for Sonic Pi by Robin Newman, April 2020
#this version on a single computer using three buffers
use_osc "localhost",4560
osc "/start"
sync "/osc*/start"
use_bpm 140
use_synth :blade
with_fx :reverb,room: 0.8 do
rbnpi / dancingNotesOnDroneBass.rb
Created Apr 17, 2020
Sonic Pi dancing notes on a drone bass driven by OSC
View dancingNotesOnDroneBass.rb
#dancing notes on a bass drone,osc driven
#by Robin Newman,April 2020
#utilises a "synth" produced from ambi_glass_rub sample
use_osc "localhost",4560
use_osc_logging false
use_cue_logging false
use_debug false
use_bpm 40
use_sample_defaults start: 0.7,attack: 0,decay: 0.1,decay_level: 0.3,sustain: 0,release: 0.25
rbnpi / FJcooperativeReceiver.rb
Last active Apr 16, 2020
Cooperative Frere Jaques. Two separate computers running Sonic Pi 3.2.2 play Frere Jaques using OSC see
View FJcooperativeReceiver.rb
#frereJaques cooperation Receiver
#adjust IP address of computer to send to in following line
use_osc "",4560 #send OSC commands to Sonic Pi port 4560
use_osc_logging false
use_cue_logging false
define :decodeSYML do |nl| #list of symbols in a string
nl[1..-2].split(",").map {|str| str.strip[1..-1].to_sym}
define :decodeFNL do |dl| #list of floating point numbers in a string
rbnpi / SonicPiGPIO_README
Last active Mar 28, 2020
Sonic Pi 3.2.1 Controls Raspberry Pi GPIO pins
These three files accompany a video on youtube illustrating Sonic Pi 3.2.1
running on a Raspberry Pi 3B+ conotrolling 5 LEDs connected to GPIO pins
using a python script incorporating an OSC server. is a pythons cript which interacts with the 5 leds using the
gpiozero library. It incorporates an OSC server which looks for the incoming
osc message addressed to "/LedNum" This has two parameters. First a number between 0 and 4
which specifies which led to control, secondly a state which is 1 if the led is to be turned on
and 0 if it is to be turned off.

These files comprise two versions of a midifileplayer for Sonic Pi version 3.0.1 or later. There are two versions.

File SPbasicMidiFilePlayer.rb is the basic version, where the synths used to play each channel in the midifile have to be specified in teh code before running the program in the form of a sonic pi ring. If this contains just a single synth e.g. (ring :saw) then each channel will use this synth. If two synths are specified eg (ring :rri) then midi channel 1 will use :saw, channel 2 :tri and then any further channel will use index into this ring and use in turn :saw, :tri,:saw,:tri This is set in line 38. Also specified at run time in the code is the attenuation level set by the fx :level wrapper in teh variable attenAmp set to 0.5 by default in line 40.

In the second more complicated vbesion, support is provided for an external TouchOSC interface which can be used to specify synth allocation on the fly as the program is running. and also to adjust the attenAmp setting in teh range 0.1 to 1 again

rbnpi /
Last active Jul 13, 2020
Beethoven Moonlight Sonata played by Sonic Pi. Uses Sonatina Symphonic Orchestra samples. See readme for availablilty. Video at

The Sonic Pi file moonlightSonata-RF.rb which plays Beethoven's Moonlight Sonata 1st Movement requires the use of the Grand Piano samples from the Sonatina Symphonic Orchestra produced by Matthias Westlund.

Unfortunately this is no longer available from his website However there is an alternative available at from where you can download the library. It is coverd by a Download and expand on your Desktop, or other suitable location and then set the link in the program at line 9 appropraitely for your installation.

The file should be run using the run_file "/path/to/file/location" command as it is too long to run from a Sonic Pi buffer.

An alternative version using the built in piano synth in Sonic Pi is included for comparison.

You can’t perform that action at this time.