Skip to content

Instantly share code, notes, and snippets.

View xavriley's full-sized avatar

Xavier Riley xavriley

View GitHub Profile
@xavriley
xavriley / README.md
Created June 18, 2018 20:34
Sonic Pi Vocoder Prototype

Prototype of vocoder on Sonic Pi

Demo here: https://www.dropbox.com/s/qiktze3ml7bz5iq/autotune_the_shipping_forecast.wav?dl=0 Original voice input here: https://soundcloud.com/jb_uk/neil-nunes-bbc-radio-4-and

This is a demo of a simple effects synth using the Vocoder.ar UGen from SuperCollider. This is a fairly primitive vocoder implementation made of a bunch of bandpass filters which are "tuned" to various frequencies.

The results are mixed, but it's difficult to get a decent reproduction of the words from this.

To get T-Pain/Imogen Heap style auto-tune it would be necessary to write a different algorithm probably using a technique called PSOLA which is described at the following links:

@xavriley
xavriley / README.md
Last active March 23, 2018 10:08
Gossip with Xbees

Gossip protocol with XBee and Arduino - Personal Report

Early on in the project we decided to divide some of the requirements from the specification between ourselves. Mirela and I looked at implementing the Gossip algorithm in parallel to the work that Luis was doing on wiring the sensors and transferring the sensor data.

The first stage was to write some pseudo-code outlining the stages of the gossip algorithm. This was done in discussion with Mirela while looking over the paper and other resources we had available. This was important to gain understanding of the key steps.

Initially we decided to try implementing half of the algorithm each with me taking the broadcasting phase and Mirela implementing the receiving phase. Given that I had marginally more experience working with C we later revised these so that I handled both parts of the implementation to allow Mirela to focus on other deliverables.

The Code

@xavriley
xavriley / README.md
Created December 4, 2017 08:53
Sonic Pi on Docker on Heroku research

locally:

developer@5b0666c5c640:~$ jackd -r -t 100000  -d dummy -r 44100
jackd 0.124.1
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
@xavriley
xavriley / wavetable_stuff.sc
Created November 13, 2017 08:20
SuperCollider wavetable experiments for Sonic Pi
s.boot
// BEGIN code to convert AKWF wavetables from 600 samples in length to 1024
// because VOsc3 needs a buffer which is a power of two to work properly
// this pipes in stdout from ls
(
var p, l;
p = Pipe.new("find ~/Projects/sonic-pi/etc/wavetables/AKWF/AKWF_0001 -iname *.wav", "r"); // list directory contents in long format
l = p.getLine; // get the first line
@xavriley
xavriley / README.md
Last active November 3, 2017 15:14
Sonic Pi timing demo in Opal Ruby
@xavriley
xavriley / dont_drop_the_bass.rb
Created July 8, 2017 20:38
Don't Drop the Bass - Source code with comments - Brighton Ruby 2017
# ❤️ Brighton Ruby
# This code uses some features from the pre-release of Sonic Pi,
# due out later this month (touch wood!).
# If you just can't wait for the release but want to try it yourself
# you can either build the Sonic Pi master branch from source (pros: free, cons: hard)
# or share some love and contribute to the Patreon page to support Sonic Pi's development
# https://www.patreon.com/samaaron
# That will give to access to the latest pre-release versions
@xavriley
xavriley / live_sample.rb
Created July 8, 2017 20:20
live_sample definition for Sonic Pi v2.13 and above
# place in ~/.sonic-pi/init.rb to autoload
def live_sample(name=nil, *args)
raise ArgumentError, "live_sample needs to have a unique name. For example: live_sample :foo" unless name
raise ArgumentError, "live_sample's name needs to be a string or symbol, got: #{name.inspect}. Example usage: live_sample :foo" unless (name.is_a?(Symbol) || name.is_a?(String))
ls_name = "live_sample_#{name}".to_sym
args_h = resolve_synth_opts_hash_or_array(args)
click = args_h[:click] || 4
dur = args_h[:dur]
@xavriley
xavriley / harmonizer_idea.rb
Created May 21, 2017 21:16
with_harmony sketch for Sonic Pi
s = scale(:c5, :blues_major, num_octaves: 1)
live_loop :foo do
n = s.choose
c = Array(s.index(n)).flat_map {|x|
[x-6, x-4, x-2, x]
}
play s.values_at(*c), release: 0.1
sleep 0.25
end
@xavriley
xavriley / rhythm_ladder.rb
Created May 21, 2017 20:43
Rhythm ladder in Sonic Pi
use_bpm 100
live_loop :ladder do
bars = 2
no_of_beats = [1, 1.5, 2, 3, 4].map {|x|
[x, (4 * x.to_f)*bars]
}.flatten
count = (knit *no_of_beats).tick
sample :elec_tick
@xavriley
xavriley / README.md
Last active July 29, 2016 16:14
LADSPA Plugin progress report - bringing LADSPA to Sonic Pi

#LADSPA Plugin progress report - bringing LADSPA to Sonic Pi

Rationale

The LMMS project have managed to package over 250 LADSPA plugins for all the main platforms. In that 250 there are many high quality fx and synths that are otherwise unavailable as SuperCollider extenstions in any other form. A few of the ones that motivate me are: