View chordfrazzle.rb
#chordfrazzle by Robin Newman, March 2017
#This piece generates the notes in a randomly selected chord type, and then plays them ascending....
#interspersed with the same sequence rising
#The base note, synth, volume and pan positions of the notes are selected at random for each chord
#certain synths are excluded (mainly "noise" types)
#In this version the live loop is faded out after 110 seconds and then stopped.
use_debug false
duration=110
killit=0
with_fx :level do |fade|
View RobinNewmanWithSonicPi.rb
#RobinNewmanWithSonicPi, March 2017
#This piece was generated using the program Muse-O-Matic
#http://nosuch.com/music/matic.htm
#seeded with the "word" RobinNewmanWithSonicPi
#The resulting midi file was converted to SP notation
#and a simple percussion part was added
with_fx :gverb,room: 20,mix: 0.4 do
use_synth :tri
tmp=120 #tempo setting
a1=[:Ef4,:r,:Ef4,:Bf3,:r,:Ef4,:r,:Ef4,:r,:r,:Bf3,:Ef4,:r,:Ef6,:r,:Bf5,:Ef6,:r,:Ef6,:r,:Cs4,:Gs4,:r,:Cs4,:Cs5,:r,:Gs4,:r,:Gs5,:Gs5,:r,:Cs6,:Gs5,:r,:Cs6,:Ef6,:r,:Cs4,:r,:Cs4,:Cs4,:Ef4,:G3,:D4,:B3,:G3,:r,:G3,:G4,:G3,:r,:r,:G3,:G3,:A3,:D4,:r,:G4,:F4,:F3,:A3,:C4,:F4,:C4,:r,:A4,:Bf3,:F3,:r,:r,:F5,:Bf4,:Bf4,:r,:Bf4,:F4,:r,:Bf3,:F3,:Bf3,:Bf3,:Bf3,:r,:C4,:F4,:Cs5,:Gs4,:Cs4,:Gs3,:F3,:Cs4,:Cs5,:r,:Cs4,:Cs4,:Cs4,:Ef4,:Cs4,:r,:F3,:Cs4,:Gs3,:Gs3,:r,:Gs3,:Gs3,:Cs4,:Ef4,:r,:Gs3,:Cs4,:Cs4,:F3,:Cs4,:Gs3,:Cs4,:Gs3,:r,:r,:Gs3,:Cs4,:Gs4,:r,:r,:Gs4,:Cs4,:Gs3,:r,:Cs4,:Cs5,:Gs4,:F3,:Gs3,:F3,:Cs4,:Bf3,:D4,:F4,:Bf4,:F4,:Bf4,:F4,:F4,:Bf4,:F4,:D4,:F4,:Gs4,:Bf4,:Ef5,:Gs5,:r,:Ef6,:C6,:Gs4,:Gs3,:E
View AmbiTablaSpaceShootout.rb
use_random_seed 2468 #try different values
n= (sample_names :tabla).length
n2=(sample_names :ambi).length
#ramped volume change
vmap=[0,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
killit=0 #flag to kill live loops
with_fx :gverb,room: 25 do
with_fx :level do |v| #fade volume in and out
control v,amp: 0
sleep 0.05 #settle time to prevent any initial click
View BachClavierConcertoBWV1054-RF.rb
#Bach Clavier Concerto no 3 in D major BWV1054 arranged for Sonic Pi midi output
#by Robin Newman Feb 2017 from score http://hz.imslp.info/files/imglnks/usimg/6/66/IMSLP02258-Bach_-_BGA_-_BWV_1054.pdf
#parts in MuseScore2, separated out especially Harpsichord to 6 parts
#exported as MusicXML to Processing Script which converted to Sonic Pi format
#output was fed to Logic Pro on a MacBook Pro but will work with other suitable players eg MuseScore2
#asssign instruments to each part
#1=violins1 2=violins2 3=violas 4=basses 5-10 = harpsichords
define :dl do |durations| #return number of crotchet beats in a note durations list
l=0.0
View BWV651-RF.rb
#BWV651-RF.rb
#use run_file "<path to BWV651-RF>" to play
#requires SP 2.11 or greater
#will play in a Raspberry Pi3
#based on an original musescore by Clarin Pedro with permission
use_debug false
use_synth :tri
use_synth_defaults cutoff: 110
with_fx :reverb,room: 0.9,mix: 0.5 do
View bwv542-RF.rb
#bwv542 Great Fantasia and Fugue in G minor verskon for solo Sonic Pi 2.11 or 2.11.1
#use runfile "<path to bwv254-RF.rb>" to run it
use_debug false
use_synth :saw
s=1;r=0.1
sb=0.95;rb=0.1
p1=0.4;p2=0.4;p3=0.4;p4=-0.4;p5=0;p6=0
with_fx :reverb, room: 0.9,mix: 0.6 do
with_fx :level,amp: 0.7 do
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'"`
View ReadMe.txt
These files accompany a video at https://youtu.be/K1KQSFiHg6I which explores the use of a GUI to control a Sonic Pi program
running code to drive an external midi player. (I used Logic Pro) It currently works with SP2.12.0-midi-alpha1 on a Mac,
but may probably break on future versions. It is intended to show some concepts, particularly the use of a GUI written
in processing which can control SP by means of OSC messages. The source code of the processing sketch is included.
It also illustrates a technique to allow a Sonic Pi piece to be started at any bar, by calculating the start note for
each of the parts concerned. It can handle a tied note already playing at the start of the selected bar.
The final technique utilised is to use an external script utilising calls to the Sonic Pi cli interface gem to stop
Sonic Pi running and then to restart the program using a run_file command. In this way, Sonic Pi can respond to
a stop singal from the GUI and then restart playing when a subsequent Play cue is received via
View JazzBach.rb
#Jazz Bach converted for Sonic Pi by Robin Newman Jan 2017
#requires to be used with run_file "path/to/filename/JazzBach.rb"
#using Sonic Pi 2.11 or later
use_synth :piano
s=1;r=0.1
with_fx :reverb,room: 0.8,mix: 0.5 do
with_fx :level,amp: 1.2 do #overall boost
with_fx :level do |v| #dynamic control during the piece
p=0.5;mp=0.7;mf=1;f=1.2;ff=1.5
in_thread do
View JellyRollBlues-RF.rb
#JellyRollBlues by Jelly Roll Morton, 1924 arranged for Sonic Pi by Robin Newman, Jan 2017
#requires SP 2.11 or later so that it can be played using run_file "path/to/file/JellyRollBlues-RF.rb"
#the Right and Left hand parts are each split into three, to accommodate the notes
#whilst still allowing the script to work to convert from the original MusicXML files
#to Sonic Pi format.
s=1;r=0.1 #sustain release parameters
with_fx :reverb,room: 0.8 do
use_synth :piano
with_fx :level do |v| #produce accents (at the end of the trills)
in_thread do