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 / BachFugues2-RF.rb
Last active February 4, 2024 20:04
Two small Bach Fugues (see source in code comments) Use run_file <filenamepath> to execute. Hear it on https://soundcloud.com/sp-rbn/twobachfugues
#BachFugues2-RF.rb
#Two small bach Fugues arranged for String Trio by Alexandre Evstyugov-Babaev
#from https://musescore.com/user/27897310/scores/14176597 copyright Attribution, Share Alike
#converted for Sonic Pi by Robin Newman, Feb 2024
use_synth :blade
use_synth_defaults amp: 0.6
s=0.95;r=0.05
with_fx :reverb, room: 0.6,mix: 0.6 do
a1=[]
b1=[]
@rbnpi
rbnpi / Blue_Danube-RF.rb
Last active January 2, 2024 17:43
Blue Danube waltz played by Sonic Pi hear it on https://soundcloud.com/sp-rbn/blue-danube
#Blue_Danube-RF.rb
#coded for sonic pi by Robin Newman, January 2024
#from https://musescore.com/user/29230024/scores/5161782 by andreamotas4
#Creative Commons Copyright Waiver
use_synth :blade
use_synth_defaults amp: 0.3
s=0.9;r=0.15
with_fx :reverb, room: 0.8,mix: 0.6 do
with_fx :level,amp: 1.2 do
a1=[]
@rbnpi
rbnpi / SonifyE.rb
Last active December 30, 2023 17:39
Sonify Euler's number e using Sonic Pi. Hear it on https://soundcloud.com/sp-rbn/sonifye
#sonification generated by the number E with steadily increasing precision
#from 1 to 60, written by Robin Newman, Dec 2023
#The number is generated by BigMath.E(precision)
#I use each digit as a lookup index into a minor pentatonic scale
#I read the digits from each end of the current number, and play
#one of the two resulting notes, selected by a density funtion and a spread function
#which gives a bit of rhythm.
#These notes are underpinned by a base drone, which is layered as it has a longer
#release time and is generated increasingly as the base E string gets longer
@rbnpi
rbnpi / SP4.5PipewireUtilities.rb
Created December 26, 2023 10:30
Program which can be run in a buffer or in init.rb to allow control of Audio connections
#functions to aid connecting and disconnectiog SuperCollider under pipewire
define :getCurrentData do
#first input ports
inputs = `pw-link -iI`.lines
set :hdmiL,inputs.grep(/hdmi.*playback_FL$/).first.to_i
set :hdmiR,inputs.grep(/hdmi.*playback_FR$/).first.to_i
set :usbL,inputs.grep(/usb.*playback_FL$/).first.to_i
set :usbR,inputs.grep(/usb.*playback_FR$/).first.to_i
set :bluezL,inputs.grep(/bluez.*playback_FL$/).first.to_i
@rbnpi
rbnpi / bach-allabreve2-bwv589-RF.rb
Created July 27, 2023 15:50
Sonic Pi version of Bach's Allabreve. You need to use run_file "path/to/bach-allabreve2-bwv589-RF.rb" to run it. Listen to it on https://soundcloud.com/rbnsonicpi/bach-allabreve-bwv589
#bach-allabreve2-bwv589-RF.rb
#coded for Sonic Pi by Robin Newman, July 2023
use_debug false
use_synth_defaults amp: 0.5
s=0.96;r=0.04;st=0 #s,r,st = sustain factor,release factor, start tempo section
Last = 4 #pause on last note
with_fx :reverb , room: 0.9,mix: 0.7 do
use_synth :pulse
with_fx :compressor,amp: 0.7 do
@rbnpi
rbnpi / SonicPiHiHats.rb
Last active May 10, 2023 21:45
Program illustrates HiHat samples added to Sonic Pi source around May9th 2023. Hear the result on https://soundcloud.com/sp-rbn/hihats
#Sonic Pi HiHats by Robin Newman May 2023
#demo of new hi-hat samples in action
#program prints sample names, then fades in
#and runs for about 1 minute before fading out and stopping
use_debug false
sample_names(:hat).each do |name|
puts name
end
set :kill,false
at 65 do
@rbnpi
rbnpi / SPhydraFrere4Pane2.rb
Last active February 6, 2023 16:18
Sonic Pi 4.4dev with built in Hydra plays Frere Jaques displaying the notes. Video at https://youtu.be/J0JbqlScl3Y
#Sonic Pi 4.4dev with built in Hydra
#Hydra sketch shows Frere Jaques 2 part round notes in real time
#coded by Robin enwman February 2023
use_debug false
define :clearPanes do
hydra "
solid(0,0,0).out(o0)
solid(0,0,0).out(o1)
solid(0,0,0).out(o2)
@rbnpi
rbnpi / SonicPiReichLikeDrumsWithHydra.rb
Created January 24, 2023 14:57
Sonic Pi produces a Reich Like drum pattern which controls a Hydra Sketch. Video at https://youtu.be/Tk70Lc2QHJY
#Reich like drumming, by Robin Newman, January 2023
#I use hi and mid tomtoms for the two parts
#or you can set them both the same eg to hard snare
use_debug false
use_midi_logging false
use_midi_defaults channel: 1,port: "iac_driver_bus"
link #lets you adjust tempo as program is running
#set master pattern option with uniform amp or accented amp
#uncomment either the 12 beat or 16 beat patterns
@rbnpi
rbnpi / Hydra Sketch2
Created December 31, 2022 22:30
Sonic Pi and hydra.ojack communicating via midi and audio See it on https://youtu.be/Du0yLoDYHOs
//Sonic Pi controlled code using midi and audio input by Robin Newman
// register WebMIDI
navigator.requestMIDIAccess()
.then(onMIDISuccess, onMIDIFailure);
function onMIDISuccess(midiAccess) {
console.log(midiAccess);
var inputs = midiAccess.inputs;
var outputs = midiAccess.outputs;
for (var input of midiAccess.inputs.values()){
@rbnpi
rbnpi / progressionsBells.rb
Created December 13, 2022 23:29
Progresions of bell like sounds above a bass drone. Based on a toolkit by theibbster on sonic-pi.net Listen on https://soundcloud.com/rbnsonicpi/progressionbells
#This piece is developed from a chord progression tool written by theibbster on sonic-pi.net
#Robin Newman, December 2022
define :chrd do |deg, tonic, sca|
n = 3
if deg.match?('7')
n = 4
deg = deg.slice(0,deg.length-1).to_sym
end