Project

tune_yard

0.0
No commit activity in last 3 years
No release in over 3 years
A simple remote for SonicPi
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

~> 0.21
~> 0.5
 Project Readme

TuneYard

With immense respect to tUnE-yArDs

TuneYard is a gem to allow remote interaction with SonicPi (outside of the built-in SonicPi IDE).

Big Disclaimer: this is built on some undocumented SonicPi internals which could very well break. It is sufficient for my somewhat limited purposes (namely, a SonicPi + Camping class project at The Iron Yard), but has only been tested in that context (namely, OSX 10.10, Ruby 2.1, and SonicPi 2.2). Please let me know if you are interested in using this elsewhere; I'd love some motivation to help properly extract SonicPi to a gem.

Installation

Be sure you have installed SonicPi. If it is installed to a non-default location, you may need to specify where to look for the bundled Ruby files:

$LOAD_PATH.unshift '/path/to/sonic pi/app/server'
require 'tune_yard'

Usage

Play some boops

TuneYard.play do
  with_fx :reverb, mix: 0.2 do
    loop do
      play scale(:Eb2, :major_pentatonic, num_octaves: 3).choose, release: 0.1, amp: rand
      sleep 0.1
    end
  end
end

With a little violencemetaprogramming, the play function should close over properly. Warning: there be dragons here.

def rate
  rrand 0.125, 1.5
end
delay = 0.25

TuneYard.play for: 2 do
  loop do
    sample :perc_bell, rate: rate
    sleep delay
  end
end