Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Newman rbnpi

  • Near Peterborough
View GitHub Profile
@rbnpi
rbnpi / JazzeupInversions.rb
Last active Aug 11, 2020
JazzedupInversions plays with a sequence of chord inversions in Sonic Pi. Hear it on https://soundcloud.com/sc3rbnman/jazzedupinversions
View JazzeupInversions.rb
#JazzedupInversions by Robin Newman, August 2020
#started playing with chord inversions and ended up with this.
use_bpm 60 #initial tempo
with_fx :reverb, room: 0.8,mix: 0.7 do
with_fx :ixi_techno,mix: 0.4 do
live_loop :arps do
#code to speed up and slow down tempo again
bpmchange=((knit 2,20)+(knit -4,10)).tick(:speed)
use_bpm current_bpm + bpmchange
@rbnpi
rbnpi / GoodBadUgly-RF.rb
Last active Jul 13, 2020
The Good the Bad and the Ugly theme by Ennio Morricone on Sonic Pi (play using run_file command) Listen at https://soundcloud.com/sc3rbnman/goodbadugly
View GoodBadUgly-RF.rb
#GoodBadUgly-RF.rb
#coded by Robin Newman, July 2020
#use run_file "path/to/GoodBadUgly-RF.rb"
with_fx :reverb, room: 0.8 do
use_synth :pluck
with_fx :compressor,amp: 2 do
a1=[]
b1=[]
a1[0]=[:r,:r,:r,:r,:r,:r,:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,:r,:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4],:r,[:G3,:B3,:E4],:r,[:G3,:B3,:E4],[:G3,:B3,:E4],[:G3,:B3,:E4]]
@rbnpi
rbnpi / recordplaybackmidi.rb
Last active Apr 27, 2020
Experimental program to record realtime midi input in Sonic Pi and subsequently play it back. Video on youtube https://youtu.be/0hq2L_ADen8
View recordplaybackmidi.rb
#program to record realtime midi input,and then replay it.
#records midi input from say a keyboard, saving data into array tlist
#this can then be replayed. Records, note pitch, time started,
#velocity of key and note duration.
#coded by Robin Newman April 2020
uncomment do #comment to record, uncomment to replay
tlist=get(:tlist)
puts tlist.length
puts tlist
@rbnpi
rbnpi / PachabelCanon-RF.rb
Last active Apr 20, 2020
Sonic Pi plays Pachabel's Canon. Four versions for 1 or 4 computers. See video on https://youtube.com/rbn1tube
View PachabelCanon-RF.rb
#PachableCanon-RF.rb
#arranged for 1 computer running Sonic-Pi. Use run-file "/path/to/PachableCanon.rb"
#as the file is too long to fit in a Sonic Pi buffer
use_bpm 45
use_synth :blade
with_fx :reverb,room: 0.8 do
a1=[]
b1=[]
a1[0]=[:r,:r,:Fs5,:E5,:D5,:Cs5,:B4,:A4,:B4,:Cs5,:D5,:Cs5,:B4,:A4,:G4,:Fs4,:G4,:E4,:D4,:Fs4,:A4,:G4,:Fs4,:D4,:Fs4,:E4,:D4,:B3,:D4,:A4,:G4,:B4,:A4,:G4,:Fs4,:D4,:E4,:Cs5,:D5,:Fs5,:A5,:A4,:B4,:G4,:A4,:Fs4,:D4,:D5,:D5,:Cs5,:D5,:Cs5,:D5,:D4,:Cs4,:A4,:E4,:Fs4,:D4,:D5,:Cs5,:B4,:Cs5,:Fs5,:A5,:B5,:G5,:Fs5,:E5,:G5,:Fs5,:E5,:D5,:Cs5,:B4,:A4,:G4,:Fs4,:E4,:G4,:Fs4,:E4,:D4,:E4,:Fs4,:G4,:A4,:E4,:A4,:G4,:Fs4,:B4,:A4,:G4,:A4,:G4,:Fs4,:E4,:D4,:B3,:B4,:Cs5,:D5,:Cs5,:B4,:A4,:G4,:Fs4,:E4,:B4,:A4,:B4,:A4,:G4,:Fs4,:Fs5,:E5,:r,:D5,:Fs5,:B5,:A5,:B5,:Cs6,:D6,:D5,:Cs5,:r,:B4,:D5,:D5,:D5,:D5,:G5,:E5,:A5,:A5,:Fs5,:G5,:A5,:Fs5,:G5,:A5,:A4,:B4,:Cs5,:D5,:E5,:Fs5,:G5,:Fs5,:D5,:E5,:Fs5,:Fs4,:G4,:A4,:B4,:A4,:G4,:A4,:Fs4,:G4,:A4,:G4,:B4,:A4,:G4,:Fs4,:E4,:Fs4,:E4,:D4,:E4,:Fs4,:G4,:A4,:B4,:G4,:B4,:A4,:B4,:Cs5,:D5,:A4,:B4,:Cs
@rbnpi
rbnpi / OdeToJoyBASS.rf
Created Apr 18, 2020
Sonic Pi plays Ode to Joy. Three versions.
View OdeToJoyBASS.rf
#ODE TO JOY: CELLO and DOUBLE-BASS
#arranged for Sonic Pi by Robin Newman, April 2020
#this version on a single computer using three buffers
use_osc "localhost",4560
osc "/start"
sync "/osc*/start"
use_bpm 140
use_synth :blade
with_fx :reverb,room: 0.8 do
#cello
@rbnpi
rbnpi / dancingNotesOnDroneBass.rb
Created Apr 17, 2020
Sonic Pi dancing notes on a drone bass driven by OSC
View dancingNotesOnDroneBass.rb
#dancing notes on a bass drone,osc driven
#by Robin Newman,April 2020
#utilises a "synth" produced from ambi_glass_rub sample
use_osc "localhost",4560
use_osc_logging false
use_cue_logging false
use_debug false
use_bpm 40
use_sample_defaults start: 0.7,attack: 0,decay: 0.1,decay_level: 0.3,sustain: 0,release: 0.25
@rbnpi
rbnpi / FJcooperativeReceiver.rb
Last active Apr 16, 2020
Cooperative Frere Jaques. Two separate computers running Sonic Pi 3.2.2 play Frere Jaques using OSC see https://in-thread.sonic-pi.net/t/decoding-osc-data-and-example/3656
View FJcooperativeReceiver.rb
#frereJaques cooperation Receiver
#adjust IP address of computer to send to in following line
use_osc "192.168.1.150",4560 #send OSC commands to Sonic Pi port 4560
use_osc_logging false
use_cue_logging false
define :decodeSYML do |nl| #list of symbols in a string
nl[1..-2].split(",").map {|str| str.strip[1..-1].to_sym}
end
define :decodeFNL do |dl| #list of floating point numbers in a string
@rbnpi
rbnpi / SonicPiGPIO_README
Last active Mar 28, 2020
Sonic Pi 3.2.1 Controls Raspberry Pi GPIO pins
View SonicPiGPIO_README
These three files accompany a video on youtube illustrating Sonic Pi 3.2.1
running on a Raspberry Pi 3B+ conotrolling 5 LEDs connected to GPIO pins
using a python script incorporating an OSC server.
gpoiledsosc.py is a pythons cript which interacts with the 5 leds using the
gpiozero library. It incorporates an OSC server which looks for the incoming
osc message addressed to "/LedNum" This has two parameters. First a number between 0 and 4
which specifies which led to control, secondly a state which is 1 if the led is to be turned on
and 0 if it is to be turned off.
View ReadMe.md

These files comprise two versions of a midifileplayer for Sonic Pi version 3.0.1 or later. There are two versions.

File SPbasicMidiFilePlayer.rb is the basic version, where the synths used to play each channel in the midifile have to be specified in teh code before running the program in the form of a sonic pi ring. If this contains just a single synth e.g. (ring :saw) then each channel will use this synth. If two synths are specified eg (ring :rri) then midi channel 1 will use :saw, channel 2 :tri and then any further channel will use index into this ring and use in turn :saw, :tri,:saw,:tri This is set in line 38. Also specified at run time in the code is the attenuation level set by the fx :level wrapper in teh variable attenAmp set to 0.5 by default in line 40.

In the second more complicated vbesion, support is provided for an external TouchOSC interface which can be used to specify synth allocation on the fly as the program is running. and also to adjust the attenAmp setting in teh range 0.1 to 1 again

@rbnpi
rbnpi / ReadMe.md
Last active Jul 13, 2020
Beethoven Moonlight Sonata played by Sonic Pi. Uses Sonatina Symphonic Orchestra samples. See readme for availablilty. Video at https://youtu.be/8rdJ9wxGw5Y
View ReadMe.md

The Sonic Pi file moonlightSonata-RF.rb which plays Beethoven's Moonlight Sonata 1st Movement requires the use of the Grand Piano samples from the Sonatina Symphonic Orchestra produced by Matthias Westlund.

Unfortunately this is no longer available from his website https://sso.mattiaswestlund.net/ However there is an alternative available at https://github.com/peastman/sso from where you can download the library. It is coverd by a https://creativecommons.org/licenses/sampling+/1.0/ Download and expand on your Desktop, or other suitable location and then set the link in the program at line 9 appropraitely for your installation.

The file should be run using the run_file "/path/to/file/location" command as it is too long to run from a Sonic Pi buffer.

An alternative version using the built in piano synth in Sonic Pi is included for comparison.

You can’t perform that action at this time.