Skip to content

Instantly share code, notes, and snippets.

View RBilsland's full-sized avatar

Robert Bilsland RBilsland

  • Worcestershire, England
View GitHub Profile
@RBilsland
RBilsland / Sonic Pi - Instrument Bank
Last active April 22, 2016 13:43
A Ruby class (and example of use) for Sonic Pi. The Instrument Bank class allows multiple samples of an instrument playing different notes to be loaded and then by changing the rate of playback to allow a wide range of notes to be produced.
#Set a couple of system settings
set_sched_ahead_time! 1
use_debug false
#Class for playing a single note
class SingleNote
def initialize(sonic_pi, sample, rate, distance, options_hash)
@sonic_pi = sonic_pi
@sample = sample
@rate = rate