Skip to content

Instantly share code, notes, and snippets.

View rbnpi's full-sized avatar

Robin Newman rbnpi

  • Near Peterborough
View GitHub Profile
@rbnpi
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 https://soundcloud.com/rbnsonicpi/bachtoccataandfugue-1
#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 / OydUnaCosa.rb
Last active October 31, 2021 23:06
Oyd, oyd una cosa by Fransisco Guerrero (16th century) coded for Sonic Pi. Hear it on https://soundcloud.com/rbnsonicpi/oyd-una-cosa
#OydUnaCosa.rb Oyd, oyd una cosa by Francisco Guerrero 1589
#coded for Sonic Pi by Robin newman October 2021
use_bpm 150
use_synth :chiplead
use_synth_defaults attack: 0.08
s=0.9;r=0.4
with_fx :reverb, room: 0.7,mix: 0.6 do
with_fx :level,amp: 0.5 do
a1=[:G4,:C5,:C5,:C5,:r,:B4,:D5,:D5,:D5,:E5,:E5,:E5,:D5,:D5,:G5,:G5,:F5,:E5,:E5,:D5,:D5,:r,:r,:r,:B4,:C5,:C5,:A4,:B4,:C5,:G4,:C5,:B4,:A4,:B4,:D5,:E5,:F5,:G5,:E5,:F5,:E5,:D5,:D5,:Cs5,:D5,:D5,:r,:G5,:F5,:E5,:G5,:C5,:E5,:F5,:E5,:A4,:G4,:A4,:B4,:C5,:B4,:C5,:C5,:r,:C5,:B4,:A4,:C5,:F4,:G4,:A4,:B4,:C5,:A4,:B4,:B4,:r,:G5,:F5,:E5,:G5,:C5,:C5,:C5,:C5,:C5,:C5,:D5,:D5,:E5,:E5,:E5,:C5,:C5,:C5,:D5,:E5,:D5,:E5,:r,:r,:C5,:F5,:E5,:C5,:D5,:E5,:D5,:C5,:G5,:F5,:E5,:G5,:F5,:E5,:F5,:D5,:E5,:D5,:C5,:D5,:E5,:C5,:D5,:C5,:B4,:A4,:A4,:G4,:G4,:G4,:C5,:C5,:C5,:r,:B4,:D5,:D5,:D5,:E5,:E5,:E5,:D5,:D5,:G5,:G5,:F5,:E5,:E5,:D5,:D5,:r,:r,:r,:B4,:C5,:C5,:A4,:B4,:C5,:G4,:C5,:B4,:A4,:B4,:D5,:E5,:F5,:G5,:E5,:F5,:E5,:D5,:D5,:Cs5,:D5,:D5,:r,:G5,:F5,:E5,:G5,:C5,:E5,:F5,:E5,:A4,:G4,:A4,:B4,:C5,:B4,:C
@rbnpi
rbnpi / bari_bassic_blues-RF.rb
Created August 29, 2021 19:45
Bari Bassic Blues (originally for saxophone quartet and drums) by Joshua Haagen coded for Sonic Pi Hear it on soundcloud.com
#"Bari_Bassic_Blues" by Joshua Haagen https://www.youtube.com/user/jzonda415/about
#originally for Saxophone Quartet and drums
#converted for Sonic Pi by Robin Newman, Aug 2021 with the composer's permission
#voiced for :dsaw synth with fxs reverb and wobble applied
#percussion parts converted to a note stream and then case statement used to select samples
#parts transposed to allow for original instrument
#use run_file "path/to/this/file" as too long for a suonic pi buffer
use_synth :dsaw
use_synth_defaults amp: 0.6
use_bpm 120
@rbnpi
rbnpi / Gabrieli-Ch172-Septimi-RF.rb
Last active July 3, 2021 21:49
Gabrieli_Canzon_per_sonar_septimi_toni_a_8 coded for Sonic Pi. Hear it on https://soundcloud.com/rbnsonicpi/gabrieli-canzon-per-sonar-septimi-toni-a-8
#Gabrieli-Ch172-Septimi-RF.rb
#converted to Sonic Pi code by Robin Neman from midi file by Martin Grayson Creative Commons 3.0 Attribution Non-Commercial-Share-Alike
use_synth_defaults attack: 0.03
s=0.9;r=0.2
with_fx :reverb, room:0.8,mix: 0.6 do
with_fx :level,amp: 0.5 do
use_synth :pulse
a1=[]
b1=[]
@rbnpi
rbnpi / DanseMacabre-RF.rb
Last active June 18, 2021 03:59
Danse-Macabre by Saints-Saëns played by Sonic Pi hear it on https://soundcloud.com/rbnsonicpi/dansemacabre
#Danse Macabre by Saint-Saëns arranged for Sonic Pi by Robin Newman from a MuseScore by Salomão Sidharta
#May 2021
#use play_file "path/to/DanseBacabre-RF.rb" to play it
#note double-sharps can;t be notated in Sonic Pi so Cdouble-sharp is entered here as a D for example
use_transpose -2 #original instruments in Bb
s=0.95;r=0.05 #set sustain and release fractions
use_synth :blade
with_fx :reverb,room: 0.8, mix: 0.7 do #add osme reverb
a1=[]
b1=[]
@rbnpi
rbnpi / Pase_el_agoa-RF.rb
Last active March 26, 2021 12:39
Pase el agoa 16th century anonymous piece coded for Sonic Pi. Hear it on https://soundcloud.com/rbnsonicpi/pase-el-agoa
#Pase_el_agoa-RF
#play using run_file "path/to/this/file"
#Anonymous 16th century manuscript Pase el agoa, ma Julieta dama
#"Across deep oceans" coded for Sonic Pi by Robin Newman, march 2021
#quite tricky to do to get the spread chords in the lute part sounding ok
#I love the corss rhythms of this piece.
#I could reduce the sequences of rests in most parts, but life is too short....
st=0 #starting section to play
s=0.97;r=0.03 #sustain/release fractions
#part volume and pan settings
@rbnpi
rbnpi / VivaldiLaFollia-RF.rb
Last active March 22, 2021 14:02
Vivaldi's La Follia Trio Sonata in D Minor arranged for Sonic Pi Hear it on https://soundcloud.com/rbnsonicpi/vivaldi-la-follia
#Vivaldi L Follia coded for Sonic Pi by Robin Newman, March 2021
#use run_file "path/to/this/file" to execute in Sonic Pi
st=0 #starting section (can change to start playing from any tempo change 0 - 13)
s=0.98;r=0.02 #multipliers for reslease and sustain fractions of duration
am=1 #amp multiplier changed for last 4 bars
with_fx :reverb,room: 0.8,mix: 0.6 do
with_fx :level, amp: 0.8 do #overall level multiplier
use_synth :tri #for top two parts
a0=[]
b0=[]
@rbnpi
rbnpi / Bach_Prelude_&_Fugue_BWV848.rb
Last active February 7, 2021 20:49
Bach Prelude and Fugue no 3 in C# Major BWV 848 coded for Sonic Pi: execute with run_file command. Hear it on https://soundcloud.com/rbnsonicpi/bach-prelude-and-fugue-bwv-848
#midi to sonic-pi conversion using midi-sonic.rb script
#Initial script idea by theibbster developed by Robin Newman
#Tempo changes are allowed provided that they occur at the start of a note
#and at the same time in every part.
#use run_file "paht/to/this+file" to execute in Sonic Pi
#amend synth, ad fx pan settings etc manually to suit your piece
use_synth :piano #default synth
#Sonic Pi Challenge #4 by Robin Newman
#I decided to generate my own binary string from text input
#which allows you to render any text here
#I liked initial code by theibbster at https://in-thread.sonic-pi.net/t/chord-progression-tool/4947
#I developed this and put the two ideas together below
use_debug false
use_random_seed 6148
L= "Robin Newman's Sonic Pi challenge #4" #the text input I used
S=[] #array to hold binary represention of the string L
L.bytes.to_a.each do |x| #convert to binary 7 bit numbers for each character
@rbnpi
rbnpi / Carol_of_the_Bells.rb
Last active December 22, 2020 14:53
"Carol of the Bells" coded for Sonic Pi. Entry for Monthly Challenge #3 on in-thread.sonic-pi.net. Hear it on https://soundcloud.com/rbnsonicpi/carol-of-the-bells
#Carol_of_the_Bells.rb
#coded for Sonic Pi by Robin Newman, Dec 22 2020
use_bpm 2*78 #twice 78rpm!! criterion for Monthly Challenge #3
s=0.95;r=0.1 #set sustain release fractions
pp=0.3;p=0.4;mf=0.6;f=0.8;ff=1 #defeine vol levels
with_fx :reverb,room: 0.8,mix: 0.8 do
use_synth :beep #synth for top part
with_fx :level ,amp: 1.3 do #most toop part relative to the others