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 / percussiongeneratorprogram2.rb
Last active August 29, 2015 14:10
Percussion Programme Generator for Sonic-Pi 2.1 VERSION 2
#Percussion track generator by Robin Newman, 4th December 2014 VERSION 2
#Inspired by an article http://www.soundonsound.com/sos/feb98/articles/rythm.html
#This program generates a percussion programme defined over two bars quantised to 32 pulses per bar
#up to 10 instruments can be incorporated
#any instrument can sound on any pulse
#one of three volumes can be chosen for each instrument for each pulse
#a variable p sets the pulse tempo for each programme
#a variable n sets the number of bars the track will play for in 2 bar increments
#In this example six drum programmes are defined num = 1 to num = 6. num=0 plays silence
#These can be chosen in a live_loop by changing the variable num
@rbnpi
rbnpi / sidingarpeggios.rb
Created December 7, 2014 14:53
Sllding Arpeggios on Sonic Pi
#slidiing arpeggios by Robin Newman 7th December 2014
#This piece generates major and minor arpeggios in C major and Minor
#created with different random octave settings
#and incorporates them with a sliding note and a variable cutoff
#each with a rising volume,
#using three separate synth voices, which is repeated 10 times
#before finishing with a C major chord
#the whole has a reverb effect added
maj=[:c4,:e4,:g4,:c5,:e5,:g5,:c6]
min=[:c4,:eb4,:g4,:c5,:eb5,:g5,:c6]
@rbnpi
rbnpi / HollyAndTheIvy.rb
Created December 8, 2014 19:27
Sonic-Pi Christmas Medley 1: The Holly and The Ivy
#The holly and the Ivy, transcribed by Robin Newman December 2014
use_synth :tri
s=0 #define s as global here
define :setbpm do |n| #set correct value of s in here
s = (1.0 / 8) *(60.0/n.to_f)
end
setbpm(120)
dsq = 1 * s #note length definitions
sq = 2 * s
@rbnpi
rbnpi / JingleBells.rb
Created December 8, 2014 19:28
Sonic-Pi Christmas Medley 2: Jingle Bells
#Jingle Bells transcribed by Robin Newman December 2014
use_synth :pretty_bell
s=0 #define here to make it global
define :setbpm do |n| #and sets to correct value
s = (1.0 / 8) *(60.0/n.to_f)
end
setbpm(120)
dsq = 1 * s #note length definitions
@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