ToneCore(function(){functiona(a){returnvoid0===a}functionb(a){return"function"==typeofa}varc,d,e,f;if(a(window.AudioContext)&&(window.AudioContext=window.webkitAudioContext),a(window.OfflineAudioContext)&&(window.OfflineAudioContext=window.webkitOfflineAudioContext),a(AudioContext))thrownewError("Web Audio is not supported in this browser");returnc=newAudioContext,b(AudioContext.prototype.createGain)||(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),b(AudioContext.prototype.createDelay)||(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode),b(AudioContext.prototype.createPeriodicWave)||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable),b(AudioBufferSourceNode.prototype.start)||(AudioBufferSourceNode.prototype.start=AudioBufferSourceNode.prototype.noteGrainOn),b(AudioBufferSourceNode.prototype.stop)||(AudioBufferSourceNode.prototype.stop=AudioBufferSourceNode.prototype.noteOff),b(OscillatorNode.prototype.start)||(OscillatorNode.prototype.start=OscillatorNode.prototype.noteOn),b(OscillatorNode.prototype.stop)||(OscillatorNode.prototype.stop=OscillatorNode.prototype.noteOff),b(OscillatorNode.prototype.setPeriodicWave)||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioNode.prototype._nativeConnect=AudioNode.prototype.connect,AudioNode.prototype.connect=function(b,c,d){if(b.input)Array.isArray(b.input)?(a(d)&&(d=0),this.connect(b.input[d])):this.connect(b.input,c,d);elsetry{binstanceofAudioNode?this._nativeConnect(b,c,d):this._nativeConnect(b,c)}catch(e){thrownewError("error connecting to node: "+b)}},d=function(b,c){a(b)||1===b?this.input=this.context.createGain():b>1&&(this.input=newArray(b)),a(c)||1===c?this.output=this.context.createGain():c>1&&(this.output=newArray(b))},d.prototype.set=function(b,c,e){varf,g,h;"object"==typeofb?e=c:"string"==typeofb&&(f={},f[b]=c,b=f);for(ginb)h=this[g],a(h)||(c=b[g],hinstanceofd.Signal?h.value!==c&&(a(e)?h.value=c:h.rampTo(c,e)):hinstanceofAudioParam?h.value!==c&&(h.value=c):hinstanceofd?h.set(c):h!==c&&(this[g]=c));returnthis},d.prototype.get=function(c){vare,f,g,h,i,j;if(a(c))c=this._collectDefaults(this.constructor);elseif("string"==typeofc)e={},e[c]=0,c=e;elseif(Array.isArray(c)){for(f={},g=0;g<c.length;g++)f[c[g]]=0;c=f}h={};for(iinc)j=this[i],"object"==typeofc[i]?h[i]=j.get(c[i]):jinstanceofd.Signal?h[i]=j.value:jinstanceofAudioParam?h[i]=j.value:jinstanceofd?h[i]=j.get():b(j)||a(j)||(h[i]=j);returnh},d.prototype._collectDefaults=function(b){varc,d,e={};if(a(b.defaults)||(e=b.defaults),!a(b._super)){c=this._collectDefaults(b._super);for(dinc)e[d]=c[d]}returne},d.prototype.setPreset=function(a){return!this.isUndef(this.preset)&&this.preset.hasOwnProperty(a)&&this.set(this.preset[a]),this},d.prototype.toString=function(){vara,c,e;for(aind)if(c=a[0].match(/^[A-Z]$/),e=d[a]===this.constructor,b(d[a])&&c&&e)returna;return"Tone"},d.context=c,d.prototype.context=d.context,d.prototype.bufferSize=2048,d.prototype.bufferTime=d.prototype.bufferSize/d.context.sampleRate,d.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},e=null,d.prototype.noGC=function(){returnthis.output.connect(e),this},AudioNode.prototype.noGC=function(){returnthis.connect(e),this},d.prototype.connect=function(a,b,c){returnArray.isArray(this.output)?(b=this.defaultArg(b,0),this.output[b].connect(a,0,c)):this.output.connect(a,b,c),this},d.prototype.disconnect=function(a){returnArray.isArray(this.output)?(a=this.defaultArg(a,0),this.output[a].disconnect()):this.output.disconnect(),this},d.prototype.connectSeries=function(){vara,b,c;if(arguments.length>1)for(a=arguments[0],b=1;b<arguments.length;b++)c=arguments[b],a.connect(c),a=c;returnthis},d.prototype.connectParallel=function(){vara,b,c=arguments[0];if(arguments.length>1)for(a=1;a<arguments.length;a++)b=ar
},a.EqualPowerGain}),ToneModule(function(a){returna.CrossFade=function(b){a.call(this,2,1),this.a=this.input[0]=this.context.createGain(),this.b=this.input[1]=this.context.createGain(),this.fade=newa.Signal(this.defaultArg(b,.5),a.Signal.Units.Normal),this._equalPowerA=newa.EqualPowerGain,this._equalPowerB=newa.EqualPowerGain,this._invert=newa.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")},a.extend(a.CrossFade),a.CrossFade.prototype.dispose=function(){returna.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},a.CrossFade}),ToneModule(function(a){returna.Filter=function(){a.call(this);varb=this.optionsObject(arguments,["frequency","type","rolloff"],a.Filter.defaults);this._filters=[],this.frequency=newa.Signal(b.frequency,a.Signal.Units.Frequency),this.detune=newa.Signal(0),this.gain=newa.Signal(b.gain,a.Signal.Units.Decibels),this.Q=newa.Signal(b.Q),this._type=b.type,this._rolloff=b.rolloff,this.rolloff=b.rolloff,this._readOnly(["detune","frequency","gain","Q"])},a.extend(a.Filter),a.Filter.defaults={type:"lowpass",frequency:350,rolloff:-12,Q:1,gain:0},Object.defineProperty(a.Filter.prototype,"type",{get:function(){returnthis._type},set:function(a){varb,c=["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"];if(-1===c.indexOf(a))thrownewTypeError("Tone.Filter does not have filter type "+a);for(this._type=a,b=0;b<this._filters.length;b++)this._filters[b].type=a}}),Object.defineProperty(a.Filter.prototype,"rolloff",{get:function(){returnthis._rolloff},set:function(a){varb,c,d,e,f=Math.log(a/-12)/Math.LN2+1;if(f%1!==0)thrownewRangeError("Filter rolloff can only be -12, -24, or -48");for(this._rolloff=a,this.input.disconnect(),b=0;b<this._filters.length;b++)this._filters[b].disconnect(),this._filters[b]=null;for(this._filters=newArray(f),c=0;f>c;c++)d=this.context.createBiquadFilter(),d.type=this._type,this.frequency.connect(d.frequency),this.detune.connect(d.detune),this.Q.connect(d.Q),this.gain.connect(d.gain),this._filters[c]=d;e=[this.input].concat(this._filters).concat([this.output]),this.connectSeries.apply(this,e)}}),a.Filter.prototype.dispose=function(){a.prototype.dispose.call(this);for(varb=0;b<this._filters.length;b++)this._filters[b].disconnect(),this._filters[b]=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},a.Filter}),ToneModule(function(a){returna.MultibandSplit=function(){varb=this.optionsObject(arguments,["lowFrequency","highFrequency"],a.MultibandSplit.defaults);this.input=this.context.createGain(),this.output=newArray(3),this.low=this.output[0]=newa.Filter(0,"lowpass"),this._lowMidFilter=newa.Filter(0,"highpass"),this.mid=this.output[1]=newa.Filter(0,"lowpass"),this.high=this.output[2]=newa.Filter(0,"highpass"),this.lowFrequency=newa.Signal(b.lowFrequency),this.highFrequency=newa.Signal(b.highFrequency),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.connect(this.low.frequency),this.lowFrequency.connect(this._lowMidFilter.frequency),this.highFrequency.connect(this.mid.frequency),this.highFrequency.connect(this.high.frequency),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},a.extend(a.MultibandSplit),a.MultibandSplit.defaults={lowFrequency:400,highFrequency:2500},a.MultibandSplit.prototype.dispose=function(){returna.prototype.dispose.call(this),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this._lowMidFilter.dispose(),this.mid.dispose(),this.high.dispos
varc=1/a;returnthis._lfcf.delayTime.setValueAtTime(c,b),this._noise.start(b),this._noise.stop(b+c*this.attackNoise),this},a.PluckSynth.prototype.dispose=function(){returna.Instrument.prototype.dispose.call(this),this._noise.dispose(),this._lfcf.dispose(),this._noise=null,this._lfcf=null,this._writable(["resonance","dampening"]),this.dampening=null,this.resonance=null,this},a.PluckSynth}),ToneModule(function(a){returna.PolySynth=function(){varb,c,d;for(a.Instrument.call(this),b=this.optionsObject(arguments,["polyphony","voice"],a.PolySynth.defaults),this.voices=newArray(b.polyphony),this._freeVoices=[],this._activeVoices={},c=0;c<b.polyphony;c++)d=newb.voice(arguments[2],arguments[3]),this.voices[c]=d,d.connect(this.output);this._freeVoices=this.voices.slice(0)},a.extend(a.PolySynth,a.Instrument),a.PolySynth.defaults={polyphony:4,voice:a.MonoSynth},a.PolySynth.prototype.triggerAttack=function(a,b,c){vard,e,f,g;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d++)e=a[d],f=JSON.stringify(e),this._activeVoices[f]?this._activeVoices[f].triggerAttack(e,b,c):this._freeVoices.length>0&&(g=this._freeVoices.shift(),g.triggerAttack(e,b,c),this._activeVoices[f]=g);returnthis},a.PolySynth.prototype.triggerAttackRelease=function(a,b,c,d){returnc=this.toSeconds(c),this.triggerAttack(a,c,d),this.triggerRelease(a,c+this.toSeconds(b)),this},a.PolySynth.prototype.triggerRelease=function(a,b){varc,d,e;for(Array.isArray(a)||(a=[a]),c=0;c<a.length;c++)d=JSON.stringify(a[c]),e=this._activeVoices[d],e&&(e.triggerRelease(b),this._freeVoices.push(e),deletethis._activeVoices[d],e=null);returnthis},a.PolySynth.prototype.set=function(a,b,c){for(vard=0;d<this.voices.length;d++)this.voices[d].set(a,b,c);returnthis},a.PolySynth.prototype.get=function(a){returnthis.voices[0].get(a)},a.PolySynth.prototype.setPreset=function(a){for(varb=0;b<this.voices.length;b++)this.voices[b].setPreset(a);returnthis},a.PolySynth.prototype.dispose=function(){a.Instrument.prototype.dispose.call(this);for(varb=0;b<this.voices.length;b++)this.voices[b].dispose(),this.voices[b]=null;returnthis.voices=null,this._activeVoices=null,this._freeVoices=null,this},a.PolySynth}),ToneModule(function(a){returna.Player=function(){varb=this.optionsObject(arguments,["url","onload"],a.Player.defaults);a.Source.call(this,b),this._source=null,this.autostart=b.autostart,this._buffer=newa.Buffer({url:b.url,onload:this._onload.bind(this,b.onload),reverse:b.reverse}),this._loop=b.loop,this._loopStart=b.loopStart,this._loopEnd=b.loopEnd,this._playbackRate=b.playbackRate,this.retrigger=b.retrigger},a.extend(a.Player,a.Source),a.Player.defaults={onload:function(){},playbackRate:1,loop:!1,autostart:!1,loopStart:0,loopEnd:0,retrigger:!1,reverse:!1},a.Player.prototype.load=function(a,b){returnthis._buffer.load(a,this._onload.bind(this,b)),this},a.Player.prototype._onload=function(a){a(this),this.autostart&&this.start()},a.Player.prototype._start=function(a,b,c){if(!this._buffer.loaded)throwError("tried to start Player before the buffer was loaded");returnb=this._loop?this.defaultArg(b,this._loopStart):this.defaultArg(b,0),b=this.toSeconds(b),c=this.defaultArg(c,this._buffer.duration-b),a=this.toSeconds(a),c=this.toSeconds(c),this._source=this.context.createBufferSource(),this._source.buffer=this._buffer.get(),this._loop?(this._source.loop=this._loop,this._source.loopStart=this.toSeconds(this._loopStart),this._source.loopEnd=this.toSeconds(this._loopEnd),c=65536):this._nextStop=a+c,this._source.playbackRate.value=this._playbackRate,this._source.onended=this.onended,this._source.connect(this.output),this._source.start(a,b,c),this},a.Player.prototype._stop=function(a){returnthis._source&&(this._source.stop(this.toSeconds(a)),this._source=null),this},a.Player.prototype.setLoopPoints=function(a,b){returnthis.loopStart=a,this.loopEnd=b,this},Object.defineProperty(a.Player.prototype,"loopStart",{get:function(){returnthis._loopStart},set:function(a){this._loopStart=a,this._source&&(this._source.loopStart=this.toSeconds(a))}}),Object.defineProperty(a.Player.prototype,"loopEnd",{get:fu