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

I hadn't seen Chuck, but it looks interesting. It doesn't align with the design goals of celluloid though. The major design goal was to "make both simple and complex media composition operations more comprehensible to the author." I wanted to create a sequencing language that more novice programmers (i.e. real musicians and performers) could use without a total disconnect.

Would be really interested in playing around with your C++ audio engine. The Nodejitsu team has done some work in this area, although I didn't have a chance to play with it yet:

https://github.com/marak/jsonloops
https://github.com/tmpvar/node-irrklang

@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