Hey.
First off, amazing project. Very fun. :)
However, might I suggest taking a look at turning the project into a CommonJS module to make it easy to integrate with other projects? I was looking in to using Beep in a small thing I've been thinking about doing for a while.
Seems like it should be pretty simple to do by just something like this to every file:
var BEEP = {
Note: require('./beep.note'),
Instrument: require('./beep.instrument'),
Voice: require('./beep.voice')
};
BEEP.Trigger = module.exports = function(){
It seems though like "main file": beep.js is hardcoded to expect an editor and stuff like that. Maybe that code should be moved to app.js so that Beep could be as "pure" as possible? IMO beep.js could be the trigger/instrument/voice registry only, as well as act as a module that exposes the other modules to third party code.
I'm thinking something like:
module.exports = {
Note: require('./beep.note'),
Instrument: require('./beep.instrument'),
Voice: require('./beep.voice'),
Trigger: require('./beep.trigger'),
AudioContext: window.AudioContext ? window.AudioContext : window.webkitAudioContext
// "Registry"
voices: [],
triggers: [],
instruments: [],
audioContext: null,
init: function () {
this.audioContext = new this.AudioContext();
}
destroy: function () { ... },
};
I wrote this straight here on GitHub and have only spent 15 minutes or so browsing the code so far. So this might (probably is) completely broken and misguided. However, it'd be very nice to have it be a clean module to make it super easy to integrate in other stuff! :)
Should you have no idea what I'm talking about: take a peek at Browserify. It's a very nice way of composing JavaScript modules!
Hey.
First off, amazing project. Very fun. :)
However, might I suggest taking a look at turning the project into a CommonJS module to make it easy to integrate with other projects? I was looking in to using Beep in a small thing I've been thinking about doing for a while.
Seems like it should be pretty simple to do by just something like this to every file:
It seems though like "main file":
beep.jsis hardcoded to expect an editor and stuff like that. Maybe that code should be moved toapp.jsso that Beep could be as "pure" as possible? IMObeep.jscould be thetrigger/instrument/voiceregistry only, as well as act as a module that exposes the other modules to third party code.I'm thinking something like:
I wrote this straight here on GitHub and have only spent 15 minutes or so browsing the code so far. So this might (probably is) completely broken and misguided. However, it'd be very nice to have it be a clean module to make it super easy to integrate in other stuff! :)
Should you have no idea what I'm talking about: take a peek at Browserify. It's a very nice way of composing JavaScript modules!