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 / c-minorstudy
Created November 19, 2014 17:39
Sonic-Pi sounds based on c-minor scale: requires features in version 2.1
#playing with code loops and c-minor scales. Robin Newman Nov 2014
#this piece controls 7 loops with a metronome loops generating cues
#which also selects a synth name from a given list and stores it in a global variable
#a loop (vset) controls the overall volume of the piece, fading it up and down
use_debug false
set_volume! 0 #set initial volume
with_fx :reverb,room: 0.8 do
live_loop :metro do
$S = [:tri,:prophet,:fm,:zawa,:saw].choose
@rbnpi
rbnpi / Instructions for use
Created November 19, 2014 17:50
Creating 3 samples with Sonic-Pi and then reusing them in second program: Prophwazsaw
The programs were created using a near release beta of Sonic-Pi 2.1
Because of the processing required these programs will not work effectively on a
Raspberry Pi, but require the more powerful resources available on the Mac version of
Sonic Pi, although they should also work on a more powerful Linux box under say Ubuntu.
and probably on the Windows version of Sonic Pi too, although I haven't tested this.
The first program createsamples uses 6 live_coding loops to generate a pattern of notes
related to a c minor scale, together with a background ambi_lunar_land sound. The timing
is controlled by cue and sync commands using the metronome thread metro.
@rbnpi
rbnpi / puppetonastring.txt
Created November 22, 2014 10:34
Puppet on a String for Sonic Pi 2.1
#Puppet on a String transcribed by Robin Newman
set_sched_ahead_time! 4
v = :tri
bv = :saw
ba = 0.3 #b vol
s = 1.0 / 15.5 #tempo 116 c/min
dsq = 1 * s #note length definitions
sq = 2 * s
@rbnpi
rbnpi / studyinGminor.txt
Created November 22, 2014 16:38
StudfyinGminor for Sonic-Pi 2.1
#study in g minor for Sonic Pi 2,1 by Robin Newman November 2014
live_loop :voice do
sync :foo
$s = [:prophet,:beep,:tri,:fm,:zawa].choose #set the synth each time loop foo3 finishes
sync :change
end
set_volume! 1
k=0
with_fx :reverb,room: 0.8,mix: 0.8 do #add overall reverb
live_loop :foo do
@rbnpi
rbnpi / harmonisedscales.rb
Last active August 29, 2015 14:10
Harmonised scales using chord inversions
#defining chord inversions, and using them to harmonise an ascending and descending scale
#by Robin Newman, November 2014
#the pattern is repeated at semitone intervals 12 times
#written by Robin Newman Nov 2014 using Sonic Pi 2.1
use_debug false
set_sched_ahead_time! 2 #set to about 55 to run on Pi!!!!!!
q=0.12 #note length used
use_synth :tri
with_fx :reverb,room: 0.8 do #add some reverb for interest
@rbnpi
rbnpi / percussionprogrammegenerator.rb
Created December 1, 2014 18:33
Percussion Programme Generator for Sonic-Pi 2.1 SUPERSEDED BY VERSION 2
#Percussion track generator by Robin Newman, 1st December 2014 for Sonic-Pi 2.1
#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 three drum programmes are defined num = 1 to num = 3. num=0 plays silence
#These can be chosen in a live_loop by changing the variable num
@rbnpi
rbnpi / basssamplevoices.rb
Last active August 29, 2015 14:10
Sample based voices for all bass_xxx_c samples built into Sonic Pi, except for :bass_hit_c
#sample based voices for any bass_xxx_c samples over 4 octave range from :c2 to :c5 by Robin Newman December 2014
#use pl(inst,n,d=0.2,pan=0,v=0.8) to play a note where n is note symbol,d duration,v volume
#or plarray(inst,nt,dur,sh=0,vol=0.8,pan=0) to play lists of note symbols and durations
#where inst is samplename,nt and dur are note symbol and duration arrays,sh transpose shift
use_debug false
rm = 2**(1.0/12) #rate multiplier between adjacent semitones (twelth root of 2)
inst = :bass_hard_c #to define scope of inst variable set up here. Used as a parameter later
s=1.0/16 #speed multiplier give 2 crotchet/sec or 120 bpm
shift=0
@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