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 / SilentNight.rb
Last active August 29, 2015 14:11
Sonic Pi Christmas Medley 3: SilentNight
#Silent Night transcribed by Robin Newman December 2014
use_synth :tri
s=0 #define s as global here
define :setbpm do |n| #set correct s value in here
s = (1.0 / 8) *(60.0/n.to_f)
end
setbpm(60)
set_volume! 1
@rbnpi
rbnpi / DingDongMerrily.rb
Created December 8, 2014 19:30
Sonic Pi Christmas Medley 4: Ding Dong Merrily on High
#Ding Dong Merrily on High transcribed by Robin Newman December 2014
use_synth :tri
s=0 #define here to set as global
define :setbpm do |n| #redefine correct value of s in here
s = (1.0 / 8) *(60.0/n.to_f)
end
setbpm(180)
dsq = 1 * s #note length definitions
sq = 2 * s
@rbnpi
rbnpi / MerryChristmas.rb
Created December 8, 2014 19:30
Sonic Pi Christmas Medley 5: We Wish You A Merry Christmas
#We wish you a Merry Christmas transcribed by Robin Newman December 2014
use_synth :tri
s=0
define :setbpm do |n|
s = (1.0 / 8) *(60.0/n.to_f)
end
setbpm(150)
set_volume! 1
dsq = 1 * s #note length definitions
@rbnpi
rbnpi / InDulciJubio.rb
Last active August 29, 2015 14:11
In Dulci Jubilo, illustrating the use of a separate control thread using the with fx_level command to set musical dynamics
#In Dulci Jubilo transcribed for Sonic Pi 2.1.1 by Robin Newman December 2014
#this piece features the use of a separate dynamics track adjusting the amplitude of the parts
#This utilises the use of the fx_level effect, and also uses the amp_slide: parameter to achive
#crescendos and diminuendos
#
set_sched_ahead_time! 2
use_debug false
use_synth :tri
s=0 #set s here with dummy value so that its scope is global
@rbnpi
rbnpi / SlidingChordsandFrereJaques.rb
Last active August 29, 2015 14:11
Code uses functions generating named args for synths, Introduced in ver 2.2dev Plays sliding chord scales and sliding Frere Jaques
#This piece explores the use of functions generating named args for synths
#introduced in version 2.2dev. You will need this version or later to play
#by Robin Newman Cecember 12th 2014
#The program explores the use of sliding notes in chord scales and in a rendition of Frere Jaques
use_debug false
s=0 #set s here with dummy value so that its scope is global
define :setbpm do |n| #set bpm equivalent
@rbnpi
rbnpi / ringfunctions.rb
Last active August 29, 2015 14:11
Program demonstrates the power of the ring function added to version 2.2
#example of the use of rings by Robin Newman, December 2014
#the following three rings hold rhythms for three percussion instruments
#they play when the relevant entry is true
k1=(bools 1,0,0,0,1,0,0,0) #drum_bass_hard rhythm
k2=(bools 0,1,1,0,0,0,1,1) #srum_snare_hard rhythm
k3=(bools 0,0,1,1,0,1,1,0) #drum_cymbal_pedal rhythm
#the next two rings, (one generated by the knit function) control the tune and transposition
@rbnpi
rbnpi / SonicPiConductor.rb
Last active August 29, 2015 14:11
Sonic Pi Conductor. Lets you play a range of workspaces automatically one after the other in a specified order. Video showing operation is on my YouTube channel http://youtu.be/GsbAgU4JdKo
#Sonic Pi Conductor by Robin Newman written for Sonic-Pi 2.1 onwards December 2014
#consists of two functions, slave and conductor, which make extensive use of the :cue and :sync system in Sonic Pi
#The program works becuase these commands can work between workspaces as well as within a single workspace.
#Instructions for use:
#1 In each workspace that you want to control, put as the FIRST LINE slave(ws number)
# eg in workspace two put slave(2), workspace 5 put slave(5) etc.
#2 Put as the LAST LINE of each workspace to be conducted the command cue :wsN where N is the workspace number:
@rbnpi
rbnpi / BachGigueInGMinorSYNTH.rb
Created December 28, 2014 19:59
Plays Bach's Gigue in G Minor on Sonic Pi 2.2 or later. Uses :pulse synth. Also versions for sample based Piano available
#Bach Gigue in G minor from English Suite no 3 Coded by Robion Newman December 2014
#Synth version
set_sched_ahead_time! 3
use_debug false
s=0 #to set global scope
define :setbpm do |n| #set bpm equivalent
s = (1.0 / 8) *(60.0/n.to_f)
end
use_synth :pulse
setbpm(180)
@rbnpi
rbnpi / BachGigueInGMinorSAMPLE1.rb
Last active August 29, 2015 14:12
BachGigueInGMinorSAMPLE1.rb Part 1 of sample based program to play Bach's Gigue in G Minor on Sonic Pi 2.2 or later. (Needs samples and part 2)
#Bach Gigue in G Minor from English Suite 3 (part 1). Coded by Robin Newman December 2014
#sample based version in two parts synced together. Start part 2 then part 1
set_sched_ahead_time! 3
#use_sample_pack '/Users/rbn/Desktop/samples/GrandPiano/' #select and adjust as necessary
use_sample_pack '/home/pi/samples/GrandPiano'
#select loud (f) or soft (p) piano samples
ps="piano_f_"
#ps="piano_p_"
rt=2**(1.0/12) #12th root of 2
@rbnpi
rbnpi / BachGigueInGMinorSAMPLE2.rb
Created December 28, 2014 20:03
Bach Gigue in G Minor sample based version for Sonic Pi 2.2 or later (needs part 1 and samples)
#BachGigueInGMinor (part 2) coded by Robin Newman, December 2014
#sample based version. (two parts synced together: staret this part first, then part 1)
sync :part2
use_sample_pack '/Users/rbn/Desktop/samples/GrandPiano/' #select and adjust as necessary
#use_sample_pack '/home/pi/samples/GrandPiano'
#select loud (f) or soft (p) piano samples
#ps="piano_f_"
ps="piano_p_"