Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Newman rbnpi

  • Near Peterborough
View GitHub Profile
@rbnpi
rbnpi / BeatusVirControlled-RFAuto.rb
Created Jan 27, 2017
Sonic Pi processing remote control GUI
View BeatusVirControlled-RFAuto.rb
#!/usr/bin/ruby
`/usr/local/bin/sonic_pi stop`
`/usr/local/bin/sonic_pi "run_file '~/Documents/SPfromXML/BeatusVirControlled-RF.rb'"`
@rbnpi
rbnpi / MarenzioMadrigal1.rb
Last active Aug 4, 2022
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 http://r.newman.ch/rpi/Marenzio.zip
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 http://r.newman.ch/rpi/Marenzio.zip
#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
rbnpi / SonicPiTocAndFugue-RF.rb
Last active Jul 27, 2022
Bach Toccata and Fugue played by Sonic Pi. Use run_file "/path/to/SonicPiTocAndFugue-RF.rb" to play. Hear it on https://soundcloud.com/rbnsonicpi/bachtoccataandfugue-1
View SonicPiTocAndFugue-RF.rb
#BachTocAndFugue-RFrb (latest version)
#coded by Robin Newman from an arrangement by Guillaume Bentaieb https://musescore.com/user/2953356/scores/7328486
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)
a0=[]
b0=[]
a0[0]=[:A6,:A6,:r,:G6,:F6,:E6,:D6,:Cs6,:D6,:A5,:A5,:r,:E5,:F5,:Cs5,:D5,:r,:r,:r,:r,:r,:r]
b0[0]=[0.16666667,0.33333334,0.125,0.0625,0.0625,0.0625,0.0625,0.125,1.0,0.16666667,0.33333334,0.125,0.125,0.125,0.125,1.0,2.0,4.0,2.0,1.0,0.5,0.25]
a0[1]=[:r,:r,:r,:r,:r,:r,:r,:E5,:r,:r,:r,:A4,:r,:r]
b0[1]=[0.25,4.0,4.0,4.0,4.0,2.0,0.5,0.5,1.0,2.0,0.5,0.5,1.0,4.0]
@rbnpi
rbnpi / HouseOfTheRisingSunVer2.rb
Created Aug 18, 2015
HouseOfTheRisingSun-ver2.rb coded for Sonic Pi. Based on score by M Ludenhoof at http://imslp.org/wiki/House_of_the_Rising_Sun_(Ludenhoff,_Martin). Requires SP 2.6 or later. Hear it at https://soundcloud.com/rbnman/houseoftherisingsun-ver2 This version has a different verse structure and varied instrument mix.
View HouseOfTheRisingSunVer2.rb
#House of the Rising Sun, coded for Sonic Pi by Robin Newman, August 2015
#Based on version by M Ludenhoof at http://imslp.org/wiki/House_of_the_Rising_Sun_(Ludenhoff,_Martin)
#Creative Commons 3.0 licence. One or two notes modified.
#version 2. Different play structure, and alternative instrument formiddle section
use_debug false
#samples used with their natural pitches
inst0=:bass_woodsy_c
samplepitch0=:c3
@rbnpi
rbnpi / README.md
Last active Jul 4, 2022
Sonic Pi program to display lissajous figures controlled by TouchOSC. Requires SP 2.12 midi-alpha6 or later. Video with details at https://youtu.be/coDyIySAZbw
View README.md

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 https://patreon.com/samaaron 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.

@rbnpi
rbnpi / 8NotePolyphonicSetup.rb
Last active May 31, 2022
8 note polyphonic gated synths for Sonic Pi 3. Allows keyboard input with notes of any length. Requires SP3, and powerful computer at present: not Raspberry Pi. Article at https://rbnrpi.wordpress.com/2017/08/06/8-note-polyphonic-gated-synth-for-sonic-pi-3/ video at https://youtu.be/gD-50-_dgxg
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
@rbnpi
rbnpi / ThereminPlus.rb
Last active May 30, 2022
Sonic Pi Theremin utilising two ultrasonic sensors. See post at https://rbnrpi.wordpress.com/2018/05/17/dual-sensor-theremin-for-sonic-pi/ and video at https://youtu.be/Kk9KO6Stqp4 for details.
View ThereminPlus.rb
#Theremin plus, controlling pitch and ixi_techno phase by Robin Newman May 2018
#/osc/ changed to /osc*/ in line 24 to work with latest Sonic Pi Aug 2021
#I control a continously playing note (length 2000)
use_debug false
define :putsPretty do |n,p|
num=(n*10**p).round/(10**p).to_f
return num
end
@rbnpi
rbnpi / GoodBadUgly-RF.rb
Last active Apr 29, 2022
The Good the Bad and the Ugly theme by Ennio Morricone on Sonic Pi (play using run_file command) Listen at https://soundcloud.com/sc3rbnman/goodbadugly
View GoodBadUgly-RF.rb
#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
a1=[]
b1=[]
a1[0]=[:r,:r,:r,:r,:r,:r,:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,:r,:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4]]
@rbnpi
rbnpi / recordplaybackmidi.rb
Last active Apr 27, 2022
Experimental program to record realtime midi input in Sonic Pi and subsequently play it back. Video on youtube https://youtu.be/0hq2L_ADen8
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 EDITED April 2022 for updated midi message handling
uncomment do #comment to record, uncomment to replay
tlist=get(:tlist)
puts tlist.length
puts tlist
@rbnpi
rbnpi / FrereSonatina.rb
Last active Apr 22, 2022
Using Sonatina Symphonic Library with Sonic Pi. Illustrated with a 19 voice round of Frere Jaques. Requires SP ver 2.10 or later an the Symphonic Library from https://github.com/peastman/sso Full article on this program at https://rbnrpi.wordpress.com/2016/03/16/sonatina-symphonic-orchestra-revisited-to-give-55-sample-voices-for-sonic-pi/
View FrereSonatina.rb
#program to utilise 48 different sample voices from Sonatina Symphonic Library
#written by Robin Newman, March 2016
#requires Sonatina Symphonic Library from http://sso.mattiaswestlund.net/download.html
#requires Sonic Pi ver 2.10
#plays 19 voice Frere Jqeus round!
#tested on Pi2, Pi3, Mac OSX and Windows 10.
#updated to handle new thread structure in SP2.11dev
use_debug false
#path to library samples folder (including trailing /)
path='~/Desktop/Sonatina Symphonic Orchestra/Samples/'