var amenPlayer = function(context, effects) {
    var queueTime = 0;
    var currentlyQueued = new Array();
    var onPlayCallback = null;
    var afterPlayCallback = null;
    var currentTriggers = new Array();

    var audioGain = context.createGain();
    audioGain.gain.value = 1;

    // Connect effects
    effects = effects || [];
    effects.unshift(audioGain);
    for (var i = 0; i < effects.length -1; i++) {
        effects[i].connect(effects[i + 1]);
    }
    effects[i].connect(context.destination);

    // create the the actual player object that we get
    var player = {
        play: function(when, q) {
            return queuePlay(when, q);
        },

        addOnPlayCallback: function(callback) {
            onPlayCallback = callback;
        },

        addAfterPlayCallback: function(callback) {
            afterPlayCallback = callback;
        },

        // Do I need both this and play?  I sort of thing so ...
        queue: function(q) {
            var now = context.currentTime;
            if (now > queueTime) {
                queueTime = now;
            }
            queueTime = queuePlay(queueTime, q);
        },

        queueRest: function(duration) {
            queueTime += duration;
        },

        stop: function() {
            for (var i = 0; i < currentlyQueued.length; i++) {
                if (currentlyQueued[i] != null) {
                    currentlyQueued[i].stop();
                }
            }
            currentlyQueued = new Array();

            if (currentTriggers.length > 0) {
                for (var j = 0; j < currentTriggers.length; j++) {
                    clearTimeout(currentTriggers[j]);
                }
                currentTriggers = new Array();
            }
        },

        curTime: function() {
            return context.currentTime;
        },
    }; // end player declaration

    function isQuantum(a) {
        return 'start' in a && 'duration' in a;
    }

    function isAudioBuffer(a) {
        return 'getChannelData' in a;
    }

    function isSilence(a) {
        return 'isSilence' in a;
    }

    // private ugly thing for actually doing playback
    function queuePlay(when, q) {
        audioGain.gain.value = 1;

        if (isAudioBuffer(q) || isQuantum(q)) {
            playBuffer(when, q);

            // Ah, this was for playing two things at once, for cowbell.js
            if ('syncBuffer' in q) {
                var audioSyncSource = context.createBufferSource();
                audioSyncSource.buffer = q.syncBuffer;
                audioSyncSource.connect(audioGain);
                currentlyQueued.push(audioSyncSource);
                audioSyncSource.start(when);
            }

            processCallbacks(when, q);
            return when + parseFloat(q.duration);

        } else if (Array.isArray(q)) {
            // Correct for load times
            if (when == 0) {
                when = context.currentTime;
            }
            for (var i = 0; i < q.length; i++) {
                when = queuePlay(when, q[i]);
            }
            return when;
        } else if (isSilence(q)) {
            return (when + parseFloat(q.duration));
        }
        else {
            console.error('cannot play ' + q);
            return when;
        }
    } // end queuePlay

    function processCallbacks(when, q) {
        var theTime = context.currentTime;
        if (onPlayCallback != null) {
            theTime = (when - context.currentTime) *  1000;
            currentTriggers.push(setTimeout(onPlayCallback, theTime));
        }

        if (afterPlayCallback != null) {
            theTime = (when - context.currentTime + parseFloat(q.duration)) *  1000;
            currentTriggers.push(setTimeout(afterPlayCallback, theTime));
        }
    }

    function playBuffer(when, q) {
        var audioSource = context.createBufferSource();
        audioSource.connect(audioGain);
        currentlyQueued.push(audioSource);
        if (isQuantum(q)) {
            audioSource.buffer = q.track.buffer;
            audioSource.start(when, q.start, q.duration);
        } else {
            audioSource.buffer = q;
            audioSource.start(when);
        }
    }


    return player;
};

exports.amenPlayer = amenPlayer;

@@ -1879,825 +1879,276 @@
 on%0A%0A
-    function isQuantum(a) %7B%0A        return 'start' in a && 'duration' in a;%0A    %7D%0A%0A    function isAudioBuffer(a) %7B%0A        return 'getChannelData' in a;%0A    %7D%0A%0A    function isSilence(a) %7B%0A        return 'isSilence' in a;%0A    %7D%0A%0A    // private ugly thing for actually doing playback%0A    function queuePlay(when, q) %7B%0A        audioGain.gain.value = 1;%0A%0A        if (isAudioBuffer(q) %7C%7C isQuantum(q)) %7B%0A            playBuffer(when, q);%0A%0A            // Ah, this was for playing two things at once, for cowbell.js%0A            if ('syncBuffer' in q) %7B%0A                var audioSyncSource = context.createBufferSource();%0A                audioSyncSource.buffer = q.syncBuffer;%0A                audioSyncSource.connect(audioGain);%0A                currentlyQueued.push(audioSyncSource);%0A                audioSyncSource.start
+%0A    // Master function for doing playback%0A    function queuePlay(when, q) %7B%0A        audioGain.gain.value = 1;%0A%0A        if (isAudioBuffer(q) %7C%7C isQuantum(q)) %7B%0A            playBuffer(when, q);%0A            if ('syncBuffer' in q) %7B%0A                playSyncBuffer
 (when
+, q
 );%0A 
@@ -2152,33 +2152,32 @@
 ;%0A            %7D%0A
-%0A
             proc
@@ -2540,32 +2540,33 @@
    return when;%0A
+%0A
         %7D else i
@@ -2767,16 +2767,62 @@
 uePlay%0A%0A
+    // Various helper functions for queuePlay%0A
     func
@@ -3307,34 +3307,33 @@
 unction 
-play
+load
 Buffer(
-when, q
+buffer
 ) %7B%0A    
@@ -3467,16 +3467,148 @@
 ource);%0A
+        audioSource.buffer = buffer;%0A        return audioSource;%0A    %7D%0A%0A    function playBuffer(when, q) %7B%0A        var audioSource;%0A
         
@@ -3650,26 +3650,30 @@
 ioSource
-.b
+ = loadB
 uffer
- = 
+(
 q.track.
@@ -3674,24 +3674,25 @@
 track.buffer
+)
 ;%0A          
@@ -3783,67 +3783,431 @@
 urce
-.buffer = q;%0A            audioSource.start(when);%0A        %7D
+ = loadBuffer(q);%0A            audioSource.start(when);%0A        %7D%0A    %7D%0A%0A    function playSyncBuffer(when, q) %7B%0A        var audioSource = loadBuffer(q.syncBuffer);%0A        audioSource.start(when);%0A    %7D%0A%0A    function isQuantum(a) %7B%0A        return 'start' in a && 'duration' in a;%0A    %7D%0A%0A    function isAudioBuffer(a) %7B%0A        return 'getChannelData' in a;%0A    %7D%0A%0A    function isSilence(a) %7B%0A        return 'isSilence' in a;
 %0A   

Clean up those if statements