!function t(e,n,r){function i(u,a){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[u]={exports:{}};e[u][0].call(l.exports,function(t){var n=e[u][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;ue;e++)t[e]=1;return t}(),u=0,a=1,s=2;i.inherits(n,r.Component),n.$$name="NeuDC",n.prototype.toAudioNode=function(){var t=this._value;if(null===this._outlet&&0!==t){var e,r,i,u=this.context;1===t?(e=u.createBuffer(1,o.length,u.sampleRate),e.getChannelData(0).set(o),r=u.createBufferSource(),r.buffer=e,r.loop=!0,r.start(0),this._bufSrc=r,this._state=a,this._outlet=r):(r=new n(u,1).toAudioNode(),i=u.createGain(),i.gain.value=t,r.connect(i),this._outlet=i)}return this._outlet},n.prototype.connect=function(t){return t instanceof r.webaudio.AudioParam?t.value=this._value:this.context.connect(this.toAudioNode(),t),this},n.prototype.disconnect=function(){return this.stop(this.context.currentTime),this.context.disconnect(this._outlet),this},n.prototype.stop=function(t){return this._state===a&&(this._bufSrc.stop(i.finite(t)),this._state=s),this},n.prototype.valueOf=function(){return this._value},e.exports=r.DC=n},{"../namespace":21,"../util":54,"./component":2}],4:[function(t){t("./component"),t("./dc"),t("./mul"),t("./param"),t("./sum")},{"./component":2,"./dc":3,"./mul":5,"./param":6,"./sum":7}],5:[function(t,e){"use strict";function n(t,e,n){if(e=e.valueOf(),n=n.valueOf(),"number"==typeof e&&"number"==typeof n)return new r.DC(t,e*n);if(r.Component.call(this,t),"number"==typeof e){var i=e;e=n,n=i}return 0===n?new r.DC(t,0):1===n?new r.Component(t,e):(this._a=e,void(this._b=n))}var r=t("../namespace");t("./component");var i=t("../util");i.inherits(n,r.Component),n.$$name="NeuMul",n.prototype.mul=function(t){return t=t.valueOf(),"number"==typeof this._b&&"number"==typeof t?new r.Mul(this.context,this._a,i.finite(this._b*t)):new r.Mul(this.context,this.toAudioNode(),t)},n.prototype.toAudioNode=function(){return null===this._outlet&&(this._outlet=this.context.createGain(),this._outlet.gain.value=0,this.context.connect(this._a,this._outlet),this.context.connect(this._b,this._outlet.gain)),this._outlet},n.prototype.connect=function(t){return this.context.connect(this.toAudioNode(),t),this},n.prototype.disconnect=function(){return this.context.disconnect(this._outlet),this},e.exports=r.Mul=n},{"../namespace":21,"../util":54,"./component":2}],6:[function(t,e){"use strict";function n(t,e,n){n=n||{},c.Component.call(this,t),this._value=l.finite(e),this._params=[],this._events=[],this._curve=n.curve,this._lag=l.defaults(n.lag,0),this._scheduled=null}function r(t,e,n){var r=t._scheduled;null==r||r.time<=n||(t.cancelScheduledValues(r.time),t[r.method](e,n))}function i(t,e){var n,r,i=e.time,o=t._events,u=0;for(n=0,r=o.length;r>n;++n){if(o[n].time===i&&o[n].type===e.type){u=1;break}if(o[n].time>i)break}o.splice(n,u,e)}function o(t,e,n,r,i,o){var u=(r-i)/(o-i);return(1-u)*e+u*n}function u(t,e,n,r,i,o){var u=(r-i)/(o-i);return e>0&&n>0?e*Math.pow(n/e,u):t}function a(t,e,n,r,i){return e+(t-e)*Math.exp((r-n)/i)}function s(t,e,n,r,i){var o=(e-n)/(r-n);return 0>=o?l.defaults(i[0],t):o>=1?l.defaults(i[i.length-1],t):l.defaults(i[i.length*o|0],t)}var c=t("../namespace");t("./component");var l=t("../util");l.inherits(n,c.Component),n.$$name="NeuParam",Object.defineProperties(n.prototype,{events:{get:function(){return this._events.slice()},enumerable:!0},value:{set:function(t){t=l.finite(t);var e=this._params;this._value=t;for(var n=0,r=e.length;r>n;n++)e[n].value=t},get:function(){return this._params.length?this._params[0].value:this._value},enumerable:!0}}),n.prototype.valueAtTime=function(t){t=l.finite(this.context.toSeconds(t));for(var e,n=this._value,r=this._events,i=0;ir;r++)n[r].setValueAtTime(t,e);return i(this,{type:"SetValue",value:t,time:e}),this},n.prototype.setValueAtTime=n.prototype.setAt,n.prototype.linTo=function(t,e){t=l.finite(t),e=l.finite(this.context.toSeconds(e));for(var n=this._params,r=0,o=n.length;o>r;r++)n[r].linearRampToValueAtTime(t,e);return i(this,{type:"LinearRampToValue",value:t,time:e}),this},n.prototype.linearRampToValueAtTime=n.prototype.linTo,n.prototype.expTo=function(t,e){t=l.finite(t),e=l.finite(this.context.toSeconds(e));for(var n=this._params,r=0,o=n.length;o>r;r++)n[r].exponentialRampToValueAtTime(t,e);return i(this,{type:"ExponentialRampToValue",value:t,time:e}),this},n.prototype.exponentialRampToValueAtTime=n.prototype.expTo,n.prototype.targetAt=function(t,e,n){t=l.finite(t),e=l.finite(this.context.toSeconds(e)),n=l.finite(this.context.toSeconds(n));for(var r=this._params,o=0,u=r.length;u>o;o++)r[o].setTargetAtTime(t,e,n);return i(this,{type:"SetTarget",value:t,time:e,timeConstant:n}),this},n.prototype.setTargetAtTime=n.prototype.targetAt,n.prototype.curveAt=function(t,e,n){e=l.finite(this.context.toSeconds(e)),n=l.finite(this.context.toSeconds(n));for(var r=this._params,o=0,u=r.length;u>o;o++)r[o].setValueCurveAtTime(t,e,n);return i(this,{type:"SetValueCurve",time:e,duration:n,curve:t}),this},n.prototype.setValueCurveAtTime=n.prototype.curveAt,n.prototype.cancel=function(t){t=l.finite(this.context.toSeconds(t));var e,n,r=this._params,i=this._events;for(e=0,n=r.length;n>e;e++)r[e].cancelScheduledValues(t);for(e=0,n=i.length;n>e;++e)if(i[e].time>=t){i.splice(e);break}return this},n.prototype.cancelScheduledValues=n.prototype.cancel,n.prototype.update=function(t,e,n){var i=this.context,o=e+l.finite(i.toSeconds(l.defaults(n,this._lag,0))),u=this.valueAtTime(e),a=this._curve,s=null;switch(r(this,u,e),e>=o&&(a="step"),a){case"exp":case"exponential":this.setValueAtTime(Math.max(1e-6,u),e),this.exponentialRampToValueAtTime(Math.max(1e-6,t),o),s={method:"exponentialRampToValueAtTime",time:o};break;case"lin":case"linear":this.setValueAtTime(u,e),this.linearRampToValueAtTime(t,o),s={method:"linearRampToValueAtTime",time:o};break;default:this.setValueAtTime(t,e)}return this._scheduled=s,this},n.prototype.toAudioNode=function(t){var e=this.context;return null==this._outlet&&(this._outlet=e.createGain(),this._outlet.gain.value=this._value,this._params.push(this._outlet.gain),t?e.connect(t,this._outlet):e.connect(new c.DC(e,1),this._outlet)),this._outlet},n.prototype.connect=function(t){return t instanceof c.webaudio.AudioParam?(t.value=this._value,this._params.push(t)):this.context.connect(this.toAudioNode(),t),this},n.prototype.disconnect=function(){return this.context.disconnect(this._outlet),this},e.exports=c.Param=n},{"../namespace":21,"../util":54,"./component":2}],7:[function(t,e){"use strict";function n(t,e){r.Component.call(this,t);var n=0,o=!1,u=null,a=[];e=i.flatten(e);for(var s=0,c=e.length;c>s;s++){var l=e[s].valueOf();"number"==typeof l?(n+=i.finite(l),o=!0):!u&&l instanceof r.Param?u=l:a.push(l)}return 0===a.length?u?u:new r.DC(t,n):0===n&&null===u&&1===a.length?new r.Component(t,a[0]):(this._hasNumber=o,this._number=n,this._param=u,this._nodes=a,void(this._inputs=e))}var r=t("../namespace");t("./component");var i=t("../util");i.inherits(n,r.Component),n.$$name="NeuSum",n.prototype.add=function(t){return new r.Sum(this.context,this._inputs.concat(t))},n.prototype.toAudioNode=function(){if(null===this._outlet){for(var t=this.context,e=this._nodes,n=t.createGain(),r=0,i=e.length;i>r;r++)t.connect(e[r],n);this._param&&t.connect(this._param,n),this._number&&t.connect(this._number,n),this._outlet=n}return this._outlet},n.prototype.connect=function(t){for(var e=this.context,n=this._number,i=this._param,o=this._nodes,u=0,a=o.length;a>u;u++)e.connect(e.toAudioNode(o[u]),t);return i?(e.connect(i,t),0!==n&&e.connect(new r.DC(e,n).toAudioNode(),t)):0!==n&&e.connect(n,t),this},n.prototype.disconnect=function(){return this.context.disconnect(this._inputs),this},e.exports=r.Sum=n},{"../namespace":21,"../util":54,"./component":2}],8:[function(t,e){"use strict";e.exports={DC_BUF_SIZE:128,WS_CURVE_SIZE:4096,MAX_RENDERING_SEC:180,MAX_DELAY_SEC:180,DEFAULT_MAX_NODES_OF_BUS:64}},{}],9:[function(t,e){"use strict";function n(t,e){e=0|o.finite(e),this._outlet=t.createGain(),this._maxNodes=i.DEFAULT_MAX_NODES_OF_BUS,this._inputs=[],Object.defineProperties(this,{context:{value:t,enumerable:!0},index:{value:e,enumerable:!0},maxNodes:{set:function(t){this._maxNodes=Math.max(0,o.int(t))},get:function(){return this._maxNodes},enumerable:!0},nodes:{get:function(){return this._inputs.slice()},enumerable:!0}})}var r=t("../namespace"),i=t("../const"),o=t("../util");n.$$name="NeuAudioBus",n.prototype.append=function(t){return this.context.connect(t.toAudioNode(this.index),this._outlet),this._inputs.push(t),this._maxNodesr;++r)t[r]*=n;return t}function u(t){for(var e=0,n=0,r=t.length;r>n;++n){var i=Math.abs(t[n]);i>e&&(e=i)}return e}function a(t,e,n){return t.length===e?new Float32Array(t):n?c(t,e):s(t,e)}function s(t,e){for(var n=(t.length-1)/(e-1),r=new Float32Array(e),i=0;e>i;i++)r[i]=t[Math.round(i*n)];return r}function c(t,e){for(var n=(t.length-1)/(e-1),r=new Float32Array(e),i=t.length-1,o=0;e>o;o++){var u=o*n,a=0|u,s=Math.min(a+1,i);r[o]=t[a]+Math.abs(u-a)*(t[s]-t[a])}return r}var l=t("../namespace"),f=t("../util"),h=t("../util/fft");n.$$name="NeuBuffer",n.create=function(t,e,r,i){return e=f.int(f.defaults(e,1)),r=f.int(f.defaults(r,0)),i=f.int(f.defaults(i,t.sampleRate)),new n(t,t.createBuffer(e,r,i))},n.from=function(t){for(var e=f.toArray(arguments).slice(1),r=e.length,i=e.reduce(function(t,e){return Math.max(t,e.length)},0),o=t.createBuffer(r,i,t.sampleRate),u=0;r>u;u++)o.getChannelData(u).set(e[u]);return new n(t,o)},n.load=function(t,e){return new Promise(function(o,u){r(e).then(function(e){return i(t,e)}).then(function(e){o(new n(t,e))}).catch(function(t){u(t)})})},n.prototype.getChannelData=function(t){return t=f.clip(f.int(t),0,this.numberOfChannels-1),this._buffer.getChannelData(t)},n.prototype.concat=function(){var t=f.toArray(arguments).filter(function(t){return t instanceof n&&this.numberOfChannels===t.numberOfChannels},this),e=this.numberOfChannels,r=t.reduce(function(t,e){return t+e.length},this.length),i=this.sampleRate,o=this.context.createBuffer(e,r,i);t.unshift(this);for(var u=t.length,a=0;e>a;a++)for(var s=o.getChannelData(a),c=0,l=0;u>l;l++)s.set(t[l][a],c),c+=t[l].length;return new n(this.context,o)},n.prototype.reverse=function(){for(var t=this.numberOfChannels,e=this.context.createBuffer(t,this.length,this.sampleRate),r=0;t>r;r++)e.getChannelData(r).set(f.toArray(this[r]).reverse());return new n(this.context,e)},n.prototype.slice=function(t,e){t=f.int(f.defaults(t,0)),e=f.int(f.defaults(e,this.length)),0>t?t+=this.length:t=Math.min(t,this.length),0>e?e+=this.length:e=Math.min(e,this.length);var r=this.numberOfChannels,i=e-t,o=this.sampleRate,u=null;if(0>=i)u=this.context.createBuffer(r,1,o);else{u=this.context.createBuffer(r,i,o);for(var a=0;r>a;a++)u.getChannelData(a).set(this[a].subarray(t,e))}return new n(this.context,u)},n.prototype.split=function(t){if(t=f.int(f.defaults(t,2)),0>=t)return[];for(var e=new Array(t),n=this.length/t,r=0,i=0,o=0;t>o;o++)i=Math.round(r+n),e[o]=this.slice(r,i),r=i;return e},n.prototype.normalize=function(){for(var t=this.numberOfChannels,e=this.context.createBuffer(t,this.length,this.sampleRate),r=0;t>r;r++)e.getChannelData(r).set(o(this[r]));return new n(this.context,e)},n.prototype.resample=function(t,e){t=Math.max(0,f.int(f.defaults(t,this.length))),e=!!f.defaults(e,!0);for(var r=this.numberOfChannels,i=this.context.createBuffer(r,t,this.sampleRate),o=0;r>o;o++)i.getChannelData(o).set(a(this[o],t,e));return new n(this.context,i)},n.prototype.toAudioBuffer=function(){return this._buffer},n.prototype.toPeriodicWave=function(t){t=f.clip(f.int(t),0,this.numberOfChannels-1);var e=this._buffer.getChannelData(t);4096o;o++)if(tn;n++)if(t===e[n].id){e.splice(n,1);break}return t},NeuTransport.prototype.nextTick=function(t,e){return this._nextTicks.push(t.bind(e||this)),this},NeuTransport.prototype.toSeconds=function(value){if("number"==typeof value)return util.finite(value);if(value&&"number"==typeof value.playbackTime)return util.finite(value.playbackTime);if("string"==typeof value){var m,offset=0,time=0;"+"===value.charAt(0)&&(offset=this.currentTime,value=value.slice(1));var components=value.split(/[\(\)\-\+\/\*]/);if(components.length>1){for(var oringalTime=value,expr=value,i=0,imax=components.length;imax>i;i++){var symb=components[i].trim();""!==symb&&(expr=expr.replace(symb,this.toSeconds(symb)))}try{time=eval(expr)}catch(e){throw new EvalError("Invalid Time Value Syntax: "+oringalTime)}}else{if("now"===value)return this.currentTime;time=null!==(m=/^(\d+)ms$/.exec(value))?.001*+m[1]:null!==(m=/^(\d+(?:\.\d+)?)hz$/.exec(value))?util.finite(1/+m[1]):null!==(m=/^(\d+)ticks$/.exec(value))?ticks2sec(+m[1],this._bpm):null!==(m=/^(\d+)(n[td]?)$/.exec(value))?note2sec(+m[1],m[2],this._bpm):null!==(m=/^(\d+)\.(\d+)\.(\d+)$/.exec(value))?ticks2sec(480*(4*+m[1]+ +m[2])+ +m[3],this._bpm):null!==(m=/^(\d\d):(\d\d):(\d\d)(?:\.(\d+))?$/.exec(value))?3600*+m[1]+60*+m[2]+ +m[3]+.001*((m[4]||"")+"000").substr(0,3):null!==(m=/^(\d+)samples$/.exec(value))?+m[1]/this.sampleRate:util.finite(+value)}return time+offset}return value},module.exports=neume.Transport=NeuTransport},{"../const":8,"../namespace":21,"../util":54,"./timer":18}],20:[function(t,e){e.exports=t("./core/neume")},{"./core/neume":16}],21:[function(t,e){"use strict";function n(){return n.impl.apply(null,arguments)}n.version="0.9.0",e.exports=n},{}],22:[function(t,e){"use strict";function n(t){Object.defineProperties(this,{context:{value:this,enumerable:!0},audioContext:{value:t.audioContext,enumerable:!0},sampleRate:{value:t.sampleRate,enumerable:!0}}),this._context=t,this._nodes=[]}var r=t("../namespace");t("../core/context");var i=t("../util");i.inherits(n,r.Context),n.$$name="NeuSynthContext",n.prototype.start=function(){return this._context.start(),this},n.prototype.stop=function(){return this._context.stop(),this},n.prototype.reset=function(){return this._context.reset(),this},n.prototype.sched=function(t,e,n){return this._context.sched(t,e,n)},n.prototype.unsched=function(t){return this._context.unsched(t)},n.prototype.nextTick=function(t,e){return this._context.nextTick(t,e),this},n.prototype.getAudioBus=function(t){return this._context.getAudioBus(t)},n.prototype.toSeconds=function(t){return this._context.toSeconds(t)},e.exports=r.SynthContext=n},{"../core/context":15,"../namespace":21,"../util":54}],23:[function(t,e){"use strict";function n(t){function e(){var e,r,s=u.toArray(arguments),c=s.shift(),l=u.isPlainObject(s[0])?s.shift():{},f=s;if("string"==typeof c){if("@"===c.charAt(0))return c=c.substr(1),i(c,l,f);if("#"===c.charAt(0))return c=c.substr(1),e=a[c]||n.find({id:c})[0],null==e&&(e=new o.UGenPromise(t,c),a[c]=e),e}return e=o.UGen.build(t,c,l,f),e.id&&(r=a[e.id],r&&r.resolve(e),a[e.id]=null),n.append(e),e }var n=new o.DB,i=r(t),a={};e.timeout=function(t){return{next:function(){return{value:t,done:!0}}}},e.interval=function(t){return{next:function(){return{value:t,done:!1}}}},e.stop=function(e){t.context.sched(t.context.toSeconds(e),function(e){t.stop(e)})},e.inputs=[],this.db=n,this.builder=e}function r(t){var e={};return function(n,r,a){if(e.hasOwnProperty(n))return e[n];i(n);var s=u.finite(u.defaults(r.value,0)),c=new o.Param(t.context,s,r);Object.defineProperty(t,n,{value:c,enumerable:!0});var l;return a.length?(l=o.UGen.build(t,"+",r,[a]),l=o.UGen.build(t,"+",{mul:c},[l])):l=o.UGen.build(t,"+",r,[c]),e[n]=l,l}}function i(t){if(!/^[a-z]\w*$/.test(t))throw new TypeError(u.format("invalid parameter name: #{name}",{name:t}))}var o=t("../namespace");t("../component/param"),t("./ugen"),t("./ugen-promise");var u=t("../util");e.exports=o.SynthDollar=n},{"../component/param":6,"../namespace":21,"../util":54,"./ugen":28,"./ugen-promise":27}],24:[function(t){t("./dollar"),t("./synth"),t("./ugen"),t("./unit")},{"./dollar":23,"./synth":26,"./ugen":28,"./unit":29}],25:[function(t,e){"use strict";function n(t){var e=i.exec(t);return!!e&&e[0]===t}function r(t){t=String(t);var e={key:"",id:null,classes:[]},n=t.match(i);n&&(e.key=n[0],t=t.substr(e.key.length));var r=t.match(/[.#][a-zA-Z](-?[a-zA-Z0-9]+)*/g);return r&&r.forEach(function(t){var n=t.charAt(0);"#"===n?e.id||(e.id=t.substr(1)):e.classes.push(t.substr(1))}),e}var i=/^([a-zA-Z](-?[a-zA-Z0-9]+)*!?\??~?|[-+*\/%<=>!?&|]+~?)/;e.exports={isValidUGenName:n,parse:r}},{}],26:[function(t,e){"use strict";function n(t,e,n){a.call(this),t=new i.SynthContext(t),Object.defineProperties(this,{context:{value:t,enumerable:!0}});var u=new i.SynthDollar(this);this.builder=u.builder,this.__scheds=[],this.__nodes=[];var s=new i.Param(t,1,{curve:"lin"}),f=e.apply(this,[u.builder].concat(n));f&&f.toAudioNode&&!f.isOutput&&this._dispatchNode(f,0),this._nodes=this.__nodes.map(function(e){var n=t.createGain();return t.connect(e,n),t.connect(s,n.gain),n}),this.__nodes=null,this._scheds=this.__scheds.map(function(e){return new i.Sched(t,e[0],e[1])}),this.__scheds=null,this._db=this._nodes.length?u.db:c,this._state=l,this._param=s;var h=r(this._db).filter(function(t){return!this.hasOwnProperty(t)},this).sort();h.forEach(function(t){Object.defineProperty(this,t,{value:function(){var e=o.toArray(arguments);return this._db.all().forEach(function(n){"function"==typeof n[t]&&n[t].apply(n,e)}),this},enumerable:!1})},this),Object.defineProperties(this,{methods:{get:function(){return h.slice()},enumerable:!0}})}function r(t){var e={};return t.all().forEach(function(t){t.methods.forEach(function(t){e[t]=!0})}),Object.keys(e).sort()}var i=t("../namespace");t("./dollar"),t("./context");var o=t("../util"),u=t("../util/db"),a=t("../util/emitter"),s=t("./parser"),c=new u,l=0,f=1,h=2;o.inherits(n,a),n.$$name="NeuSynth",n.prototype.hasClass=function(t){return this._db.all().some(function(e){return e.hasClass(t)})},n.prototype.query=function(t){var e=this._db.find(s.parse(t));return["on","once","off","hasClass","trig"].concat(this.methods).forEach(function(t){e[t]=function(){var n=o.toArray(arguments);return e.forEach(function(e){"function"==typeof e[t]&&e[t].apply(e,n)}),e}}),e},n.prototype.start=function(t){if(this._state!==l)return this;var e=this.context;return t=o.defaults(e.toSeconds(t),e.currentTime),t=o.finite(t),this._state=f,e.sched(t,function(n){this._nodes.forEach(function(t,n){e.getAudioBus(n).append(this)},this),this._db.all().concat(this._scheds).forEach(function(t){t.start(n)}),this.emit("start",{type:"start",playbackTime:t})},this),e.start(),this},n.prototype.stop=function(t){if(this._state!==f)return this;var e=this.context;return t=o.defaults(e.toSeconds(t),e.currentTime),t=o.finite(t),this._state=h,e.sched(t,function(t){this._nodes.forEach(function(t,n){e.getAudioBus(n).remove(this)}),e.nextTick(function(){e.dispose()}),this._db.all().concat(this._scheds).forEach(function(e){e.stop(t)}),this.emit("stop",{type:"stop",playbackTime:t})},this),this},n.prototype.trig=function(t){return this._db.all().forEach(function(e){e.trig(t)}),this},n.prototype.fadeIn=function(t,e){if(this._state!==l)return this;var n=this.context;return t=o.defaults(n.toSeconds(t),n.currentTime),t=o.finite(t),this._nodes.length&&(e=o.defaults(n.toSeconds(e),.5),e=o.finite(e),this._param.value=0,n.sched(t,function(t){this._param.update(1,t,e)},this)),this.start(t),this},n.prototype.fadeOut=function(t,e){if(this._state!==f)return this;var n=this.context;return t=o.defaults(n.toSeconds(t),n.currentTime),t=o.finite(t),e=o.defaults(n.toSeconds(e),.5),e=o.finite(e),this._nodes.length&&n.sched(t,function(t){this._param.update(0,t,e)},this),this.stop(t+e),this},n.prototype.fade=function(t,e,n){if(this._state!==f)return this;var r=this.context;return this._nodes.length&&(t=o.defaults(r.toSeconds(t),r.currentTime),t=o.finite(t),e=o.finite(e),n=o.defaults(r.toSeconds(n),.5),n=o.finite(n),r.sched(t,function(t){this._param.update(e,t,n)},this)),this},n.prototype.toAudioNode=function(t){return t=o.int(t),this._nodes[t]?this.context.toAudioNode(this._nodes[t]):null},n.prototype._dispatchNode=function(t,e){this.__nodes&&(e=Math.max(0,o.int(e)),this.__nodes[e]||(this.__nodes[e]=[]),this.__nodes[e].push(t))},n.prototype._dispatchSched=function(t,e){this.__scheds&&o.isIterator(t)&&"function"==typeof e&&this.__scheds.push([t,e])},e.exports=i.Synth=n},{"../namespace":21,"../util":54,"../util/db":51,"../util/emitter":52,"./context":22,"./dollar":23,"./parser":25}],27:[function(t,e){"use strict";function n(t,e){Object.defineProperties(this,{context:{value:t.context,enumerable:!0},synth:{value:t,enumerable:!0},key:{value:"",enumerable:!0},id:{value:e,enumerable:!0}}),this._classes={},this._outlet=null,this._resolved=!1,this._to=[],this._from=[]}var r=t("../namespace");t("./ugen");var i=t("../util");i.inherits(n,r.UGen),n.$$name="NeuUGenPromise",n.prototype.resolve=function(t){return this._to.forEach(function(e){this.context.connect(t,e)},this),this._from.forEach(function(e){this.context.connect(e,t)},this),this._to=this._from=null,this},n.prototype.connect=function(t){return this._to.push(t),this},n.prototype.onconnected=function(t){this._from.push(t)},e.exports=r.UGenPromise=n},{"../namespace":21,"../util":54,"./ugen":28}],28:[function(t,e){"use strict";function n(t,e,c,l){a.call(this);var f=s.parse(e);if(!n.registered.hasOwnProperty(f.key))throw new Error("unknown key: "+e);var h=f.classes,p={};"string"==typeof c.class&&c.class.trim()&&(h=h.concat(c.class.split(/\s+/))),h.forEach(function(t){p[t]=!0}),Object.defineProperties(this,{context:{value:t.context,enumerable:!0},synth:{value:t,enumerable:!0},key:{value:f.key,enumerable:!0},id:{value:u.defaults(c.id,f.id),enumerable:!0},"class":{value:Object.keys(p).sort().join(" "),enumerable:!0}}),this._classes=p,this.hasClass("mute")?(this._unit=new o.Unit({}),this._node=this.context.createGain()):this.hasClass("bypass")?(this._unit=n.registered["+"](this,{},l),this._node=this._unit.outlet):(this._unit=n.registered[f.key](this,c,l),this._node=this._unit.outlet,this._node=r(this.context,this._node,u.defaults(c.mul,1)),this._node=i(this.context,this._node,u.defaults(c.add,0))),this.isOutput=!!this._unit.isOutput,this.methods=Object.keys(this._unit.methods).sort(),this.methods.forEach(function(t){var e=this._unit.methods[t];u.definePropertyIfNotExists(this,t,{value:function(){var t=this.context,n=u.toArray(arguments);return t.sched(t.toSeconds(n[0]),function(){e.apply(null,n)}),this}})},this),this._outlet=null,this._scheds=[]}function r(t,e,n){if(1===n)return e;if(0===n)return new o.DC(t,0);var r=t.createGain();return r.gain.value=0,t.connect(e,r),t.connect(n,r.gain),r}function i(t,e,n){return new o.Sum(t,[e,n])}var o=t("../namespace"),u=t("../util"),a=t("../util/emitter"),s=t("./parser");u.inherits(n,a),n.$$name="NeuUGen",n.registered={},n.register=function(t,e){if(!s.isValidUGenName(t))throw new Error("invalid ugen name: "+t);if("function"!=typeof e)throw new TypeError("ugen must be a function");n.registered[t]=e},n.build=function(t,e,r,i){if("string"!=typeof e){var o=u.typeOf(e);"object"!=typeof e||n.registered.hasOwnProperty(o)||(o="object"),r.value=e,e=o}return new n(t,e,r,i)},n.prototype.hasClass=function(t){return!!this._classes[t]},n.prototype.$=function(){var t=u.toArray(arguments),e=t.shift(),n=u.isPlainObject(t[0])?t.shift():{},r=Array.prototype.concat.apply([this],t);return this.synth.builder(e,n,r)},n.prototype.mul=function(t){return this.synth.builder("*",this,u.defaults(t,1))},n.prototype.add=function(t){return this.synth.builder("+",this,u.defaults(t,0))},n.prototype.start=function(t){return this.hasClass("trig")||this._unit.start(t),this},n.prototype.stop=function(t){return this._unit.stop(t),this},n.prototype.patch=function(t){var e=u.toArray(arguments).slice(1),n=this.synth.builder;if("function"==typeof t){var r=function(){return n.apply(null,arguments)};return r.timeout=n.timeout,r.interval=n.interval,r.stop=n.stop,r.inputs=[this],t.apply(this.synth,[r].concat(e))}return n("+",this)},n.prototype.trig=function(t){var e=this.context;return t=u.finite(e.toSeconds(t)),e.sched(t,function(){this._unit.start(t)},this),this},n.prototype.sched=function(t,e){var n=this;return this.synth._dispatchSched(t,function(t){"start"===t.type||"stop"===t.type&&!t.done||(t=Object.create(t),t.synth=n.synth,e.call(n,t))}),this},n.prototype.toAudioNode=function(){return null===this._outlet&&(this._outlet=this.context.toAudioNode(this._node)),this._outlet},n.prototype.connect=function(t){return this._node.connect(t),this},n.prototype.disconnect=function(){return this._node.disconnect(),this},e.exports=o.UGen=n},{"../namespace":21,"../util":54,"../util/emitter":52,"./parser":25}],29:[function(t,e){"use strict";function n(t){this.outlet=i.defaults(t.outlet,null),this.methods=i.defaults(t.methods,{}),this.isOutput=!!t.isOutput,this._spec=t,this._state=o}var r=t("../namespace"),i=t("../util"),o=0,u=1,a=2;n.$$name="NeuUnit",n.prototype.start=function(t){this._state===o&&"function"==typeof this._spec.start&&(this._state=u,this._spec.start(i.finite(t)))},n.prototype.stop=function(t){this._state===u&&"function"==typeof this._spec.stop&&(this._state=a,this._spec.stop(i.finite(t)))},e.exports=r.Unit=n},{"../namespace":21,"../util":54}],30:[function(t,e){e.exports=function(t,e){"use strict";function n(e,n,r){return new t.Unit({outlet:new t.Sum(e.context,r)})}t.register("+",function(t,e,r){return n(t,e,r)}),t.register("array",function(t,r,i){return i=e.toArray(r.value).concat(i),n(t,r,i)})}},{}],31:[function(t,e){e.exports=function(t){"use strict";function e(e,n,r){var i=e.context,o=n.value,u=null;return Object.keys(n).forEach(function(e){"undefined"!=typeof o[e]&&(o[e]instanceof t.webaudio.AudioParam?i.connect(n[e],o[e]):o[e]=n[e])}),r.length&&(o.numberOfInputs?i.connect(r,o):(u=i.createGain(),u.gain.value=0,i.connect(r,u),i.connect(o,u.gain),o=u)),new t.Unit({outlet:o})}["AudioBufferSourceNode","MediaElementAudioSourceNode","MediaStreamAudioSourceNode","ScriptProcessorNode","GainNode","BiquadFilterNode","DelayNode","PannerNode","ConvolverNode","AnalyserNode","DynamicsCompressorNode","WaveShaperNode","OscillatorNode"].forEach(function(n){t.register(n,function(t,n,r){return e(t,n,r)})})}},{}],32:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,i,o){var u=r.context,a=u.createBiquadFilter();a.type=n,a.frequency.value=0,a.detune.value=0,a.Q.value=0,a.gain.value=0;var s=e.defaults(i.freq,i.frequency,350),c=e.defaults(i.dt,i.detune,0),l=e.defaults(i.q,i.Q,1),f=e.defaults(i.gain,0);return u.connect(s,a.frequency),u.connect(c,a.detune),u.connect(l,a.Q),u.connect(f,a.gain),u.connect(o,a),new t.Unit({outlet:a})}var r={lowpass:"lowpass",highpass:"highpass",bandpass:"bandpass",lowshelf:"lowshelf",highshelf:"highshelf",peaking:"peaking",notch:"notch",allpass:"allpass",lpf:"lowpass",hpf:"highpass",bpf:"bandpass"};t.register("biquad",function(t,e,i){var o=r[e.type]||"lowpass";return n(o,t,e,i)}),Object.keys(r).forEach(function(e){var i=r[e];t.register(e,function(t,e,r){return n(i,t,e,r)})})}},{}],33:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,i,o){function u(t){l.start(t),l.onended=function(){r.emit("end",{type:"end",synth:r.synth,playbackTime:t+h})}}function a(t){l.onended=null,l.stop(t)}var s=r.context,c=null,l=s.createBufferSource(),f=null,h=0;n=s.toAudioBuffer(n),null!=n&&(l.buffer=n,h=n.duration);var p=!!e.defaults(i.loop,!1),d=e.finite(e.defaults(i.start,i.loopStart,0)),m=e.finite(e.defaults(i.end,i.loopEnd,0)),v=e.defaults(i.rate,i.playbackRate,1);return l.loop=p,l.loopStart=d,l.loopEnd=m,l.playbackRate.value=0,s.connect(v,l.playbackRate),o.length?(f=s.createGain(),f.gain.value=0,s.connect(o,f),s.connect(l,f.gain),c=f):c=l,new t.Unit({outlet:c,start:u,stop:a})}t.register("buf",function(t,r,i){return n(e.defaults(r.buf,r.buffer),t,r,i)}),t.register("AudioBuffer",function(t,e,r){return n(e.value,t,e,r)}),t.register("NeuBuffer",function(t,e,r){return n(e.value,t,e,r)})}},{}],34:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,i){var o=n.context,u=o.createDynamicsCompressor();u.threshold.value=0,u.knee.value=0,u.ratio.value=0,u.attack.value=0,u.release.value=0;var a=e.defaults(r.thresh,r.threshold,-24),s=e.defaults(r.knee,30),c=e.defaults(r.ratio,12),l=e.defaults(r.a,r.attack,r.attackTime,.003),f=e.defaults(r.r,r.release,r.releaseTime,.25);return l=o.toSeconds(l),f=o.toSeconds(f),o.connect(a,u.threshold),o.connect(s,u.knee),o.connect(c,u.ratio),o.connect(l,u.attack),o.connect(f,u.release),o.connect(i,u),new t.Unit({outlet:u})}t.register("comp",function(t,e,r){return n(t,e,r)})}},{}],35:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,i){var o=n.context,u=o.createConvolver(),a=e.defaults(r.buf,r.buffer);return a=o.toAudioBuffer(a),null!=a&&(u.buffer=a),u.normalize=!!e.defaults(r.norm,r.normalize,!0),o.connect(i,u),new t.Unit({outlet:u})}t.register("conv",function(t,e,r){return n(t,e,r)})}},{}],36:[function(t,e){e.exports=function(t,e){"use strict";function n(n,i,o){var u,a=n.context,s=a.toSeconds(e.defaults(i.delay,i.delayTime,0)),c=e.defaults(i.fb,i.feedback,0);"number"==typeof s?(s=e.clip(e.finite(s),0,r),u=s):u=e.finite(a.toSeconds(e.defaults(i.maxDelay,i.maxDelayTime,1))),u=e.clip(u,1/a.sampleRate,r);var l=a.createDelay(u);if(l.delayTime.value=0,a.connect(s,l.delayTime),0!==c){var f=a.createGain();f.gain.value=0,a.connect(l,f),a.connect(c,f.gain),o=o.concat(f)}return a.connect(o,l),new t.Unit({outlet:l})}var r=t.MAX_DELAY_SEC;t.register("delay",function(t,e,r){return n(t,e,r)})}},{}],37:[function(t,e){e.exports=function(t,e){"use strict";function n(n,o,u){var a=n.context,s=e.defaults(o.mix,0),c=e.defaults(o.patch,o.efx,o.wet,null),l=e.defaults(o.args,[]),f=u,h=null;if("function"==typeof c){var p=n.synth.builder,d=function(){return p.apply(null,arguments)};d.timeout=p.timeout,d.interval=p.interval,d.stop=p.stop,d.inputs=u,h=c.apply(n.synth,[d].concat(l))}var m;return m=null==h||"number"==typeof s?r(a,f,h,s):i(a,f,h,s),new t.Unit({outlet:m})}function r(n,r,i,o){if(o=e.clip(e.finite(o),-1,1),-1===o||null==i)return new t.Sum(n,r);if(1===o)return new t.Sum(n,i);o=.25*(o+1)*Math.PI;var u=n.createGain(),a=n.createGain();return u.gain.value=Math.cos(o),a.gain.value=Math.sin(o),n.connect(r,u),n.connect(i,a),new t.Sum(n,[u,a])}function i(e,n,r,i){var o=e.createGain(),a=e.createGain(),s=e.createWaveShaper(),c=e.createWaveShaper(),l=t.KVS.get(u+"curve");return s.curve=l.dry,c.curve=l.wet,o.gain.value=0,a.gain.value=0,e.connect(i,s),e.connect(i,c),e.connect(s,o.gain),e.connect(c,a.gain),e.connect(n,o),e.connect(r,a),new t.Sum(e,[o,a])}var o=t.WS_CURVE_SIZE,u="@neume:drywet:";t.register("drywet",function(t,e,r){return n(t,e,r)}),t.KVS.set(u+"curve",function(){for(var t=new Float32Array(o),e=new Float32Array(o),n=0;o>n;n++)t[n]=Math.cos(n/o*Math.PI*.5),e[n]=Math.sin(n/o*Math.PI*.5);return{dry:t,wet:e}})}},{}],38:[function(t,e){e.exports=function(t,e){"use strict";function n(t,n){for(var r=[],i={init:e.finite(t.shift()),list:r,releaseNode:-1,loopNode:-1,index:0,length:0},o=0,u=t.length;u>o;){var a=t[o++];"number"==typeof a?r.push([n(e.clip(e.finite(a),0,1)),t[o++]]):(/^(>|r(elease)?)$/i.test(a)&&(i.releaseNode=r.length),/^(<|l(oop)?)$/i.test(a)&&(i.loopNode=r.length))}return i.length=r.length,i}function r(e,n,r){var o,u=null;return"number"==typeof r&&(t.KVS.exists(a+r)||t.KVS.set(a+r,i(r))),t.KVS.exists(a+r)&&(u=t.KVS.get(a+r)),null!=u&&(o=e.createWaveShaper(),o.curve=u,e.connect(n,o),n=o),n}function i(t){for(var e=new Float32Array(4096),n=Math.exp(t),r=1/(1-n),i=0;2048>i;i++){var o=i/2048;e[i+2048]=r-r*Math.pow(n,o)}return e}function o(t){return"number"==typeof t?function(e){var n=1/(1-Math.exp(t));return Math.log((n-e)/n)/t}:s[t]||s.identity}function u(i,u,a,s){function c(t){b.index=0,x.setValueAtTime(b.init,t),0!==b.releaseNode&&(v=d.sched(t,h))}function l(t){p(t),x.setValueAtTime(x.valueAtTime(t),t),d.unsched(v),d.unsched(y),v=0,b.index=b.length,w=!0}function f(t){w||y||-1===b.releaseNode||(t=e.finite(d.toSeconds(t)),y=d.sched(t,function(t){d.unsched(v),v=0,b.index=b.releaseNode,g=!0,p(t),h(t)}))}function h(t){var n=b.list[b.index];if(null!=n){b.index+=1;var r=e.finite(d.toSeconds(n[1])),i=t+r,o=x.valueAtTime(t),a=e.finite(n[0]);switch(m){case"step":x.setValueAtTime(a,t);break;case"hold":x.setValueAtTime(o,t),x.setValueAtTime(a,i);break;case"exp":case"exponential":x.setValueAtTime(Math.max(1e-6,o),t),x.exponentialRampToValueAtTime(Math.max(1e-6,a),i),_={method:"exponentialRampToValueAtTime",time:i};break;default:x.setValueAtTime(o,t),x.linearRampToValueAtTime(a,i),_={method:"linearRampToValueAtTime",time:i}}g||-1===b.loopNode||(b.index===b.releaseNode||b.index===b.length)&&(b.index=b.loopNode),v=0,b.index===b.length?v=d.sched(i,function(t){v=0,u.emit("end",{type:"end",synth:u.synth,playbackTime:t})}):b.index!==b.releaseNode&&(v=d.sched(i,h))}}function p(t){if(!(null==_||_.time<=t)){var e=x.valueAtTime(t);x.cancelScheduledValues(_.time),x[_.method](e,t)}}var d=u.context,m=e.defaults(a.curve,"lin");"number"==typeof m&&(m=e.finite(m),Math.abs(m)<.001&&(m="lin"));var v,y,_,b=n(i,o(m)),x=new t.Param(d,b.init),g=!1,w=!1,A=s.length?x.toAudioNode(s):x;return A=r(d,A,m),new t.Unit({outlet:A,start:c,stop:l,methods:{release:f}})}var a="@neume:env:";t.register("env",function(t,n,r){return u(e.toArray(n.table),t,n,r)}),t.register("adsr",function(t,n,r){var i=e.defaults(n.a,n.attackTime,.01),o=e.defaults(n.d,n.decayTime,.3),a=e.defaults(n.s,n.sustainLevel,.5),s=e.defaults(n.r,n.releaseTime,1);return u([0,1,i,a,o,">",0,s],t,n,r)}),t.register("asr",function(t,n,r){var i=e.defaults(n.a,n.attackTime,.01),o=e.defaults(n.s,n.sustainLevel,1),a=e.defaults(n.r,n.releaseTime,1);return u([0,o,i,">",0,a],t,n,r)}),t.register("cutoff",function(t,n,r){var i=e.defaults(n.r,n.releaseTime,.1);return u([1,">",0,i],t,n,r)}),t.KVS.set(a+"sine",function(){for(var t=new Float32Array(4096),e=0;2048>e;e++){var n=e/2048;t[e+2048]=n-.15*Math.sin(2*n*Math.PI)}return t}),t.KVS.set(a+"welch",function(){for(var t=new Float32Array(4096),e=0;2048>e;e++){var n=e/2048;t[e+2048]=Math.sin(.5*n*Math.PI)}return t}),t.KVS.set(a+"squared",function(){for(var t=new Float32Array(4096),e=0;2048>e;e++){var n=e/2048;t[e+2048]=n*n}return t}),t.KVS.set(a+"cubic",function(){for(var t=new Float32Array(4096),e=0;2048>e;e++){var n=e/2048;t[e+2048]=n*n*n}return t});var s={sine:function(t){var e,n,r=1,i=0;if(0===t)return 0;if(1===t)return 1;for(;;){if(e=.5*(r+i),n=e-.15*Math.sin(2*e*Math.PI),Math.abs(t-n)<1e-6)break;t>n?i=e:r=e}return e},welch:function(t){return 2*Math.asin(t)/Math.PI},squared:function(t){return Math.pow(t,.5)},cubic:function(t){return Math.pow(t,1/3)},identity:function(t){return t}}}},{}],39:[function(t,e){e.exports=function(e){"use strict";e.use(t("./add")),e.use(t("./audio-node")),e.use(t("./biquad")),e.use(t("./buf")),e.use(t("./comp")),e.use(t("./conv")),e.use(t("./delay")),e.use(t("./drywet")),e.use(t("./env")),e.use(t("./inout")),e.use(t("./iter")),e.use(t("./lfpulse")),e.use(t("./line")),e.use(t("./mono")),e.use(t("./mul")),e.use(t("./noise")),e.use(t("./object")),e.use(t("./osc")),e.use(t("./pan2")),e.use(t("./shaper"))}},{"./add":30,"./audio-node":31,"./biquad":32,"./buf":33,"./comp":34,"./conv":35,"./delay":36,"./drywet":37,"./env":38,"./inout":40,"./iter":41,"./lfpulse":42,"./line":43,"./mono":44,"./mul":45,"./noise":46,"./object":47,"./osc":48,"./pan2":49,"./shaper":50}],40:[function(t,e){e.exports=function(t,e){"use strict";t.register("in",function(n,r){var i=n.context,o=Math.max(0,e.int(r.bus));return new t.Unit({outlet:i.getAudioBus(o)})}),t.register("out",function(n,r,i){var o=n.context,u=new t.Sum(o,i),a=Math.max(0,e.int(r.bus));return n.synth._dispatchNode(u,a),new t.Unit({outlet:u,isOutput:!0})})}},{}],41:[function(t,e){e.exports=function(t,e){"use strict";function n(n,o,u){function a(t){var r=c();r.done?(h=i,n.emit("end",{type:"end",synth:n.synth,playbackTime:t})):p.setValueAtTime(e.finite(r.value),t)}function s(t){if(h===r){t=e.finite(l.toSeconds(t));var o=c();o.done?(h=i,n.emit("end",{type:"end",synth:n.synth,playbackTime:t})):p.update(e.finite(o.value),t)}}function c(){return e.isIterator(f)?f.next():{done:!0}}var l=n.context,f=e.defaults(o.iter,null),h=r,p=new t.Param(l,0,o),d=u.length?p.toAudioNode(u):p;return new t.Unit({outlet:d,start:a,methods:{next:s}})}var r=0,i=1;t.register("iter",function(t,e,r){return n(t,e,r)})}},{}],42:[function(t,e){e.exports=function(t,e){"use strict";function n(e,n,i){var o=e.context,u=null,a=i.length?2:440,s=r(o,n,a),c=null;return i.length?(c=o.createGain(),c.gain.value=0,o.connect(i,c),o.connect(s.outlet,c.gain),u=c):u=s.outlet,new t.Unit({outlet:u,start:function(t){s.ctrl.start(t)},stop:function(t){s.ctrl.stop(t)}})}function r(n,r,s){var c,l=e.defaults(r.width,r.duty,.5),f=i(n,r,s),h=o(n,t.KVS.get(a+"ws-curve"));return"number"==typeof l?c=-2*l:(c=u(n,-2),n.connect(l,c)),n.connect([f,1,c],h),{outlet:h,ctrl:f}}function i(n,r,i){var o=n.createOscillator();o.setPeriodicWave(t.KVS.get(a+"src",n)),o.frequency.value=0,o.detune.value=0;var u=e.defaults(r.freq,r.frequency,i),s=e.defaults(r.dt,r.detune,0);return n.connect(u,o.frequency),n.connect(s,o.detune),o}function o(t,e){var n=t.createWaveShaper();return n.curve=e,n}function u(t,e){var n=t.createGain();return n.gain.value=e,n}var a="@neume:lfpulse:";t.register("lfpulse",function(t,e,r){return n(t,e,r)}),t.KVS.set(a+"src",function(t){for(var e=new Float32Array(4096),n=new Float32Array(4096),r=1;4096>r;r++)n[r]=1/r,r%2===0&&(n[r]*=-1);return t.createPeriodicWave(e,n)}),t.KVS.set(a+"ws-curve",function(){for(var t=new Float32Array(4096),e=0;2048>e;e++)t[e]=-1,t[e+2048]=1;return t})}},{}],43:[function(t,e){e.exports=function(t,e){"use strict";function n(e,n,r,i,o,u){function a(t){var u=t,a=u+o;f.setAt(r,u),f[e](i,a),l=c.sched(a,function(t){l=0,n.emit("end",{type:"end",synth:n.synth,playbackTime:t})})}function s(){c.unsched(l)}var c=n.context,l=0,f=new t.Param(c,r),h=u.length?f.toAudioNode(u):f;return new t.Unit({outlet:h,start:a,stop:s})}t.register("line",function(t,r,i){var o=e.finite(e.defaults(r.start,r.startValue,r.from,1)),u=e.finite(e.defaults(r.end,r.endValue,r.to,0)),a=e.finite(t.context.toSeconds(e.defaults(r.dur,r.duration,1)));return n("linTo",t,o,u,a,i)}),t.register("xline",function(t,r,i){var o=Math.max(1e-6,e.finite(e.defaults(r.start,r.startValue,r.from,1))),u=Math.max(1e-6,e.finite(e.defaults(r.end,r.endValue,r.to,0))),a=e.finite(t.context.toSeconds(e.defaults(r.dur,r.duration,1)));return n("expTo",t,o,u,a,i)})}},{}],44:[function(t,e){e.exports=function(t){"use strict";function e(e,n,r){var i=e.context,o=i.createGain();return o.channelCount=1,o.channelCountMode="explicit",o.channelInterpretation="speakers",i.connect(r,o),new t.Unit({outlet:o})}t.register("mono",function(t,n,r){return e(t,n,r)})}},{}],45:[function(t,e){e.exports=function(t,e){"use strict";function n(t){for(var n=1,r=[],i=0,o=t.length;o>i;i++)"number"==typeof t[i]?n*=t[i]:r.push(t[i]);return{multiple:e.finite(n),nodes:r}}function r(e,n,r){var i=e.context;if(0===r)return new t.DC(i,0);if(0===n.length)return new t.DC(i,r);if(1===n.length&&1===r)return n[0];1!==r&&n.push(r);for(var u,a=n[0],s=1,c=n.length;c>s;s++)u=o(i,n[s]),i.connect(a,u),a=u;return a}function i(e){return new t.Unit({outlet:e})}function o(t,e){var n=t.createGain();return"number"==typeof e?n.gain.value=e:(n.gain.value=0,t.connect(e,n.gain)),n}t.register("*",function(t,e,o){var u=n(o);return i(r(t,u.nodes,u.multiple))})}},{}],46:[function(t,e){e.exports=function(t){"use strict";function e(e,i,o){var u=i.context,a=null,s=u.createBufferSource(),c=null;return s.buffer=t.KVS.get(r+e,u,n),s.loop=!0,o.length?(c=u.createGain(),c.gain.value=0,u.connect(o,c),u.connect(s,c.gain),a=c):a=s,new t.Unit({outlet:a,start:function(t){s.start(t)},stop:function(t){s.stop(t)}})}var n=4,r="@neume:noise:";t.register("noise",function(t,n,r){var i={pink:"pink",brown:"brown"}[n.type]||"white";return e(i,t,r)}),["white","pink","brown"].forEach(function(n){t.register(n,function(t,r,i){return e(n,t,i)})}),t.KVS.set(r+"white",function(t,e){for(var n=t.sampleRate*e,r=new Float32Array(n),i=0,o=r.length;o>i;i++)r[i]=2*Math.random()-1;var u=t.createBuffer(1,n,t.sampleRate);return u.getChannelData(0).set(r),u}),t.KVS.set(r+"pink",function(t,e){for(var n,r=t.sampleRate*e,i=new Float32Array(r),o=0,u=0,a=0,s=0,c=0,l=0,f=0,h=0,p=i.length;p>h;h++)n=2*Math.random()-1,o=.99886*o+.0555179*n,u=.99332*u+.0750759*n,a=.969*a+.153852*n,s=.8665*s+.3104856*n,c=.55*c+.5329522*n,l=-.7616*l-.016898*n,i[h]=o+u+a+s+c+l+f+.5362*n,i[h]*=.11,f=.115926*n;var d=t.createBuffer(1,r,t.sampleRate);return d.getChannelData(0).set(i),d}),t.KVS.set(r+"brown",function(t,e){for(var n,r=t.sampleRate*e,i=new Float32Array(r),o=0,u=0,a=i.length;a>u;u++)n=2*Math.random()-1,i[u]=(o+.02*n)/1.02,o=i[u],i[u]*=3.5;var s=t.createBuffer(1,r,t.sampleRate);return s.getChannelData(0).set(i),s})}},{}],47:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,i){function o(t){var n=e.finite(f());n!==p&&(d.update(n,t),p=n);var r=Math.max(h,e.finite(u.toSeconds(c)));l=u.sched(t+r,o)}var u=n.context,a=e.defaults(r.value,0),s=e.defaults(r.i,r.index,r.key,""),c=e.defaults(r.poll,r.pollTime,r.interval,.25),l=0,f=null;f="string"!=typeof s&&"number"!=typeof s||!a.hasOwnProperty(s)?function(){return a.valueOf()}:"function"==typeof a[s]?function(){return a[s]()}:function(){return a[s]};var h=1/u.sampleRate,p=e.finite(f()),d=new t.Param(u,p,r),m=i.length?d.toAudioNode(i):d;return new t.Unit({outlet:m,start:function(t){o(t)},stop:function(){u.unsched(l),l=0}})}t.register("object",n),t.register("Float32Array",n)}},{}],48:[function(t,e){e.exports=function(t,e){"use strict";function n(n,i,o,u){var a=i.context,s=null,c=a.createOscillator(),l=null,f=u.length?2:440,h=e.defaults(o.freq,o.frequency,f),p=e.defaults(o.dt,o.detune,0);return r(n)?c.setPeriodicWave(n):c.type=n,c.frequency.value=0,c.detune.value=0,a.connect(h,c.frequency),a.connect(p,c.detune),u.length?(l=a.createGain(),l.gain.value=0,a.connect(u,l),a.connect(c,l.gain),s=l):s=c,new t.Unit({outlet:s,start:function(t){c.start(t)},stop:function(t){c.stop(t)}})}function r(e){return e instanceof t.webaudio.PeriodicWave}var i={sin:"sine",square:"square",saw:"sawtooth",tri:"triangle"};t.register("osc",function(t,e,o){var u=e.type;return r(u)||(u=i[u]||"sine"),n(u,t,e,o)}),t.register("PeriodicWave",function(t,e,i){var o=e.value;return r(o)||(o="sine"),n(o,t,e,i)}),Object.keys(i).forEach(function(e){var r=i[e];t.register(e,function(t,e,i){return n(r,t,e,i)})})}},{}],49:[function(t,e){e.exports=function(t,e){"use strict";function n(n,r,o){var u=n.context,a=u.createGain(),s=u.createGain();a.channelCount=1,a.channelCountMode="explicit",a.channelInterpretation="speakers",s.channelCount=1,s.channelCountMode="explicit",s.channelInterpretation="speakers";var c=e.defaults(r.pos,r.pan,0);if("number"==typeof c)c=.5*e.clip(c,-1,1)+.5,a.gain.value=Math.cos(c*Math.PI*.5),s.gain.value=Math.sin(c*Math.PI*.5);else{var l=u.createWaveShaper(),f=u.createWaveShaper(),h=t.KVS.get(i+"curve");l.curve=h.L,f.curve=h.R,u.connect(c,l),u.connect(c,f),a.gain.value=0,s.gain.value=0,l.connect(a.gain),f.connect(s.gain)}var p=u.createChannelMerger(2);return a.connect(p,0,0),s.connect(p,0,1),u.connect(o,a),u.connect(o,s),new t.Unit({outlet:p})}var r=t.WS_CURVE_SIZE,i="@neume:pan2:";t.register("pan2",function(t,e,r){return n(t,e,r)}),t.KVS.set(i+"curve",function(){for(var t=new Float32Array(r),e=new Float32Array(r),n=0;r>n;n++)t[n]=Math.cos(n/r*Math.PI*.5),e[n]=Math.sin(n/r*Math.PI*.5);return{L:t,R:e}})}},{}],50:[function(t,e){e.exports=function(t,e){"use strict";function n(e,n,r,i){var o=n.context,u=o.createWaveShaper();return e instanceof Float32Array&&(u.curve=e),u.oversample={"2x":"2x","4x":"4x"}[r.oversample]||"none",o.connect(i,u),new t.Unit({outlet:u})}var r=t.WS_CURVE_SIZE,i="@neume:shaper:";t.register("shaper",function(r,o,u){var a=null;if("number"==typeof o.curve){var s=Math.floor(256*e.clip(e.finite(o.curve),0,1));a=t.KVS.get(i+s,s)}else a=o.curve;return n(a,r,o,u)}),t.register("clip",function(e,r,o){var u=t.KVS.get(i+"0");return n(u,e,r,o)}),function(){function e(t){for(var e,n=new Float32Array(r),i=2*t/(1-t),o=0;r>o;o++)e=2*o/r-1,n[o]=(1+i)*e/(1+i*Math.abs(e));return n}function n(t){return function(){return e(t)}}for(var o=1;256>o;o++)t.KVS.set(i+o,n(o/256))}(),t.KVS.set(i+"0",function(){for(var t=new Float32Array(r),e=0;r>e;e++)t[e]=e/r*2-1;return t}),t.KVS.set(i+"256",function(){for(var t=new Float32Array(r),e=r>>1,n=0;r>n;n++)t[n]=e>n?-1:1;return t})}},{}],51:[function(t,e){"use strict";function n(){this._all=[],this._ids={}}n.prototype.append=function(t){return this._all.push(t),t.id&&(this._ids[t.id]=t),this},n.prototype.all=function(){return this._all},n.prototype.find=function(t){var e=null;return e=t.id?this._ids[t.id]?[this._ids[t.id]]:[]:this._all,t.classes&&t.classes.forEach(function(t){e=e.filter(function(e){return e.hasClass&&e.hasClass(t)})}),t.key&&(e=e.filter(function(e){return e.key===t.key})),e},e.exports=n},{}],52:[function(t,e){"use strict";function n(){this._callbacks={}}n.prototype.hasListeners=function(t){return this._callbacks.hasOwnProperty(t)},n.prototype.listeners=function(t){return this.hasListeners(t)?this._callbacks[t].slice():[]},n.prototype.on=function(t,e){return"function"==typeof e&&(this.hasListeners(t)||(this._callbacks[t]=[]),this._callbacks[t].push(e)),this},n.prototype.once=function(t,e){if("function"==typeof e){var n=function(r){this.off(t,n),e.call(this,r)};n.listener=e,this.on(t,n)}return this},n.prototype.off=function(t,e){return"undefined"==typeof e?"undefined"==typeof t?this._callbacks={}:this.hasListeners(t)&&delete this._callbacks[t]:this.hasListeners(t)&&(this._callbacks[t]=this._callbacks[t].filter(function(t){return!(t===e||t.listener===e)})),this},n.prototype.emit=function(t,e,n){this.listeners(t).forEach(function(t){t.call(this,e)},n||this)},e.exports=n},{}],53:[function(t,e){"use strict";function n(t){var e,n,r,i,a,s,c,l,f,h,p,d=1<e;e++)m[e]=t[e],v[e]=t[b[e]],y[e]=0;for(r=1;d>r;r=i)for(a=0,i=r+r,s=d/i,n=0;r>n;n++){for(c=g[a],l=x[a],e=n;d>e;e+=i)f=e+r,h=l*y[f]+c*v[f],p=c*y[f]-l*v[f],v[f]=v[e]-h,y[f]=y[e]-p,v[e]+=h,y[e]+=p;a+=s}return{real:v,imag:y}}function r(t,e){var n,r,i,a,s,c,l,f,h,p,d,m=1<n;n++)r=x[n],y[n]=+t[r],_[n]=-e[r];for(i=1;m>i;i=a)for(s=0,a=i+i,c=m/a,r=0;i>r;r++){for(l=w[s],f=g[s],n=r;m>n;n+=a)h=n+i,p=f*_[h]+l*y[h],d=l*_[h]-f*y[h],y[h]=y[n]-p,_[h]=_[n]-d,y[n]+=p,_[n]+=d;s+=c}for(n=0;m>n;n++)v[n]=y[n]/m;return v}function i(t){for(var e=new Int16Array(t),n=t>>1,r=0,i=0;;){if(e[r]=i,++r>=t)break;for(var o=n;i>=o;)i-=o,o>>=1; i+=o}return e}function o(t){if(o.cache[t])return o.cache[t];for(var e=i(t),n=Math.floor(Math.log(t)/Math.LN2),r=new Float32Array((1<a;a++)r[a]=Math.sin(2*Math.PI*(a/t)),u[a]=Math.cos(2*Math.PI*(a/t));return o.cache[t]={bitrev:e,sintable:r,costable:u},o.cache[t]}var u=t("../util");o.cache=[],e.exports={forward:n,inverse:r}},{"../util":54}],54:[function(t,e){"use strict";var n={};n.isPlainObject=function(t){return null!=t&&t.constructor===Object},n.isFinite=function(t){return"number"==typeof t&&isFinite(t)},n.isIterator=function(t){return!!t&&"function"==typeof t.next},n.toArray=function(t){return null==t?[]:Array.prototype.slice.call(t)},n.flatten=function(t){return Array.isArray(t)?t.reduce(function(t,e){return t.concat(Array.isArray(e)?n.flatten(e):e)},[]):[t]},n.definePropertyIfNotExists=function(t,e,n){return t.hasOwnProperty(e)||Object.defineProperty(t,e,n),t},n.format=function(t,e){return Object.keys(e).forEach(function(n){/^\w+$/.test(n)&&(t=t.replace(new RegExp("#\\{"+n+"\\}","g"),e[n]))}),t},n.num=function(t){return+t||0},n.int=function(t){return 0|+t},n.finite=function(t){return t=+t||0,n.isFinite(t)||(t=0),t},n.clip=function(t,e,n){return Math.max(e,Math.min(t,n))},n.typeOf=function(t){var e=typeof t;if("number"===e)return t===t?"number":"nan";if("string"===e)return"string";if("function"===e)return"function";if("boolean"===e)return"boolean";if(null===t)return"null";if(void 0===t)return"undefined";if(Array.isArray(t))return"array";var n;return t.constructor&&("string"==typeof t.constructor.$$name?n=t.constructor.$$name:t.constructor.name&&"string"==typeof t.constructor.name&&(n=t.constructor.name)),n||(n=Object.prototype.toString.call(t).slice(8,-1)),"Object"===n&&(n="object"),n},n.defaults=function(){var t,e,r=n.toArray(arguments);for(t=0,e=r.length;e>t;t++)if(null!=r[t])return r[t];return null},n.inherits=function(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e.exports=n},{}],55:[function(t,e){"use strict";var n=t("../util"),r={},i={};e.exports={exists:function(t){return t=String(t),i.hasOwnProperty(t)},set:function(t,e){t=String(t),i.hasOwnProperty(t)&&delete r[t],i[t]=e},get:function(t){if(t=String(t),!r.hasOwnProperty(t)){if(!i.hasOwnProperty(t))throw new Error("key '"+t+"' is not registered.");r[t]="@"===t.charAt(0)&&"function"==typeof i[t]?i[t].apply(null,n.toArray(arguments).slice(1)):i[t],i[t]=null}return r[t]}}},{"../util":54}],56:[function(t,e){"use strict";var n=t("./"),r={};r.exports=function(){return Object.create(r)},r.asInt=n.int,r.midicps=function(t){return 440*Math.pow(2,(t-69)/12)},r.mtof=r.midicps,r.cpsmidi=function(t){return Math.log(t/440)*Math.LOG2E*12+69},r.ftom=r.cpsmidi,r.midiratio=function(t){return Math.pow(2,t/12)},r.ratiomidi=function(t){return Math.log(Math.abs(t))*Math.LOG2E*12},r.dbamp=function(t){return Math.pow(10,.05*t)},r.ampdb=function(t){return Math.log(t)*Math.LOG10E*20},r.linlin=function(t,e,n,r,i){return(t-e)/(n-e)*(i-r)+r},r.linexp=function(t,e,n,r,i){return Math.pow(i/r,(t-e)/(n-e))*r},r.explin=function(t,e,n,r,i){return Math.log(t/e)/Math.log(n/e)*(i-r)+r},r.expexp=function(t,e,n,r,i){return Math.pow(i/r,Math.log(t/e)/Math.log(n/e))*r},r.coin=function(t,e){return t=n.finite(n.defaults(t,.5)),e=n.defaults(e,Math.random),e()e&&(e+=t.length),t[e]},r.foldAt=function(t,e){e=0|e;var n=2*t.length-2;return e%=n,0>e&&(e+=n),t.length<=e&&(e=n-e),t[e]},e.exports=r},{"./":54}]},{},[1]); //# sourceMappingURL=neume.min.js.map