Main(function(){functiont(t){returnvoid0===t}functione(t){return"function"==typeoft}vari,s,n,o;if(t(window.AudioContext)&&(window.AudioContext=window.webkitAudioContext),t(window.OfflineAudioContext)&&(window.OfflineAudioContext=window.webkitOfflineAudioContext),t(AudioContext))thrownewError("Web Audio is not supported in this browser");returni=newAudioContext,e(AudioContext.prototype.createGain)||(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),e(AudioContext.prototype.createDelay)||(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode),e(AudioContext.prototype.createPeriodicWave)||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable),e(AudioBufferSourceNode.prototype.start)||(AudioBufferSourceNode.prototype.start=AudioBufferSourceNode.prototype.noteGrainOn),e(AudioBufferSourceNode.prototype.stop)||(AudioBufferSourceNode.prototype.stop=AudioBufferSourceNode.prototype.noteOff),e(OscillatorNode.prototype.start)||(OscillatorNode.prototype.start=OscillatorNode.prototype.noteOn),e(OscillatorNode.prototype.stop)||(OscillatorNode.prototype.stop=OscillatorNode.prototype.noteOff),e(OscillatorNode.prototype.setPeriodicWave)||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioNode.prototype._nativeConnect=AudioNode.prototype.connect,AudioNode.prototype.connect=function(e,i,s){if(e.input)Array.isArray(e.input)?(t(s)&&(s=0),this.connect(e.input[s])):this.connect(e.input,i,s);elsetry{einstanceofAudioNode?this._nativeConnect(e,i,s):this._nativeConnect(e,i)}catch(n){thrownewError("error connecting to node: "+e)}},s=function(e,i){t(e)||1===e?this.input=this.context.createGain():e>1&&(this.input=newArray(e)),t(i)||1===i?this.output=this.context.createGain():i>1&&(this.output=newArray(e))},s.prototype.set=function(e,i,n){varo,r,l,a,h,u;"object"==typeofe?n=i:"string"==typeofe&&(o={},o[e]=i,e=o);for(rine){if(i=e[r],l=this,-1!==r.indexOf(".")){for(a=r.split("."),h=0;h<a.length-1;h++)l=l[a[h]];r=a[a.length-1]}u=l[r],t(u)||(uinstanceofs.Signal?u.value!==i&&(t(n)?u.value=i:u.rampTo(i,n)):uinstanceofAudioParam?u.value!==i&&(u.value=i):uinstanceofs?u.set(i):u!==i&&(l[r]=i))}returnthis},s.prototype.get=function(i){varn,o,r,l,a,h,u,c,p;for(t(i)?i=this._collectDefaults(this.constructor):"string"==typeofi&&(i=[i]),n={},o=0;o<i.length;o++){if(r=i[o],l=this,a=n,-1!==r.indexOf(".")){for(h=r.split("."),u=0;u<h.length-1;u++)c=h[u],a[c]=a[c]||{},a=a[c],l=l[c];r=h[h.length-1]}p=l[r],"object"==typeofi[r]?a[r]=p.get():pinstanceofs.Signal?a[r]=p.value:pinstanceofAudioParam?a[r]=p.value:pinstanceofs?a[r]=p.get():e(p)||t(p)||(a[r]=p)}returnn},s.prototype._collectDefaults=function(e){vari,s,n=[];if(t(e.defaults)||(n=Object.keys(e.defaults)),!t(e._super))for(i=this._collectDefaults(e._super),s=0;s<i.length;s++)-1===n.indexOf(i[s])&&n.push(i[s]);returnn},s.prototype.setPreset=function(t){return!this.isUndef(this.preset)&&this.preset.hasOwnProperty(t)&&this.set(this.preset[t]),this},s.prototype.toString=function(){vart,i,n;for(tins)if(i=t[0].match(/^[A-Z]$/),n=s[t]===this.constructor,e(s[t])&&i&&n)returnt;return"Tone"},s.context=i,s.prototype.context=s.context,s.prototype.bufferSize=2048,s.prototype.bufferTime=s.prototype.bufferSize/s.context.sampleRate,s.prototype.dispose=function(){returnthis.isUndef(this.input)||(this.inputinstanceofAudioNode&&this.input.disconnect(),this.input=null),this.isUndef(this.output)||(this.outputinstanceofAudioNode&&this.output.disconnect(),this.output=null),this},n=null,s.prototype.noGC=function(){returnthis.output.connect(n),this},AudioNode.prototype.noGC=function(){returnthis.connect(n),this},s.prototype.connect=function(t,e,i){returnArray.isArray(this.output)?(e=this.defaultArg(e,0),this.output[e].connect(t,0,i)):this.output.connect(t,e,i),this},s.prototype.disconnect=function(t){returnArray.isArray(this.output)?(t=this.defaultArg(t,0),this.output[t].disconnect()):this.output.disconnect(),this},s.prototype.connectSeries=function(){vart,e,i;if(arguments.length>1)for(t=ar
vart,e;for(t=0;t<this._nodes.length;t++)e=this._nodes[t],this.isFunction(e.dispose)?e.dispose():this.isFunction(e.disconnect)&&e.disconnect(),e=null,this._nodes[t]=null;this._nodes=null},t.Expr.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeNodes()},t.Expr}),Module(function(t){returnt.EqualPowerGain=function(){this._eqPower=this.input=this.output=newt.WaveShaper(function(t){returnMath.abs(t)<.001?0:this.equalPowerScale(t)}.bind(this),4096)},t.extend(t.EqualPowerGain,t.SignalBase),t.EqualPowerGain.prototype.dispose=function(){returnt.prototype.dispose.call(this),this._eqPower.dispose(),this._eqPower=null,this},t.EqualPowerGain}),Module(function(t){returnt.CrossFade=function(e){t.call(this,2,1),this.a=this.input[0]=this.context.createGain(),this.b=this.input[1]=this.context.createGain(),this.fade=newt.Signal(this.defaultArg(e,.5),t.Type.NormalRange),this._equalPowerA=newt.EqualPowerGain,this._equalPowerB=newt.EqualPowerGain,this._invert=newt.Expr("1 - $0"),this.a.connect(this.output),this.b.connect(this.output),this.fade.chain(this._equalPowerB,this.b.gain),this.fade.chain(this._invert,this._equalPowerA,this.a.gain),this._readOnly("fade")},t.extend(t.CrossFade),t.CrossFade.prototype.dispose=function(){returnt.prototype.dispose.call(this),this._writable("fade"),this._equalPowerA.dispose(),this._equalPowerA=null,this._equalPowerB.dispose(),this._equalPowerB=null,this.fade.dispose(),this.fade=null,this._invert.dispose(),this._invert=null,this.a.disconnect(),this.a=null,this.b.disconnect(),this.b=null,this},t.CrossFade}),Module(function(t){returnt.Filter=function(){t.call(this);vare=this.optionsObject(arguments,["frequency","type","rolloff"],t.Filter.defaults);this._filters=[],this.frequency=newt.Signal(e.frequency,t.Type.Frequency),this.detune=newt.Signal(0,t.Type.Cents),this.gain=newt.Signal({value:e.gain,units:t.Type.Decibels,convert:!1}),this.Q=newt.Signal(e.Q),this._type=e.type,this._rolloff=e.rolloff,this.rolloff=e.rolloff,this._readOnly(["detune","frequency","gain","Q"])},t.extend(t.Filter),t.Filter.defaults={type:"lowpass",frequency:350,rolloff:-12,Q:1,gain:0},Object.defineProperty(t.Filter.prototype,"type",{get:function(){returnthis._type},set:function(t){vare,i=["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"];if(-1===i.indexOf(t))thrownewTypeError("Tone.Filter does not have filter type "+t);for(this._type=t,e=0;e<this._filters.length;e++)this._filters[e].type=t}}),Object.defineProperty(t.Filter.prototype,"rolloff",{get:function(){returnthis._rolloff},set:function(t){vare,i,s,n,o=[-12,-24,-48],r=o.indexOf(t);if(-1===r)thrownewRangeError("Filter rolloff can only be -12, -24, or -48");for(r++,this._rolloff=t,this.input.disconnect(),e=0;e<this._filters.length;e++)this._filters[e].disconnect(),this._filters[e]=null;for(this._filters=newArray(r),i=0;r>i;i++)s=this.context.createBiquadFilter(),s.type=this._type,this.frequency.connect(s.frequency),this.detune.connect(s.detune),this.Q.connect(s.Q),this.gain.connect(s.gain),this._filters[i]=s;n=[this.input].concat(this._filters).concat([this.output]),this.connectSeries.apply(this,n)}}),t.Filter.prototype.dispose=function(){t.prototype.dispose.call(this);for(vare=0;e<this._filters.length;e++)this._filters[e].disconnect(),this._filters[e]=null;returnthis._filters=null,this._writable(["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.frequency=null,this.Q=null,this.detune.dispose(),this.detune=null,this.gain.dispose(),this.gain=null,this},t.Filter}),Module(function(t){returnt.MultibandSplit=function(){vare=this.optionsObject(arguments,["lowFrequency","highFrequency"],t.MultibandSplit.defaults);this.input=this.context.createGain(),this.output=newArray(3),this.low=this.output[0]=newt.Filter(0,"lowpass"),this._lowMidFilter=newt.Filter(0,"highpass"),this.mid=this.output[1]=newt.Filter(0,"lowpass"),this.high=this.output[2]=newt.Filter(0,"highpass"),this.lowFrequency=newt.Signal(e.lowFrequency,t.Type.Frequency),this.highFrequency=newt.Signal(e.highFrequency