Skip to content

Instantly share code, notes, and snippets.


Robin Newman rbnpi

  • Near Peterborough
View GitHub Profile
rbnpi / SonicPiReichLikeDrumsWithHydra.rb
Created January 24, 2023 14:57
Sonic Pi produces a Reich Like drum pattern which controls a Hydra Sketch. Video at
View SonicPiReichLikeDrumsWithHydra.rb
#Reich like drumming, by Robin Newman, January 2023
#I use hi and mid tomtoms for the two parts
#or you can set them both the same eg to hard snare
use_debug false
use_midi_logging false
use_midi_defaults channel: 1,port: "iac_driver_bus"
link #lets you adjust tempo as program is running
#set master pattern option with uniform amp or accented amp
#uncomment either the 12 beat or 16 beat patterns
rbnpi / Hydra Sketch2
Created December 31, 2022 22:30
Sonic Pi and hydra.ojack communicating via midi and audio See it on
View Hydra Sketch2
//Sonic Pi controlled code using midi and audio input by Robin Newman
// register WebMIDI
.then(onMIDISuccess, onMIDIFailure);
function onMIDISuccess(midiAccess) {
var inputs = midiAccess.inputs;
var outputs = midiAccess.outputs;
for (var input of midiAccess.inputs.values()){
rbnpi / progressionsBells.rb
Created December 13, 2022 23:29
Progresions of bell like sounds above a bass drone. Based on a toolkit by theibbster on Listen on
View progressionsBells.rb
#This piece is developed from a chord progression tool written by theibbster on
#Robin Newman, December 2022
define :chrd do |deg, tonic, sca|
n = 3
if deg.match?('7')
n = 4
deg = deg.slice(0,deg.length-1).to_sym
rbnpi /
Last active December 3, 2022 17:03
Sonic Pi Loop Controller. Updated for Sonic Pi versions 3.31 and later This program arose out of a question on inquiring how to control switching a live_loop on and off via a push button see See video at


USE SPloopController4.rb for SP versions 3.31, or 4 or greater. YOu can use the new version of TouchOSC see later in the ReadMe file. A SEPARATE VERSION TUNED FOR Pi3 IS ALSO INCLUDED The original question was concerned with using mekey-makey as the "switch input" source. Here I have used a TouchOSC template with 11 pushbuttons on it as the input source. To make it more interesting, I also drive a large "LED" on the TouchOSC screen with OSC commands from the Sonic Pi program. The program has been streamlined to use just ONE live loop to detect the switches being pushed,

rbnpi /
Last active November 13, 2022 21:26
Sonic Pi and TouchOSC Sequencer Instructions in readme file. Acompanying article at Video available at

UPDATED NOVEMBER 13th 2022 for new format OSC message parsing introduced in Sonic Pi Feb 2020 Use the file Sequencer2.0-RF.rb for Sonic Pi >= 3.2. which uses the new format

The index.xml file will still work, but once you hav it loaded you may like to amend the top label to Sonic Pi Sequencer 2 by Robin Newman, but this is purely cosmetic and not essential

For convenience I have added 4 specimen json files seq1.json to seq4.json which you can use. You can generate your own otherwise using the write commands in the interface. The location of these files is specified in the program. Adjust to suit your own requirements.

orginal ReadMe text follows

rbnpi /
Last active November 8, 2022 19:40
Tuning Sonic Pi for best performance

Tuning Sonic Pi for best performance

Several of the programs I write for Sonic Pi push it fairly close to the limit when run on a Raspberry Pi. This note gives some tips on to how to maximise the performance on that platform. Of course, if you run Sonic Pi on Mac OSX,or a Windows PC then the performance is much better on these more powerful platforms and some of the issues may not arise.

Over-clocking your Pi

By increasing the voltage applied to the Pi processor, and running it at a higher clock frequency than normal it is possible to achive significant gains in performance. The down side is that you may reduce the lifetime of your Pi. There are five levels that can be configured: None, Modest, Medium, High and Turbo. I routinely run my Raspberry Pis with Medium Overclocking and have noticed no ill effects on any of them.

If you wish to apply some over-clocking you do so by running the program raspi-config from the command line. Having logged on, from the command line before you start the gra

rbnpi / GlassArmonicaPlaysMozart.rb
Last active August 27, 2022 18:47
Glass Armonica for Sonic Pi plays Mozart UPDATED to use rpitch: (introduced after this was first written) to calculate sample rate. MUCH simpler
View GlassArmonicaPlaysMozart.rb
#a Glass Armonica "voice" for Sonic Pi by Robin Newman November 2014
# revised to use rpitch 2018; corrected 2022 for missing tr function
#This simulates the Glass Armonica invented by Benjamin Franklin and for which Mozart
#composed the piece played here
#This version uses rpitch: parameter added to Sonic Pi after the original was written in 2014
##| sample :ambi_glass_rub
##| play :fs5
##| puts note(:fs5)
##| stop
use_debug false
rbnpi / BeatusVirControlled-RFAuto.rb
Created January 27, 2017 17:16
Sonic Pi processing remote control GUI
View BeatusVirControlled-RFAuto.rb
`/usr/local/bin/sonic_pi stop`
`/usr/local/bin/sonic_pi "run_file '~/Documents/SPfromXML/BeatusVirControlled-RF.rb'"`
rbnpi / MarenzioMadrigal1.rb
Last active August 4, 2022 21:11
Sonic Pi plays 3 16th Century madrigals by Luca Marenzio, arranged for 5 trumpets. uses sample based voices, and features dynamic level variation. Requires SP 2.5 or later. Sample download at
View MarenzioMadrigal1.rb
# Luca Marenzio Madrigal 1553-1599 "Togli dolce ben mio" arranged for 5 trumpets coded for by Robin Newman, April 2015
#uses sample based voice, and also has variable dynamic settings for each part and final rit.
#requires version >=2.9
#Sample requires can be downloaded from
#This version altered for syntax changes. Wrosk with later versions of SP
use_debug false
path= '~/Desktop/samples/Marenzio/' #path to sample folder
#first deal with selecting and setting up the sample
inst0 = 0 #first (in fact only) sample in folder
rbnpi / SonicPiTocAndFugue-RF.rb
Last active July 27, 2022 22:08
Bach Toccata and Fugue played by Sonic Pi. Use run_file "/path/to/SonicPiTocAndFugue-RF.rb" to play. Hear it on
View SonicPiTocAndFugue-RF.rb
#BachTocAndFugue-RFrb (latest version)
#coded by Robin Newman from an arrangement by Guillaume Bentaieb
start = 0 #section to start playing from (fugue stats at 6)
#note data part0 (a few extra notes from part 1 which required this to play on Sonic Pi)