Skip to content

jamesdabbs/tune_yard

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A simple SonicPi remote.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages