Skip to content

Instantly share code, notes, and snippets.

@weepy
Created April 22, 2011 16:45
Show Gist options
  • Save weepy/937026 to your computer and use it in GitHub Desktop.
Save weepy/937026 to your computer and use it in GitHub Desktop.
////////////// 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
}
@weepy
Copy link
Author

weepy commented Apr 22, 2011 via email

@indexzero
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment