Created
April 22, 2011 16:45
-
-
Save weepy/937026 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////// SETUP ///////////////// | |
sleep = (time, fun) { setTimeout fun, time } | |
global.dawn = require("../node/bridge").load("../cpp/dawncontroller/dawncontroller") | |
global.__ = require "pipe_utils" | |
Units = require "./units" | |
Unit = Units.Unit | |
instruments = require "./instruments" | |
dawn.message_handler = (args) { | |
uid = args.shift(); cmd = args.shift() | |
unit = Units.Unit.all[uid] | |
cb = unit.callbacks[cmd] | |
cb | |
? cb.apply(unit, args) | |
: console.log "no callback: #{cmd} for #{uid}" | |
} | |
////////////////////////// | |
sm = new Units.USampleManager() | |
sm.load "../audio/sine-440.wav" | |
sm.load "../audio/ride.wav" | |
mx = new Units.UMixer | |
out = new Units.USoundOut | |
Unit.connect mx, "audio_out", out, "audio_in" | |
si = new instruments.SamplerInstrument { polyphony: 6 } | |
si.init sm, mx | |
si.bind "loaded", { | |
setInterval { | |
si.play 800 | |
sleep! 100 | |
si.play 700 | |
sleep! 100 | |
si.play 400 | |
sleep! 100 | |
si.play 1000 | |
si.play 800 | |
sleep! 100 | |
si.play 1700 | |
sleep! 200 | |
si.play 200 | |
sleep! 100 | |
si.play 100 | |
}, 2000 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nodejitsu is bi-coastal (NYC and SF). Our NYC offices are at General Assembly (http://generalassemb.ly), where I (and most of the team) is based.
Look forward to seeing what you've got going on with Dawn. Could be a really interesting language back-end for Celluloid :-D