text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tensorflow/tfjs"),require("tone"),require("@magenta/music/es6/core"),require("lit")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs","tone","@magenta/music/es6/core","lit"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).MusicPlayer={},t.require$$0,t.require$$1,t.require$$2,t.lit)}(this,(function(exports,require$$0,require$$1,require$$2,lit){"use strict";function _interopDefaultLegacy(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var require$$0__default=_interopDefaultLegacy(require$$0),require$$1__default=_interopDefaultLegacy(require$$1),require$$2__default=_interopDefaultLegacy(require$$2);function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function asyncGeneratorStep(t,e,n,i,r,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(i,r)}function _asyncToGenerator(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){asyncGeneratorStep(o,i,r,a,s,"next",t)}function s(t){asyncGeneratorStep(o,i,r,a,s,"throw",t)}a(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function _construct(t,e,n){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&_setPrototypeOf(r,n.prototype),r}).apply(null,arguments)}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,t)})(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var n,i=_getPrototypeOf(t);if(e){var r=_getPrototypeOf(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _get(t,e,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=_superPropBase(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function _taggedTemplateLiteral(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);a=!0);}catch(t){s=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return o}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _createForOfIteratorHelper(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function createCommonjsModule(t){var e={exports:{}};return t(e,e.exports),e.exports}var htmlMidiPlayer=createCommonjsModule((function(module,exports){var e;"undefined"!=typeof self&&self,module.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=148)}([function(t,e,n){n.r(e),function(t){var i=n(93),r=function t(){if(!(this instanceof t))throw new Error("constructor needs to be called with the 'new' keyword")};
  /**
               *  Tone.js
               *  @author Yotam Mann
               *  @license http://opensource.org/licenses/MIT MIT License
               *  @copyright 2014-2019 Yotam Mann
               */r.prototype.toString=function(){for(var t in r){var e=t[0].match(/^[A-Z]$/),n=r[t]===this.constructor;if(r.isFunction(r[t])&&e&&n)return t}return"Tone"},r.prototype.dispose=function(){return this},r.prototype.set=function(t,e){if(r.isString(t)){var n={};n[t]=e,t=n}t:for(var i in t){e=t[i];var o=this;if(-1!==i.indexOf(".")){for(var a=i.split("."),s=0;s<a.length-1;s++)if((o=o[a[s]])instanceof r){a.splice(0,s+1);var u=a.join(".");o.set(u,e);continue t}i=a[a.length-1]}var l=o[i];r.isUndef(l)||(r.Signal&&l instanceof r.Signal||r.Param&&l instanceof r.Param||l instanceof AudioParam?l.value!==e&&(l.value=e):r.TimeBase&&l instanceof r.TimeBase?o[i]=e:l instanceof r?l.set(e):l!==e&&(o[i]=e))}return this},r.prototype.get=function(t){r.isUndef(t)?t=this._collectDefaults(this.constructor):r.isString(t)&&(t=[t]);for(var e={},n=0;n<t.length;n++){var i=t[n],o=this,a=e;if(-1!==i.indexOf(".")){for(var s=i.split("."),u=0;u<s.length-1;u++){var l=s[u];a[l]=a[l]||{},a=a[l],o=o[l]}i=s[s.length-1]}var c=o[i];r.isObject(t[i])?a[i]=c.get():r.Signal&&c instanceof r.Signal||r.Param&&c instanceof r.Param||c instanceof AudioParam?a[i]=c.value:c instanceof r?a[i]=c.get():!r.isFunction(c)&&r.isDefined(c)&&(a[i]=c)}return e},r.prototype._collectDefaults=function(t){var e=[];if(r.isDefined(t.defaults)&&(e=Object.keys(t.defaults)),r.isDefined(t._super))for(var n=this._collectDefaults(t._super),i=0;i<n.length;i++)-1===e.indexOf(n[i])&&e.push(n[i]);return e},r.defaults=function(t,e,n){var i={};if(1===t.length&&r.isObject(t[0]))i=t[0];else for(var o=0;o<e.length;o++)i[e[o]]=t[o];return r.isDefined(n.defaults)?r.defaultArg(i,n.defaults):r.isObject(n)?r.defaultArg(i,n):i},r.defaultArg=function(t,e){if(r.isObject(t)&&r.isObject(e)){var n={};for(var i in t)n[i]=r.defaultArg(e[i],t[i]);for(var o in e)n[o]=r.defaultArg(t[o],e[o]);return n}return r.isUndef(t)?e:t},r.prototype.log=function(){if(this.debug||this.toString()===r.global.TONE_DEBUG_CLASS){var t=Array.from(arguments);t.unshift(this.toString()+":"),console.log.apply(void 0,t)}},r.prototype.assert=function(t,e){if(!t)throw new Error(e)},r.connectSeries=function(){for(var t=arguments[0],e=1;e<arguments.length;e++){var n=arguments[e];r.connect(t,n),t=n}return r},r.connect=function(t,e,n,i){for(;r.isDefined(e.input);)r.isArray(e.input)?(i=r.defaultArg(i,0),e=e.input[i],i=0):e.input&&(e=e.input);return e instanceof AudioParam?t.connect(e,n):e instanceof AudioNode&&t.connect(e,n,i),r},r.disconnect=function(t,e,n,i){if(e){for(var o=!1;!o;)r.isArray(e.input)?(r.isDefined(i)?r.disconnect(t,e.input[i],n):e.input.forEach((function(e){try{r.disconnect(t,e,n)}catch(t){}})),o=!0):e.input?e=e.input:o=!0;e instanceof AudioParam?t.disconnect(e,n):e instanceof AudioNode&&t.disconnect(e,n,i)}else t.disconnect();return r},r.isUndef=function(t){return void 0===t},r.isDefined=function(t){return!r.isUndef(t)},r.isFunction=function(t){return"function"==typeof t},r.isNumber=function(t){return"number"==typeof t},r.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object},r.isBoolean=function(t){return"boolean"==typeof t},r.isArray=function(t){return Array.isArray(t)},r.isString=function(t){return"string"==typeof t},r.isNote=function(t){return r.isString(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)},r.noOp=function(){},r.prototype._readOnly=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._readOnly(t[e]);else Object.defineProperty(this,t,{writable:!1,enumerable:!0})},r.prototype._writable=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._writable(t[e]);else Object.defineProperty(this,t,{writable:!0})},r.State={Started:"started",Stopped:"stopped",Paused:"paused"},r.global=r.isUndef(t)?window:t,r.equalPowerScale=function(t){var e=.5*Math.PI;return Math.sin(t*e)},r.dbToGain=function(t){return Math.pow(10,t/20)},r.gainToDb=function(t){return Math.log(t)/Math.LN10*20},r.intervalToFrequencyRatio=function(t){return Math.pow(2,t/12)},r.prototype.now=function(){return r.context.now()},r.now=function(){return r.context.now()},r.prototype.immediate=function(){return r.context.currentTime},r.immediate=function(){return r.context.currentTime},r.extend=function(t,e){function n(){}r.isUndef(e)&&(e=r),n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t._super=e},r._audioContext=null,r.start=function(){return r.context.resume()},Object.defineProperty(r,"context",{get:function(){return r._audioContext},set:function(t){t.isContext?r._audioContext=t:r._audioContext=new r.Context(t),r.Context.emit("init",r._audioContext)}}),Object.defineProperty(r.prototype,"context",{get:function(){return r.context}}),r.setContext=function(t){r.context=t},Object.defineProperty(r.prototype,"blockTime",{get:function(){return 128/this.context.sampleRate}}),Object.defineProperty(r.prototype,"sampleTime",{get:function(){return 1/this.context.sampleRate}}),Object.defineProperty(r,"supported",{get:function(){var t=r.global.hasOwnProperty("AudioContext")||r.global.hasOwnProperty("webkitAudioContext"),e=r.global.hasOwnProperty("Promise");return t&&e}}),Object.defineProperty(r,"initialized",{get:function(){return Boolean(r.context)}}),r.getContext=function(t){if(r.initialized)t(r.context);else{var e=function e(){t(r.context),r.Context.off("init",e)};r.Context.on("init",e)}return r},r.version=i.a,e.default=r}.call(this,n(147))},function(t,e,n){n.r(e);var i=n(0);if(n(20),i.default.supported){var r=new OfflineAudioContext(2,1,44100),o=r.createGain(),a=r.createGain();if(o.connect(a)!==a){var s=AudioNode.prototype.connect;AudioNode.prototype.connect=function(){return s.apply(this,arguments),arguments[0]}}}i.default.AudioNode=function(){i.default.call(this);var t=i.default.defaults(arguments,["context"],{context:i.default.context});this._context=t.context},i.default.extend(i.default.AudioNode),Object.defineProperty(i.default.AudioNode.prototype,"context",{get:function(){return this._context}}),i.default.AudioNode.prototype.createInsOuts=function(t,e){1===t?this.input=this.context.createGain():t>1&&(this.input=new Array(t)),1===e?this.output=this.context.createGain():e>1&&(this.output=new Array(e))},Object.defineProperty(i.default.AudioNode.prototype,"channelCount",{get:function(){return this.output.channelCount},set:function(t){return this.output.channelCount=t}}),Object.defineProperty(i.default.AudioNode.prototype,"channelCountMode",{get:function(){return this.output.channelCountMode},set:function(t){return this.output.channelCountMode=t}}),Object.defineProperty(i.default.AudioNode.prototype,"channelInterpretation",{get:function(){return this.output.channelInterpretation},set:function(t){return this.output.channelInterpretation=t}}),Object.defineProperty(i.default.AudioNode.prototype,"numberOfInputs",{get:function(){return this.input?i.default.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(i.default.AudioNode.prototype,"numberOfOutputs",{get:function(){return this.output?i.default.isArray(this.output)?this.output.length:1:0}}),i.default.AudioNode.prototype.connect=function(t,e,n){return i.default.isArray(this.output)?(e=i.default.defaultArg(e,0),this.output[e].connect(t,0,n)):i.default.connect(this.output,t,e,n),this},i.default.AudioNode.prototype.disconnect=function(t,e,n){return i.default.isArray(this.output)?(e=i.default.defaultArg(e,0),this.output[e].disconnect(t,0,n)):i.default.disconnect(this.output,t,e,n),this},i.default.AudioNode.prototype.chain=function(){var t=Array.from(arguments);return t.unshift(this),i.default.connectSeries.apply(void 0,t),this},i.default.AudioNode.prototype.fan=function(){for(var t=0;t<arguments.length;t++)this.connect(arguments[t]);return this},i.default.AudioNode.prototype.dispose=function(){return i.default.isDefined(this.input)&&(this.input instanceof AudioNode&&this.input.disconnect(),this.input=null),i.default.isDefined(this.output)&&(this.output instanceof AudioNode&&this.output.disconnect(),this.output=null),this._context=null,this},e.default=i.default.AudioNode},function(t,e,n){n.r(e);var i=n(0);if(n(4),n(14),n(30),n(44),n(20),n(3),i.default.supported&&!i.default.global.AudioContext.prototype.createConstantSource){var r=function(t){this.context=t;for(var e=t.createBuffer(1,128,t.sampleRate),n=e.getChannelData(0),i=0;i<n.length;i++)n[i]=1;this._bufferSource=t.createBufferSource(),this._bufferSource.channelCount=1,this._bufferSource.channelCountMode="explicit",this._bufferSource.buffer=e,this._bufferSource.loop=!0;var r=this._output=t.createGain();this.offset=r.gain,this._bufferSource.connect(r)};r.prototype.start=function(t){return this._bufferSource.start(t),this},r.prototype.stop=function(t){return this._bufferSource.stop(t),this},r.prototype.connect=function(){return this._output.connect.apply(this._output,arguments),this},r.prototype.disconnect=function(){return this._output.disconnect.apply(this._output,arguments),this},AudioContext.prototype.createConstantSource=function(){return new r(this)},i.default.Context.prototype.createConstantSource=function(){return new r(this)}}i.default.Signal=function(){var t=i.default.defaults(arguments,["value","units"],i.default.Signal);i.default.Param.call(this,t),this._constantSource=this.context.createConstantSource(),this._constantSource.start(0),this._param=this._constantSource.offset,this.value=t.value,this.output=this._constantSource,this.input=this._param=this.output.offset},i.default.extend(i.default.Signal,i.default.Param),i.default.Signal.defaults={value:0,units:i.default.Type.Default,convert:!0},i.default.Signal.prototype.connect=i.default.SignalBase.prototype.connect,i.default.Signal.prototype.disconnect=i.default.SignalBase.prototype.disconnect,i.default.Signal.prototype.getValueAtTime=function(t){return this._param.getValueAtTime?this._param.getValueAtTime(t):i.default.Param.prototype.getValueAtTime.call(this,t)},i.default.Signal.prototype.dispose=function(){return i.default.Param.prototype.dispose.call(this),this._constantSource.stop(),this._constantSource.disconnect(),this._constantSource=null,this},e.default=i.default.Signal},function(t,e,n){n.r(e);var i=n(0);n(14),n(4),n(1),i.default.Gain=function(){var t=i.default.defaults(arguments,["gain","units"],i.default.Gain);i.default.AudioNode.call(this,t),this.input=this.output=this._gainNode=this.context.createGain(),this.gain=new i.default.Param({param:this._gainNode.gain,units:t.units,value:t.gain,convert:t.convert}),this._readOnly("gain")},i.default.extend(i.default.Gain,i.default.AudioNode),i.default.Gain.defaults={gain:1,convert:!0},i.default.Gain.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this._gainNode.disconnect(),this._gainNode=null,this._writable("gain"),this.gain.dispose(),this.gain=null},e.default=i.default.Gain},function(t,e,n){n.r(e);var i=n(0);n(63),n(46),n(45),n(20),i.default.Type={Default:"number",Time:"time",Frequency:"frequency",TransportTime:"transportTime",Ticks:"ticks",NormalRange:"normalRange",AudioRange:"audioRange",Decibels:"db",Interval:"interval",BPM:"bpm",Positive:"positive",Gain:"gain",Cents:"cents",Degrees:"degrees",MIDI:"midi",BarsBeatsSixteenths:"barsBeatsSixteenths",Samples:"samples",Hertz:"hertz",Note:"note",Milliseconds:"milliseconds",Seconds:"seconds",Notation:"notation"},i.default.prototype.toSeconds=function(t){return i.default.isNumber(t)?t:i.default.isUndef(t)?this.now():i.default.isString(t)||i.default.isObject(t)?new i.default.Time(t).toSeconds():t instanceof i.default.TimeBase?t.toSeconds():void 0},i.default.prototype.toFrequency=function(t){return i.default.isNumber(t)?t:i.default.isString(t)||i.default.isUndef(t)||i.default.isObject(t)?new i.default.Frequency(t).valueOf():t instanceof i.default.TimeBase?t.toFrequency():void 0},i.default.prototype.toTicks=function(t){return i.default.isNumber(t)||i.default.isString(t)||i.default.isObject(t)?new i.default.TransportTime(t).toTicks():i.default.isUndef(t)?i.default.Transport.ticks:t instanceof i.default.TimeBase?t.toTicks():void 0},e.default=i.default},function(t,e,n){n.r(e);var i=n(0);n(14),n(3),n(30),i.default.Multiply=function(t){i.default.Signal.call(this),this.createInsOuts(2,0),this._mult=this.input[0]=this.output=new i.default.Gain,this._param=this.input[1]=this.output.gain,this.value=i.default.defaultArg(t,0)},i.default.extend(i.default.Multiply,i.default.Signal),i.default.Multiply.prototype.dispose=function(){return i.default.Signal.prototype.dispose.call(this),this._mult.dispose(),this._mult=null,this._param=null,this},e.default=i.default.Multiply},function(t,e,n){n.r(e);var i=n(0);n(16),n(27),n(40),n(4),n(34),n(2),n(1),i.default.Source=function(t){t=i.default.defaultArg(t,i.default.Source.defaults),i.default.AudioNode.call(this),this._volume=this.output=new i.default.Volume(t.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._state=new i.default.TimelineState(i.default.State.Stopped),this._state.memory=100,this._synced=!1,this._scheduled=[],this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=t.mute},i.default.extend(i.default.Source,i.default.AudioNode),i.default.Source.defaults={volume:0,mute:!1},Object.defineProperty(i.default.Source.prototype,"state",{get:function(){return this._synced?i.default.Transport.state===i.default.State.Started?this._state.getValueAtTime(i.default.Transport.seconds):i.default.State.Stopped:this._state.getValueAtTime(this.now())}}),Object.defineProperty(i.default.Source.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),i.default.Source.prototype._start=i.default.noOp,i.default.Source.prototype.restart=i.default.noOp,i.default.Source.prototype._stop=i.default.noOp,i.default.Source.prototype.start=function(t,e,n){if(i.default.isUndef(t)&&this._synced?t=i.default.Transport.seconds:(t=this.toSeconds(t),this._synced||(t=Math.max(t,this.context.currentTime))),this._state.getValueAtTime(t)===i.default.State.Started)this._state.cancel(t),this._state.setStateAtTime(i.default.State.Started,t),this.restart(t,e,n);else if(this._state.setStateAtTime(i.default.State.Started,t),this._synced){var r=this._state.get(t);r.offset=i.default.defaultArg(e,0),r.duration=n;var o=i.default.Transport.schedule(function(t){this._start(t,e,n)}.bind(this),t);this._scheduled.push(o),i.default.Transport.state===i.default.State.Started&&this._syncedStart(this.now(),i.default.Transport.seconds)}else this._start.apply(this,arguments);return this},i.default.Source.prototype.stop=function(t){if(i.default.isUndef(t)&&this._synced?t=i.default.Transport.seconds:(t=this.toSeconds(t),t=Math.max(t,this.context.currentTime)),this._synced){var e=i.default.Transport.schedule(this._stop.bind(this),t);this._scheduled.push(e)}else this._stop.apply(this,arguments);return this._state.cancel(t),this._state.setStateAtTime(i.default.State.Stopped,t),this},i.default.Source.prototype.sync=function(){return this._synced=!0,this._syncedStart=function(t,e){if(e>0){var n=this._state.get(e);if(n&&n.state===i.default.State.Started&&n.time!==e){var r,o=e-this.toSeconds(n.time);n.duration&&(r=this.toSeconds(n.duration)-o),this._start(t,this.toSeconds(n.offset)+o,r)}}}.bind(this),this._syncedStop=function(t){var e=i.default.Transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));this._state.getValueAtTime(e)===i.default.State.Started&&this._stop(t)}.bind(this),i.default.Transport.on("start loopStart",this._syncedStart),i.default.Transport.on("stop pause loopEnd",this._syncedStop),this},i.default.Source.prototype.unsync=function(){this._synced&&(i.default.Transport.off("stop pause loopEnd",this._syncedStop),i.default.Transport.off("start loopStart",this._syncedStart)),this._synced=!1;for(var t=0;t<this._scheduled.length;t++){var e=this._scheduled[t];i.default.Transport.clear(e)}return this._scheduled=[],this._state.cancel(0),this},i.default.Source.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this.unsync(),this._scheduled=null,this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this._state.dispose(),this._state=null},e.default=i.default.Source},function(t,e,n){n.r(e);var i=n(0);if(n(30),n(44),i.default.supported&&!i.default.global.AudioContext.prototype._native_createWaveShaper){var r=navigator.userAgent.toLowerCase();if(r.includes("safari")&&!r.includes("chrome")){var o=function(t){for(var e in this._internalNode=this.input=this.output=t._native_createWaveShaper(),this._curve=null,this._internalNode)this._defineProperty(this._internalNode,e)};Object.defineProperty(o.prototype,"curve",{get:function(){return this._curve},set:function(t){this._curve=t;var e=new Float32Array(t.length+1);e.set(t,1),e[0]=t[0],this._internalNode.curve=e}}),o.prototype._defineProperty=function(t,e){i.default.isUndef(this[e])&&Object.defineProperty(this,e,{get:function(){return"function"==typeof t[e]?t[e].bind(t):t[e]},set:function(n){t[e]=n}})},i.default.global.AudioContext.prototype._native_createWaveShaper=i.default.global.AudioContext.prototype.createWaveShaper,i.default.global.AudioContext.prototype.createWaveShaper=function(){return new o(this)}}}i.default.WaveShaper=function(t,e){i.default.SignalBase.call(this),this._shaper=this.input=this.output=this.context.createWaveShaper(),this._curve=null,Array.isArray(t)?this.curve=t:isFinite(t)||i.default.isUndef(t)?this._curve=new Float32Array(i.default.defaultArg(t,1024)):i.default.isFunction(t)&&(this._curve=new Float32Array(i.default.defaultArg(e,1024)),this.setMap(t))},i.default.extend(i.default.WaveShaper,i.default.SignalBase),i.default.WaveShaper.prototype.setMap=function(t){for(var e=new Array(this._curve.length),n=0,i=this._curve.length;n<i;n++){var r=n/(i-1)*2-1;e[n]=t(r,n)}return this.curve=e,this},Object.defineProperty(i.default.WaveShaper.prototype,"curve",{get:function(){return this._shaper.curve},set:function(t){this._curve=new Float32Array(t),this._shaper.curve=this._curve}}),Object.defineProperty(i.default.WaveShaper.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){if(!["none","2x","4x"].includes(t))throw new RangeError("Tone.WaveShaper: oversampling must be either 'none', '2x', or '4x'");this._shaper.oversample=t}}),i.default.WaveShaper.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._shaper.disconnect(),this._shaper=null,this._curve=null,this},e.default=i.default.WaveShaper},function(t,e,n){n.r(e);var i=n(0);n(23),n(1),i.default.Effect=function(){var t=i.default.defaults(arguments,["wet"],i.default.Effect);i.default.AudioNode.call(this),this.createInsOuts(1,1),this._dryWet=new i.default.CrossFade(t.wet),this.wet=this._dryWet.fade,this.effectSend=new i.default.Gain,this.effectReturn=new i.default.Gain,i.default.connect(this.input,this._dryWet.a),i.default.connect(this.input,this.effectSend),this.effectReturn.connect(this._dryWet.b),this._dryWet.connect(this.output),this._readOnly(["wet"])},i.default.extend(i.default.Effect,i.default.AudioNode),i.default.Effect.defaults={wet:1},i.default.Effect.prototype.connectEffect=function(t){return this.effectSend.chain(t,this.effectReturn),this},i.default.Effect.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this.effectSend.dispose(),this.effectSend=null,this.effectReturn.dispose(),this.effectReturn=null,this._writable(["wet"]),this.wet=null,this},e.default=i.default.Effect},function(t,e,n){n.r(e);var i=n(0);n(2),n(1),i.default.Filter=function(){var t=i.default.defaults(arguments,["frequency","type","rolloff"],i.default.Filter);i.default.AudioNode.call(this),this.createInsOuts(1,1),this._filters=[],this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.detune=new i.default.Signal(0,i.default.Type.Cents),this.gain=new i.default.Signal({value:t.gain,convert:!0,type:i.default.Type.Decibels}),this.Q=new i.default.Signal(t.Q),this._type=t.type,this._rolloff=t.rolloff,this.rolloff=t.rolloff,this._readOnly(["detune","frequency","gain","Q"])},i.default.extend(i.default.Filter,i.default.AudioNode),i.default.Filter.defaults={type:"lowpass",frequency:350,rolloff:-12,Q:1,gain:0},Object.defineProperty(i.default.Filter.prototype,"type",{get:function(){return this._type},set:function(t){if(-1===["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t))throw new TypeError("Tone.Filter: invalid type "+t);this._type=t;for(var e=0;e<this._filters.length;e++)this._filters[e].type=t}}),Object.defineProperty(i.default.Filter.prototype,"rolloff",{get:function(){return this._rolloff},set:function(t){t=parseInt(t,10);var e=[-12,-24,-48,-96].indexOf(t);if(-1===e)throw new RangeError("Tone.Filter: rolloff can only be -12, -24, -48 or -96");e+=1,this._rolloff=t,this.input.disconnect();for(var n=0;n<this._filters.length;n++)this._filters[n].disconnect(),this._filters[n]=null;this._filters=new Array(e);for(var r=0;r<e;r++){var o=this.context.createBiquadFilter();o.type=this._type,this.frequency.connect(o.frequency),this.detune.connect(o.detune),this.Q.connect(o.Q),this.gain.connect(o.gain),this._filters[r]=o}var a=[this.input].concat(this._filters).concat([this.output]);i.default.connectSeries.apply(i.default,a)}}),i.default.Filter.prototype.getFrequencyResponse=function(t){t=i.default.defaultArg(t,128);for(var e=new Float32Array(t).map((function(){return 1})),n=new Float32Array(t),r=0;r<t;r++){var o=19980*Math.pow(r/t,2)+20;n[r]=o}var a=new Float32Array(t),s=new Float32Array(t);return this._filters.forEach(function(){var t=this.context.createBiquadFilter();t.type=this._type,t.Q.value=this.Q.value,t.frequency.value=this.frequency.value,t.gain.value=this.gain.value,t.getFrequencyResponse(n,a,s),a.forEach((function(t,n){e[n]*=t}))}.bind(this)),e},i.default.Filter.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this);for(var t=0;t<this._filters.length;t++)this._filters[t].disconnect(),this._filters[t]=null;return this._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},e.default=i.default.Filter},function(t,e,n){n.r(e);var i=n(0);n(1),i.default.Merge=function(t){t=i.default.defaultArg(t,2),i.default.AudioNode.call(this),this.createInsOuts(t,0),this._merger=this.output=this.context.createChannelMerger(t);for(var e=0;e<t;e++)this.input[e]=new i.default.Gain,this.input[e].connect(this._merger,0,e),this.input[e].channelCount=1,this.input[e].channelCountMode="explicit";this.left=this.input[0],this.right=this.input[1]},i.default.extend(i.default.Merge,i.default.AudioNode),i.default.Merge.prototype.dispose=function(){return this.input.forEach((function(t){t.dispose()})),i.default.AudioNode.prototype.dispose.call(this),this.left=null,this.right=null,this._merger.disconnect(),this._merger=null,this},e.default=i.default.Merge},function(t,e,n){n.r(e);var i=n(0);n(35),n(4),i.default.supported&&(AudioBuffer.prototype.copyToChannel||(AudioBuffer.prototype.copyToChannel=function(t,e,n){var i=this.getChannelData(e);n=n||0;for(var r=0;r<i.length;r++)i[r+n]=t[r]},AudioBuffer.prototype.copyFromChannel=function(t,e,n){var i=this.getChannelData(e);n=n||0;for(var r=0;r<t.length;r++)t[r]=i[r+n]})),i.default.Buffer=function(){var t=i.default.defaults(arguments,["url","onload","onerror"],i.default.Buffer);i.default.call(this),this._buffer=null,this._reversed=t.reverse,this._xhr=null,this.onload=i.default.noOp,t.url instanceof AudioBuffer||t.url instanceof i.default.Buffer?(this.set(t.url),this.loaded||(this.onload=t.onload)):i.default.isString(t.url)&&this.load(t.url).then(t.onload).catch(t.onerror)},i.default.extend(i.default.Buffer),i.default.Buffer.defaults={url:void 0,reverse:!1,onload:i.default.noOp,onerror:i.default.noOp},i.default.Buffer.prototype.set=function(t){return t instanceof i.default.Buffer?t.loaded?this._buffer=t.get():t.onload=function(){this.set(t),this.onload(this)}.bind(this):this._buffer=t,this._reversed&&this._reverse(),this},i.default.Buffer.prototype.get=function(){return this._buffer},i.default.Buffer.prototype.load=function(t,e,n){return new Promise(function(r,o){this._xhr=i.default.Buffer.load(t,function(t){this._xhr=null,this.set(t),r(this),this.onload(this),e&&e(this)}.bind(this),function(t){this._xhr=null,o(t),n&&n(t)}.bind(this))}.bind(this))},i.default.Buffer.prototype.dispose=function(){return i.default.prototype.dispose.call(this),this._buffer=null,this._xhr&&(i.default.Buffer._removeFromDownloadQueue(this._xhr),this._xhr.abort(),this._xhr=null),this},Object.defineProperty(i.default.Buffer.prototype,"loaded",{get:function(){return this.length>0}}),Object.defineProperty(i.default.Buffer.prototype,"duration",{get:function(){return this._buffer?this._buffer.duration:0}}),Object.defineProperty(i.default.Buffer.prototype,"length",{get:function(){return this._buffer?this._buffer.length:0}}),Object.defineProperty(i.default.Buffer.prototype,"numberOfChannels",{get:function(){return this._buffer?this._buffer.numberOfChannels:0}}),i.default.Buffer.prototype.fromArray=function(t){var e=t[0].length>0,n=e?t.length:1,i=e?t[0].length:t.length,r=this.context.createBuffer(n,i,this.context.sampleRate);e||1!==n||(t=[t]);for(var o=0;o<n;o++)r.copyToChannel(t[o],o);return this._buffer=r,this},i.default.Buffer.prototype.toMono=function(t){if(i.default.isNumber(t))this.fromArray(this.toArray(t));else{for(var e=new Float32Array(this.length),n=this.numberOfChannels,r=0;r<n;r++)for(var o=this.toArray(r),a=0;a<o.length;a++)e[a]+=o[a];e=e.map((function(t){return t/n})),this.fromArray(e)}return this},i.default.Buffer.prototype.toArray=function(t){if(i.default.isNumber(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);for(var e=[],n=0;n<this.numberOfChannels;n++)e[n]=this.getChannelData(n);return e},i.default.Buffer.prototype.getChannelData=function(t){return this._buffer.getChannelData(t)},i.default.Buffer.prototype.slice=function(t,e){e=i.default.defaultArg(e,this.duration);for(var n=Math.floor(this.context.sampleRate*this.toSeconds(t)),r=Math.floor(this.context.sampleRate*this.toSeconds(e)),o=[],a=0;a<this.numberOfChannels;a++)o[a]=this.toArray(a).slice(n,r);return(new i.default.Buffer).fromArray(o)},i.default.Buffer.prototype._reverse=function(){if(this.loaded)for(var t=0;t<this.numberOfChannels;t++)Array.prototype.reverse.call(this.getChannelData(t));return this},Object.defineProperty(i.default.Buffer.prototype,"reverse",{get:function(){return this._reversed},set:function(t){this._reversed!==t&&(this._reversed=t,this._reverse())}}),i.default.Emitter.mixin(i.default.Buffer),i.default.Buffer._downloadQueue=[],i.default.Buffer.baseUrl="",i.default.Buffer.fromArray=function(t){return(new i.default.Buffer).fromArray(t)},i.default.Buffer.fromUrl=function(t){var e=new i.default.Buffer;return e.load(t).then((function(){return e}))},i.default.Buffer._removeFromDownloadQueue=function(t){var e=i.default.Buffer._downloadQueue.indexOf(t);-1!==e&&i.default.Buffer._downloadQueue.splice(e,1)},i.default.Buffer.load=function(t,e,n){e=i.default.defaultArg(e,i.default.noOp);var r=t.match(/\[(.+\|?)+\]$/);if(r){for(var o=r[1].split("|"),a=o[0],s=0;s<o.length;s++)if(i.default.Buffer.supportsType(o[s])){a=o[s];break}t=t.replace(r[0],a)}function u(t){if(i.default.Buffer._removeFromDownloadQueue(c),i.default.Buffer.emit("error",t),!n)throw t;n(t)}function l(){for(var t=0,e=0;e<i.default.Buffer._downloadQueue.length;e++)t+=i.default.Buffer._downloadQueue[e].progress;i.default.Buffer.emit("progress",t/i.default.Buffer._downloadQueue.length)}var c=new XMLHttpRequest;return c.open("GET",i.default.Buffer.baseUrl+t,!0),c.responseType="arraybuffer",c.progress=0,i.default.Buffer._downloadQueue.push(c),c.addEventListener("load",(function(){200===c.status?i.default.context.decodeAudioData(c.response).then((function(t){c.progress=1,l(),e(t),i.default.Buffer._removeFromDownloadQueue(c),0===i.default.Buffer._downloadQueue.length&&i.default.Buffer.emit("load")})).catch((function(){i.default.Buffer._removeFromDownloadQueue(c),u("Tone.Buffer: could not decode audio data: "+t)})):u("Tone.Buffer: could not locate file: "+t)})),c.addEventListener("error",u),c.addEventListener("progress",(function(t){t.lengthComputable&&(c.progress=t.loaded/t.total*.95,l())})),c.send(),c},i.default.Buffer.cancelDownloads=function(){return i.default.Buffer._downloadQueue.slice().forEach((function(t){i.default.Buffer._removeFromDownloadQueue(t),t.abort()})),i.default.Buffer},i.default.Buffer.supportsType=function(t){var e=t.split(".");return e=e[e.length-1],""!==document.createElement("audio").canPlayType("audio/"+e)},i.default.loaded=function(){var t,e;function n(){i.default.Buffer.off("load",t),i.default.Buffer.off("error",e)}return new Promise((function(n,r){t=function(){n()},e=function(){r()},i.default.Buffer.on("load",t),i.default.Buffer.on("error",e)})).then(n).catch((function(t){throw n(),new Error(t)}))},e.default=i.default.Buffer},function(t,e,n){n.r(e);var i=n(0);n(17),n(26),n(1),n(2),n(22),n(4),n(28),i.default.LFO=function(){var t=i.default.defaults(arguments,["frequency","min","max"],i.default.LFO);i.default.AudioNode.call(this),this._oscillator=new i.default.Oscillator({frequency:t.frequency,type:t.type}),this.frequency=this._oscillator.frequency,this.amplitude=this._oscillator.volume,this.amplitude.units=i.default.Type.NormalRange,this.amplitude.value=t.amplitude,this._stoppedSignal=new i.default.Signal(0,i.default.Type.AudioRange),this._zeros=new i.default.Zero,this._stoppedValue=0,this._a2g=new i.default.AudioToGain,this._scaler=this.output=new i.default.Scale(t.min,t.max),this._units=i.default.Type.Default,this.units=t.units,this._oscillator.chain(this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),this._readOnly(["amplitude","frequency"]),this.phase=t.phase},i.default.extend(i.default.LFO,i.default.AudioNode),i.default.LFO.defaults={type:"sine",min:0,max:1,phase:0,frequency:"4n",amplitude:1,units:i.default.Type.Default},i.default.LFO.prototype.start=function(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this},i.default.LFO.prototype.stop=function(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this},i.default.LFO.prototype.sync=function(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this},i.default.LFO.prototype.unsync=function(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this},Object.defineProperty(i.default.LFO.prototype,"min",{get:function(){return this._toUnits(this._scaler.min)},set:function(t){t=this._fromUnits(t),this._scaler.min=t}}),Object.defineProperty(i.default.LFO.prototype,"max",{get:function(){return this._toUnits(this._scaler.max)},set:function(t){t=this._fromUnits(t),this._scaler.max=t}}),Object.defineProperty(i.default.LFO.prototype,"type",{get:function(){return this._oscillator.type},set:function(t){this._oscillator.type=t,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(i.default.LFO.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(t){this._oscillator.phase=t,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(i.default.LFO.prototype,"units",{get:function(){return this._units},set:function(t){var e=this.min,n=this.max;this._units=t,this.min=e,this.max=n}}),Object.defineProperty(i.default.LFO.prototype,"state",{get:function(){return this._oscillator.state}}),i.default.LFO.prototype.connect=function(t){return t.constructor!==i.default.Signal&&t.constructor!==i.default.Param||(this.convert=t.convert,this.units=t.units),i.default.SignalBase.prototype.connect.apply(this,arguments),this},i.default.LFO.prototype._fromUnits=i.default.Param.prototype._fromUnits,i.default.LFO.prototype._toUnits=i.default.Param.prototype._toUnits,i.default.LFO.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["amplitude","frequency"]),this._oscillator.dispose(),this._oscillator=null,this._stoppedSignal.dispose(),this._stoppedSignal=null,this._zeros.dispose(),this._zeros=null,this._scaler.dispose(),this._scaler=null,this._a2g.dispose(),this._a2g=null,this.frequency=null,this.amplitude=null,this},e.default=i.default.LFO},function(t,e,n){n.r(e);var i=n(0);n(29),n(90),n(2),n(3),i.default.Subtract=function(t){i.default.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.output=new i.default.Gain,this._neg=new i.default.Negate,this._param=this.input[1]=new i.default.Signal(t),this._param.chain(this._neg,this._sum)},i.default.extend(i.default.Subtract,i.default.Signal),i.default.Subtract.prototype.dispose=function(){return i.default.Signal.prototype.dispose.call(this),this._neg.dispose(),this._neg=null,this._sum.disconnect(),this._sum=null,this},e.default=i.default.Subtract},function(t,e,n){n.r(e);var i=n(0);n(4),n(1),n(24),i.default.Param=function(){var t=i.default.defaults(arguments,["param","units","convert"],i.default.Param);i.default.AudioNode.call(this,t),this._param=this.input=t.param,this.units=t.units,this.convert=t.convert,this.overridden=!1,this._events=new i.default.Timeline(1e3),i.default.isDefined(t.value)&&this._param&&this.setValueAtTime(t.value,0)},i.default.extend(i.default.Param,i.default.AudioNode),i.default.Param.defaults={units:i.default.Type.Default,convert:!0,param:void 0},Object.defineProperty(i.default.Param.prototype,"value",{get:function(){var t=this.now();return this._toUnits(this.getValueAtTime(t))},set:function(t){this._initialValue=this._fromUnits(t),this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}}),Object.defineProperty(i.default.Param.prototype,"minValue",{get:function(){return this.units===i.default.Type.Time||this.units===i.default.Type.Frequency||this.units===i.default.Type.NormalRange||this.units===i.default.Type.Positive||this.units===i.default.Type.BPM?0:this.units===i.default.Type.AudioRange?-1:this.units===i.default.Type.Decibels?-1/0:this._param.minValue}}),Object.defineProperty(i.default.Param.prototype,"maxValue",{get:function(){return this.units===i.default.Type.NormalRange||this.units===i.default.Type.AudioRange?1:this._param.maxValue}}),i.default.Param.prototype._fromUnits=function(t){if(!this.convert&&!i.default.isUndef(this.convert)||this.overridden)return t;switch(this.units){case i.default.Type.Time:return this.toSeconds(t);case i.default.Type.Frequency:return this.toFrequency(t);case i.default.Type.Decibels:return i.default.dbToGain(t);case i.default.Type.NormalRange:return Math.min(Math.max(t,0),1);case i.default.Type.AudioRange:return Math.min(Math.max(t,-1),1);case i.default.Type.Positive:return Math.max(t,0);default:return t}},i.default.Param.prototype._toUnits=function(t){if(!this.convert&&!i.default.isUndef(this.convert))return t;switch(this.units){case i.default.Type.Decibels:return i.default.gainToDb(t);default:return t}},i.default.Param.prototype._minOutput=1e-5,i.default.Param.AutomationType={Linear:"linearRampToValueAtTime",Exponential:"exponentialRampToValueAtTime",Target:"setTargetAtTime",SetValue:"setValueAtTime",Cancel:"cancelScheduledValues"},i.default.Param.prototype.setValueAtTime=function(t,e){return e=this.toSeconds(e),t=this._fromUnits(t),this._events.add({type:i.default.Param.AutomationType.SetValue,value:t,time:e}),this.log(i.default.Param.AutomationType.SetValue,t,e),this._param.setValueAtTime(t,e),this},i.default.Param.prototype.getValueAtTime=function(t){t=this.toSeconds(t);var e=this._events.getAfter(t),n=this._events.get(t),r=i.default.defaultArg(this._initialValue,this._param.defaultValue),o=r;if(null===n)o=r;else if(n.type===i.default.Param.AutomationType.Target){var a,s=this._events.getBefore(n.time);a=null===s?r:s.value,o=this._exponentialApproach(n.time,a,n.value,n.constant,t)}else o=null===e?n.value:e.type===i.default.Param.AutomationType.Linear?this._linearInterpolate(n.time,n.value,e.time,e.value,t):e.type===i.default.Param.AutomationType.Exponential?this._exponentialInterpolate(n.time,n.value,e.time,e.value,t):n.value;return o},i.default.Param.prototype.setRampPoint=function(t){t=this.toSeconds(t);var e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===e&&(e=this._minOutput),this.setValueAtTime(this._toUnits(e),t),this},i.default.Param.prototype.linearRampToValueAtTime=function(t,e){return t=this._fromUnits(t),e=this.toSeconds(e),this._events.add({type:i.default.Param.AutomationType.Linear,value:t,time:e}),this.log(i.default.Param.AutomationType.Linear,t,e),this._param.linearRampToValueAtTime(t,e),this},i.default.Param.prototype.exponentialRampToValueAtTime=function(t,e){return t=this._fromUnits(t),t=Math.max(this._minOutput,t),e=this.toSeconds(e),this._events.add({type:i.default.Param.AutomationType.Exponential,time:e,value:t}),this.log(i.default.Param.AutomationType.Exponential,t,e),this._param.exponentialRampToValueAtTime(t,e),this},i.default.Param.prototype.exponentialRampTo=function(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this},i.default.Param.prototype.linearRampTo=function(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this},i.default.Param.prototype.targetRampTo=function(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this},i.default.Param.prototype.exponentialApproachValueAtTime=function(t,e,n){var i=Math.log(this.toSeconds(n)+1)/Math.log(200);return e=this.toSeconds(e),this.setTargetAtTime(t,e,i),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this},i.default.Param.prototype.setTargetAtTime=function(t,e,n){if(t=this._fromUnits(t),n<=0)throw new Error("timeConstant must be greater than 0");return e=this.toSeconds(e),this._events.add({type:i.default.Param.AutomationType.Target,value:t,time:e,constant:n}),this.log(i.default.Param.AutomationType.Target,t,e,n),this._param.setTargetAtTime(t,e,n),this},i.default.Param.prototype.setValueCurveAtTime=function(t,e,n,r){r=i.default.defaultArg(r,1),n=this.toSeconds(n),e=this.toSeconds(e),this.setValueAtTime(t[0]*r,e);for(var o=n/(t.length-1),a=1;a<t.length;a++)this.linearRampToValueAtTime(t[a]*r,e+a*o);return this},i.default.Param.prototype.cancelScheduledValues=function(t){return t=this.toSeconds(t),this._events.cancel(t),this._param.cancelScheduledValues(t),this.log(i.default.Param.AutomationType.Cancel,t),this},i.default.Param.prototype.cancelAndHoldAtTime=function(t){t=this.toSeconds(t);var e=this.getValueAtTime(t);this.log("cancelAndHoldAtTime",t,"value="+e),this._param.cancelScheduledValues(t);var n=this._events.get(t),r=this._events.getAfter(t);return n&&n.time===t?r?this._events.cancel(r.time):this._events.cancel(t+this.sampleTime):r&&(this._events.cancel(r.time),r.type===i.default.Param.AutomationType.Linear?this.linearRampToValueAtTime(e,t):r.type===i.default.Param.AutomationType.Exponential&&this.exponentialRampToValueAtTime(e,t)),this._events.add({type:i.default.Param.AutomationType.SetValue,value:e,time:t}),this._param.setValueAtTime(e,t),this},i.default.Param.prototype.rampTo=function(t,e,n){return e=i.default.defaultArg(e,.1),this.units===i.default.Type.Frequency||this.units===i.default.Type.BPM||this.units===i.default.Type.Decibels?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this},i.default.Param.prototype._exponentialApproach=function(t,e,n,i,r){return n+(e-n)*Math.exp(-(r-t)/i)},i.default.Param.prototype._linearInterpolate=function(t,e,n,i,r){return e+(r-t)/(n-t)*(i-e)},i.default.Param.prototype._exponentialInterpolate=function(t,e,n,i,r){return e*Math.pow(i/e,(r-t)/(n-t))},i.default.Param.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._param=null,this._events=null,this},e.default=i.default.Param},function(t,e,n){n.r(e);var i=n(0);n(8),n(19),n(10),n(23),i.default.StereoEffect=function(){i.default.AudioNode.call(this);var t=i.default.defaults(arguments,["wet"],i.default.Effect);this.createInsOuts(1,1),this._dryWet=new i.default.CrossFade(t.wet),this.wet=this._dryWet.fade,this._split=new i.default.Split,this.effectSendL=this._split.left,this.effectSendR=this._split.right,this._merge=new i.default.Merge,this.effectReturnL=this._merge.left,this.effectReturnR=this._merge.right,i.default.connect(this.input,this._split),i.default.connect(this.input,this._dryWet,0,0),this._merge.connect(this._dryWet,0,1),this._dryWet.connect(this.output),this._readOnly(["wet"])},i.default.extend(i.default.StereoEffect,i.default.Effect),i.default.StereoEffect.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this._split.dispose(),this._split=null,this._merge.dispose(),this._merge=null,this.effectSendL=null,this.effectSendR=null,this.effectReturnL=null,this.effectReturnR=null,this._writable(["wet"]),this.wet=null,this},e.default=i.default.StereoEffect},function(t,e,n){n.r(e);var i=n(0);n(83),n(4),n(24),n(35),n(3),n(81),n(80),n(56),i.default.Transport=function(){i.default.Emitter.call(this),i.default.getContext(function(){this.loop=!1,this._loopStart=0,this._loopEnd=0,this._ppq=r.defaults.PPQ,this._clock=new i.default.Clock({callback:this._processTick.bind(this),frequency:0}),this._bindClockEvents(),this.bpm=this._clock.frequency,this.bpm._toUnits=this._toUnits.bind(this),this.bpm._fromUnits=this._fromUnits.bind(this),this.bpm.units=i.default.Type.BPM,this.bpm.value=r.defaults.bpm,this._readOnly("bpm"),this._timeSignature=r.defaults.timeSignature,this._scheduledEvents={},this._timeline=new i.default.Timeline,this._repeatedEvents=new i.default.IntervalTimeline,this._syncedSignals=[],this._swingTicks=r.defaults.PPQ/2,this._swingAmount=0,this.context.transport=this}.bind(this))},i.default.extend(i.default.Transport,i.default.Emitter),i.default.Transport.defaults={bpm:120,swing:0,swingSubdivision:"8n",timeSignature:4,loopStart:0,loopEnd:"4m",PPQ:192},i.default.Transport.prototype.isTransport=!0,i.default.Transport.prototype._processTick=function(t,e){if(this._swingAmount>0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){var n=e%(2*this._swingTicks)/(2*this._swingTicks),r=Math.sin(n*Math.PI)*this._swingAmount;t+=i.default.Ticks(2*this._swingTicks/3).toSeconds()*r}this.loop&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._timeline.forEachAtTime(e,(function(e){e.invoke(t)}))},i.default.Transport.prototype.schedule=function(t,e){var n=new i.default.TransportEvent(this,{time:i.default.TransportTime(e),callback:t});return this._addEvent(n,this._timeline)},i.default.Transport.prototype.scheduleRepeat=function(t,e,n,r){var o=new i.default.TransportRepeatEvent(this,{callback:t,interval:i.default.Time(e),time:i.default.TransportTime(n),duration:i.default.Time(i.default.defaultArg(r,1/0))});return this._addEvent(o,this._repeatedEvents)},i.default.Transport.prototype.scheduleOnce=function(t,e){var n=new i.default.TransportEvent(this,{time:i.default.TransportTime(e),callback:t,once:!0});return this._addEvent(n,this._timeline)},i.default.Transport.prototype.clear=function(t){if(this._scheduledEvents.hasOwnProperty(t)){var e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this},i.default.Transport.prototype._addEvent=function(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id},i.default.Transport.prototype.cancel=function(t){return t=i.default.defaultArg(t,0),t=this.toTicks(t),this._timeline.forEachFrom(t,function(t){this.clear(t.id)}.bind(this)),this._repeatedEvents.forEachFrom(t,function(t){this.clear(t.id)}.bind(this)),this},i.default.Transport.prototype._bindClockEvents=function(){this._clock.on("start",function(t,e){e=i.default.Ticks(e).toSeconds(),this.emit("start",t,e)}.bind(this)),this._clock.on("stop",function(t){this.emit("stop",t)}.bind(this)),this._clock.on("pause",function(t){this.emit("pause",t)}.bind(this))},Object.defineProperty(i.default.Transport.prototype,"state",{get:function(){return this._clock.getStateAtTime(this.now())}}),i.default.Transport.prototype.start=function(t,e){return i.default.isDefined(e)&&(e=this.toTicks(e)),this._clock.start(t,e),this},i.default.Transport.prototype.stop=function(t){return this._clock.stop(t),this},i.default.Transport.prototype.pause=function(t){return this._clock.pause(t),this},i.default.Transport.prototype.toggle=function(t){return t=this.toSeconds(t),this._clock.getStateAtTime(t)!==i.default.State.Started?this.start(t):this.stop(t),this},Object.defineProperty(i.default.Transport.prototype,"timeSignature",{get:function(){return this._timeSignature},set:function(t){i.default.isArray(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}}),Object.defineProperty(i.default.Transport.prototype,"loopStart",{get:function(){return i.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t)}}),Object.defineProperty(i.default.Transport.prototype,"loopEnd",{get:function(){return i.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t)}}),i.default.Transport.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(i.default.Transport.prototype,"swing",{get:function(){return this._swingAmount},set:function(t){this._swingAmount=t}}),Object.defineProperty(i.default.Transport.prototype,"swingSubdivision",{get:function(){return i.default.Ticks(this._swingTicks).toNotation()},set:function(t){this._swingTicks=this.toTicks(t)}}),Object.defineProperty(i.default.Transport.prototype,"position",{get:function(){var t=this.now(),e=this._clock.getTicksAtTime(t);return i.default.Ticks(e).toBarsBeatsSixteenths()},set:function(t){var e=this.toTicks(t);this.ticks=e}}),Object.defineProperty(i.default.Transport.prototype,"seconds",{get:function(){return this._clock.seconds},set:function(t){var e=this.now(),n=this.bpm.timeToTicks(t,e);this.ticks=n}}),Object.defineProperty(i.default.Transport.prototype,"progress",{get:function(){if(this.loop){var t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}}),Object.defineProperty(i.default.Transport.prototype,"ticks",{get:function(){return this._clock.ticks},set:function(t){if(this._clock.ticks!==t){var e=this.now();this.state===i.default.State.Started?(this.emit("stop",e),this._clock.setTicksAtTime(t,e),this.emit("start",e,this.seconds)):this._clock.setTicksAtTime(t,e)}}}),i.default.Transport.prototype.getTicksAtTime=function(t){return Math.round(this._clock.getTicksAtTime(t))},i.default.Transport.prototype.getSecondsAtTime=function(t){return this._clock.getSecondsAtTime(t)},Object.defineProperty(i.default.Transport.prototype,"PPQ",{get:function(){return this._ppq},set:function(t){var e=this.bpm.value;this._ppq=t,this.bpm.value=e}}),i.default.Transport.prototype._fromUnits=function(t){return 1/(60/t/this.PPQ)},i.default.Transport.prototype._toUnits=function(t){return t/this.PPQ*60},i.default.Transport.prototype.nextSubdivision=function(t){if(t=this.toTicks(t),this.state!==i.default.State.Started)return 0;var e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)},i.default.Transport.prototype.syncSignal=function(t,e){if(!e){var n=this.now();e=0!==t.getValueAtTime(n)?t.getValueAtTime(n)/this.bpm.getValueAtTime(n):0}var r=new i.default.Gain(e);return this.bpm.chain(r,t._param),this._syncedSignals.push({ratio:r,signal:t,initial:t.value}),t.value=0,this},i.default.Transport.prototype.unsyncSignal=function(t){for(var e=this._syncedSignals.length-1;e>=0;e--){var n=this._syncedSignals[e];n.signal===t&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this},i.default.Transport.prototype.dispose=function(){return i.default.Emitter.prototype.dispose.call(this),this._clock.dispose(),this._clock=null,this._writable("bpm"),this.bpm=null,this._timeline.dispose(),this._timeline=null,this._repeatedEvents.dispose(),this._repeatedEvents=null,this};var r=i.default.Transport;i.default.Transport=new r,i.default.Context.on("init",(function(t){t.transport&&t.transport.isTransport?i.default.Transport=t.transport:i.default.Transport=new r})),i.default.Context.on("close",(function(t){t.transport&&t.transport.isTransport&&t.transport.dispose()})),e.default=i.default.Transport},function(t,e,n){n.r(e);var i=n(0);n(2),n(6),n(16),n(64),i.default.Oscillator=function(){var t=i.default.defaults(arguments,["frequency","type"],i.default.Oscillator);i.default.Source.call(this,t),this._oscillator=null,this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this._wave=null,this._partials=t.partials,this._partialCount=t.partialCount,this._phase=t.phase,this._type=t.type,t.partialCount&&t.type!==i.default.Oscillator.Type.Custom&&(this._type=this.baseType+t.partialCount.toString()),this.phase=this._phase,this._readOnly(["frequency","detune"])},i.default.extend(i.default.Oscillator,i.default.Source),i.default.Oscillator.defaults={type:"sine",frequency:440,detune:0,phase:0,partials:[],partialCount:0},i.default.Oscillator.Type={Sine:"sine",Triangle:"triangle",Sawtooth:"sawtooth",Square:"square",Custom:"custom"},i.default.Oscillator.prototype._start=function(t){this.log("start",t);var e=new i.default.OscillatorNode;this._oscillator=e,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),t=this.toSeconds(t),this._oscillator.start(t)},i.default.Oscillator.prototype._stop=function(t){return this.log("stop",t),this._oscillator&&(t=this.toSeconds(t),this._oscillator.stop(t)),this},i.default.Oscillator.prototype.restart=function(t){return this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(this.toSeconds(t)),this},i.default.Oscillator.prototype.syncFrequency=function(){return i.default.Transport.syncSignal(this.frequency),this},i.default.Oscillator.prototype.unsyncFrequency=function(){return i.default.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(i.default.Oscillator.prototype,"type",{get:function(){return this._type},set:function(t){var e=[i.default.Oscillator.Type.Sine,i.default.Oscillator.Type.Square,i.default.Oscillator.Type.Triangle,i.default.Oscillator.Type.Sawtooth].includes(t);if(0===this._phase&&e)this._wave=null,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=t);else{var n=this._getRealImaginary(t,this._phase),r=this.context.createPeriodicWave(n[0],n[1]);this._wave=r,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}this._type=t}}),Object.defineProperty(i.default.Oscillator.prototype,"baseType",{get:function(){return this._type.replace(this.partialCount,"")},set:function(t){this.partialCount&&this._type!==i.default.Oscillator.Type.Custom&&t!==i.default.Oscillator.Type.Custom?this.type=t+this.partialCount:this.type=t}}),Object.defineProperty(i.default.Oscillator.prototype,"partialCount",{get:function(){return this._partialCount},set:function(t){var e=this._type,n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);n&&(e=n[1]),this._type!==i.default.Oscillator.Type.Custom&&(this.type=0===t?e:e+t.toString())}}),i.default.Oscillator.prototype.get=function(){var t=i.default.prototype.get.apply(this,arguments);return t.type!==i.default.Oscillator.Type.Custom&&delete t.partials,t},i.default.Oscillator.prototype._getRealImaginary=function(t,e){var n=2048,r=new Float32Array(n),o=new Float32Array(n),a=1;if(t===i.default.Oscillator.Type.Custom)a=this._partials.length+1,this._partialCount=this._partials.length,n=a;else{var s=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);s?(a=parseInt(s[2])+1,this._partialCount=parseInt(s[2]),t=s[1],n=a=Math.max(a,2)):this._partialCount=0,this._partials=[]}for(var u=1;u<n;++u){var l,c=2/(u*Math.PI);switch(t){case i.default.Oscillator.Type.Sine:l=u<=a?1:0,this._partials[u-1]=l;break;case i.default.Oscillator.Type.Square:l=1&u?2*c:0,this._partials[u-1]=l;break;case i.default.Oscillator.Type.Sawtooth:l=c*(1&u?1:-1),this._partials[u-1]=l;break;case i.default.Oscillator.Type.Triangle:l=1&u?c*c*2*(u-1>>1&1?-1:1):0,this._partials[u-1]=l;break;case i.default.Oscillator.Type.Custom:l=this._partials[u-1];break;default:throw new TypeError("Tone.Oscillator: invalid type: "+t)}0!==l?(r[u]=-l*Math.sin(e*u),o[u]=l*Math.cos(e*u)):(r[u]=0,o[u]=0)}return[r,o]},i.default.Oscillator.prototype._inverseFFT=function(t,e,n){for(var i=0,r=t.length,o=0;o<r;o++)i+=t[o]*Math.cos(o*n)+e[o]*Math.sin(o*n);return i},i.default.Oscillator.prototype._getInitialValue=function(){for(var t=this._getRealImaginary(this._type,0),e=t[0],n=t[1],i=0,r=2*Math.PI,o=0;o<8;o++)i=Math.max(this._inverseFFT(e,n,o/8*r),i);return-this._inverseFFT(e,n,this._phase)/i},Object.defineProperty(i.default.Oscillator.prototype,"partials",{get:function(){return this._partials},set:function(t){this._partials=t,this.type=i.default.Oscillator.Type.Custom}}),Object.defineProperty(i.default.Oscillator.prototype,"phase",{get:function(){return this._phase*(180/Math.PI)},set:function(t){this._phase=t*Math.PI/180,this.type=this._type}}),i.default.Oscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),null!==this._oscillator&&(this._oscillator.dispose(),this._oscillator=null),this._wave=null,this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._partials=null,this},e.default=i.default.Oscillator},function(t,e,n){n.r(e);var i=n(0);n(14),n(1),i.default.Delay=function(){var t=i.default.defaults(arguments,["delayTime","maxDelay"],i.default.Delay);i.default.AudioNode.call(this,t),this._maxDelay=Math.max(this.toSeconds(t.maxDelay),this.toSeconds(t.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(this._maxDelay),this.delayTime=new i.default.Param({param:this._delayNode.delayTime,units:i.default.Type.Time,value:t.delayTime}),this._readOnly("delayTime")},i.default.extend(i.default.Delay,i.default.AudioNode),i.default.Delay.defaults={maxDelay:1,delayTime:0},Object.defineProperty(i.default.Delay.prototype,"maxDelay",{get:function(){return this._maxDelay}}),i.default.Delay.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._delayNode.disconnect(),this._delayNode=null,this._writable("delayTime"),this.delayTime=null,this},e.default=i.default.Delay},function(t,e,n){n.r(e);var i=n(0);n(3),n(1),i.default.Split=function(t){t=i.default.defaultArg(t,2),i.default.AudioNode.call(this),this.createInsOuts(0,t),this._splitter=this.input=this.context.createChannelSplitter(t);for(var e=0;e<t;e++)this.output[e]=new i.default.Gain,i.default.connect(this._splitter,this.output[e],e,0),this.output[e].channelCount=1,this.output[e].channelCountMode="explicit";this.left=this.output[0],this.right=this.output[1]},i.default.extend(i.default.Split,i.default.AudioNode),i.default.Split.prototype.dispose=function(){return this.output.forEach((function(t){t.dispose()})),i.default.AudioNode.prototype.dispose.call(this),this._splitter.disconnect(),this.left=null,this.right=null,this._splitter=null,this},e.default=i.default.Split},function(t,e,n){n.r(e);var i=n(0),r=(n(35),n(24),n(44),["baseLatency","destination","currentTime","sampleRate","listener","state"]),o=["suspend","close","resume","getOutputTimestamp","createMediaElementSource","createMediaStreamSource","createMediaStreamDestination","createBuffer","decodeAudioData","createBufferSource","createConstantSource","createGain","createDelay","createBiquadFilter","createIIRFilter","createWaveShaper","createPanner","createConvolver","createDynamicsCompressor","createAnalyser","createScriptProcessor","createStereoPanner","createOscillator","createPeriodicWave","createChannelSplitter","createChannelMerger","audioWorklet"];i.default.Context=function(){i.default.Emitter.call(this);var t=i.default.defaults(arguments,["context"],i.default.Context);if(!t.context&&(t.context=new i.default.global.AudioContext,!t.context))throw new Error("could not create AudioContext. Possibly too many AudioContexts running already.");for(this._context=t.context;this._context.rawContext;)this._context=this._context.rawContext;r.forEach(function(t){this._defineProperty(this._context,t)}.bind(this)),o.forEach(function(t){this._defineMethod(this._context,t)}.bind(this)),this._latencyHint=t.latencyHint,this._constants={},this.lookAhead=t.lookAhead,this._computedUpdateInterval=0,this._ticker=new a(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this._timeouts=new i.default.Timeline,this._timeoutIds=0,this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=function(t){this.emit("statechange",t)}.bind(this)},i.default.extend(i.default.Context,i.default.Emitter),i.default.Emitter.mixin(i.default.Context),i.default.Context.defaults={clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.03},i.default.Context.prototype.isContext=!0,i.default.Context.prototype._defineProperty=function(t,e){i.default.isUndef(this[e])&&Object.defineProperty(this,e,{get:function(){return t[e]},set:function(n){t[e]=n}})},i.default.Context.prototype._defineMethod=function(t,e){i.default.isUndef(this[e])&&Object.defineProperty(this,e,{get:function(){return t[e].bind(t)}})},i.default.Context.prototype.now=function(){return this._context.currentTime+this.lookAhead},Object.defineProperty(i.default.Context.prototype,"destination",{get:function(){return this.master?this.master:this._context.destination}}),i.default.Context.prototype.resume=function(){return"suspended"===this._context.state&&this._context instanceof AudioContext?this._context.resume():Promise.resolve()},i.default.Context.prototype.close=function(){var t=Promise.resolve();return this!==i.default.global.TONE_AUDIO_CONTEXT&&(t=this.rawContext.close()),t.then(function(){i.default.Context.emit("close",this)}.bind(this))},i.default.Context.prototype.getConstant=function(t){if(this._constants[t])return this._constants[t];for(var e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0),i=0;i<n.length;i++)n[i]=t;var r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode="explicit",r.buffer=e,r.loop=!0,r.start(0),this._constants[t]=r,r},i.default.Context.prototype._timeoutLoop=function(){for(var t=this.now();this._timeouts&&this._timeouts.length&&this._timeouts.peek().time<=t;)this._timeouts.shift().callback()},i.default.Context.prototype.setTimeout=function(t,e){this._timeoutIds++;var n=this.now();return this._timeouts.add({callback:t,time:n+e,id:this._timeoutIds}),this._timeoutIds},i.default.Context.prototype.clearTimeout=function(t){return this._timeouts.forEach((function(e){e.id===t&&this.remove(e)})),this},Object.defineProperty(i.default.Context.prototype,"updateInterval",{get:function(){return this._ticker.updateInterval},set:function(t){this._ticker.updateInterval=t}}),Object.defineProperty(i.default.Context.prototype,"rawContext",{get:function(){return this._context}}),Object.defineProperty(i.default.Context.prototype,"clockSource",{get:function(){return this._ticker.type},set:function(t){this._ticker.type=t}}),Object.defineProperty(i.default.Context.prototype,"latencyHint",{get:function(){return this._latencyHint},set:function(t){var e=t;if(this._latencyHint=t,i.default.isString(t))switch(t){case"interactive":e=.1,this._context.latencyHint=t;break;case"playback":e=.8,this._context.latencyHint=t;break;case"balanced":e=.25,this._context.latencyHint=t;break;case"fastest":this._context.latencyHint="interactive",e=.01}this.lookAhead=e,this.updateInterval=e/3}}),i.default.Context.prototype.dispose=function(){return this.close().then(function(){for(var t in i.default.Emitter.prototype.dispose.call(this),this._ticker.dispose(),this._ticker=null,this._timeouts.dispose(),this._timeouts=null,this._constants)this._constants[t].disconnect();this._constants=null}.bind(this))};var a=function(t,e,n){this._type=e,this._updateInterval=n,this._callback=i.default.defaultArg(t,i.default.noOp),this._createClock()};if(a.Type={Worker:"worker",Timeout:"timeout",Offline:"offline"},a.prototype._createWorker=function(){i.default.global.URL=i.default.global.URL||i.default.global.webkitURL;var t=new Blob(["var timeoutTime = "+(1e3*this._updateInterval).toFixed(1)+";self.onmessage = function(msg){\ttimeoutTime = parseInt(msg.data);};function tick(){\tsetTimeout(tick, timeoutTime);\tself.postMessage('tick');}tick();"]),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n},a.prototype._createTimeout=function(){this._timeout=setTimeout(function(){this._createTimeout(),this._callback()}.bind(this),1e3*this._updateInterval)},a.prototype._createClock=function(){if(this._type===a.Type.Worker)try{this._createWorker()}catch(t){this._type=a.Type.Timeout,this._createClock()}else this._type===a.Type.Timeout&&this._createTimeout()},Object.defineProperty(a.prototype,"updateInterval",{get:function(){return this._updateInterval},set:function(t){this._updateInterval=Math.max(t,128/44100),this._type===a.Type.Worker&&this._worker.postMessage(Math.max(1e3*t,1))}}),Object.defineProperty(a.prototype,"type",{get:function(){return this._type},set:function(t){this._disposeClock(),this._type=t,this._createClock()}}),a.prototype._disposeClock=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this._worker&&(this._worker.terminate(),this._worker.onmessage=null,this._worker=null)},a.prototype.dispose=function(){this._disposeClock(),this._callback=null},i.default.supported&&!i.default.initialized){if(i.default.global.TONE_AUDIO_CONTEXT||(i.default.global.TONE_AUDIO_CONTEXT=new i.default.Context),i.default.context=i.default.global.TONE_AUDIO_CONTEXT,!i.default.global.TONE_SILENCE_LOGGING){var s="v";"dev"===i.default.version&&(s="");var u=" * Tone.js "+s+i.default.version+" * ";console.log("%c"+u,"background: #000; color: #fff")}}else i.default.supported||i.default.global.TONE_SILENCE_LOGGING||console.warn("This browser does not support Tone.js");e.default=i.default.Context},function(t,e,n){n.r(e);var i=n(0);n(4),n(40),i.default.Instrument=function(t){t=i.default.defaultArg(t,i.default.Instrument.defaults),i.default.AudioNode.call(this),this._volume=this.output=new i.default.Volume(t.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._scheduledEvents=[]},i.default.extend(i.default.Instrument,i.default.AudioNode),i.default.Instrument.defaults={volume:0},i.default.Instrument.prototype.triggerAttack=i.default.noOp,i.default.Instrument.prototype.triggerRelease=i.default.noOp,i.default.Instrument.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this},i.default.Instrument.prototype._syncMethod=function(t,e){var n=this["_original_"+t]=this[t];this[t]=function(){var t=Array.prototype.slice.call(arguments),r=t[e],o=i.default.Transport.schedule(function(i){t[e]=i,n.apply(this,t)}.bind(this),r);this._scheduledEvents.push(o)}.bind(this)},i.default.Instrument.prototype.unsync=function(){return this._scheduledEvents.forEach((function(t){i.default.Transport.clear(t)})),this._scheduledEvents=[],this._original_triggerAttack&&(this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this},i.default.Instrument.prototype.triggerAttackRelease=function(t,e,n,i){return n=this.toSeconds(n),e=this.toSeconds(e),this.triggerAttack(t,n,i),this.triggerRelease(n+e),this},i.default.Instrument.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable(["volume"]),this.volume=null,this.unsync(),this._scheduledEvents=null,this},e.default=i.default.Instrument},function(t,e,n){n.r(e);var i=n(0);n(7),n(2),i.default.AudioToGain=function(){i.default.SignalBase.call(this),this._norm=this.input=this.output=new i.default.WaveShaper((function(t){return(t+1)/2}))},i.default.extend(i.default.AudioToGain,i.default.SignalBase),i.default.AudioToGain.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},e.default=i.default.AudioToGain},function(t,e,n){n.r(e);var i=n(0);n(2),n(13),n(89),n(3),n(1),i.default.CrossFade=function(t){i.default.AudioNode.call(this),this.createInsOuts(2,1),this.a=this.input[0]=new i.default.Gain,this.b=this.input[1]=new i.default.Gain,this.fade=new i.default.Signal(i.default.defaultArg(t,.5),i.default.Type.NormalRange),this._equalPowerA=new i.default.EqualPowerGain,this._equalPowerB=new i.default.EqualPowerGain,this._one=this.context.getConstant(1),this._invert=new i.default.Subtract,this.a.connect(this.output),this.b.connect(this.output),this.fade.chain(this._equalPowerB,this.b.gain),i.default.connect(this._one,this._invert,0,0),this.fade.connect(this._invert,0,1),this._invert.chain(this._equalPowerA,this.a.gain),this._readOnly("fade")},i.default.extend(i.default.CrossFade,i.default.AudioNode),i.default.CrossFade.prototype.dispose=function(){return i.default.AudioNode.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._one=null,this.a.dispose(),this.a=null,this.b.dispose(),this.b=null,this},e.default=i.default.CrossFade},function(t,e,n){n.r(e);var i=n(0);i.default.Timeline=function(){var t=i.default.defaults(arguments,["memory"],i.default.Timeline);i.default.call(this),this._timeline=[],this.memory=t.memory},i.default.extend(i.default.Timeline),i.default.Timeline.defaults={memory:1/0},Object.defineProperty(i.default.Timeline.prototype,"length",{get:function(){return this._timeline.length}}),i.default.Timeline.prototype.add=function(t){if(i.default.isUndef(t.time))throw new Error("Tone.Timeline: events must have a time attribute");t.time=t.time.valueOf();var e=this._search(t.time);if(this._timeline.splice(e+1,0,t),this.length>this.memory){var n=this.length-this.memory;this._timeline.splice(0,n)}return this},i.default.Timeline.prototype.remove=function(t){var e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this},i.default.Timeline.prototype.get=function(t,e){e=i.default.defaultArg(e,"time");var n=this._search(t,e);return-1!==n?this._timeline[n]:null},i.default.Timeline.prototype.peek=function(){return this._timeline[0]},i.default.Timeline.prototype.shift=function(){return this._timeline.shift()},i.default.Timeline.prototype.getAfter=function(t,e){e=i.default.defaultArg(e,"time");var n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null},i.default.Timeline.prototype.getBefore=function(t,e){e=i.default.defaultArg(e,"time");var n=this._timeline.length;if(n>0&&this._timeline[n-1][e]<t)return this._timeline[n-1];var r=this._search(t,e);return r-1>=0?this._timeline[r-1]:null},i.default.Timeline.prototype.cancel=function(t){if(this._timeline.length>1){var e=this._search(t);if(e>=0)if(this._timeline[e].time===t){for(var n=e;n>=0&&this._timeline[n].time===t;n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=t&&(this._timeline=[]);return this},i.default.Timeline.prototype.cancelBefore=function(t){var e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this},i.default.Timeline.prototype.previousEvent=function(t){var e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null},i.default.Timeline.prototype._search=function(t,e){if(0===this._timeline.length)return-1;e=i.default.defaultArg(e,"time");var n=0,r=this._timeline.length,o=r;if(r>0&&this._timeline[r-1][e]<=t)return r-1;for(;n<o;){var a=Math.floor(n+(o-n)/2),s=this._timeline[a],u=this._timeline[a+1];if(s[e]===t){for(var l=a;l<this._timeline.length;l++)this._timeline[l][e]===t&&(a=l);return a}if(s[e]<t&&u[e]>t)return a;s[e]>t?o=a:n=a+1}return-1},i.default.Timeline.prototype._iterate=function(t,e,n){e=i.default.defaultArg(e,0),n=i.default.defaultArg(n,this._timeline.length-1),this._timeline.slice(e,n+1).forEach(function(e){t.call(this,e)}.bind(this))},i.default.Timeline.prototype.forEach=function(t){return this._iterate(t),this},i.default.Timeline.prototype.forEachBefore=function(t,e){var n=this._search(t);return-1!==n&&this._iterate(e,0,n),this},i.default.Timeline.prototype.forEachAfter=function(t,e){var n=this._search(t);return this._iterate(e,n+1),this},i.default.Timeline.prototype.forEachBetween=function(t,e,n){var i=this._search(t),r=this._search(e);return-1!==i&&-1!==r?(this._timeline[i].time!==t&&(i+=1),this._timeline[r].time===e&&(r-=1),this._iterate(n,i,r)):-1===i&&this._iterate(n,0,r),this},i.default.Timeline.prototype.forEachFrom=function(t,e){for(var n=this._search(t);n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this},i.default.Timeline.prototype.forEachAtTime=function(t,e){var n=this._search(t);return-1!==n&&this._iterate((function(n){n.time===t&&e.call(this,n)}),0,n),this},i.default.Timeline.prototype.dispose=function(){return i.default.prototype.dispose.call(this),this._timeline=null,this},e.default=i.default.Timeline},function(t,e,n){n.r(e);var i=n(0);n(21),n(2),i.default.Monophonic=function(t){t=i.default.defaultArg(t,i.default.Monophonic.defaults),i.default.Instrument.call(this,t),this.portamento=t.portamento},i.default.extend(i.default.Monophonic,i.default.Instrument),i.default.Monophonic.defaults={portamento:0},i.default.Monophonic.prototype.triggerAttack=function(t,e,n){return this.log("triggerAttack",t,e,n),e=this.toSeconds(e),this._triggerEnvelopeAttack(e,n),this.setNote(t,e),this},i.default.Monophonic.prototype.triggerRelease=function(t){return this.log("triggerRelease",t),t=this.toSeconds(t),this._triggerEnvelopeRelease(t),this},i.default.Monophonic.prototype._triggerEnvelopeAttack=function(){},i.default.Monophonic.prototype._triggerEnvelopeRelease=function(){},i.default.Monophonic.prototype.getLevelAtTime=function(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)},i.default.Monophonic.prototype.setNote=function(t,e){if(e=this.toSeconds(e),this.portamento>0&&this.getLevelAtTime(e)>.05){var n=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(t,n,e)}else this.frequency.setValueAtTime(t,e);return this},e.default=i.default.Monophonic},function(t,e,n){n.r(e);var i=n(0);n(29),n(5),n(2),i.default.Scale=function(t,e){i.default.SignalBase.call(this),this._outputMin=i.default.defaultArg(t,0),this._outputMax=i.default.defaultArg(e,1),this._scale=this.input=new i.default.Multiply(1),this._add=this.output=new i.default.Add(0),this._scale.connect(this._add),this._setRange()},i.default.extend(i.default.Scale,i.default.SignalBase),Object.defineProperty(i.default.Scale.prototype,"min",{get:function(){return this._outputMin},set:function(t){this._outputMin=t,this._setRange()}}),Object.defineProperty(i.default.Scale.prototype,"max",{get:function(){return this._outputMax},set:function(t){this._outputMax=t,this._setRange()}}),i.default.Scale.prototype._setRange=function(){this._add.value=this._outputMin,this._scale.value=this._outputMax-this._outputMin},i.default.Scale.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._add.dispose(),this._add=null,this._scale.dispose(),this._scale=null,this},e.default=i.default.Scale},function(t,e,n){n.r(e);var i=n(0);n(2),n(3),n(1),i.default.Volume=function(){var t=i.default.defaults(arguments,["volume"],i.default.Volume);i.default.AudioNode.call(this,t),this.output=this.input=new i.default.Gain(t.volume,i.default.Type.Decibels),this._unmutedVolume=t.volume,this.volume=this.output.gain,this._readOnly("volume"),this.mute=t.mute},i.default.extend(i.default.Volume,i.default.AudioNode),i.default.Volume.defaults={volume:0,mute:!1},Object.defineProperty(i.default.Volume.prototype,"mute",{get:function(){return this.volume.value===-1/0},set:function(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}}),i.default.Volume.prototype.dispose=function(){return this.input.dispose(),i.default.AudioNode.prototype.dispose.call(this),this._writable("volume"),this.volume.dispose(),this.volume=null,this},e.default=i.default.Volume},function(t,e,n){n.r(e);var i=n(0);n(3),n(30),i.default.Zero=function(){i.default.SignalBase.call(this),this._gain=this.input=this.output=new i.default.Gain,i.default.connect(this.context.getConstant(0),this._gain)},i.default.extend(i.default.Zero,i.default.SignalBase),i.default.Zero.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._gain.dispose(),this._gain=null,this},e.default=i.default.Zero},function(t,e,n){n.r(e);var i=n(0);n(2),n(3),i.default.Add=function(t){i.default.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.input[1]=this.output=new i.default.Gain,this._param=this.input[1]=new i.default.Signal(t),this._param.connect(this._sum)},i.default.extend(i.default.Add,i.default.Signal),i.default.Add.prototype.dispose=function(){return i.default.Signal.prototype.dispose.call(this),this._sum.dispose(),this._sum=null,this},e.default=i.default.Add},function(t,e,n){n.r(e);var i=n(0);n(1),i.default.SignalBase=function(){i.default.AudioNode.call(this)},i.default.extend(i.default.SignalBase,i.default.AudioNode),i.default.SignalBase.prototype.connect=function(t,e,n){return i.default.Signal&&i.default.Signal===t.constructor||i.default.Param&&i.default.Param===t.constructor?(t._param.cancelScheduledValues(0),t._param.setValueAtTime(0,0),t.overridden=!0):t instanceof AudioParam&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0)),i.default.AudioNode.prototype.connect.call(this,t,e,n),this},e.default=i.default.SignalBase},function(t,e,n){n.r(e);var i=n(0);n(47),n(3),i.default.AmplitudeEnvelope=function(){i.default.Envelope.apply(this,arguments),this.input=this.output=new i.default.Gain,this._sig.connect(this.output.gain)},i.default.extend(i.default.AmplitudeEnvelope,i.default.Envelope),i.default.AmplitudeEnvelope.prototype.dispose=function(){return i.default.Envelope.prototype.dispose.call(this),this},e.default=i.default.AmplitudeEnvelope},function(t,e,n){n.r(e);var i=n(0);n(11),n(6),n(3),n(1),i.default.BufferSource=function(){var t=i.default.defaults(arguments,["buffer","onload"],i.default.BufferSource);i.default.AudioNode.call(this,t),this.onended=t.onended,this._startTime=-1,this._sourceStarted=!1,this._sourceStopped=!1,this._stopTime=-1,this._gainNode=this.output=new i.default.Gain(0),this._source=this.context.createBufferSource(),i.default.connect(this._source,this._gainNode),this._source.onended=this._onended.bind(this),this._buffer=new i.default.Buffer(t.buffer,t.onload),this.playbackRate=new i.default.Param({param:this._source.playbackRate,units:i.default.Type.Positive,value:t.playbackRate}),this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut,this.curve=t.curve,this._onendedTimeout=-1,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd},i.default.extend(i.default.BufferSource,i.default.AudioNode),i.default.BufferSource.defaults={onended:i.default.noOp,onload:i.default.noOp,loop:!1,loopStart:0,loopEnd:0,fadeIn:0,fadeOut:0,curve:"linear",playbackRate:1},Object.defineProperty(i.default.BufferSource.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),i.default.BufferSource.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),-1!==this._startTime&&this._startTime<=t&&(-1===this._stopTime||t<this._stopTime)&&!this._sourceStopped?i.default.State.Started:i.default.State.Stopped},i.default.BufferSource.prototype.start=function(t,e,n,r){this.log("start",t,e,n,r),this.assert(-1===this._startTime,"can only be started once"),this.assert(this.buffer.loaded,"buffer is either not set or not loaded"),this.assert(!this._sourceStopped,"source is already stopped"),t=this.toSeconds(t),e=this.loop?i.default.defaultArg(e,this.loopStart):i.default.defaultArg(e,0),e=this.toSeconds(e),e=Math.max(e,0),r=i.default.defaultArg(r,1);var o=this.toSeconds(this.fadeIn);if(o>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this.curve?this._gainNode.gain.linearRampToValueAtTime(r,t+o):this._gainNode.gain.exponentialApproachValueAtTime(r,t,o)):this._gainNode.gain.setValueAtTime(r,t),this._startTime=t,i.default.isDefined(n)){var a=this.toSeconds(n);a=Math.max(a,0),this.stop(t+a)}if(this.loop){var s=this.loopEnd||this.buffer.duration,u=this.loopStart;e>=s&&(e=(e-u)%(s-u)+u)}return this._source.buffer=this.buffer.get(),this._source.loopEnd=this.loopEnd||this.buffer.duration,e<this.buffer.duration&&(this._sourceStarted=!0,this._source.start(t,e)),this},i.default.BufferSource.prototype.stop=function(t){this.log("stop",t),this.assert(this.buffer.loaded,"buffer is either not set or not loaded"),this.assert(!this._sourceStopped,"source is already stopped"),t=this.toSeconds(t),-1!==this._stopTime&&this.cancelStop();var e=this.toSeconds(this.fadeOut);return this._stopTime=t+e,e>0?"linear"===this.curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),i.default.context.clearTimeout(this._onendedTimeout),this._onendedTimeout=i.default.context.setTimeout(this._onended.bind(this),this._stopTime-this.now()),this},i.default.BufferSource.prototype.cancelStop=function(){if(-1!==this._startTime&&!this._sourceStopped){var t=this.toSeconds(this.fadeIn);this._gainNode.gain.cancelScheduledValues(this._startTime+t+this.sampleTime),this.context.clearTimeout(this._onendedTimeout),this._stopTime=-1}return this},i.default.BufferSource.prototype._onended=function(){if(!this._sourceStopped){this._sourceStopped=!0;var t="exponential"===this.curve?2*this.fadeOut:0;this._sourceStarted&&-1!==this._stopTime&&this._source.stop(this._stopTime+t),this.onended(this),setTimeout(function(){this._source&&(this._source.disconnect(),this._gainNode.disconnect())}.bind(this),1e3*t+100)}},Object.defineProperty(i.default.BufferSource.prototype,"loopStart",{get:function(){return this._source.loopStart},set:function(t){this._source.loopStart=this.toSeconds(t)}}),Object.defineProperty(i.default.BufferSource.prototype,"loopEnd",{get:function(){return this._source.loopEnd},set:function(t){this._source.loopEnd=this.toSeconds(t)}}),Object.defineProperty(i.default.BufferSource.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(i.default.BufferSource.prototype,"loop",{get:function(){return this._source.loop},set:function(t){this._source.loop=t,this.cancelStop()}}),i.default.BufferSource.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,i.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._source.onended=null,this._source.disconnect(),this._source=null,this._gainNode.dispose(),this._gainNode=null,this._buffer.dispose(),this._buffer=null,this._startTime=-1,this.playbackRate=null,i.default.context.clearTimeout(this._onendedTimeout)),this},e.default=i.default.BufferSource},function(t,e,n){n.r(e);var i=n(0);n(8),n(2),n(5),n(3),i.default.FeedbackEffect=function(){var t=i.default.defaults(arguments,["feedback"],i.default.FeedbackEffect);i.default.Effect.call(this,t),this._feedbackGain=new i.default.Gain(t.feedback,i.default.Type.NormalRange),this.feedback=this._feedbackGain.gain,this.effectReturn.chain(this._feedbackGain,this.effectSend),this._readOnly(["feedback"])},i.default.extend(i.default.FeedbackEffect,i.default.Effect),i.default.FeedbackEffect.defaults={feedback:.125},i.default.FeedbackEffect.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._writable(["feedback"]),this._feedbackGain.dispose(),this._feedbackGain=null,this.feedback=null,this},e.default=i.default.FeedbackEffect},function(t,e,n){n.r(e);var i=n(0);n(24),n(4),i.default.TimelineState=function(t){i.default.Timeline.call(this),this._initial=t},i.default.extend(i.default.TimelineState,i.default.Timeline),i.default.TimelineState.prototype.getValueAtTime=function(t){var e=this.get(t);return null!==e?e.state:this._initial},i.default.TimelineState.prototype.setStateAtTime=function(t,e){return this.add({state:t,time:e}),this},i.default.TimelineState.prototype.getLastState=function(t,e){e=this.toSeconds(e);for(var n=this._search(e);n>=0;n--){var i=this._timeline[n];if(i.state===t)return i}},i.default.TimelineState.prototype.getNextState=function(t,e){e=this.toSeconds(e);var n=this._search(e);if(-1!==n)for(var i=n;i<this._timeline.length;i++){var r=this._timeline[i];if(r.state===t)return r}},e.default=i.default.TimelineState},function(t,e,n){n.r(e);var i=n(0);i.default.Emitter=function(){i.default.call(this),this._events={}},i.default.extend(i.default.Emitter),i.default.Emitter.prototype.on=function(t,e){for(var n=t.split(/\W+/),i=0;i<n.length;i++){var r=n[i];this._events.hasOwnProperty(r)||(this._events[r]=[]),this._events[r].push(e)}return this},i.default.Emitter.prototype.once=function(t,e){var n=function(){e.apply(this,arguments),this.off(t,n)}.bind(this);return this.on(t,n),this},i.default.Emitter.prototype.off=function(t,e){for(var n=t.split(/\W+/),r=0;r<n.length;r++)if(t=n[r],this._events.hasOwnProperty(t))if(i.default.isUndef(e))this._events[t]=[];else for(var o=this._events[t],a=0;a<o.length;a++)o[a]===e&&o.splice(a,1);return this},i.default.Emitter.prototype.emit=function(t){if(this._events){var e=Array.apply(null,arguments).slice(1);if(this._events.hasOwnProperty(t))for(var n=this._events[t].slice(0),i=0,r=n.length;i<r;i++)n[i].apply(this,e)}return this},i.default.Emitter.mixin=function(t){var e=["on","once","off","emit"];t._events={};for(var n=0;n<e.length;n++){var r=e[n],o=i.default.Emitter.prototype[r];t[r]=o}return i.default.Emitter},i.default.Emitter.prototype.dispose=function(){return i.default.prototype.dispose.call(this),this._events=null,this},e.default=i.default.Emitter},function(t,e,n){n.r(e);var i=n(0);n(1),n(44),i.default.supported&&(AnalyserNode.prototype.getFloatTimeDomainData||(AnalyserNode.prototype.getFloatTimeDomainData=function(t){var e=new Uint8Array(t.length);this.getByteTimeDomainData(e);for(var n=0;n<e.length;n++)t[n]=(e[n]-128)/128})),i.default.Analyser=function(){var t=i.default.defaults(arguments,["type","size"],i.default.Analyser);i.default.AudioNode.call(this),this._analyser=this.input=this.output=this.context.createAnalyser(),this._type=t.type,this._buffer=null,this.size=t.size,this.type=t.type},i.default.extend(i.default.Analyser,i.default.AudioNode),i.default.Analyser.defaults={size:1024,type:"fft",smoothing:.8},i.default.Analyser.Type={Waveform:"waveform",FFT:"fft"},i.default.Analyser.prototype.getValue=function(){return this._type===i.default.Analyser.Type.FFT?this._analyser.getFloatFrequencyData(this._buffer):this._type===i.default.Analyser.Type.Waveform&&this._analyser.getFloatTimeDomainData(this._buffer),this._buffer},Object.defineProperty(i.default.Analyser.prototype,"size",{get:function(){return this._analyser.frequencyBinCount},set:function(t){this._analyser.fftSize=2*t,this._buffer=new Float32Array(t)}}),Object.defineProperty(i.default.Analyser.prototype,"type",{get:function(){return this._type},set:function(t){if(t!==i.default.Analyser.Type.Waveform&&t!==i.default.Analyser.Type.FFT)throw new TypeError("Tone.Analyser: invalid type: "+t);this._type=t}}),Object.defineProperty(i.default.Analyser.prototype,"smoothing",{get:function(){return this._analyser.smoothingTimeConstant},set:function(t){this._analyser.smoothingTimeConstant=t}}),i.default.Analyser.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this._analyser.disconnect(),this._analyser=null,this._buffer=null},e.default=i.default.Analyser},function(t,e,n){n.r(e);var i=n(0);n(6),n(17),n(50),n(69),n(49),n(68),n(67),i.default.OmniOscillator=function(){var t=i.default.defaults(arguments,["frequency","type"],i.default.OmniOscillator);i.default.Source.call(this,t),this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this._sourceType=void 0,this._oscillator=null,this.type=t.type,this._readOnly(["frequency","detune"]),this.set(t)},i.default.extend(i.default.OmniOscillator,i.default.Source),i.default.OmniOscillator.defaults={frequency:440,detune:0,type:"sine",phase:0};var r="PulseOscillator",o="PWMOscillator",a="Oscillator",s="FMOscillator",u="AMOscillator",l="FatOscillator";i.default.OmniOscillator.prototype._start=function(t){this._oscillator.start(t)},i.default.OmniOscillator.prototype._stop=function(t){this._oscillator.stop(t)},i.default.OmniOscillator.prototype.restart=function(t){this._oscillator.restart(t)},Object.defineProperty(i.default.OmniOscillator.prototype,"type",{get:function(){var t="";return this._sourceType===s?t="fm":this._sourceType===u?t="am":this._sourceType===l&&(t="fat"),t+this._oscillator.type},set:function(t){"fm"===t.substr(0,2)?(this._createNewOscillator(s),this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator(u),this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator(l),this._oscillator.type=t.substr(3)):"pwm"===t?this._createNewOscillator(o):"pulse"===t?this._createNewOscillator(r):(this._createNewOscillator(a),this._oscillator.type=t)}}),Object.defineProperty(i.default.OmniOscillator.prototype,"partials",{get:function(){return this._oscillator.partials},set:function(t){this._oscillator.partials=t}}),Object.defineProperty(i.default.OmniOscillator.prototype,"partialCount",{get:function(){return this._oscillator.partialCount},set:function(t){this._oscillator.partialCount=t}}),i.default.OmniOscillator.prototype.set=function(t,e){return"type"===t?this.type=e:i.default.isObject(t)&&t.hasOwnProperty("type")&&(this.type=t.type),i.default.prototype.set.apply(this,arguments),this},i.default.OmniOscillator.prototype.get=function(t){var e=this._oscillator.get(t);return e.type=this.type,e},i.default.OmniOscillator.prototype._createNewOscillator=function(t){if(t!==this._sourceType){this._sourceType=t;var e=i.default[t],n=this.now();if(null!==this._oscillator){var r=this._oscillator;r.stop(n),this.context.setTimeout((function(){r.dispose(),r=null}),this.blockTime)}this._oscillator=new e,this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this.state===i.default.State.Started&&this._oscillator.start(n)}},Object.defineProperty(i.default.OmniOscillator.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(t){this._oscillator.phase=t}});var c={PulseOscillator:"pulse",PWMOscillator:"pwm",Oscillator:"oscillator",FMOscillator:"fm",AMOscillator:"am",FatOscillator:"fat"};Object.defineProperty(i.default.OmniOscillator.prototype,"sourceType",{get:function(){return c[this._sourceType]},set:function(t){var e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),t===c.FMOscillator?this.type="fm"+e:t===c.AMOscillator?this.type="am"+e:t===c.FatOscillator?this.type="fat"+e:t===c.Oscillator?this.type=e:t===c.PulseOscillator?this.type="pulse":t===c.PWMOscillator&&(this.type="pwm")}}),Object.defineProperty(i.default.OmniOscillator.prototype,"baseType",{get:function(){return this._oscillator.baseType},set:function(t){this.sourceType!==c.PulseOscillator&&this.sourceType!==c.PWMOscillator&&(this._oscillator.baseType=t)}}),Object.defineProperty(i.default.OmniOscillator.prototype,"width",{get:function(){return this._sourceType===r?this._oscillator.width:void 0}}),Object.defineProperty(i.default.OmniOscillator.prototype,"count",{get:function(){return this._sourceType===l?this._oscillator.count:void 0},set:function(t){this._sourceType===l&&(this._oscillator.count=t)}}),Object.defineProperty(i.default.OmniOscillator.prototype,"spread",{get:function(){return this._sourceType===l?this._oscillator.spread:void 0},set:function(t){this._sourceType===l&&(this._oscillator.spread=t)}}),Object.defineProperty(i.default.OmniOscillator.prototype,"modulationType",{get:function(){return this._sourceType===s||this._sourceType===u?this._oscillator.modulationType:void 0},set:function(t){this._sourceType!==s&&this._sourceType!==u||(this._oscillator.modulationType=t)}}),Object.defineProperty(i.default.OmniOscillator.prototype,"modulationIndex",{get:function(){return this._sourceType===s?this._oscillator.modulationIndex:void 0}}),Object.defineProperty(i.default.OmniOscillator.prototype,"harmonicity",{get:function(){return this._sourceType===s||this._sourceType===u?this._oscillator.harmonicity:void 0}}),Object.defineProperty(i.default.OmniOscillator.prototype,"modulationFrequency",{get:function(){return this._sourceType===o?this._oscillator.modulationFrequency:void 0}}),i.default.OmniOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.detune.dispose(),this.detune=null,this.frequency.dispose(),this.frequency=null,this._oscillator.dispose(),this._oscillator=null,this._sourceType=null,this},e.default=i.default.OmniOscillator},function(t,e,n){n.r(e);var i=n(0);n(31),n(37),n(25),i.default.Synth=function(t){t=i.default.defaultArg(t,i.default.Synth.defaults),i.default.Monophonic.call(this,t),this.oscillator=new i.default.OmniOscillator(t.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new i.default.AmplitudeEnvelope(t.envelope),this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","frequency","detune","envelope"])},i.default.extend(i.default.Synth,i.default.Monophonic),i.default.Synth.defaults={oscillator:{type:"triangle"},envelope:{attack:.005,decay:.1,sustain:.3,release:1}},i.default.Synth.prototype._triggerEnvelopeAttack=function(t,e){return this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain&&this.oscillator.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this},i.default.Synth.prototype._triggerEnvelopeRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release)),this},i.default.Synth.prototype.dispose=function(){return i.default.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.frequency=null,this.detune=null,this},e.default=i.default.Synth},function(t,e,n){n.r(e);var i=n(0);n(6),n(11),n(32),i.default.Noise=function(){var t=i.default.defaults(arguments,["type"],i.default.Noise);i.default.Source.call(this,t),this._source=null,this._type=t.type,this._playbackRate=t.playbackRate},i.default.extend(i.default.Noise,i.default.Source),i.default.Noise.defaults={type:"white",playbackRate:1},Object.defineProperty(i.default.Noise.prototype,"type",{get:function(){return this._type},set:function(t){if(this._type!==t){if(!(t in r))throw new TypeError("Tone.Noise: invalid type: "+t);if(this._type=t,this.state===i.default.State.Started){var e=this.now();this._stop(e),this._start(e)}}}}),Object.defineProperty(i.default.Noise.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}}),i.default.Noise.prototype._start=function(t){var e=r[this._type];this._source=new i.default.BufferSource(e).connect(this.output),this._source.loop=!0,this._source.playbackRate.value=this._playbackRate,this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))},i.default.Noise.prototype._stop=function(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)},i.default.Noise.prototype.restart=function(t){return this._stop(t),this._start(t),this},i.default.Noise.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),null!==this._source&&(this._source.disconnect(),this._source=null),this._buffer=null,this};var r={},o={};Object.defineProperty(r,"pink",{get:function(){if(!o.pink){for(var t=[],e=0;e<2;e++){var n,r,a,s,u,l,c,f=new Float32Array(220500);t[e]=f,n=r=a=s=u=l=c=0;for(var h=0;h<220500;h++){var d=2*Math.random()-1;n=.99886*n+.0555179*d,r=.99332*r+.0750759*d,a=.969*a+.153852*d,s=.8665*s+.3104856*d,u=.55*u+.5329522*d,l=-.7616*l-.016898*d,f[h]=n+r+a+s+u+l+c+.5362*d,f[h]*=.11,c=.115926*d}}o.pink=(new i.default.Buffer).fromArray(t)}return o.pink}}),Object.defineProperty(r,"brown",{get:function(){if(!o.brown){for(var t=[],e=0;e<2;e++){var n=new Float32Array(220500);t[e]=n;for(var r=0,a=0;a<220500;a++){var s=2*Math.random()-1;n[a]=(r+.02*s)/1.02,r=n[a],n[a]*=3.5}}o.brown=(new i.default.Buffer).fromArray(t)}return o.brown}}),Object.defineProperty(r,"white",{get:function(){if(!o.white){for(var t=[],e=0;e<2;e++){var n=new Float32Array(220500);t[e]=n;for(var r=0;r<220500;r++)n[r]=2*Math.random()-1}o.white=(new i.default.Buffer).fromArray(t)}return o.white}}),e.default=i.default.Noise},function(t,e,n){n.r(e);var i=n(0);n(27),n(20),n(1),i.default.Master=function(){i.default.AudioNode.call(this),i.default.getContext(function(){this.createInsOuts(1,0),this._volume=this.output=new i.default.Volume,this.volume=this._volume.volume,this._readOnly("volume"),i.default.connectSeries(this.input,this.output,this.context.destination),this.context.master=this}.bind(this))},i.default.extend(i.default.Master,i.default.AudioNode),i.default.Master.defaults={volume:0,mute:!1},i.default.Master.prototype.isMaster=!0,Object.defineProperty(i.default.Master.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),i.default.Master.prototype.chain=function(){this.input.disconnect();var t=Array.from(arguments);t.unshift(this.input),t.push(this.output),i.default.connectSeries.apply(void 0,t)},i.default.Master.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null},i.default.AudioNode.prototype.toMaster=function(){return this.connect(this.context.master),this};var r=i.default.Master;i.default.Master=new r,i.default.Context.on("init",(function(t){t.master&&t.master.isMaster?i.default.Master=t.master:i.default.Master=new r})),i.default.Context.on("close",(function(t){t.master&&t.master.isMaster&&t.master.dispose()})),e.default=i.default.Master},function(t,e,n){n.r(e);var i=n(0);n(86),n(47),i.default.FrequencyEnvelope=function(){var t=i.default.defaults(arguments,["attack","decay","sustain","release"],i.default.Envelope);t=i.default.defaultArg(t,i.default.FrequencyEnvelope.defaults),i.default.ScaledEnvelope.call(this,t),this._octaves=t.octaves,this.baseFrequency=t.baseFrequency,this.octaves=t.octaves,this.exponent=t.exponent},i.default.extend(i.default.FrequencyEnvelope,i.default.Envelope),i.default.FrequencyEnvelope.defaults={baseFrequency:200,octaves:4,exponent:1},Object.defineProperty(i.default.FrequencyEnvelope.prototype,"baseFrequency",{get:function(){return this._scale.min},set:function(t){this._scale.min=this.toFrequency(t),this.octaves=this._octaves}}),Object.defineProperty(i.default.FrequencyEnvelope.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._scale.max=this.baseFrequency*Math.pow(2,t)}}),Object.defineProperty(i.default.FrequencyEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),i.default.FrequencyEnvelope.prototype.dispose=function(){return i.default.ScaledEnvelope.prototype.dispose.call(this),this},e.default=i.default.FrequencyEnvelope},function(t,e,n){n.r(e);var i=n(0);n(26),n(61),i.default.ScaleExp=function(t,e,n){i.default.SignalBase.call(this),this._scale=this.output=new i.default.Scale(t,e),this._exp=this.input=new i.default.Pow(i.default.defaultArg(n,2)),this._exp.connect(this._scale)},i.default.extend(i.default.ScaleExp,i.default.SignalBase),Object.defineProperty(i.default.ScaleExp.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),Object.defineProperty(i.default.ScaleExp.prototype,"min",{get:function(){return this._scale.min},set:function(t){this._scale.min=t}}),Object.defineProperty(i.default.ScaleExp.prototype,"max",{get:function(){return this._scale.max},set:function(t){this._scale.max=t}}),i.default.ScaleExp.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},e.default=i.default.ScaleExp},function(t,e,n){n.r(e);var i=n(0);n(14),n(1),i.default.Compressor=function(){var t=i.default.defaults(arguments,["threshold","ratio"],i.default.Compressor);i.default.AudioNode.call(this),this._compressor=this.input=this.output=this.context.createDynamicsCompressor(),this.threshold=new i.default.Param({param:this._compressor.threshold,units:i.default.Type.Decibels,convert:!1}),this.attack=new i.default.Param(this._compressor.attack,i.default.Type.Time),this.release=new i.default.Param(this._compressor.release,i.default.Type.Time),this.knee=new i.default.Param({param:this._compressor.knee,units:i.default.Type.Decibels,convert:!1}),this.ratio=new i.default.Param({param:this._compressor.ratio,convert:!1}),this._readOnly(["knee","release","attack","ratio","threshold"]),this.set(t)},i.default.extend(i.default.Compressor,i.default.AudioNode),i.default.Compressor.defaults={ratio:12,threshold:-24,release:.25,attack:.003,knee:30},i.default.Compressor.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["knee","release","attack","ratio","threshold"]),this._compressor.disconnect(),this._compressor=null,this.attack.dispose(),this.attack=null,this.release.dispose(),this.release=null,this.threshold.dispose(),this.threshold=null,this.ratio.dispose(),this.ratio=null,this.knee.dispose(),this.knee=null,this},e.default=i.default.Compressor},function(t,e,n){var i=n(0);if(n(92),i.default.supported){!i.default.global.hasOwnProperty("AudioContext")&&i.default.global.hasOwnProperty("webkitAudioContext")&&(i.default.global.AudioContext=i.default.global.webkitAudioContext),AudioContext.prototype.close||(AudioContext.prototype.close=function(){return i.default.isFunction(this.suspend)&&this.suspend(),Promise.resolve()}),AudioContext.prototype.resume||(AudioContext.prototype.resume=function(){var t=this.createBuffer(1,1,this.sampleRate),e=this.createBufferSource();return e.buffer=t,e.connect(this.destination),e.start(0),Promise.resolve()}),!AudioContext.prototype.createGain&&AudioContext.prototype.createGainNode&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),!AudioContext.prototype.createDelay&&AudioContext.prototype.createDelayNode&&(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode);var r=!1,o=new OfflineAudioContext(1,1,44100),a=new Uint32Array([1179011410,48,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,8,0,0,0,0]).buffer;try{var s=o.decodeAudioData(a);s&&i.default.isFunction(s.then)&&(r=!0)}catch(t){r=!1}r||(AudioContext.prototype._native_decodeAudioData=AudioContext.prototype.decodeAudioData,AudioContext.prototype.decodeAudioData=function(t){return new Promise(function(e,n){this._native_decodeAudioData(t,e,n)}.bind(this))})}},function(t,e,n){n.r(e);var i=n(0);n(63),i.default.TransportTime=function(t,e){if(!(this instanceof i.default.TransportTime))return new i.default.TransportTime(t,e);i.default.Time.call(this,t,e)},i.default.extend(i.default.TransportTime,i.default.Time),i.default.TransportTime.prototype._now=function(){return i.default.Transport.seconds},e.default=i.default.TransportTime},function(t,e,n){n.r(e);var i=n(0);n(62),i.default.Frequency=function(t,e){if(!(this instanceof i.default.Frequency))return new i.default.Frequency(t,e);i.default.TimeBase.call(this,t,e)},i.default.extend(i.default.Frequency,i.default.TimeBase),i.default.Frequency.prototype._expressions=Object.assign({},i.default.TimeBase.prototype._expressions,{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method:function(t){return"midi"===this._defaultUnits?t:i.default.Frequency.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(t,e){var n=r[t.toLowerCase()]+12*(parseInt(e)+1);return"midi"===this._defaultUnits?n:i.default.Frequency.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(t,e,n){var i=1;return t&&"0"!==t&&(i*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(i*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(i*=this._beatsToUnits(parseFloat(n)/4)),i}}}),i.default.Frequency.prototype.transpose=function(t){return new this.constructor(this.valueOf()*i.default.intervalToFrequencyRatio(t))},i.default.Frequency.prototype.harmonize=function(t){return t.map(function(t){return this.transpose(t)}.bind(this))},i.default.Frequency.prototype.toMidi=function(){return i.default.Frequency.ftom(this.valueOf())},i.default.Frequency.prototype.toNote=function(){var t=this.toFrequency(),e=Math.log2(t/i.default.Frequency.A4),n=Math.round(12*e)+57,r=Math.floor(n/12);return r<0&&(n+=-12*r),o[n%12]+r.toString()},i.default.Frequency.prototype.toSeconds=function(){return 1/i.default.TimeBase.prototype.toSeconds.call(this)},i.default.Frequency.prototype.toFrequency=function(){return i.default.TimeBase.prototype.toFrequency.call(this)},i.default.Frequency.prototype.toTicks=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*i.default.Transport.PPQ)},i.default.Frequency.prototype._noArg=function(){return 0},i.default.Frequency.prototype._frequencyToUnits=function(t){return t},i.default.Frequency.prototype._ticksToUnits=function(t){return 1/(60*t/(i.default.Transport.bpm.value*i.default.Transport.PPQ))},i.default.Frequency.prototype._beatsToUnits=function(t){return 1/i.default.TimeBase.prototype._beatsToUnits.call(this,t)},i.default.Frequency.prototype._secondsToUnits=function(t){return 1/t},i.default.Frequency.prototype._defaultUnits="hz";var r={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},o=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];i.default.Frequency.A4=440,i.default.Frequency.mtof=function(t){return i.default.Frequency.A4*Math.pow(2,(t-69)/12)},i.default.Frequency.ftom=function(t){return 69+Math.round(12*Math.log2(t/i.default.Frequency.A4))},e.default=i.default.Frequency},function(t,e,n){n.r(e);var i=n(0);n(2),n(61),n(4),n(1),i.default.Envelope=function(){var t=i.default.defaults(arguments,["attack","decay","sustain","release"],i.default.Envelope);i.default.AudioNode.call(this),this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this._attackCurve="linear",this._releaseCurve="exponential",this._sig=this.output=new i.default.Signal(0),this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve},i.default.extend(i.default.Envelope,i.default.AudioNode),i.default.Envelope.defaults={attack:.01,decay:.1,sustain:.5,release:1,attackCurve:"linear",decayCurve:"exponential",releaseCurve:"exponential"},Object.defineProperty(i.default.Envelope.prototype,"value",{get:function(){return this.getValueAtTime(this.now())}}),i.default.Envelope.prototype._getCurve=function(t,e){if(i.default.isString(t))return t;if(i.default.isArray(t))for(var n in i.default.Envelope.Type)if(i.default.Envelope.Type[n][e]===t)return n},i.default.Envelope.prototype._setCurve=function(t,e,n){if(i.default.Envelope.Type.hasOwnProperty(n)){var r=i.default.Envelope.Type[n];i.default.isObject(r)?this[t]=r[e]:this[t]=r}else{if(!i.default.isArray(n))throw new Error("Tone.Envelope: invalid curve: "+n);this[t]=n}},Object.defineProperty(i.default.Envelope.prototype,"attackCurve",{get:function(){return this._getCurve(this._attackCurve,"In")},set:function(t){this._setCurve("_attackCurve","In",t)}}),Object.defineProperty(i.default.Envelope.prototype,"releaseCurve",{get:function(){return this._getCurve(this._releaseCurve,"Out")},set:function(t){this._setCurve("_releaseCurve","Out",t)}}),Object.defineProperty(i.default.Envelope.prototype,"decayCurve",{get:function(){return this._decayCurve},set:function(t){if(!["linear","exponential"].includes(t))throw new Error("Tone.Envelope: invalid curve: "+t);this._decayCurve=t}}),i.default.Envelope.prototype.triggerAttack=function(t,e){this.log("triggerAttack",t,e),t=this.toSeconds(t);var n=this.toSeconds(this.attack),r=this.toSeconds(this.decay);e=i.default.defaultArg(e,1);var o=this.getValueAtTime(t);if(o>0&&(n=(1-o)/(1/n)),0===n)this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else if(n>0){this._sig.cancelAndHoldAtTime(t);for(var a=this._attackCurve,s=1;s<a.length;s++)if(a[s-1]<=o&&o<=a[s]){(a=this._attackCurve.slice(s))[0]=o;break}this._sig.setValueCurveAtTime(a,t,n,e)}if(r){var u=e*this.sustain,l=t+n;this.log("decay",l),"linear"===this._decayCurve?this._sig.linearRampTo(u,r,l+this.sampleTime):"exponential"===this._decayCurve&&this._sig.exponentialApproachValueAtTime(u,l,r)}return this},i.default.Envelope.prototype.triggerRelease=function(t){this.log("triggerRelease",t),t=this.toSeconds(t);var e=this.getValueAtTime(t);if(e>0){var n=this.toSeconds(this.release);if("linear"===this._releaseCurve)this._sig.linearRampTo(0,n,t);else if("exponential"===this._releaseCurve)this._sig.targetRampTo(0,n,t);else{var r=this._releaseCurve;i.default.isArray(r)&&(this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(r,t,n,e))}}return this},i.default.Envelope.prototype.getValueAtTime=function(t){return this._sig.getValueAtTime(t)},i.default.Envelope.prototype.triggerAttackRelease=function(t,e,n){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this},i.default.Envelope.prototype.cancel=function(t){return this._sig.cancelScheduledValues(t),this},i.default.Envelope.prototype.connect=i.default.SignalBase.prototype.connect,function(){var t,e,n=[];for(t=0;t<128;t++)n[t]=Math.sin(t/127*(Math.PI/2));var r=[];for(t=0;t<127;t++){e=t/127;var o=Math.sin(e*(2*Math.PI)*6.4-Math.PI/2)+1;r[t]=o/10+.83*e}r[127]=1;var a=[];for(t=0;t<128;t++)a[t]=Math.ceil(t/127*5)/5;var s=[];for(t=0;t<128;t++)e=t/127,s[t]=.5*(1-Math.cos(Math.PI*e));var u,l=[];for(t=0;t<128;t++){e=t/127;var c=4*Math.pow(e,3)+.2,f=Math.cos(c*Math.PI*2*e);l[t]=Math.abs(f*(1-e))}function h(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=1-t[n];return e}i.default.Envelope.Type={linear:"linear",exponential:"exponential",bounce:{In:h(l),Out:l},cosine:{In:n,Out:(u=n,u.slice(0).reverse())},step:{In:a,Out:h(a)},ripple:{In:r,Out:h(r)},sine:{In:s,Out:h(s)}}}(),i.default.Envelope.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._sig.dispose(),this._sig=null,this._attackCurve=null,this._releaseCurve=null,this},e.default=i.default.Envelope},function(t,e,n){n.r(e);var i=n(0);if(n(23),n(10),n(19),n(7),n(28),n(3),n(2),n(20),i.default.supported&&!i.default.global.AudioContext.prototype.createStereoPanner){var r=function(t){this.context=t,this.pan=new i.default.Signal(0,i.default.Type.AudioRange);var e=new i.default.WaveShaper((function(t){return i.default.equalPowerScale((t+1)/2)}),4096),n=new i.default.WaveShaper((function(t){return i.default.equalPowerScale(1-(t+1)/2)}),4096),r=new i.default.Gain,o=new i.default.Gain,a=this.input=new i.default.Split;a._splitter.channelCountMode="explicit",(new i.default.Zero).fan(e,n);var s=this.output=new i.default.Merge;a.left.chain(r,s.left),a.right.chain(o,s.right),this.pan.chain(n,r.gain),this.pan.chain(e,o.gain)};r.prototype.disconnect=function(){this.output.disconnect.apply(this.output,arguments)},r.prototype.connect=function(){this.output.connect.apply(this.output,arguments)},AudioContext.prototype.createStereoPanner=function(){return new r(this)},i.default.Context.prototype.createStereoPanner=function(){return new r(this)}}n(22),n(1),i.default.Panner=function(){var t=i.default.defaults(arguments,["pan"],i.default.Panner);i.default.AudioNode.call(this),this._panner=this.input=this.output=this.context.createStereoPanner(),this.pan=this._panner.pan,this.pan.value=t.pan,this._readOnly("pan")},i.default.extend(i.default.Panner,i.default.AudioNode),i.default.Panner.defaults={pan:0},i.default.Panner.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable("pan"),this._panner.disconnect(),this._panner=null,this.pan=null,this},e.default=i.default.Panner},function(t,e,n){n.r(e);var i=n(0);n(6),n(17),n(5),n(3),i.default.FMOscillator=function(){var t=i.default.defaults(arguments,["frequency","type","modulationType"],i.default.FMOscillator);i.default.Source.call(this,t),this._carrier=new i.default.Oscillator(t.frequency,t.type),this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.detune=this._carrier.detune,this.detune.value=t.detune,this.modulationIndex=new i.default.Multiply(t.modulationIndex),this.modulationIndex.units=i.default.Type.Positive,this._modulator=new i.default.Oscillator(t.frequency,t.modulationType),this.harmonicity=new i.default.Multiply(t.harmonicity),this.harmonicity.units=i.default.Type.Positive,this._modulationNode=new i.default.Gain(0),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),this.phase=t.phase,this._readOnly(["modulationIndex","frequency","detune","harmonicity"])},i.default.extend(i.default.FMOscillator,i.default.Source),i.default.FMOscillator.defaults={frequency:440,detune:0,phase:0,type:"sine",modulationIndex:2,modulationType:"square",harmonicity:1},i.default.FMOscillator.prototype._start=function(t){this._modulator.start(t),this._carrier.start(t)},i.default.FMOscillator.prototype._stop=function(t){this._modulator.stop(t),this._carrier.stop(t)},i.default.FMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._carrier.restart(t)},Object.defineProperty(i.default.FMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(t){this._carrier.type=t}}),Object.defineProperty(i.default.FMOscillator.prototype,"baseType",{get:function(){return this._carrier.baseType},set:function(t){this._carrier.baseType=t}}),Object.defineProperty(i.default.FMOscillator.prototype,"partialCount",{get:function(){return this._carrier.partialCount},set:function(t){this._carrier.partialCount=t}}),Object.defineProperty(i.default.FMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(t){this._modulator.type=t}}),Object.defineProperty(i.default.FMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(t){this._carrier.phase=t,this._modulator.phase=t}}),Object.defineProperty(i.default.FMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(t){this._carrier.partials=t}}),i.default.FMOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._writable(["modulationIndex","frequency","detune","harmonicity"]),this.frequency.dispose(),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this.modulationIndex.dispose(),this.modulationIndex=null,this},e.default=i.default.FMOscillator},function(t,e,n){n.r(e);var i=n(0);n(6),n(17),n(2),n(7),n(3),i.default.PulseOscillator=function(){var t=i.default.defaults(arguments,["frequency","width"],i.default.Oscillator);i.default.Source.call(this,t),this.width=new i.default.Signal(t.width,i.default.Type.NormalRange),this._widthGate=new i.default.Gain(0),this._sawtooth=new i.default.Oscillator({frequency:t.frequency,detune:t.detune,type:"sawtooth",phase:t.phase}),this.frequency=this._sawtooth.frequency,this.detune=this._sawtooth.detune,this._thresh=new i.default.WaveShaper((function(t){return t<0?-1:1})),this._sawtooth.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),this._readOnly(["width","frequency","detune"])},i.default.extend(i.default.PulseOscillator,i.default.Source),i.default.PulseOscillator.defaults={frequency:440,detune:0,phase:0,width:.2},i.default.PulseOscillator.prototype._start=function(t){t=this.toSeconds(t),this._sawtooth.start(t),this._widthGate.gain.setValueAtTime(1,t)},i.default.PulseOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._sawtooth.stop(t),this._widthGate.gain.setValueAtTime(0,t)},i.default.PulseOscillator.prototype.restart=function(t){this._sawtooth.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)},Object.defineProperty(i.default.PulseOscillator.prototype,"phase",{get:function(){return this._sawtooth.phase},set:function(t){this._sawtooth.phase=t}}),Object.defineProperty(i.default.PulseOscillator.prototype,"type",{get:function(){return"pulse"}}),Object.defineProperty(i.default.PulseOscillator.prototype,"baseType",{get:function(){return"pulse"}}),Object.defineProperty(i.default.PulseOscillator.prototype,"partials",{get:function(){return[]}}),i.default.PulseOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._sawtooth.dispose(),this._sawtooth=null,this._writable(["width","frequency","detune"]),this.width.dispose(),this.width=null,this._widthGate.dispose(),this._widthGate=null,this._thresh.dispose(),this._thresh=null,this.frequency=null,this.detune=null,this},e.default=i.default.PulseOscillator},function(t,e,n){n.r(e);var i=n(0);n(16),n(4),n(34),i.default.Event=function(){var t=i.default.defaults(arguments,["callback","value"],i.default.Event);i.default.call(this),this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._state=new i.default.TimelineState(i.default.State.Stopped),this._playbackRate=1,this._startOffset=0,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this.playbackRate=t.playbackRate},i.default.extend(i.default.Event),i.default.Event.defaults={callback:i.default.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,value:null,probability:1,mute:!1,humanize:!1},i.default.Event.prototype._rescheduleEvents=function(t){return t=i.default.defaultArg(t,-1),this._state.forEachFrom(t,function(t){var e;if(t.state===i.default.State.Started){i.default.isDefined(t.id)&&i.default.Transport.clear(t.id);var n=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||i.default.isNumber(this._loop)&&this._loop>1){e=1/0,i.default.isNumber(this._loop)&&(e=this._loop*this._getLoopDuration());var r=this._state.getAfter(n);null!==r&&(e=Math.min(e,r.time-n)),e!==1/0&&(this._state.setStateAtTime(i.default.State.Stopped,n+e+1),e=i.default.Ticks(e));var o=i.default.Ticks(this._getLoopDuration());t.id=i.default.Transport.scheduleRepeat(this._tick.bind(this),o,i.default.Ticks(n),e)}else t.id=i.default.Transport.schedule(this._tick.bind(this),i.default.Ticks(n))}}.bind(this)),this},Object.defineProperty(i.default.Event.prototype,"state",{get:function(){return this._state.getValueAtTime(i.default.Transport.ticks)}}),Object.defineProperty(i.default.Event.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t}}),Object.defineProperty(i.default.Event.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t}}),Object.defineProperty(i.default.Event.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t}}),i.default.Event.prototype.start=function(t){return t=this.toTicks(t),this._state.getValueAtTime(t)===i.default.State.Stopped&&(this._state.add({state:i.default.State.Started,time:t,id:void 0}),this._rescheduleEvents(t)),this},i.default.Event.prototype.stop=function(t){if(this.cancel(t),t=this.toTicks(t),this._state.getValueAtTime(t)===i.default.State.Started){this._state.setStateAtTime(i.default.State.Stopped,t);var e=this._state.getBefore(t),n=t;null!==e&&(n=e.time),this._rescheduleEvents(n)}return this},i.default.Event.prototype.cancel=function(t){return t=i.default.defaultArg(t,-1/0),t=this.toTicks(t),this._state.forEachFrom(t,(function(t){i.default.Transport.clear(t.id)})),this._state.cancel(t),this},i.default.Event.prototype._tick=function(t){var e=i.default.Transport.getTicksAtTime(t);if(!this.mute&&this._state.getValueAtTime(e)===i.default.State.Started){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){var n=.02;i.default.isBoolean(this.humanize)||(n=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*n}this.callback(t,this.value)}},i.default.Event.prototype._getLoopDuration=function(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)},Object.defineProperty(i.default.Event.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._rescheduleEvents()}}),Object.defineProperty(i.default.Event.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._rescheduleEvents()}}),Object.defineProperty(i.default.Event.prototype,"loopEnd",{get:function(){return i.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(i.default.Event.prototype,"loopStart",{get:function(){return i.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(i.default.Event.prototype,"progress",{get:function(){if(this._loop){var t=i.default.Transport.ticks,e=this._state.get(t);if(null!==e&&e.state===i.default.State.Started){var n=this._getLoopDuration();return(t-e.time)%n/n}return 0}return 0}}),i.default.Event.prototype.dispose=function(){this.cancel(),this._state.dispose(),this._state=null,this.callback=null,this.value=null},e.default=i.default.Event},function(t,e,n){n.r(e);var i=n(0);n(2),n(13),n(29),n(10),n(3),n(1),i.default.MidSideMerge=function(){i.default.AudioNode.call(this),this.createInsOuts(2,0),this.mid=this.input[0]=new i.default.Gain,this._left=new i.default.Add,this._timesTwoLeft=new i.default.Multiply(Math.SQRT1_2),this.side=this.input[1]=new i.default.Gain,this._right=new i.default.Subtract,this._timesTwoRight=new i.default.Multiply(Math.SQRT1_2),this._merge=this.output=new i.default.Merge,this.mid.connect(this._left,0,0),this.side.connect(this._left,0,1),this.mid.connect(this._right,0,0),this.side.connect(this._right,0,1),this._left.connect(this._timesTwoLeft),this._right.connect(this._timesTwoRight),this._timesTwoLeft.connect(this._merge,0,0),this._timesTwoRight.connect(this._merge,0,1)},i.default.extend(i.default.MidSideMerge,i.default.AudioNode),i.default.MidSideMerge.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._left.dispose(),this._left=null,this._timesTwoLeft.dispose(),this._timesTwoLeft=null,this._right.dispose(),this._right=null,this._timesTwoRight.dispose(),this._timesTwoRight=null,this._merge.dispose(),this._merge=null,this},e.default=i.default.MidSideMerge},function(t,e,n){n.r(e);var i=n(0);n(29),n(13),n(2),n(19),n(1),i.default.MidSideSplit=function(){i.default.AudioNode.call(this),this.createInsOuts(0,2),this._split=this.input=new i.default.Split,this._midAdd=new i.default.Add,this.mid=this.output[0]=new i.default.Multiply(Math.SQRT1_2),this._sideSubtract=new i.default.Subtract,this.side=this.output[1]=new i.default.Multiply(Math.SQRT1_2),this._split.connect(this._midAdd,0,0),this._split.connect(this._midAdd,1,1),this._split.connect(this._sideSubtract,0,0),this._split.connect(this._sideSubtract,1,1),this._midAdd.connect(this.mid),this._sideSubtract.connect(this.side)},i.default.extend(i.default.MidSideSplit,i.default.AudioNode),i.default.MidSideSplit.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midAdd.dispose(),this._midAdd=null,this._sideSubtract.dispose(),this._sideSubtract=null,this._split.dispose(),this._split=null,this},e.default=i.default.MidSideSplit},function(t,e,n){n.r(e);var i=n(0);n(2),n(9),n(1),n(59),i.default.LowpassCombFilter=function(){var t=i.default.defaults(arguments,["delayTime","resonance","dampening"],i.default.LowpassCombFilter);i.default.AudioNode.call(this),this._combFilter=this.output=new i.default.FeedbackCombFilter(t.delayTime,t.resonance),this.delayTime=this._combFilter.delayTime,this._lowpass=this.input=new i.default.Filter({frequency:t.dampening,type:"lowpass",Q:0,rolloff:-12}),this.dampening=this._lowpass.frequency,this.resonance=this._combFilter.resonance,this._lowpass.connect(this._combFilter),this._readOnly(["dampening","resonance","delayTime"])},i.default.extend(i.default.LowpassCombFilter,i.default.AudioNode),i.default.LowpassCombFilter.defaults={delayTime:.1,resonance:.5,dampening:3e3},i.default.LowpassCombFilter.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["dampening","resonance","delayTime"]),this._combFilter.dispose(),this._combFilter=null,this.resonance=null,this.delayTime=null,this._lowpass.dispose(),this._lowpass=null,this.dampening=null,this},e.default=i.default.LowpassCombFilter},function(t,e,n){n.r(e);var i=n(0);n(45),i.default.Ticks=function(t,e){if(!(this instanceof i.default.Ticks))return new i.default.Ticks(t,e);i.default.TransportTime.call(this,t,e)},i.default.extend(i.default.Ticks,i.default.TransportTime),i.default.Ticks.prototype._defaultUnits="i",i.default.Ticks.prototype._now=function(){return i.default.Transport.ticks},i.default.Ticks.prototype._beatsToUnits=function(t){return this._getPPQ()*t},i.default.Ticks.prototype._secondsToUnits=function(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())},i.default.Ticks.prototype._ticksToUnits=function(t){return t},i.default.Ticks.prototype.toTicks=function(){return this.valueOf()},i.default.Ticks.prototype.toSeconds=function(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())},e.default=i.default.Ticks},function(t,e,n){n.r(e);var i=n(0);n(55),i.default.TransportEvent=function(t,e){e=i.default.defaultArg(e,i.default.TransportEvent.defaults),i.default.call(this),this.Transport=t,this.id=i.default.TransportEvent._eventId++,this.time=i.default.Ticks(e.time),this.callback=e.callback,this._once=e.once},i.default.extend(i.default.TransportEvent),i.default.TransportEvent.defaults={once:!1,callback:i.default.noOp},i.default.TransportEvent._eventId=0,i.default.TransportEvent.prototype.invoke=function(t){this.callback&&(this.callback(t),this._once&&this.Transport&&this.Transport.clear(this.id))},i.default.TransportEvent.prototype.dispose=function(){return i.default.prototype.dispose.call(this),this.Transport=null,this.callback=null,this.time=null,this},e.default=i.default.TransportEvent},function(t,e,n){n.r(e);var i=n(0);n(82),n(34),n(24),n(14),i.default.TickSource=function(){var t=i.default.defaults(arguments,["frequency"],i.default.TickSource);this.frequency=new i.default.TickSignal(t.frequency),this._readOnly("frequency"),this._state=new i.default.TimelineState(i.default.State.Stopped),this._state.setStateAtTime(i.default.State.Stopped,0),this._tickOffset=new i.default.Timeline,this.setTicksAtTime(0,0)},i.default.extend(i.default.TickSource),i.default.TickSource.defaults={frequency:1},Object.defineProperty(i.default.TickSource.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),i.default.TickSource.prototype.start=function(t,e){return t=this.toSeconds(t),this._state.getValueAtTime(t)!==i.default.State.Started&&(this._state.setStateAtTime(i.default.State.Started,t),i.default.isDefined(e)&&this.setTicksAtTime(e,t)),this},i.default.TickSource.prototype.stop=function(t){if(t=this.toSeconds(t),this._state.getValueAtTime(t)===i.default.State.Stopped){var e=this._state.get(t);e.time>0&&(this._tickOffset.cancel(e.time),this._state.cancel(e.time))}return this._state.cancel(t),this._state.setStateAtTime(i.default.State.Stopped,t),this.setTicksAtTime(0,t),this},i.default.TickSource.prototype.pause=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)===i.default.State.Started&&this._state.setStateAtTime(i.default.State.Paused,t),this},i.default.TickSource.prototype.cancel=function(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this},i.default.TickSource.prototype.getTicksAtTime=function(t){t=this.toSeconds(t);var e=this._state.getLastState(i.default.State.Stopped,t),n={state:i.default.State.Paused,time:t};this._state.add(n);var r=e,o=0;return this._state.forEachBetween(e.time,t+this.sampleTime,function(t){var e=r.time,n=this._tickOffset.get(t.time);n.time>=r.time&&(o=n.ticks,e=n.time),r.state===i.default.State.Started&&t.state!==i.default.State.Started&&(o+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),r=t}.bind(this)),this._state.remove(n),o},Object.defineProperty(i.default.TickSource.prototype,"ticks",{get:function(){return this.getTicksAtTime(this.now())},set:function(t){this.setTicksAtTime(t,this.now())}}),Object.defineProperty(i.default.TickSource.prototype,"seconds",{get:function(){return this.getSecondsAtTime(this.now())},set:function(t){var e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}}),i.default.TickSource.prototype.getSecondsAtTime=function(t){t=this.toSeconds(t);var e=this._state.getLastState(i.default.State.Stopped,t),n={state:i.default.State.Paused,time:t};this._state.add(n);var r=e,o=0;return this._state.forEachBetween(e.time,t+this.sampleTime,function(t){var e=r.time,n=this._tickOffset.get(t.time);n.time>=r.time&&(o=n.seconds,e=n.time),r.state===i.default.State.Started&&t.state!==i.default.State.Started&&(o+=t.time-e),r=t}.bind(this)),this._state.remove(n),o},i.default.TickSource.prototype.setTicksAtTime=function(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({time:e,ticks:t,seconds:this.frequency.getDurationOfTicks(t,e)}),this},i.default.TickSource.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},i.default.TickSource.prototype.getTimeOfTick=function(t,e){e=i.default.defaultArg(e,this.now());var n=this._tickOffset.get(e),r=this._state.get(e),o=Math.max(n.time,r.time),a=this.frequency.getTicksAtTime(o)+t-n.ticks;return this.frequency.getTimeOfTick(a)},i.default.TickSource.prototype.forEachTickBetween=function(t,e,n){var r=this._state.get(t);if(this._state.forEachBetween(t,e,function(e){r.state===i.default.State.Started&&e.state!==i.default.State.Started&&this.forEachTickBetween(Math.max(r.time,t),e.time-this.sampleTime,n),r=e}.bind(this)),t=Math.max(r.time,t),r.state===i.default.State.Started&&this._state){var o=this.frequency.getTicksAtTime(t),a=(o-this.frequency.getTicksAtTime(r.time))%1;0!==a&&(a=1-a);for(var s=this.frequency.getTimeOfTick(o+a),u=null;s<e&&this._state;){try{n(s,Math.round(this.getTicksAtTime(s)))}catch(t){u=t;break}this._state&&(s+=this.frequency.getDurationOfTicks(1,s))}}if(u)throw u;return this},i.default.TickSource.prototype.dispose=function(){return i.default.Param.prototype.dispose.call(this),this._state.dispose(),this._state=null,this._tickOffset.dispose(),this._tickOffset=null,this._writable("frequency"),this.frequency.dispose(),this.frequency=null,this},e.default=i.default.TickSource},function(t,e,n){n.r(e);var i=n(0);n(87),n(13),n(2),n(4),n(18),n(1),i.default.Follower=function(){var t=i.default.defaults(arguments,["smoothing"],i.default.Follower);i.default.AudioNode.call(this),this.createInsOuts(1,1),this._abs=new i.default.Abs,this._filter=this.context.createBiquadFilter(),this._filter.type="lowpass",this._filter.frequency.value=0,this._filter.Q.value=0,this._sub=new i.default.Subtract,this._delay=new i.default.Delay(this.blockTime),this._smoothing=t.smoothing,i.default.connect(this.input,this._delay),i.default.connect(this.input,this._sub,0,1),this._sub.chain(this._abs,this._filter,this.output),this.smoothing=t.smoothing},i.default.extend(i.default.Follower,i.default.AudioNode),i.default.Follower.defaults={smoothing:.05},Object.defineProperty(i.default.Follower.prototype,"smoothing",{get:function(){return this._smoothing},set:function(t){this._smoothing=t,this._filter.frequency.value=.5*i.default.Time(t).toFrequency()}}),i.default.Follower.prototype.connect=i.default.SignalBase.prototype.connect,i.default.Follower.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._filter.disconnect(),this._filter=null,this._delay.dispose(),this._delay=null,this._sub.disconnect(),this._sub=null,this._abs.dispose(),this._abs=null,this},e.default=i.default.Follower},function(t,e,n){n.r(e);var i=n(0);n(42),n(2),n(14),n(18),n(3),n(1),i.default.FeedbackCombFilter=function(){var t=i.default.defaults(arguments,["delayTime","resonance"],i.default.FeedbackCombFilter);i.default.AudioNode.call(this),this._delay=this.input=this.output=new i.default.Delay(t.delayTime),this.delayTime=this._delay.delayTime,this._feedback=new i.default.Gain(t.resonance,i.default.Type.NormalRange),this.resonance=this._feedback.gain,this._delay.chain(this._feedback,this._delay),this._readOnly(["resonance","delayTime"])},i.default.extend(i.default.FeedbackCombFilter,i.default.AudioNode),i.default.FeedbackCombFilter.defaults={delayTime:.1,resonance:.5},i.default.FeedbackCombFilter.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["resonance","delayTime"]),this._delay.dispose(),this._delay=null,this.delayTime=null,this._feedback.dispose(),this._feedback=null,this.resonance=null,this},e.default=i.default.FeedbackCombFilter},function(t,e,n){n.r(e);var i=n(0);n(9),n(2),n(3),n(1),i.default.MultibandSplit=function(){var t=i.default.defaults(arguments,["lowFrequency","highFrequency"],i.default.MultibandSplit);i.default.AudioNode.call(this),this.input=new i.default.Gain,this.output=new Array(3),this.low=this.output[0]=new i.default.Filter(0,"lowpass"),this._lowMidFilter=new i.default.Filter(0,"highpass"),this.mid=this.output[1]=new i.default.Filter(0,"lowpass"),this.high=this.output[2]=new i.default.Filter(0,"highpass"),this.lowFrequency=new i.default.Signal(t.lowFrequency,i.default.Type.Frequency),this.highFrequency=new i.default.Signal(t.highFrequency,i.default.Type.Frequency),this.Q=new i.default.Signal(t.Q),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.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},i.default.extend(i.default.MultibandSplit,i.default.AudioNode),i.default.MultibandSplit.defaults={lowFrequency:400,highFrequency:2500,Q:1},i.default.MultibandSplit.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.low=null,this._lowMidFilter.dispose(),this._lowMidFilter=null,this.mid.dispose(),this.mid=null,this.high.dispose(),this.high=null,this.lowFrequency.dispose(),this.lowFrequency=null,this.highFrequency.dispose(),this.highFrequency=null,this.Q.dispose(),this.Q=null,this},e.default=i.default.MultibandSplit},function(t,e,n){n.r(e);var i=n(0);n(7),i.default.Pow=function(t){i.default.SignalBase.call(this),this._exp=i.default.defaultArg(t,1),this._expScaler=this.input=this.output=new i.default.WaveShaper(this._expFunc(this._exp),8192)},i.default.extend(i.default.Pow,i.default.SignalBase),Object.defineProperty(i.default.Pow.prototype,"value",{get:function(){return this._exp},set:function(t){this._exp=t,this._expScaler.setMap(this._expFunc(this._exp))}}),i.default.Pow.prototype._expFunc=function(t){return function(e){return Math.pow(Math.abs(e),t)}},i.default.Pow.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._expScaler.dispose(),this._expScaler=null,this},e.default=i.default.Pow},function(t,e,n){n.r(e);var i=n(0);i.default.TimeBase=function(t,e){if(!(this instanceof i.default.TimeBase))return new i.default.TimeBase(t,e);if(this._val=t,this._units=e,i.default.isUndef(this._units)&&i.default.isString(this._val)&&parseFloat(this._val)==this._val&&"+"!==this._val.charAt(0))this._val=parseFloat(this._val),this._units=this._defaultUnits;else if(t&&t.constructor===this.constructor)this._val=t._val,this._units=t._units;else if(t instanceof i.default.TimeBase)switch(this._defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi();break;default:throw new Error("Unrecognized default units "+this._defaultUnits)}},i.default.extend(i.default.TimeBase),i.default.TimeBase.prototype._expressions={n:{regexp:/^(\d+)n(\.?)$/i,method:function(t,e){var n="."===e?1.5:1;return 1===(t=parseInt(t))?this._beatsToUnits(this._getTimeSignature())*n:this._beatsToUnits(4/t)*n}},t:{regexp:/^(\d+)t$/i,method:function(t){return t=parseInt(t),this._beatsToUnits(8/(3*parseInt(t)))}},m:{regexp:/^(\d+)m$/i,method:function(t){return this._beatsToUnits(parseInt(t)*this._getTimeSignature())}},i:{regexp:/^(\d+)i$/i,method:function(t){return this._ticksToUnits(parseInt(t))}},hz:{regexp:/^(\d+(?:\.\d+)?)hz$/i,method:function(t){return this._frequencyToUnits(parseFloat(t))}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/,method:function(t,e,n){var i=0;return t&&"0"!==t&&(i+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(i+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(i+=this._beatsToUnits(parseFloat(n)/4)),i}},s:{regexp:/^(\d+(?:\.\d+)?)s$/,method:function(t){return this._secondsToUnits(parseFloat(t))}},samples:{regexp:/^(\d+)samples$/,method:function(t){return parseInt(t)/this.context.sampleRate}},default:{regexp:/^(\d+(?:\.\d+)?)$/,method:function(t){return this._expressions[this._defaultUnits].method.call(this,t)}}},i.default.TimeBase.prototype._defaultUnits="s",i.default.TimeBase.prototype._getBpm=function(){return i.default.Transport?i.default.Transport.bpm.value:120},i.default.TimeBase.prototype._getTimeSignature=function(){return i.default.Transport?i.default.Transport.timeSignature:4},i.default.TimeBase.prototype._getPPQ=function(){return i.default.Transport?i.default.Transport.PPQ:192},i.default.TimeBase.prototype._now=function(){return this.now()},i.default.TimeBase.prototype._frequencyToUnits=function(t){return 1/t},i.default.TimeBase.prototype._beatsToUnits=function(t){return 60/this._getBpm()*t},i.default.TimeBase.prototype._secondsToUnits=function(t){return t},i.default.TimeBase.prototype._ticksToUnits=function(t){return t*(this._beatsToUnits(1)/this._getPPQ())},i.default.TimeBase.prototype._noArg=function(){return this._now()},i.default.TimeBase.prototype.valueOf=function(){if(i.default.isUndef(this._val))return this._noArg();if(i.default.isString(this._val)&&i.default.isUndef(this._units)){for(var t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(i.default.isObject(this._val)){var e=0;for(var n in this._val){var r=this._val[n];e+=new this.constructor(n).valueOf()*r}return e}if(i.default.isDefined(this._units)){var o=this._expressions[this._units],a=this._val.toString().trim().match(o.regexp);return a?o.method.apply(this,a.slice(1)):o.method.call(this,parseFloat(this._val))}return this._val},i.default.TimeBase.prototype.toSeconds=function(){return this.valueOf()},i.default.TimeBase.prototype.toFrequency=function(){return 1/this.toSeconds()},i.default.TimeBase.prototype.toSamples=function(){return this.toSeconds()*this.context.sampleRate},i.default.TimeBase.prototype.toMilliseconds=function(){return 1e3*this.toSeconds()},i.default.TimeBase.prototype.dispose=function(){this._val=null,this._units=null},e.default=i.default.TimeBase},function(t,e,n){n.r(e);var i=n(0);n(62),n(46),i.default.Time=function(t,e){if(!(this instanceof i.default.Time))return new i.default.Time(t,e);i.default.TimeBase.call(this,t,e)},i.default.extend(i.default.Time,i.default.TimeBase),i.default.Time.prototype._expressions=Object.assign({},i.default.TimeBase.prototype._expressions,{quantize:{regexp:/^@(.+)/,method:function(t){if(i.default.Transport){var e=new this.constructor(t);return this._secondsToUnits(i.default.Transport.nextSubdivision(e))}return 0}},now:{regexp:/^\+(.+)/,method:function(t){return this._now()+new this.constructor(t)}}}),i.default.Time.prototype.quantize=function(t,e){e=i.default.defaultArg(e,1);var n=new this.constructor(t),r=this.valueOf();return r+(Math.round(r/n)*n-r)*e},i.default.Time.prototype.toNotation=function(){for(var t=this.toSeconds(),e=["1m"],n=1;n<8;n++){var r=Math.pow(2,n);e.push(r+"n."),e.push(r+"n"),e.push(r+"t")}e.push("0");var o=e[0],a=i.default.Time(e[0]).toSeconds();return e.forEach((function(e){var n=i.default.Time(e).toSeconds();Math.abs(n-t)<Math.abs(a-t)&&(o=e,a=n)})),o},i.default.Time.prototype.toBarsBeatsSixteenths=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t;e=parseFloat(e.toFixed(4));var n=Math.floor(e/this._getTimeSignature()),i=e%1*4;return e=Math.floor(e)%this._getTimeSignature(),(i=i.toString()).length>3&&(i=parseFloat(parseFloat(i).toFixed(3))),[n,e,i].join(":")},i.default.Time.prototype.toTicks=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())},i.default.Time.prototype.toSeconds=function(){return this.valueOf()},i.default.Time.prototype.toMidi=function(){return i.default.Frequency.ftom(this.toFrequency())},e.default=i.default.Time},function(t,e,n){n.r(e);var i=n(0);n(11),n(6),n(3),n(1),i.default.supported&&(OscillatorNode.prototype.setPeriodicWave||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioContext.prototype.createPeriodicWave||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable)),i.default.OscillatorNode=function(){var t=i.default.defaults(arguments,["frequency","type"],i.default.OscillatorNode);i.default.AudioNode.call(this,t),this.onended=t.onended,this._startTime=-1,this._stopTime=-1,this._gainNode=this.output=new i.default.Gain(0),this._oscillator=this.context.createOscillator(),i.default.connect(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new i.default.Param({param:this._oscillator.frequency,units:i.default.Type.Frequency,value:t.frequency}),this.detune=new i.default.Param({param:this._oscillator.detune,units:i.default.Type.Cents,value:t.detune}),this._gain=1},i.default.extend(i.default.OscillatorNode,i.default.AudioNode),i.default.OscillatorNode.defaults={frequency:440,detune:0,type:"sine",onended:i.default.noOp},Object.defineProperty(i.default.OscillatorNode.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),i.default.OscillatorNode.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),-1!==this._startTime&&t>=this._startTime&&(-1===this._stopTime||t<=this._stopTime)?i.default.State.Started:i.default.State.Stopped},i.default.OscillatorNode.prototype.start=function(t){if(this.log("start",t),-1!==this._startTime)throw new Error("cannot call OscillatorNode.start more than once");return this._startTime=this.toSeconds(t),this._startTime=Math.max(this._startTime,this.context.currentTime),this._oscillator.start(this._startTime),this._gainNode.gain.setValueAtTime(1,this._startTime),this},i.default.OscillatorNode.prototype.setPeriodicWave=function(t){return this._oscillator.setPeriodicWave(t),this},i.default.OscillatorNode.prototype.stop=function(t){return this.log("stop",t),this.assert(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop(),this._stopTime=this.toSeconds(t),this._stopTime=Math.max(this._stopTime,this.context.currentTime),this._stopTime>this._startTime?(this._gainNode.gain.setValueAtTime(0,this._stopTime),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(function(){this._oscillator.stop(this.now()),this.onended(),setTimeout(function(){this._oscillator&&(this._oscillator.disconnect(),this._gainNode.disconnect())}.bind(this),100)}.bind(this),this._stopTime-this.context.currentTime)):this._gainNode.gain.cancelScheduledValues(this._startTime),this},i.default.OscillatorNode.prototype.cancelStop=function(){return-1!==this._startTime&&(this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1),this},Object.defineProperty(i.default.OscillatorNode.prototype,"type",{get:function(){return this._oscillator.type},set:function(t){this._oscillator.type=t}}),i.default.OscillatorNode.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,this.context.clearTimeout(this._timeout),i.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._oscillator.disconnect(),this._oscillator=null,this._gainNode.dispose(),this._gainNode=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null),this},e.default=i.default.OscillatorNode},function(t,e,n){n.r(e);var i=n(0);n(11),n(6),n(57),n(32),i.default.Player=function(t){var e;t instanceof i.default.Buffer&&t.loaded?(t=t.get(),e=i.default.Player.defaults):e=i.default.defaults(arguments,["url","onload"],i.default.Player),i.default.Source.call(this,e),this.autostart=e.autostart,this._buffer=new i.default.Buffer({url:e.url,onload:this._onload.bind(this,e.onload),reverse:e.reverse}),t instanceof AudioBuffer&&this._buffer.set(t),this._loop=e.loop,this._loopStart=e.loopStart,this._loopEnd=e.loopEnd,this._playbackRate=e.playbackRate,this._activeSources=[],this.fadeIn=e.fadeIn,this.fadeOut=e.fadeOut},i.default.extend(i.default.Player,i.default.Source),i.default.Player.defaults={onload:i.default.noOp,playbackRate:1,loop:!1,autostart:!1,loopStart:0,loopEnd:0,reverse:!1,fadeIn:0,fadeOut:0},i.default.Player.prototype.load=function(t,e){return this._buffer.load(t,this._onload.bind(this,e))},i.default.Player.prototype._onload=function(t){(t=i.default.defaultArg(t,i.default.noOp))(this),this.autostart&&this.start()},i.default.Player.prototype._onSourceEnd=function(t){var e=this._activeSources.indexOf(t);this._activeSources.splice(e,1),0!==this._activeSources.length||this._synced||this._state.setStateAtTime(i.default.State.Stopped,i.default.now())},i.default.Player.prototype._start=function(t,e,n){e=this._loop?i.default.defaultArg(e,this._loopStart):i.default.defaultArg(e,0),e=this.toSeconds(e),this._synced&&(e*=this._playbackRate);var r=i.default.defaultArg(n,Math.max(this._buffer.duration-e,0));r=this.toSeconds(r),r/=this._playbackRate,t=this.toSeconds(t);var o=new i.default.BufferSource({buffer:this._buffer,loop:this._loop,loopStart:this._loopStart,loopEnd:this._loopEnd,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate,fadeIn:this.fadeIn,fadeOut:this.fadeOut}).connect(this.output);return this._loop||this._synced||this._state.setStateAtTime(i.default.State.Stopped,t+r),this._activeSources.push(o),this._loop&&i.default.isUndef(n)?o.start(t,e):o.start(t,e,r-this.toSeconds(this.fadeOut)),this},i.default.Player.prototype._stop=function(t){return t=this.toSeconds(t),this._activeSources.forEach((function(e){e.stop(t)})),this},i.default.Player.prototype.restart=function(t,e,n){return this._stop(t),this._start(t,e,n),this},i.default.Player.prototype.seek=function(t,e){return e=this.toSeconds(e),this._state.getValueAtTime(e)===i.default.State.Started&&(t=this.toSeconds(t),this._stop(e),this._start(e,t)),this},i.default.Player.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(i.default.Player.prototype,"loopStart",{get:function(){return this._loopStart},set:function(t){this._loopStart=t,this._activeSources.forEach((function(e){e.loopStart=t}))}}),Object.defineProperty(i.default.Player.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(t){this._loopEnd=t,this._activeSources.forEach((function(e){e.loopEnd=t}))}}),Object.defineProperty(i.default.Player.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(i.default.Player.prototype,"loop",{get:function(){return this._loop},set:function(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach((function(e){e.loop=t})),t)){var e=this._state.getNextState(i.default.State.Stopped,this.now());e&&this._state.cancel(e.time)}}}),Object.defineProperty(i.default.Player.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t;var e=this.now(),n=this._state.getNextState(i.default.State.Stopped,e);n&&this._state.cancel(n.time),this._activeSources.forEach((function(n){n.cancelStop(),n.playbackRate.setValueAtTime(t,e)}))}}),Object.defineProperty(i.default.Player.prototype,"reverse",{get:function(){return this._buffer.reverse},set:function(t){this._buffer.reverse=t}}),Object.defineProperty(i.default.Player.prototype,"loaded",{get:function(){return this._buffer.loaded}}),i.default.Player.prototype.dispose=function(){return this._activeSources.forEach((function(t){t.dispose()})),this._activeSources=null,i.default.Source.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this},e.default=i.default.Player},function(t,e,n){n.r(e);var i=n(0);n(31),n(41),n(37),n(2),n(9),n(25),i.default.MonoSynth=function(t){t=i.default.defaultArg(t,i.default.MonoSynth.defaults),i.default.Monophonic.call(this,t),this.oscillator=new i.default.OmniOscillator(t.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new i.default.Filter(t.filter),this.filter.frequency.value=5e3,this.filterEnvelope=new i.default.FrequencyEnvelope(t.filterEnvelope),this.envelope=new i.default.AmplitudeEnvelope(t.envelope),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),this._readOnly(["oscillator","frequency","detune","filter","filterEnvelope","envelope"])},i.default.extend(i.default.MonoSynth,i.default.Monophonic),i.default.MonoSynth.defaults={frequency:"C4",detune:0,oscillator:{type:"square"},filter:{Q:6,type:"lowpass",rolloff:-24},envelope:{attack:.005,decay:.1,sustain:.9,release:1},filterEnvelope:{attack:.06,decay:.2,sustain:.5,release:2,baseFrequency:200,octaves:7,exponent:2}},i.default.MonoSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain&&this.oscillator.stop(t+this.envelope.attack+this.envelope.decay),this},i.default.MonoSynth.prototype._triggerEnvelopeRelease=function(t){return this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},i.default.MonoSynth.prototype.dispose=function(){return i.default.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","filter","filterEnvelope","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.filterEnvelope.dispose(),this.filterEnvelope=null,this.filter.dispose(),this.filter=null,this.frequency=null,this.detune=null,this},e.default=i.default.MonoSynth},function(t,e,n){n.r(e);var i=n(0);n(6),n(17),n(5),n(3),i.default.FatOscillator=function(){var t=i.default.defaults(arguments,["frequency","type","spread"],i.default.FatOscillator);i.default.Source.call(this,t),this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this._oscillators=[],this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,this._readOnly(["frequency","detune"])},i.default.extend(i.default.FatOscillator,i.default.Source),i.default.FatOscillator.defaults={frequency:440,detune:0,phase:0,spread:20,count:3,type:"sawtooth",partials:[],partialCount:0},i.default.FatOscillator.prototype._start=function(t){t=this.toSeconds(t),this._forEach((function(e){e.start(t)}))},i.default.FatOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._forEach((function(e){e.stop(t)}))},i.default.FatOscillator.prototype.restart=function(t){t=this.toSeconds(t),this._forEach((function(e){e.restart(t)}))},i.default.FatOscillator.prototype._forEach=function(t){for(var e=0;e<this._oscillators.length;e++)t.call(this,this._oscillators[e],e)},Object.defineProperty(i.default.FatOscillator.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t,this._forEach((function(e){e.type=t}))}}),Object.defineProperty(i.default.FatOscillator.prototype,"spread",{get:function(){return this._spread},set:function(t){if(this._spread=t,this._oscillators.length>1){var e=-t/2,n=t/(this._oscillators.length-1);this._forEach((function(t,i){t.detune.value=e+n*i}))}}}),Object.defineProperty(i.default.FatOscillator.prototype,"count",{get:function(){return this._oscillators.length},set:function(t){if(t=Math.max(t,1),this._oscillators.length!==t){this._forEach((function(t){t.dispose()})),this._oscillators=[];for(var e=0;e<t;e++){var n=new i.default.Oscillator;this.type===i.default.Oscillator.Type.Custom?n.partials=this._partials:n.type=this._type,n.partialCount=this._partialCount,n.phase=this._phase+e/t*360,n.volume.value=-6-1.1*t,this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,this.state===i.default.State.Started&&this._forEach((function(t){t.start()}))}}}),Object.defineProperty(i.default.FatOscillator.prototype,"phase",{get:function(){return this._phase},set:function(t){this._phase=t,this._forEach((function(e){e.phase=t}))}}),Object.defineProperty(i.default.FatOscillator.prototype,"baseType",{get:function(){return this._oscillators[0].baseType},set:function(t){this._forEach((function(e){e.baseType=t})),this._type=this._oscillators[0].type}}),Object.defineProperty(i.default.FatOscillator.prototype,"partials",{get:function(){return this._oscillators[0].partials},set:function(t){this._partials=t,this._type=i.default.Oscillator.Type.Custom,this._forEach((function(e){e.partials=t}))}}),Object.defineProperty(i.default.FatOscillator.prototype,"partialCount",{get:function(){return this._oscillators[0].partialCount},set:function(t){this._partialCount=t,this._forEach((function(e){e.partialCount=t})),this._type=this._oscillators[0].type}}),i.default.FatOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._forEach((function(t){t.dispose()})),this._oscillators=null,this._partials=null,this},e.default=i.default.FatOscillator},function(t,e,n){n.r(e);var i=n(0);n(6),n(17),n(5),n(3),n(22),i.default.AMOscillator=function(){var t=i.default.defaults(arguments,["frequency","type","modulationType"],i.default.AMOscillator);i.default.Source.call(this,t),this._carrier=new i.default.Oscillator(t.frequency,t.type),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this.detune.value=t.detune,this._modulator=new i.default.Oscillator(t.frequency,t.modulationType),this._modulationScale=new i.default.AudioToGain,this.harmonicity=new i.default.Multiply(t.harmonicity),this.harmonicity.units=i.default.Type.Positive,this._modulationNode=new i.default.Gain(0),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.connect(this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),this.phase=t.phase,this._readOnly(["frequency","detune","harmonicity"])},i.default.extend(i.default.AMOscillator,i.default.Oscillator),i.default.AMOscillator.defaults={frequency:440,detune:0,phase:0,type:"sine",modulationType:"square",harmonicity:1},i.default.AMOscillator.prototype._start=function(t){this._modulator.start(t),this._carrier.start(t)},i.default.AMOscillator.prototype._stop=function(t){this._modulator.stop(t),this._carrier.stop(t)},i.default.AMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._carrier.restart(t)},Object.defineProperty(i.default.AMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(t){this._carrier.type=t}}),Object.defineProperty(i.default.AMOscillator.prototype,"baseType",{get:function(){return this._carrier.baseType},set:function(t){this._carrier.baseType=t}}),Object.defineProperty(i.default.AMOscillator.prototype,"partialCount",{get:function(){return this._carrier.partialCount},set:function(t){this._carrier.partialCount=t}}),Object.defineProperty(i.default.AMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(t){this._modulator.type=t}}),Object.defineProperty(i.default.AMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(t){this._carrier.phase=t,this._modulator.phase=t}}),Object.defineProperty(i.default.AMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(t){this._carrier.partials=t}}),i.default.AMOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune","harmonicity"]),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this._modulationScale.dispose(),this._modulationScale=null,this},e.default=i.default.AMOscillator},function(t,e,n){n.r(e);var i=n(0);n(6),n(50),n(17),n(5),i.default.PWMOscillator=function(){var t=i.default.defaults(arguments,["frequency","modulationFrequency"],i.default.PWMOscillator);i.default.Source.call(this,t),this._pulse=new i.default.PulseOscillator(t.modulationFrequency),this._pulse._sawtooth.type="sine",this._modulator=new i.default.Oscillator({frequency:t.frequency,detune:t.detune,phase:t.phase}),this._scale=new i.default.Multiply(2),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this.modulationFrequency=this._pulse.frequency,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),this._readOnly(["modulationFrequency","frequency","detune"])},i.default.extend(i.default.PWMOscillator,i.default.Source),i.default.PWMOscillator.defaults={frequency:440,detune:0,phase:0,modulationFrequency:.4},i.default.PWMOscillator.prototype._start=function(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)},i.default.PWMOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)},i.default.PWMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._pulse.restart(t)},Object.defineProperty(i.default.PWMOscillator.prototype,"type",{get:function(){return"pwm"}}),Object.defineProperty(i.default.PWMOscillator.prototype,"baseType",{get:function(){return"pwm"}}),Object.defineProperty(i.default.PWMOscillator.prototype,"partials",{get:function(){return[]}}),Object.defineProperty(i.default.PWMOscillator.prototype,"phase",{get:function(){return this._modulator.phase},set:function(t){this._modulator.phase=t}}),i.default.PWMOscillator.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this._pulse.dispose(),this._pulse=null,this._scale.dispose(),this._scale=null,this._modulator.dispose(),this._modulator=null,this._writable(["modulationFrequency","frequency","detune"]),this.frequency=null,this.detune=null,this.modulationFrequency=null,this},e.default=i.default.PWMOscillator},function(t,e,n){n.r(e);var i=n(0);n(51),n(4),n(16),i.default.Part=function(){var t=i.default.defaults(arguments,["callback","events"],i.default.Part);i.default.Event.call(this,t),this._events=[];for(var e=0;e<t.events.length;e++)Array.isArray(t.events[e])?this.add(t.events[e][0],t.events[e][1]):this.add(t.events[e])},i.default.extend(i.default.Part,i.default.Event),i.default.Part.defaults={callback:i.default.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,probability:1,humanize:!1,mute:!1,events:[]},i.default.Part.prototype.start=function(t,e){var n=this.toTicks(t);return this._state.getValueAtTime(n)!==i.default.State.Started&&(e=this._loop?i.default.defaultArg(e,this._loopStart):i.default.defaultArg(e,0),e=this.toTicks(e),this._state.add({state:i.default.State.Started,time:n,offset:e}),this._forEach((function(t){this._startNote(t,n,e)}))),this},i.default.Part.prototype._startNote=function(t,e,n){e-=n,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<n&&(e+=this._getLoopDuration()),t.start(i.default.Ticks(e))):t.startOffset<this._loopStart&&t.startOffset>=n&&(t.loop=!1,t.start(i.default.Ticks(e))):t.startOffset>=n&&t.start(i.default.Ticks(e))},Object.defineProperty(i.default.Part.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t,this._forEach((function(t){t.startOffset+=this._startOffset}))}}),i.default.Part.prototype.stop=function(t){var e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime(i.default.State.Stopped,e),this._forEach((function(e){e.stop(t)})),this},i.default.Part.prototype.at=function(t,e){t=i.default.TransportTime(t);for(var n=i.default.Ticks(1).toSeconds(),r=0;r<this._events.length;r++){var o=this._events[r];if(Math.abs(t.toTicks()-o.startOffset)<n)return i.default.isDefined(e)&&(o.value=e),o}return i.default.isDefined(e)?(this.add(t,e),this._events[this._events.length-1]):null},i.default.Part.prototype.add=function(t,e){var n;return t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),e instanceof i.default.Event?(n=e).callback=this._tick.bind(this):n=new i.default.Event({callback:this._tick.bind(this),value:e}),n.startOffset=t,n.set({loopEnd:this.loopEnd,loopStart:this.loopStart,loop:this.loop,humanize:this.humanize,playbackRate:this.playbackRate,probability:this.probability}),this._events.push(n),this._restartEvent(n),this},i.default.Part.prototype._restartEvent=function(t){this._state.forEach(function(e){e.state===i.default.State.Started?this._startNote(t,e.time,e.offset):t.stop(i.default.Ticks(e.time))}.bind(this))},i.default.Part.prototype.remove=function(t,e){t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t);for(var n=this._events.length-1;n>=0;n--){var r=this._events[n];r.startOffset===t&&(i.default.isUndef(e)||i.default.isDefined(e)&&r.value===e)&&(this._events.splice(n,1),r.dispose())}return this},i.default.Part.prototype.removeAll=function(){return this._forEach((function(t){t.dispose()})),this._events=[],this},i.default.Part.prototype.cancel=function(t){return this._forEach((function(e){e.cancel(t)})),this._state.cancel(this.toTicks(t)),this},i.default.Part.prototype._forEach=function(t,e){if(this._events){e=i.default.defaultArg(e,this);for(var n=this._events.length-1;n>=0;n--){var r=this._events[n];r instanceof i.default.Part?r._forEach(t,e):t.call(e,r)}}return this},i.default.Part.prototype._setAll=function(t,e){this._forEach((function(n){n[t]=e}))},i.default.Part.prototype._tick=function(t,e){this.mute||this.callback(t,e)},i.default.Part.prototype._testLoopBoundries=function(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):t.state===i.default.State.Stopped&&this._restartEvent(t)},Object.defineProperty(i.default.Part.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t,this._setAll("probability",t)}}),Object.defineProperty(i.default.Part.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t,this._setAll("humanize",t)}}),Object.defineProperty(i.default.Part.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._forEach((function(e){e._loopStart=this._loopStart,e._loopEnd=this._loopEnd,e.loop=t,this._testLoopBoundries(e)}))}}),Object.defineProperty(i.default.Part.prototype,"loopEnd",{get:function(){return i.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach((function(e){e.loopEnd=t,this._testLoopBoundries(e)}))}}),Object.defineProperty(i.default.Part.prototype,"loopStart",{get:function(){return i.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach((function(t){t.loopStart=this.loopStart,this._testLoopBoundries(t)}))}}),Object.defineProperty(i.default.Part.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._setAll("playbackRate",t)}}),Object.defineProperty(i.default.Part.prototype,"length",{get:function(){return this._events.length}}),i.default.Part.prototype.dispose=function(){return i.default.Event.prototype.dispose.call(this),this.removeAll(),this.callback=null,this._events=null,this},e.default=i.default.Part},function(t,e,n){n.r(e);var i=n(0);n(51),i.default.Loop=function(){var t=i.default.defaults(arguments,["callback","interval"],i.default.Loop);i.default.call(this),this._event=new i.default.Event({callback:this._tick.bind(this),loop:!0,loopEnd:t.interval,playbackRate:t.playbackRate,probability:t.probability}),this.callback=t.callback,this.iterations=t.iterations},i.default.extend(i.default.Loop),i.default.Loop.defaults={interval:"4n",callback:i.default.noOp,playbackRate:1,iterations:1/0,probability:!0,mute:!1},i.default.Loop.prototype.start=function(t){return this._event.start(t),this},i.default.Loop.prototype.stop=function(t){return this._event.stop(t),this},i.default.Loop.prototype.cancel=function(t){return this._event.cancel(t),this},i.default.Loop.prototype._tick=function(t){this.callback(t)},Object.defineProperty(i.default.Loop.prototype,"state",{get:function(){return this._event.state}}),Object.defineProperty(i.default.Loop.prototype,"progress",{get:function(){return this._event.progress}}),Object.defineProperty(i.default.Loop.prototype,"interval",{get:function(){return this._event.loopEnd},set:function(t){this._event.loopEnd=t}}),Object.defineProperty(i.default.Loop.prototype,"playbackRate",{get:function(){return this._event.playbackRate},set:function(t){this._event.playbackRate=t}}),Object.defineProperty(i.default.Loop.prototype,"humanize",{get:function(){return this._event.humanize},set:function(t){this._event.humanize=t}}),Object.defineProperty(i.default.Loop.prototype,"probability",{get:function(){return this._event.probability},set:function(t){this._event.probability=t}}),Object.defineProperty(i.default.Loop.prototype,"mute",{get:function(){return this._event.mute},set:function(t){this._event.mute=t}}),Object.defineProperty(i.default.Loop.prototype,"iterations",{get:function(){return!0===this._event.loop?1/0:this._event.loop},set:function(t){this._event.loop=t===1/0||t}}),i.default.Loop.prototype.dispose=function(){this._event.dispose(),this._event=null,this.callback=null},e.default=i.default.Loop},function(t,e,n){n.r(e);var i=n(0);n(15),n(33),i.default.StereoXFeedbackEffect=function(){var t=i.default.defaults(arguments,["feedback"],i.default.FeedbackEffect);i.default.StereoEffect.call(this,t),this.feedback=new i.default.Signal(t.feedback,i.default.Type.NormalRange),this._feedbackLR=new i.default.Gain,this._feedbackRL=new i.default.Gain,this.effectReturnL.chain(this._feedbackLR,this.effectSendR),this.effectReturnR.chain(this._feedbackRL,this.effectSendL),this.feedback.fan(this._feedbackLR.gain,this._feedbackRL.gain),this._readOnly(["feedback"])},i.default.extend(i.default.StereoXFeedbackEffect,i.default.StereoEffect),i.default.StereoXFeedbackEffect.prototype.dispose=function(){return i.default.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackLR.dispose(),this._feedbackLR=null,this._feedbackRL.dispose(),this._feedbackRL=null,this},e.default=i.default.StereoXFeedbackEffect},function(t,e,n){n.r(e);var i=n(0);n(8),n(53),n(52),i.default.MidSideEffect=function(){i.default.Effect.apply(this,arguments),this._midSideSplit=new i.default.MidSideSplit,this._midSideMerge=new i.default.MidSideMerge,this.midSend=this._midSideSplit.mid,this.sideSend=this._midSideSplit.side,this.midReturn=this._midSideMerge.mid,this.sideReturn=this._midSideMerge.side,this.effectSend.connect(this._midSideSplit),this._midSideMerge.connect(this.effectReturn)},i.default.extend(i.default.MidSideEffect,i.default.Effect),i.default.MidSideEffect.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this.midSend=null,this.sideSend=null,this.midReturn=null,this.sideReturn=null,this},e.default=i.default.MidSideEffect},function(t,e,n){n.r(e);var i=n(0);n(11),n(8),i.default.Convolver=function(){var t=i.default.defaults(arguments,["url","onload"],i.default.Convolver);i.default.Effect.call(this,t),this._convolver=this.context.createConvolver(),this._buffer=new i.default.Buffer(t.url,function(e){this.buffer=e.get(),t.onload()}.bind(this)),this._buffer.loaded&&(this.buffer=this._buffer),this.normalize=t.normalize,this.connectEffect(this._convolver)},i.default.extend(i.default.Convolver,i.default.Effect),i.default.Convolver.defaults={onload:i.default.noOp,normalize:!0},Object.defineProperty(i.default.Convolver.prototype,"buffer",{get:function(){return this._buffer.length?this._buffer:null},set:function(t){this._buffer.set(t),this._convolver.buffer&&(this.effectSend.disconnect(),this._convolver.disconnect(),this._convolver=this.context.createConvolver(),this.connectEffect(this._convolver)),this._convolver.buffer=this._buffer.get()}}),Object.defineProperty(i.default.Convolver.prototype,"normalize",{get:function(){return this._convolver.normalize},set:function(t){this._convolver.normalize=t}}),i.default.Convolver.prototype.load=function(t,e){return this._buffer.load(t,function(t){this.buffer=t,e&&e()}.bind(this))},i.default.Convolver.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this._convolver.disconnect(),this._convolver=null,this},e.default=i.default.Convolver},function(t,e,n){n.r(e);var i=n(0);n(7),n(5),n(13),i.default.Modulo=function(t){i.default.SignalBase.call(this),this.createInsOuts(1,0),this._shaper=new i.default.WaveShaper(Math.pow(2,16)),this._multiply=new i.default.Multiply,this._subtract=this.output=new i.default.Subtract,this._modSignal=new i.default.Signal(t),i.default.connect(this.input,this._shaper),i.default.connect(this.input,this._subtract),this._modSignal.connect(this._multiply,0,0),this._shaper.connect(this._multiply,0,1),this._multiply.connect(this._subtract,0,1),this._setWaveShaper(t)},i.default.extend(i.default.Modulo,i.default.SignalBase),i.default.Modulo.prototype._setWaveShaper=function(t){this._shaper.setMap((function(e){return Math.floor((e+1e-4)/t)}))},Object.defineProperty(i.default.Modulo.prototype,"value",{get:function(){return this._modSignal.value},set:function(t){this._modSignal.value=t,this._setWaveShaper(t)}}),i.default.Modulo.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this._multiply.dispose(),this._multiply=null,this._subtract.dispose(),this._subtract=null,this._modSignal.dispose(),this._modSignal=null,this},e.default=i.default.Modulo},function(t,e,n){n.r(e);var i=n(0);n(20),n(92),i.default.OfflineContext=function(t,e,n){var r=new OfflineAudioContext(t,e*n,n);i.default.Context.call(this,{context:r,clockSource:"offline",lookAhead:0,updateInterval:128/n}),this._duration=e,this._currentTime=0},i.default.extend(i.default.OfflineContext,i.default.Context),i.default.OfflineContext.prototype.now=function(){return this._currentTime},i.default.OfflineContext.prototype.resume=function(){return Promise.resolve()},i.default.OfflineContext.prototype.render=function(){for(;this._duration-this._currentTime>=0;)this.emit("tick"),this._currentTime+=.005;return this._context.startRendering()},i.default.OfflineContext.prototype.close=function(){return this._context=null,Promise.resolve()},e.default=i.default.OfflineContext},function(t,e,n){n.r(e);var i=n(0);n(16),n(11),n(76),n(40),i.default.Offline=function(t,e){var n=i.default.context.sampleRate,r=i.default.context,o=new i.default.OfflineContext(2,e,n);i.default.context=o;var a=t(i.default.Transport),s=null;return s=a&&i.default.isFunction(a.then)?a.then((function(){return o.render()})):o.render(),i.default.context=r,s.then((function(t){return new i.default.Buffer(t)}))},e.default=i.default.Offline},function(t,e,n){n.r(e);var i=n(0);n(11),i.default.Buffers=function(t){var e=Array.prototype.slice.call(arguments);e.shift();var n=i.default.defaults(e,["onload","baseUrl"],i.default.Buffers);for(var r in i.default.call(this),this._buffers={},this.baseUrl=n.baseUrl,this._loadingCount=0,t)this._loadingCount++,this.add(r,t[r],this._bufferLoaded.bind(this,n.onload))},i.default.extend(i.default.Buffers),i.default.Buffers.defaults={onload:i.default.noOp,baseUrl:""},i.default.Buffers.prototype.has=function(t){return this._buffers.hasOwnProperty(t)},i.default.Buffers.prototype.get=function(t){if(this.has(t))return this._buffers[t];throw new Error("Tone.Buffers: no buffer named "+t)},i.default.Buffers.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(i.default.Buffers.prototype,"loaded",{get:function(){var t=!0;for(var e in this._buffers){var n=this.get(e);t=t&&n.loaded}return t}}),i.default.Buffers.prototype.add=function(t,e,n){return n=i.default.defaultArg(n,i.default.noOp),e instanceof i.default.Buffer?(this._buffers[t]=e,n(this)):e instanceof AudioBuffer?(this._buffers[t]=new i.default.Buffer(e),n(this)):i.default.isString(e)&&(this._buffers[t]=new i.default.Buffer(this.baseUrl+e,n)),this},i.default.Buffers.prototype.dispose=function(){for(var t in i.default.prototype.dispose.call(this),this._buffers)this._buffers[t].dispose();return this._buffers=null,this},e.default=i.default.Buffers},function(t,e,n){n.r(e);var i=n(0);i.default.CtrlPattern=function(){var t=i.default.defaults(arguments,["values","type"],i.default.CtrlPattern);i.default.call(this),this.values=t.values,this.index=0,this._type=null,this._shuffled=null,this._direction=null,this.type=t.type},i.default.extend(i.default.CtrlPattern),i.default.CtrlPattern.Type={Up:"up",Down:"down",UpDown:"upDown",DownUp:"downUp",AlternateUp:"alternateUp",AlternateDown:"alternateDown",Random:"random",RandomWalk:"randomWalk",RandomOnce:"randomOnce"},i.default.CtrlPattern.defaults={type:i.default.CtrlPattern.Type.Up,values:[]},Object.defineProperty(i.default.CtrlPattern.prototype,"value",{get:function(){if(0!==this.values.length){if(1===this.values.length)return this.values[0];this.index=Math.min(this.index,this.values.length-1);var t=this.values[this.index];return this.type===i.default.CtrlPattern.Type.RandomOnce&&(this.values.length!==this._shuffled.length&&this._shuffleValues(),t=this.values[this._shuffled[this.index]]),t}}}),Object.defineProperty(i.default.CtrlPattern.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t,this._shuffled=null,this._type===i.default.CtrlPattern.Type.Up||this._type===i.default.CtrlPattern.Type.UpDown||this._type===i.default.CtrlPattern.Type.RandomOnce||this._type===i.default.CtrlPattern.Type.AlternateUp?this.index=0:this._type!==i.default.CtrlPattern.Type.Down&&this._type!==i.default.CtrlPattern.Type.DownUp&&this._type!==i.default.CtrlPattern.Type.AlternateDown||(this.index=this.values.length-1),this._type===i.default.CtrlPattern.Type.UpDown||this._type===i.default.CtrlPattern.Type.AlternateUp?this._direction=i.default.CtrlPattern.Type.Up:this._type!==i.default.CtrlPattern.Type.DownUp&&this._type!==i.default.CtrlPattern.Type.AlternateDown||(this._direction=i.default.CtrlPattern.Type.Down),this._type===i.default.CtrlPattern.Type.RandomOnce?this._shuffleValues():this._type===i.default.CtrlPattern.Type.Random&&(this.index=Math.floor(Math.random()*this.values.length))}}),i.default.CtrlPattern.prototype.next=function(){var t=this.type;return t===i.default.CtrlPattern.Type.Up?(this.index++,this.index>=this.values.length&&(this.index=0)):t===i.default.CtrlPattern.Type.Down?(this.index--,this.index<0&&(this.index=this.values.length-1)):t===i.default.CtrlPattern.Type.UpDown||t===i.default.CtrlPattern.Type.DownUp?(this._direction===i.default.CtrlPattern.Type.Up?this.index++:this.index--,this.index<0?(this.index=1,this._direction=i.default.CtrlPattern.Type.Up):this.index>=this.values.length&&(this.index=this.values.length-2,this._direction=i.default.CtrlPattern.Type.Down)):t===i.default.CtrlPattern.Type.Random?this.index=Math.floor(Math.random()*this.values.length):t===i.default.CtrlPattern.Type.RandomWalk?Math.random()<.5?(this.index--,this.index=Math.max(this.index,0)):(this.index++,this.index=Math.min(this.index,this.values.length-1)):t===i.default.CtrlPattern.Type.RandomOnce?(this.index++,this.index>=this.values.length&&(this.index=0,this._shuffleValues())):t===i.default.CtrlPattern.Type.AlternateUp?(this._direction===i.default.CtrlPattern.Type.Up?(this.index+=2,this._direction=i.default.CtrlPattern.Type.Down):(this.index-=1,this._direction=i.default.CtrlPattern.Type.Up),this.index>=this.values.length&&(this.index=0,this._direction=i.default.CtrlPattern.Type.Up)):t===i.default.CtrlPattern.Type.AlternateDown&&(this._direction===i.default.CtrlPattern.Type.Up?(this.index+=1,this._direction=i.default.CtrlPattern.Type.Down):(this.index-=2,this._direction=i.default.CtrlPattern.Type.Up),this.index<0&&(this.index=this.values.length-1,this._direction=i.default.CtrlPattern.Type.Down)),this.value},i.default.CtrlPattern.prototype._shuffleValues=function(){var t=[];this._shuffled=[];for(var e=0;e<this.values.length;e++)t[e]=e;for(;t.length>0;){var n=t.splice(Math.floor(t.length*Math.random()),1);this._shuffled.push(n[0])}},i.default.CtrlPattern.prototype.dispose=function(){this._shuffled=null,this.values=null},e.default=i.default.CtrlPattern},function(t,e,n){n.r(e);var i=n(0);n(56),n(55),i.default.TransportRepeatEvent=function(t,e){i.default.TransportEvent.call(this,t,e),e=i.default.defaultArg(e,i.default.TransportRepeatEvent.defaults),this.duration=i.default.Ticks(e.duration),this._interval=i.default.Ticks(e.interval),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this),this.Transport.on("start loopStart",this._boundRestart),this._restart()},i.default.extend(i.default.TransportRepeatEvent,i.default.TransportEvent),i.default.TransportRepeatEvent.defaults={duration:1/0,interval:1},i.default.TransportRepeatEvent.prototype.invoke=function(t){this._createEvents(t),i.default.TransportEvent.prototype.invoke.call(this,t)},i.default.TransportRepeatEvent.prototype._createEvents=function(t){var e=this.Transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),i.default.Ticks(this._nextTick)))},i.default.TransportRepeatEvent.prototype._restart=function(t){this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this._nextTick=this.time;var e=this.Transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.Transport.scheduleOnce(this.invoke.bind(this),i.default.Ticks(this._nextTick)),this._nextTick+=this._interval,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),i.default.Ticks(this._nextTick))},i.default.TransportRepeatEvent.prototype.dispose=function(){return this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this.Transport.off("start loopStart",this._boundRestart),this._boundCreateEvents=null,i.default.TransportEvent.prototype.dispose.call(this),this.duration=null,this._interval=null,this},e.default=i.default.TransportRepeatEvent},function(t,e,n){n.r(e);var i=n(0);n(4),i.default.IntervalTimeline=function(){i.default.call(this),this._root=null,this._length=0},i.default.extend(i.default.IntervalTimeline),i.default.IntervalTimeline.prototype.add=function(t){if(i.default.isUndef(t.time)||i.default.isUndef(t.duration))throw new Error("Tone.IntervalTimeline: events must have time and duration parameters");t.time=t.time.valueOf();var e=new r(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this},i.default.IntervalTimeline.prototype.remove=function(t){if(null!==this._root){var e=[];this._root.search(t.time,e);for(var n=0;n<e.length;n++){var i=e[n];if(i.event===t){this._removeNode(i),this._length--;break}}}return this},Object.defineProperty(i.default.IntervalTimeline.prototype,"length",{get:function(){return this._length}}),i.default.IntervalTimeline.prototype.cancel=function(t){return this.forEachFrom(t,function(t){this.remove(t)}.bind(this)),this},i.default.IntervalTimeline.prototype._setRoot=function(t){this._root=t,null!==this._root&&(this._root.parent=null)},i.default.IntervalTimeline.prototype._replaceNodeInParent=function(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)},i.default.IntervalTimeline.prototype._removeNode=function(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{var e,n;if(t.getBalance()>0)if(null===t.left.right)(e=t.left).right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right}else if(null===t.right.left)(e=t.right).left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),this._rebalance(n)}t.dispose()},i.default.IntervalTimeline.prototype._rotateLeft=function(t){var e=t.parent,n=t.isLeftChild(),i=t.right;t.right=i.left,i.left=t,null!==e?n?e.left=i:e.right=i:this._setRoot(i)},i.default.IntervalTimeline.prototype._rotateRight=function(t){var e=t.parent,n=t.isLeftChild(),i=t.left;t.left=i.right,i.right=t,null!==e?n?e.left=i:e.right=i:this._setRoot(i)},i.default.IntervalTimeline.prototype._rebalance=function(t){var e=t.getBalance();e>1?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))},i.default.IntervalTimeline.prototype.get=function(t){if(null!==this._root){var e=[];if(this._root.search(t,e),e.length>0){for(var n=e[0],i=1;i<e.length;i++)e[i].low>n.low&&(n=e[i]);return n.event}}return null},i.default.IntervalTimeline.prototype.forEach=function(t){if(null!==this._root){var e=[];this._root.traverse((function(t){e.push(t)}));for(var n=0;n<e.length;n++){var i=e[n].event;i&&t(i)}}return this},i.default.IntervalTimeline.prototype.forEachAtTime=function(t,e){if(null!==this._root){var n=[];this._root.search(t,n);for(var i=n.length-1;i>=0;i--){var r=n[i].event;r&&e(r)}}return this},i.default.IntervalTimeline.prototype.forEachFrom=function(t,e){if(null!==this._root){var n=[];this._root.searchAfter(t,n);for(var i=n.length-1;i>=0;i--)e(n[i].event)}return this},i.default.IntervalTimeline.prototype.dispose=function(){var t=[];null!==this._root&&this._root.traverse((function(e){t.push(e)}));for(var e=0;e<t.length;e++)t[e].dispose();return t=null,this._root=null,this};var r=function(t,e,n){this.event=n,this.low=t,this.high=e,this.max=this.high,this._left=null,this._right=null,this.parent=null,this.height=0};r.prototype.insert=function(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)},r.prototype.search=function(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))},r.prototype.searchAfter=function(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)},r.prototype.traverse=function(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)},r.prototype.updateHeight=function(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0},r.prototype.updateMax=function(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))},r.prototype.getBalance=function(){var t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t},r.prototype.isLeftChild=function(){return null!==this.parent&&this.parent.left===this},Object.defineProperty(r.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),Object.defineProperty(r.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),r.prototype.dispose=function(){this.parent=null,this._left=null,this._right=null,this.event=null},e.default=i.default.IntervalTimeline},function(t,e,n){n.r(e);var i=n(0);function r(t){return function(e,n){n=this.toSeconds(n),t.apply(this,arguments);var i=this._events.get(n),r=this._events.previousEvent(i),o=this._getTicksUntilEvent(r,n);return i.ticks=Math.max(o,0),this}}n(2),i.default.TickSignal=function(t){t=i.default.defaultArg(t,1),i.default.Signal.call(this,{units:i.default.Type.Ticks,value:t}),this._events.memory=1/0,this.cancelScheduledValues(0),this._events.add({type:i.default.Param.AutomationType.SetValue,time:0,value:t})},i.default.extend(i.default.TickSignal,i.default.Signal),i.default.TickSignal.prototype.setValueAtTime=r(i.default.Signal.prototype.setValueAtTime),i.default.TickSignal.prototype.linearRampToValueAtTime=r(i.default.Signal.prototype.linearRampToValueAtTime),i.default.TickSignal.prototype.setTargetAtTime=function(t,e,n){e=this.toSeconds(e),this.setRampPoint(e),t=this._fromUnits(t);for(var i=this._events.get(e),r=Math.round(Math.max(1/n,1)),o=0;o<=r;o++){var a=n*o+e,s=this._exponentialApproach(i.time,i.value,t,n,a);this.linearRampToValueAtTime(this._toUnits(s),a)}return this},i.default.TickSignal.prototype.exponentialRampToValueAtTime=function(t,e){e=this.toSeconds(e),t=this._fromUnits(t);for(var n=this._events.get(e),i=Math.round(Math.max(10*(e-n.time),1)),r=(e-n.time)/i,o=0;o<=i;o++){var a=r*o+n.time,s=this._exponentialInterpolate(n.time,n.value,e,t,a);this.linearRampToValueAtTime(this._toUnits(s),a)}return this},i.default.TickSignal.prototype._getTicksUntilEvent=function(t,e){if(null===t)t={ticks:0,time:0};else if(i.default.isUndef(t.ticks)){var n=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(n,t.time)}var r=this.getValueAtTime(t.time),o=this.getValueAtTime(e);return this._events.get(e).time===e&&this._events.get(e).type===i.default.Param.AutomationType.SetValue&&(o=this.getValueAtTime(e-this.sampleTime)),.5*(e-t.time)*(r+o)+t.ticks},i.default.TickSignal.prototype.getTicksAtTime=function(t){t=this.toSeconds(t);var e=this._events.get(t);return Math.max(this._getTicksUntilEvent(e,t),0)},i.default.TickSignal.prototype.getDurationOfTicks=function(t,e){e=this.toSeconds(e);var n=this.getTicksAtTime(e);return this.getTimeOfTick(n+t)-e},i.default.TickSignal.prototype.getTimeOfTick=function(t){var e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&n.type===i.default.Param.AutomationType.Linear&&e.value!==n.value){var r=this.getValueAtTime(e.time),o=(this.getValueAtTime(n.time)-r)/(n.time-e.time),a=Math.sqrt(Math.pow(r,2)-2*o*(e.ticks-t)),s=(-r+a)/o;return(s>0?s:(-r-a)/o)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue},i.default.TickSignal.prototype.ticksToTime=function(t,e){return e=this.toSeconds(e),new i.default.Time(this.getDurationOfTicks(t,e))},i.default.TickSignal.prototype.timeToTicks=function(t,e){e=this.toSeconds(e),t=this.toSeconds(t);var n=this.getTicksAtTime(e),r=this.getTicksAtTime(e+t);return new i.default.Ticks(r-n)},e.default=i.default.TickSignal},function(t,e,n){n.r(e);var i=n(0);n(57),n(34),n(35),n(20),i.default.Clock=function(){var t=i.default.defaults(arguments,["callback","frequency"],i.default.Clock);i.default.Emitter.call(this),this.callback=t.callback,this._nextTick=0,this._tickSource=new i.default.TickSource(t.frequency),this._lastUpdate=0,this.frequency=this._tickSource.frequency,this._readOnly("frequency"),this._state=new i.default.TimelineState(i.default.State.Stopped),this._state.setStateAtTime(i.default.State.Stopped,0),this._boundLoop=this._loop.bind(this),this.context.on("tick",this._boundLoop)},i.default.extend(i.default.Clock,i.default.Emitter),i.default.Clock.defaults={callback:i.default.noOp,frequency:1},Object.defineProperty(i.default.Clock.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),i.default.Clock.prototype.start=function(t,e){return this.context.resume(),t=this.toSeconds(t),this._state.getValueAtTime(t)!==i.default.State.Started&&(this._state.setStateAtTime(i.default.State.Started,t),this._tickSource.start(t,e),t<this._lastUpdate&&this.emit("start",t,e)),this},i.default.Clock.prototype.stop=function(t){return t=this.toSeconds(t),this._state.cancel(t),this._state.setStateAtTime(i.default.State.Stopped,t),this._tickSource.stop(t),t<this._lastUpdate&&this.emit("stop",t),this},i.default.Clock.prototype.pause=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)===i.default.State.Started&&(this._state.setStateAtTime(i.default.State.Paused,t),this._tickSource.pause(t),t<this._lastUpdate&&this.emit("pause",t)),this},Object.defineProperty(i.default.Clock.prototype,"ticks",{get:function(){return Math.ceil(this.getTicksAtTime(this.now()))},set:function(t){this._tickSource.ticks=t}}),Object.defineProperty(i.default.Clock.prototype,"seconds",{get:function(){return this._tickSource.seconds},set:function(t){this._tickSource.seconds=t}}),i.default.Clock.prototype.getSecondsAtTime=function(t){return this._tickSource.getSecondsAtTime(t)},i.default.Clock.prototype.setTicksAtTime=function(t,e){return this._tickSource.setTicksAtTime(t,e),this},i.default.Clock.prototype.getTicksAtTime=function(t){return this._tickSource.getTicksAtTime(t)},i.default.Clock.prototype.nextTickTime=function(t,e){e=this.toSeconds(e);var n=this.getTicksAtTime(e);return this._tickSource.getTimeOfTick(n+t,e)},i.default.Clock.prototype._loop=function(){var t=this._lastUpdate,e=this.now();this._lastUpdate=e,t!==e&&(this._state.forEachBetween(t,e,function(t){switch(t.state){case i.default.State.Started:var e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case i.default.State.Stopped:0!==t.time&&this.emit("stop",t.time);break;case i.default.State.Paused:this.emit("pause",t.time)}}.bind(this)),this._tickSource.forEachTickBetween(t,e,function(t,e){this.callback(t,e)}.bind(this)))},i.default.Clock.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},i.default.Clock.prototype.dispose=function(){i.default.Emitter.prototype.dispose.call(this),this.context.off("tick",this._boundLoop),this._writable("frequency"),this._tickSource.dispose(),this._tickSource=null,this.frequency=null,this._boundLoop=null,this._nextTick=1/0,this.callback=null,this._state.dispose(),this._state=null},e.default=i.default.Clock},function(t,e,n){n.r(e);var i=n(0);n(2),n(5),n(7),i.default.GreaterThanZero=function(){i.default.SignalBase.call(this),this._thresh=this.output=new i.default.WaveShaper((function(t){return t<=0?0:1}),127),this._scale=this.input=new i.default.Multiply(1e4),this._scale.connect(this._thresh)},i.default.extend(i.default.GreaterThanZero,i.default.SignalBase),i.default.GreaterThanZero.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._thresh.dispose(),this._thresh=null,this},e.default=i.default.GreaterThanZero},function(t,e,n){n.r(e);var i=n(0);n(84),n(13),n(2),i.default.GreaterThan=function(t){i.default.Signal.call(this),this.createInsOuts(2,0),this._param=this.input[0]=new i.default.Subtract(t),this.input[1]=this._param.input[1],this._gtz=this.output=new i.default.GreaterThanZero,this._param.connect(this._gtz)},i.default.extend(i.default.GreaterThan,i.default.Signal),i.default.GreaterThan.prototype.dispose=function(){return i.default.Signal.prototype.dispose.call(this),this._gtz.dispose(),this._gtz=null,this},e.default=i.default.GreaterThan},function(t,e,n){n.r(e);var i=n(0);n(47),n(26),i.default.ScaledEnvelope=function(){var t=i.default.defaults(arguments,["attack","decay","sustain","release"],i.default.Envelope);i.default.Envelope.call(this,t),t=i.default.defaultArg(t,i.default.ScaledEnvelope.defaults),this._exp=this.output=new i.default.Pow(t.exponent),this._scale=this.output=new i.default.Scale(t.min,t.max),this._sig.chain(this._exp,this._scale)},i.default.extend(i.default.ScaledEnvelope,i.default.Envelope),i.default.ScaledEnvelope.defaults={min:0,max:1,exponent:1},Object.defineProperty(i.default.ScaledEnvelope.prototype,"min",{get:function(){return this._scale.min},set:function(t){this._scale.min=t}}),Object.defineProperty(i.default.ScaledEnvelope.prototype,"max",{get:function(){return this._scale.max},set:function(t){this._scale.max=t}}),Object.defineProperty(i.default.ScaledEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),i.default.ScaledEnvelope.prototype.dispose=function(){return i.default.Envelope.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},e.default=i.default.ScaledEnvelope},function(t,e,n){n.r(e);var i=n(0);n(7),n(30),i.default.Abs=function(){i.default.SignalBase.call(this),this._abs=this.input=this.output=new i.default.WaveShaper((function(t){return Math.abs(t)<.001?0:Math.abs(t)}),1024)},i.default.extend(i.default.Abs,i.default.SignalBase),i.default.Abs.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._abs.dispose(),this._abs=null,this},e.default=i.default.Abs},function(t,e,n){n.r(e);var i=n(0);n(3),n(1),i.default.Solo=function(){var t=i.default.defaults(arguments,["solo"],i.default.Solo);i.default.AudioNode.call(this),this.input=this.output=new i.default.Gain,this._soloBind=this._soloed.bind(this),this.context.on("solo",this._soloBind),this.solo=t.solo},i.default.extend(i.default.Solo,i.default.AudioNode),i.default.Solo.defaults={solo:!1},Object.defineProperty(i.default.Solo.prototype,"solo",{get:function(){return this._isSoloed()},set:function(t){t?this._addSolo():this._removeSolo(),this.context.emit("solo",this)}}),Object.defineProperty(i.default.Solo.prototype,"muted",{get:function(){return 0===this.input.gain.value}}),i.default.Solo.prototype._addSolo=function(){i.default.isArray(this.context._currentSolo)||(this.context._currentSolo=[]),this._isSoloed()||this.context._currentSolo.push(this)},i.default.Solo.prototype._removeSolo=function(){if(this._isSoloed()){var t=this.context._currentSolo.indexOf(this);this.context._currentSolo.splice(t,1)}},i.default.Solo.prototype._isSoloed=function(){return!!i.default.isArray(this.context._currentSolo)&&0!==this.context._currentSolo.length&&-1!==this.context._currentSolo.indexOf(this)},i.default.Solo.prototype._noSolos=function(){return!i.default.isArray(this.context._currentSolo)||0===this.context._currentSolo.length},i.default.Solo.prototype._soloed=function(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0},i.default.Solo.prototype.dispose=function(){return this.context.off("solo",this._soloBind),this._removeSolo(),this._soloBind=null,i.default.AudioNode.prototype.dispose.call(this),this},e.default=i.default.Solo},function(t,e,n){n.r(e);var i=n(0);n(7),i.default.EqualPowerGain=function(){i.default.SignalBase.call(this),this._eqPower=this.input=this.output=new i.default.WaveShaper(function(t){return Math.abs(t)<.001?0:i.default.equalPowerScale(t)}.bind(this),4096)},i.default.extend(i.default.EqualPowerGain,i.default.SignalBase),i.default.EqualPowerGain.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._eqPower.dispose(),this._eqPower=null,this},e.default=i.default.EqualPowerGain},function(t,e,n){n.r(e);var i=n(0);n(5),n(2),i.default.Negate=function(){i.default.SignalBase.call(this),this._multiply=this.input=this.output=new i.default.Multiply(-1)},i.default.extend(i.default.Negate,i.default.SignalBase),i.default.Negate.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._multiply.dispose(),this._multiply=null,this},e.default=i.default.Negate},function(t,e,n){n.r(e);var i=n(0);n(48),n(27),n(1),i.default.PanVol=function(){var t=i.default.defaults(arguments,["pan","volume"],i.default.PanVol);i.default.AudioNode.call(this),this._panner=this.input=new i.default.Panner(t.pan),this.pan=this._panner.pan,this._volume=this.output=new i.default.Volume(t.volume),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,this._readOnly(["pan","volume"])},i.default.extend(i.default.PanVol,i.default.AudioNode),i.default.PanVol.defaults={pan:0,volume:0,mute:!1},Object.defineProperty(i.default.PanVol.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),i.default.PanVol.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["pan","volume"]),this._panner.dispose(),this._panner=null,this.pan=null,this._volume.dispose(),this._volume=null,this.volume=null,this},e.default=i.default.PanVol},function(t,e,n){var i=n(0);if(i.default.supported){!i.default.global.hasOwnProperty("OfflineAudioContext")&&i.default.global.hasOwnProperty("webkitOfflineAudioContext")&&(i.default.global.OfflineAudioContext=i.default.global.webkitOfflineAudioContext);var r=new OfflineAudioContext(1,1,44100).startRendering();r&&i.default.isFunction(r.then)||(OfflineAudioContext.prototype._native_startRendering=OfflineAudioContext.prototype.startRendering,OfflineAudioContext.prototype.startRendering=function(){return new Promise(function(t){this.oncomplete=function(e){t(e.renderedBuffer)},this._native_startRendering()}.bind(this))})}},function(t,e,n){e.a="13.8.34"},function(t,e,n){n.r(e);var i=n(0);n(46),i.default.Midi=function(t,e){if(!(this instanceof i.default.Midi))return new i.default.Midi(t,e);i.default.Frequency.call(this,t,e)},i.default.extend(i.default.Midi,i.default.Frequency),i.default.Midi.prototype._defaultUnits="midi",i.default.Midi.prototype._frequencyToUnits=function(t){return i.default.Frequency.ftom(i.default.Frequency.prototype._frequencyToUnits.call(this,t))},i.default.Midi.prototype._ticksToUnits=function(t){return i.default.Frequency.ftom(i.default.Frequency.prototype._ticksToUnits.call(this,t))},i.default.Midi.prototype._beatsToUnits=function(t){return i.default.Frequency.ftom(i.default.Frequency.prototype._beatsToUnits.call(this,t))},i.default.Midi.prototype._secondsToUnits=function(t){return i.default.Frequency.ftom(i.default.Frequency.prototype._secondsToUnits.call(this,t))},i.default.Midi.prototype.toMidi=function(){return this.valueOf()},i.default.Midi.prototype.toFrequency=function(){return i.default.Frequency.mtof(this.toMidi())},i.default.Midi.prototype.transpose=function(t){return new this.constructor(this.toMidi()+t)},e.default=i.default.Midi},function(t,e,n){n.r(e);var i=n(0);n(27),n(1),i.default.UserMedia=function(){var t=i.default.defaults(arguments,["volume"],i.default.UserMedia);i.default.AudioNode.call(this),this._mediaStream=null,this._stream=null,this._device=null,this._volume=this.output=new i.default.Volume(t.volume),this.volume=this._volume.volume,this._readOnly("volume"),this.mute=t.mute},i.default.extend(i.default.UserMedia,i.default.AudioNode),i.default.UserMedia.defaults={volume:0,mute:!1},i.default.UserMedia.prototype.open=function(t){return this.state===i.default.State.Started&&this.close(),i.default.UserMedia.enumerateDevices().then(function(e){var n;if(i.default.isNumber(t))n=e[t];else if(!(n=e.find((function(e){return e.label===t||e.deviceId===t})))&&e.length>0)n=e[0];else if(!n&&i.default.isDefined(t))throw new Error("Tone.UserMedia: no matching device: "+t);this._device=n;var r={audio:{echoCancellation:!1,sampleRate:this.context.sampleRate,noiseSuppression:!1,mozNoiseSuppression:!1}};return n&&(r.audio.deviceId=n.deviceId),navigator.mediaDevices.getUserMedia(r).then(function(t){return this._stream||(this._stream=t,this._mediaStream=this.context.createMediaStreamSource(t),i.default.connect(this._mediaStream,this.output)),this}.bind(this))}.bind(this))},i.default.UserMedia.prototype.close=function(){return this._stream&&(this._stream.getAudioTracks().forEach((function(t){t.stop()})),this._stream=null,this._mediaStream.disconnect(),this._mediaStream=null),this._device=null,this},i.default.UserMedia.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices().then((function(t){return t.filter((function(t){return"audioinput"===t.kind}))}))},Object.defineProperty(i.default.UserMedia.prototype,"state",{get:function(){return this._stream&&this._stream.active?i.default.State.Started:i.default.State.Stopped}}),Object.defineProperty(i.default.UserMedia.prototype,"deviceId",{get:function(){return this._device?this._device.deviceId:null}}),Object.defineProperty(i.default.UserMedia.prototype,"groupId",{get:function(){return this._device?this._device.groupId:null}}),Object.defineProperty(i.default.UserMedia.prototype,"label",{get:function(){return this._device?this._device.label:null}}),Object.defineProperty(i.default.UserMedia.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),i.default.UserMedia.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this.close(),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this},Object.defineProperty(i.default.UserMedia,"supported",{get:function(){return i.default.isDefined(navigator.mediaDevices)&&i.default.isFunction(navigator.mediaDevices.getUserMedia)}}),e.default=i.default.UserMedia},function(t,e,n){n.r(e);var i=n(0);n(65),n(27),n(1),i.default.Players=function(t){var e=Array.prototype.slice.call(arguments);e.shift();var n=i.default.defaults(e,["onload"],i.default.Players);for(var r in i.default.AudioNode.call(this,n),this._volume=this.output=new i.default.Volume(n.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=n.mute,this._players={},this._loadingCount=0,this._fadeIn=n.fadeIn,this._fadeOut=n.fadeOut,t)this._loadingCount++,this.add(r,t[r],this._bufferLoaded.bind(this,n.onload))},i.default.extend(i.default.Players,i.default.AudioNode),i.default.Players.defaults={volume:0,mute:!1,onload:i.default.noOp,fadeIn:0,fadeOut:0},i.default.Players.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(i.default.Players.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),Object.defineProperty(i.default.Players.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(t){this._fadeIn=t,this._forEach((function(e){e.fadeIn=t}))}}),Object.defineProperty(i.default.Players.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(t){this._fadeOut=t,this._forEach((function(e){e.fadeOut=t}))}}),Object.defineProperty(i.default.Players.prototype,"state",{get:function(){var t=!1;return this._forEach((function(e){t=t||e.state===i.default.State.Started})),t?i.default.State.Started:i.default.State.Stopped}}),i.default.Players.prototype.has=function(t){return this._players.hasOwnProperty(t)},i.default.Players.prototype.get=function(t){if(this.has(t))return this._players[t];throw new Error("Tone.Players: no player named "+t)},i.default.Players.prototype._forEach=function(t){for(var e in this._players)t(this._players[e],e);return this},Object.defineProperty(i.default.Players.prototype,"loaded",{get:function(){var t=!0;return this._forEach((function(e){t=t&&e.loaded})),t}}),i.default.Players.prototype.add=function(t,e,n){return this._players[t]=new i.default.Player(e,n).connect(this.output),this._players[t].fadeIn=this._fadeIn,this._players[t].fadeOut=this._fadeOut,this},i.default.Players.prototype.stopAll=function(t){this._forEach((function(e){e.stop(t)}))},i.default.Players.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable("volume"),this.volume=null,this.output=null,this._forEach((function(t){t.dispose()})),this._players=null,this},e.default=i.default.Players},function(t,e,n){n.r(e);var i=n(0);n(6),n(11),n(32),i.default.GrainPlayer=function(){var t=i.default.defaults(arguments,["url","onload"],i.default.GrainPlayer);i.default.Source.call(this,t),this.buffer=new i.default.Buffer(t.url,t.onload.bind(void 0,this)),this._clock=new i.default.Clock(this._tick.bind(this),t.grainSize),this._loopStart=0,this._loopEnd=0,this._activeSources=[],this._playbackRate=t.playbackRate,this._grainSize=t.grainSize,this._overlap=t.overlap,this.detune=t.detune,this.overlap=t.overlap,this.loop=t.loop,this.playbackRate=t.playbackRate,this.grainSize=t.grainSize,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.reverse=t.reverse,this._clock.on("stop",this._onstop.bind(this))},i.default.extend(i.default.GrainPlayer,i.default.Source),i.default.GrainPlayer.defaults={onload:i.default.noOp,overlap:.1,grainSize:.2,playbackRate:1,detune:0,loop:!1,loopStart:0,loopEnd:0,reverse:!1},i.default.GrainPlayer.prototype._start=function(t,e,n){e=i.default.defaultArg(e,0),e=this.toSeconds(e),t=this.toSeconds(t),this._offset=e,this._clock.start(t),n&&this.stop(t+this.toSeconds(n))},i.default.GrainPlayer.prototype._stop=function(t){this._clock.stop(t)},i.default.GrainPlayer.prototype._onstop=function(t){this._activeSources.forEach((function(e){e.fadeOut=0,e.stop(t)}))},i.default.GrainPlayer.prototype._tick=function(t){if(!this.loop&&this._offset>this.buffer.duration)this.stop(t);else{var e=this._offset<this._overlap?0:this._overlap,n=new i.default.BufferSource({buffer:this.buffer,fadeIn:e,fadeOut:this._overlap,loop:this.loop,loopStart:this._loopStart,loopEnd:this._loopEnd,playbackRate:i.default.intervalToFrequencyRatio(this.detune/100)}).connect(this.output);n.start(t,this._offset),this._offset+=this.grainSize,n.stop(t+this.grainSize/this.playbackRate),this._activeSources.push(n),n.onended=function(){var t=this._activeSources.indexOf(n);-1!==t&&this._activeSources.splice(t,1)}.bind(this)}},Object.defineProperty(i.default.GrainPlayer.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this.grainSize=this._grainSize}}),Object.defineProperty(i.default.GrainPlayer.prototype,"loopStart",{get:function(){return this._loopStart},set:function(t){this._loopStart=this.toSeconds(t)}}),Object.defineProperty(i.default.GrainPlayer.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(t){this._loopEnd=this.toSeconds(t)}}),Object.defineProperty(i.default.GrainPlayer.prototype,"reverse",{get:function(){return this.buffer.reverse},set:function(t){this.buffer.reverse=t}}),Object.defineProperty(i.default.GrainPlayer.prototype,"grainSize",{get:function(){return this._grainSize},set:function(t){this._grainSize=this.toSeconds(t),this._clock.frequency.value=this._playbackRate/this._grainSize}}),Object.defineProperty(i.default.GrainPlayer.prototype,"overlap",{get:function(){return this._overlap},set:function(t){this._overlap=this.toSeconds(t)}}),Object.defineProperty(i.default.GrainPlayer.prototype,"loaded",{get:function(){return this.buffer.loaded}}),i.default.GrainPlayer.prototype.dispose=function(){return i.default.Source.prototype.dispose.call(this),this.buffer.dispose(),this.buffer=null,this._clock.dispose(),this._clock=null,this._activeSources.forEach((function(t){t.dispose()})),this._activeSources=null,this},e.default=i.default.GrainPlayer},function(t,e,n){n.r(e);var i=n(0);n(16),n(2),n(45),i.default.TransportTimelineSignal=function(){i.default.Signal.apply(this,arguments),this.output=this._outputSig=new i.default.Signal(this._initialValue),this._lastVal=this.value,this._synced=i.default.Transport.scheduleRepeat(this._onTick.bind(this),"1i"),this._bindAnchorValue=this._anchorValue.bind(this),i.default.Transport.on("start stop pause",this._bindAnchorValue),this._events.memory=1/0},i.default.extend(i.default.TransportTimelineSignal,i.default.Signal),i.default.TransportTimelineSignal.prototype._onTick=function(t){var e=this.getValueAtTime(i.default.Transport.seconds);this._lastVal!==e&&(this._lastVal=e,this._outputSig.linearRampToValueAtTime(e,t))},i.default.TransportTimelineSignal.prototype._anchorValue=function(t){var e=this.getValueAtTime(i.default.Transport.seconds);return this._lastVal=e,this._outputSig.cancelScheduledValues(t),this._outputSig.setValueAtTime(e,t),this},i.default.TransportTimelineSignal.prototype.getValueAtTime=function(t){return t=i.default.TransportTime(t),i.default.Signal.prototype.getValueAtTime.call(this,t)},i.default.TransportTimelineSignal.prototype.setValueAtTime=function(t,e){return e=i.default.TransportTime(e),i.default.Signal.prototype.setValueAtTime.call(this,t,e),this},i.default.TransportTimelineSignal.prototype.linearRampToValueAtTime=function(t,e){return e=i.default.TransportTime(e),i.default.Signal.prototype.linearRampToValueAtTime.call(this,t,e),this},i.default.TransportTimelineSignal.prototype.exponentialRampToValueAtTime=function(t,e){return e=i.default.TransportTime(e),i.default.Signal.prototype.exponentialRampToValueAtTime.call(this,t,e),this},i.default.TransportTimelineSignal.prototype.setTargetAtTime=function(t,e,n){return e=i.default.TransportTime(e),i.default.Signal.prototype.setTargetAtTime.call(this,t,e,n),this},i.default.TransportTimelineSignal.prototype.cancelScheduledValues=function(t){return t=i.default.TransportTime(t),i.default.Signal.prototype.cancelScheduledValues.call(this,t),this},i.default.TransportTimelineSignal.prototype.setValueCurveAtTime=function(t,e,n,r){return e=i.default.TransportTime(e),n=i.default.TransportTime(n),i.default.Signal.prototype.setValueCurveAtTime.call(this,t,e,n,r),this},i.default.TransportTimelineSignal.prototype.cancelAndHoldAtTime=function(t){return i.default.Signal.prototype.cancelAndHoldAtTime.call(this,i.default.TransportTime(t))},i.default.TransportTimelineSignal.prototype.dispose=function(){i.default.Transport.clear(this._synced),i.default.Transport.off("start stop pause",this._syncedCallback),this._events.cancel(0),i.default.Signal.prototype.dispose.call(this),this._outputSig.dispose(),this._outputSig=null},e.default=i.default.TransportTimelineSignal},function(t,e,n){n.r(e);var i=n(0);n(29),n(5),i.default.Normalize=function(t,e){i.default.SignalBase.call(this),this._inputMin=i.default.defaultArg(t,0),this._inputMax=i.default.defaultArg(e,1),this._sub=this.input=new i.default.Add(0),this._div=this.output=new i.default.Multiply(1),this._sub.connect(this._div),this._setRange()},i.default.extend(i.default.Normalize,i.default.SignalBase),Object.defineProperty(i.default.Normalize.prototype,"min",{get:function(){return this._inputMin},set:function(t){this._inputMin=t,this._setRange()}}),Object.defineProperty(i.default.Normalize.prototype,"max",{get:function(){return this._inputMax},set:function(t){this._inputMax=t,this._setRange()}}),i.default.Normalize.prototype._setRange=function(){this._sub.value=-this._inputMin,this._div.value=1/(this._inputMax-this._inputMin)},i.default.Normalize.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._sub.dispose(),this._sub=null,this._div.dispose(),this._div=null,this},e.default=i.default.Normalize},function(t,e,n){n.r(e);var i=n(0);n(7),n(2),i.default.GainToAudio=function(){i.default.SignalBase.call(this),this._norm=this.input=this.output=new i.default.WaveShaper((function(t){return 2*Math.abs(t)-1}))},i.default.extend(i.default.GainToAudio,i.default.SignalBase),i.default.GainToAudio.prototype.dispose=function(){return i.default.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},e.default=i.default.GainToAudio},function(t,e,n){n.r(e);var i=n(0);n(21),n(78),n(32),i.default.Sampler=function(t){var e=Array.prototype.slice.call(arguments);e.shift();var n=i.default.defaults(e,["onload","baseUrl"],i.default.Sampler);i.default.Instrument.call(this,n);var r={};for(var o in t)if(i.default.isNote(o))r[i.default.Frequency(o).toMidi()]=t[o];else{if(isNaN(parseFloat(o)))throw new Error("Tone.Sampler: url keys must be the note's pitch");r[o]=t[o]}this._buffers=new i.default.Buffers(r,n.onload,n.baseUrl),this._activeSources={},this.attack=n.attack,this.release=n.release,this.curve=n.curve},i.default.extend(i.default.Sampler,i.default.Instrument),i.default.Sampler.defaults={attack:0,release:.1,onload:i.default.noOp,baseUrl:"",curve:"exponential"},i.default.Sampler.prototype._findClosest=function(t){for(var e=0;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error("No available buffers for note: "+t)},i.default.Sampler.prototype.triggerAttack=function(t,e,n){this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++){var o=i.default.Frequency(t[r]).toMidi(),a=this._findClosest(o),s=o-a,u=this._buffers.get(s),l=i.default.intervalToFrequencyRatio(a),c=new i.default.BufferSource({buffer:u,playbackRate:l,fadeIn:this.attack,fadeOut:this.release,curve:this.curve}).connect(this.output);c.start(e,0,u.duration/l,n),i.default.isArray(this._activeSources[o])||(this._activeSources[o]=[]),this._activeSources[o].push(c),c.onended=function(){if(this._activeSources&&this._activeSources[o]){var t=this._activeSources[o].indexOf(c);-1!==t&&this._activeSources[o].splice(t,1)}}.bind(this)}return this},i.default.Sampler.prototype.triggerRelease=function(t,e){this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]);for(var n=0;n<t.length;n++){var r=i.default.Frequency(t[n]).toMidi();this._activeSources[r]&&this._activeSources[r].length&&(e=this.toSeconds(e),this._activeSources[r].forEach((function(t){t.stop(e)})),this._activeSources[r]=[])}return this},i.default.Sampler.prototype.releaseAll=function(t){for(var e in t=this.toSeconds(t),this._activeSources)for(var n=this._activeSources[e];n.length;)n.shift().stop(t);return this},i.default.Sampler.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},i.default.Sampler.prototype.triggerAttackRelease=function(t,e,n,r){if(n=this.toSeconds(n),this.triggerAttack(t,n,r),i.default.isArray(e)&&i.default.isArray(t))for(var o=0;o<t.length;o++){var a=e[Math.min(o,e.length-1)];this.triggerRelease(t[o],n+this.toSeconds(a))}else this.triggerRelease(t,n+this.toSeconds(e));return this},i.default.Sampler.prototype.add=function(t,e,n){if(i.default.isNote(t)){var r=i.default.Frequency(t).toMidi();this._buffers.add(r,e,n)}else{if(isNaN(parseFloat(t)))throw new Error("Tone.Sampler: note must be the note's pitch. Instead got "+t);this._buffers.add(t,e,n)}},Object.defineProperty(i.default.Sampler.prototype,"loaded",{get:function(){return this._buffers.loaded}}),i.default.Sampler.prototype.dispose=function(){for(var t in i.default.Instrument.prototype.dispose.call(this),this._buffers.dispose(),this._buffers=null,this._activeSources)this._activeSources[t].forEach((function(t){t.dispose()}));return this._activeSources=null,this},e.default=i.default.Sampler},function(t,e,n){n.r(e);var i=n(0);n(38),n(6),i.default.PolySynth=function(){var t=i.default.defaults(arguments,["polyphony","voice"],i.default.PolySynth);i.default.Instrument.call(this,t),(t=i.default.defaultArg(t,i.default.Instrument.defaults)).polyphony=Math.min(i.default.PolySynth.MAX_POLYPHONY,t.polyphony),this.voices=new Array(t.polyphony),this.assert(t.polyphony>0,"polyphony must be greater than 0"),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this._readOnly("detune");for(var e=0;e<t.polyphony;e++){var n=new t.voice(arguments[2],arguments[3]);if(!(n instanceof i.default.Monophonic))throw new Error("Synth constructor must be instance of Tone.Monophonic");this.voices[e]=n,n.index=e,n.connect(this.output),n.hasOwnProperty("detune")&&this.detune.connect(n.detune)}},i.default.extend(i.default.PolySynth,i.default.Instrument),i.default.PolySynth.defaults={polyphony:4,volume:0,detune:0,voice:i.default.Synth},i.default.PolySynth.prototype._getClosestVoice=function(t,e){return this.voices.find((function(n){if(Math.abs(n.frequency.getValueAtTime(t)-i.default.Frequency(e))<1e-4&&n.getLevelAtTime(t)>1e-5)return n}))||this.voices.slice().sort(function(e,n){var i=e.getLevelAtTime(t+this.blockTime),r=n.getLevelAtTime(t+this.blockTime);return i<1e-5&&(i=0),r<1e-5&&(r=0),i-r}.bind(this))[0]},i.default.PolySynth.prototype.triggerAttack=function(t,e,n){return Array.isArray(t)||(t=[t]),e=this.toSeconds(e),t.forEach(function(t){var i=this._getClosestVoice(e,t);i.triggerAttack(t,e,n),this.log("triggerAttack",i.index,t)}.bind(this)),this},i.default.PolySynth.prototype.triggerRelease=function(t,e){return Array.isArray(t)||(t=[t]),e=this.toSeconds(e),t.forEach(function(t){var n=this._getClosestVoice(e,t);this.log("triggerRelease",n.index,t),n.triggerRelease(e)}.bind(this)),this},i.default.PolySynth.prototype.triggerAttackRelease=function(t,e,n,r){if(n=this.toSeconds(n),this.triggerAttack(t,n,r),i.default.isArray(e)&&i.default.isArray(t))for(var o=0;o<t.length;o++){var a=e[Math.min(o,e.length-1)];this.triggerRelease(t[o],n+this.toSeconds(a))}else this.triggerRelease(t,n+this.toSeconds(e));return this},i.default.PolySynth.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},i.default.PolySynth.prototype.set=function(t,e,n){for(var i=0;i<this.voices.length;i++)this.voices[i].set(t,e,n);return this},i.default.PolySynth.prototype.get=function(t){return this.voices[0].get(t)},i.default.PolySynth.prototype.releaseAll=function(t){return t=this.toSeconds(t),this.voices.forEach((function(e){e.triggerRelease(t)})),this},i.default.PolySynth.prototype.dispose=function(){return i.default.Instrument.prototype.dispose.call(this),this.voices.forEach((function(t){t.dispose()})),this._writable("detune"),this.detune.dispose(),this.detune=null,this.voices=null,this},i.default.PolySynth.MAX_POLYPHONY=20,e.default=i.default.PolySynth},function(t,e,n){n.r(e);var i=n(0);n(21),n(39),n(54),i.default.PluckSynth=function(t){t=i.default.defaultArg(t,i.default.PluckSynth.defaults),i.default.Instrument.call(this,t),this._noise=new i.default.Noise("pink"),this.attackNoise=t.attackNoise,this._lfcf=new i.default.LowpassCombFilter({resonance:t.resonance,dampening:t.dampening}),this.resonance=this._lfcf.resonance,this.dampening=this._lfcf.dampening,this._noise.connect(this._lfcf),this._lfcf.connect(this.output),this._readOnly(["resonance","dampening"])},i.default.extend(i.default.PluckSynth,i.default.Instrument),i.default.PluckSynth.defaults={attackNoise:1,dampening:4e3,resonance:.7},i.default.PluckSynth.prototype.triggerAttack=function(t,e){t=this.toFrequency(t),e=this.toSeconds(e);var n=1/t;return this._lfcf.delayTime.setValueAtTime(n,e),this._noise.start(e),this._noise.stop(e+n*this.attackNoise),this},i.default.PluckSynth.prototype.dispose=function(){return i.default.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},e.default=i.default.PluckSynth},function(t,e,n){n.r(e);var i=n(0);n(31),n(41),n(39),n(2),n(9),n(21),i.default.NoiseSynth=function(t){t=i.default.defaultArg(t,i.default.NoiseSynth.defaults),i.default.Instrument.call(this,t),this.noise=new i.default.Noise(t.noise),this.envelope=new i.default.AmplitudeEnvelope(t.envelope),this.noise.chain(this.envelope,this.output),this._readOnly(["noise","envelope"])},i.default.extend(i.default.NoiseSynth,i.default.Instrument),i.default.NoiseSynth.defaults={noise:{type:"white"},envelope:{attack:.005,decay:.1,sustain:0}},i.default.NoiseSynth.prototype.triggerAttack=function(t,e){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.noise.start(t),0===this.envelope.sustain&&this.noise.stop(t+this.envelope.attack+this.envelope.decay),this},i.default.NoiseSynth.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.noise.stop(t+this.envelope.release),this},i.default.NoiseSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},i.default.NoiseSynth.prototype.triggerAttackRelease=function(t,e,n){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,n),this.triggerRelease(e+t),this},i.default.NoiseSynth.prototype.dispose=function(){return i.default.Instrument.prototype.dispose.call(this),this._writable(["noise","envelope"]),this.noise.dispose(),this.noise=null,this.envelope.dispose(),this.envelope=null,this},e.default=i.default.NoiseSynth},function(t,e,n){n.r(e);var i=n(0),r=(n(21),n(49),n(9),n(41),n(31),n(3),n(26),n(5),[1,1.483,1.932,2.546,2.63,3.897]);i.default.MetalSynth=function(t){t=i.default.defaultArg(t,i.default.MetalSynth.defaults),i.default.Instrument.call(this,t),this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this._oscillators=[],this._freqMultipliers=[],this._amplitue=new i.default.Gain(0).connect(this.output),this._highpass=new i.default.Filter({type:"highpass",Q:-3.0102999566398125}).connect(this._amplitue),this._octaves=t.octaves,this._filterFreqScaler=new i.default.Scale(t.resonance,7e3),this.envelope=new i.default.Envelope({attack:t.envelope.attack,attackCurve:"linear",decay:t.envelope.decay,sustain:0,release:t.envelope.release}).chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitue.gain);for(var e=0;e<r.length;e++){var n=new i.default.FMOscillator({type:"square",modulationType:"square",harmonicity:t.harmonicity,modulationIndex:t.modulationIndex});n.connect(this._highpass),this._oscillators[e]=n;var o=new i.default.Multiply(r[e]);this._freqMultipliers[e]=o,this.frequency.chain(o,n.frequency)}this.octaves=t.octaves},i.default.extend(i.default.MetalSynth,i.default.Instrument),i.default.MetalSynth.defaults={frequency:200,envelope:{attack:.001,decay:1.4,release:.2},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1.5},i.default.MetalSynth.prototype.triggerAttack=function(t,e){return t=this.toSeconds(t),e=i.default.defaultArg(e,1),this.envelope.triggerAttack(t,e),this._oscillators.forEach((function(e){e.start(t)})),0===this.envelope.sustain&&this._oscillators.forEach(function(e){e.stop(t+this.envelope.attack+this.envelope.decay)}.bind(this)),this},i.default.MetalSynth.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this._oscillators.forEach(function(e){e.stop(t+this.envelope.release)}.bind(this)),this},i.default.MetalSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},i.default.MetalSynth.prototype.triggerAttackRelease=function(t,e,n){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,n),this.triggerRelease(e+t),this},Object.defineProperty(i.default.MetalSynth.prototype,"modulationIndex",{get:function(){return this._oscillators[0].modulationIndex.value},set:function(t){for(var e=0;e<this._oscillators.length;e++)this._oscillators[e].modulationIndex.value=t}}),Object.defineProperty(i.default.MetalSynth.prototype,"harmonicity",{get:function(){return this._oscillators[0].harmonicity.value},set:function(t){for(var e=0;e<this._oscillators.length;e++)this._oscillators[e].harmonicity.value=t}}),Object.defineProperty(i.default.MetalSynth.prototype,"resonance",{get:function(){return this._filterFreqScaler.min},set:function(t){this._filterFreqScaler.min=t,this.octaves=this._octaves}}),Object.defineProperty(i.default.MetalSynth.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}}),i.default.MetalSynth.prototype.dispose=function(){i.default.Instrument.prototype.dispose.call(this);for(var t=0;t<this._oscillators.length;t++)this._oscillators[t].dispose(),this._freqMultipliers[t].dispose();this._oscillators=null,this._freqMultipliers=null,this.frequency.dispose(),this.frequency=null,this._filterFreqScaler.dispose(),this._filterFreqScaler=null,this._amplitue.dispose(),this._amplitue=null,this.envelope.dispose(),this.envelope=null,this._highpass.dispose(),this._highpass=null},e.default=i.default.MetalSynth},function(t,e,n){n.r(e);var i=n(0);n(37),n(21),n(31),i.default.MembraneSynth=function(t){t=i.default.defaultArg(t,i.default.MembraneSynth.defaults),i.default.Instrument.call(this,t),this.oscillator=new i.default.OmniOscillator(t.oscillator),this.envelope=new i.default.AmplitudeEnvelope(t.envelope),this.octaves=t.octaves,this.pitchDecay=t.pitchDecay,this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","envelope"])},i.default.extend(i.default.MembraneSynth,i.default.Instrument),i.default.MembraneSynth.defaults={pitchDecay:.05,octaves:10,oscillator:{type:"sine"},envelope:{attack:.001,decay:.4,sustain:.01,release:1.4,attackCurve:"exponential"}},i.default.MembraneSynth.prototype.triggerAttack=function(t,e,n){e=this.toSeconds(e);var i=(t=this.toFrequency(t))*this.octaves;return this.oscillator.frequency.setValueAtTime(i,e),this.oscillator.frequency.exponentialRampToValueAtTime(t,e+this.toSeconds(this.pitchDecay)),this.envelope.triggerAttack(e,n),this.oscillator.start(e),0===this.envelope.sustain&&this.oscillator.stop(e+this.envelope.attack+this.envelope.decay),this},i.default.MembraneSynth.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},i.default.MembraneSynth.prototype.dispose=function(){return i.default.Instrument.prototype.dispose.call(this),this._writable(["oscillator","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this},e.default=i.default.MembraneSynth},function(t,e,n){n.r(e);var i=n(0);n(38),n(2),n(5),n(25),i.default.FMSynth=function(t){t=i.default.defaultArg(t,i.default.FMSynth.defaults),i.default.Monophonic.call(this,t),this._carrier=new i.default.Synth(t.carrier),this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope.set(t.envelope),this._modulator=new i.default.Synth(t.modulator),this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(t.modulation),this.modulationEnvelope=this._modulator.envelope.set(t.modulationEnvelope),this.frequency=new i.default.Signal(440,i.default.Type.Frequency),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this.harmonicity=new i.default.Multiply(t.harmonicity),this.harmonicity.units=i.default.Type.Positive,this.modulationIndex=new i.default.Multiply(t.modulationIndex),this.modulationIndex.units=i.default.Type.Positive,this._modulationNode=new i.default.Gain(0),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this._readOnly(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"])},i.default.extend(i.default.FMSynth,i.default.Monophonic),i.default.FMSynth.defaults={harmonicity:3,modulationIndex:10,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},i.default.FMSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t),this},i.default.FMSynth.prototype._triggerEnvelopeRelease=function(t){return t=this.toSeconds(t),this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this},i.default.FMSynth.prototype.dispose=function(){return i.default.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.modulationIndex.dispose(),this.modulationIndex=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},e.default=i.default.FMSynth},function(t,e,n){n.r(e);var i=n(0);n(66),n(12),n(2),n(5),n(25),n(14),i.default.DuoSynth=function(t){t=i.default.defaultArg(t,i.default.DuoSynth.defaults),i.default.Monophonic.call(this,t),this.voice0=new i.default.MonoSynth(t.voice0),this.voice0.volume.value=-10,this.voice1=new i.default.MonoSynth(t.voice1),this.voice1.volume.value=-10,this._vibrato=new i.default.LFO(t.vibratoRate,-50,50),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new i.default.Gain(t.vibratoAmount,i.default.Type.Positive),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new i.default.Signal(440,i.default.Type.Frequency),this.harmonicity=new i.default.Multiply(t.harmonicity),this.harmonicity.units=i.default.Type.Positive,this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),this._readOnly(["voice0","voice1","frequency","vibratoAmount","vibratoRate"])},i.default.extend(i.default.DuoSynth,i.default.Monophonic),i.default.DuoSynth.defaults={vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}},voice1:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}},i.default.DuoSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e),this},i.default.DuoSynth.prototype._triggerEnvelopeRelease=function(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this},i.default.DuoSynth.prototype.getLevelAtTime=function(t){return(this.voice0.getLevelAtTime(t)+this.voice1.getLevelAtTime(t))/2},i.default.DuoSynth.prototype.dispose=function(){return i.default.Monophonic.prototype.dispose.call(this),this._writable(["voice0","voice1","frequency","vibratoAmount","vibratoRate"]),this.voice0.dispose(),this.voice0=null,this.voice1.dispose(),this.voice1=null,this.frequency.dispose(),this.frequency=null,this._vibratoGain.dispose(),this._vibratoGain=null,this._vibrato=null,this.harmonicity.dispose(),this.harmonicity=null,this.vibratoAmount.dispose(),this.vibratoAmount=null,this.vibratoRate=null,this},e.default=i.default.DuoSynth},function(t,e,n){n.r(e);var i=n(0);n(38),n(2),n(5),n(25),n(22),n(3),i.default.AMSynth=function(t){t=i.default.defaultArg(t,i.default.AMSynth.defaults),i.default.Monophonic.call(this,t),this._carrier=new i.default.Synth,this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator.set(t.oscillator),this.envelope=this._carrier.envelope.set(t.envelope),this._modulator=new i.default.Synth,this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(t.modulation),this.modulationEnvelope=this._modulator.envelope.set(t.modulationEnvelope),this.frequency=new i.default.Signal(440,i.default.Type.Frequency),this.detune=new i.default.Signal(t.detune,i.default.Type.Cents),this.harmonicity=new i.default.Multiply(t.harmonicity),this.harmonicity.units=i.default.Type.Positive,this._modulationScale=new i.default.AudioToGain,this._modulationNode=new i.default.Gain,this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),this._readOnly(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])},i.default.extend(i.default.AMSynth,i.default.Monophonic),i.default.AMSynth.defaults={harmonicity:3,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},i.default.AMSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t),this},i.default.AMSynth.prototype._triggerEnvelopeRelease=function(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this},i.default.AMSynth.prototype.dispose=function(){return i.default.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationScale.dispose(),this._modulationScale=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},e.default=i.default.AMSynth},function(t,e,n){n.r(e);var i=n(0);n(70),n(16),i.default.Sequence=function(){var t=i.default.defaults(arguments,["callback","events","subdivision"],i.default.Sequence),e=t.events;if(delete t.events,i.default.Part.call(this,t),this._subdivision=this.toTicks(t.subdivision),i.default.isUndef(t.loopEnd)&&i.default.isDefined(e)&&(this._loopEnd=e.length*this._subdivision),this._loop=!0,i.default.isDefined(e))for(var n=0;n<e.length;n++)this.add(n,e[n])},i.default.extend(i.default.Sequence,i.default.Part),i.default.Sequence.defaults={subdivision:"4n"},Object.defineProperty(i.default.Sequence.prototype,"subdivision",{get:function(){return i.default.Ticks(this._subdivision).toSeconds()}}),i.default.Sequence.prototype.at=function(t,e){return i.default.isArray(e)&&this.remove(t),i.default.Part.prototype.at.call(this,this._indexTime(t),e)},i.default.Sequence.prototype.add=function(t,e){if(null===e)return this;if(i.default.isArray(e)){var n=Math.round(this._subdivision/e.length);e=new i.default.Sequence(this._tick.bind(this),e,i.default.Ticks(n))}return i.default.Part.prototype.add.call(this,this._indexTime(t),e),this},i.default.Sequence.prototype.remove=function(t,e){return i.default.Part.prototype.remove.call(this,this._indexTime(t),e),this},i.default.Sequence.prototype._indexTime=function(t){return t instanceof i.default.TransportTime?t:i.default.Ticks(t*this._subdivision+this.startOffset).toSeconds()},i.default.Sequence.prototype.dispose=function(){return i.default.Part.prototype.dispose.call(this),this},e.default=i.default.Sequence},function(t,e,n){n.r(e);var i=n(0);n(71),n(79),i.default.Pattern=function(){var t=i.default.defaults(arguments,["callback","values","pattern"],i.default.Pattern);i.default.Loop.call(this,t),this._pattern=new i.default.CtrlPattern({values:t.values,type:t.pattern,index:t.index})},i.default.extend(i.default.Pattern,i.default.Loop),i.default.Pattern.defaults={pattern:i.default.CtrlPattern.Type.Up,callback:i.default.noOp,values:[]},i.default.Pattern.prototype._tick=function(t){this.callback(t,this._pattern.value),this._pattern.next()},Object.defineProperty(i.default.Pattern.prototype,"index",{get:function(){return this._pattern.index},set:function(t){this._pattern.index=t}}),Object.defineProperty(i.default.Pattern.prototype,"values",{get:function(){return this._pattern.values},set:function(t){this._pattern.values=t}}),Object.defineProperty(i.default.Pattern.prototype,"value",{get:function(){return this._pattern.value}}),Object.defineProperty(i.default.Pattern.prototype,"pattern",{get:function(){return this._pattern.type},set:function(t){this._pattern.type=t}}),i.default.Pattern.prototype.dispose=function(){i.default.Loop.prototype.dispose.call(this),this._pattern.dispose(),this._pattern=null},e.default=i.default.Pattern},function(t,e,n){n.r(e);var i=n(0);n(8),n(18),n(12),i.default.Vibrato=function(){var t=i.default.defaults(arguments,["frequency","depth"],i.default.Vibrato);i.default.Effect.call(this,t),this._delayNode=new i.default.Delay(0,t.maxDelay),this._lfo=new i.default.LFO({type:t.type,min:0,max:t.maxDelay,frequency:t.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=t.depth,this._readOnly(["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)},i.default.extend(i.default.Vibrato,i.default.Effect),i.default.Vibrato.defaults={maxDelay:.005,frequency:5,depth:.1,type:"sine"},Object.defineProperty(i.default.Vibrato.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),i.default.Vibrato.prototype.dispose=function(){i.default.Effect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._lfo.dispose(),this._lfo=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null},e.default=i.default.Vibrato},function(t,e,n){n.r(e);var i=n(0);n(12),n(15),i.default.Tremolo=function(){var t=i.default.defaults(arguments,["frequency","depth"],i.default.Tremolo);i.default.StereoEffect.call(this,t),this._lfoL=new i.default.LFO({phase:t.spread,min:1,max:0}),this._lfoR=new i.default.LFO({phase:t.spread,min:1,max:0}),this._amplitudeL=new i.default.Gain,this._amplitudeR=new i.default.Gain,this.frequency=new i.default.Signal(t.frequency,i.default.Type.Frequency),this.depth=new i.default.Signal(t.depth,i.default.Type.NormalRange),this._readOnly(["frequency","depth"]),this.effectSendL.chain(this._amplitudeL,this.effectReturnL),this.effectSendR.chain(this._amplitudeR,this.effectReturnR),this._lfoL.connect(this._amplitudeL.gain),this._lfoR.connect(this._amplitudeR.gain),this.frequency.fan(this._lfoL.frequency,this._lfoR.frequency),this.depth.fan(this._lfoR.amplitude,this._lfoL.amplitude),this.type=t.type,this.spread=t.spread},i.default.extend(i.default.Tremolo,i.default.StereoEffect),i.default.Tremolo.defaults={frequency:10,type:"sine",depth:.5,spread:180},i.default.Tremolo.prototype.start=function(t){return this._lfoL.start(t),this._lfoR.start(t),this},i.default.Tremolo.prototype.stop=function(t){return this._lfoL.stop(t),this._lfoR.stop(t),this},i.default.Tremolo.prototype.sync=function(t){return this._lfoL.sync(t),this._lfoR.sync(t),i.default.Transport.syncSignal(this.frequency),this},i.default.Tremolo.prototype.unsync=function(){return this._lfoL.unsync(),this._lfoR.unsync(),i.default.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(i.default.Tremolo.prototype,"type",{get:function(){return this._lfoL.type},set:function(t){this._lfoL.type=t,this._lfoR.type=t}}),Object.defineProperty(i.default.Tremolo.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}}),i.default.Tremolo.prototype.dispose=function(){return i.default.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","depth"]),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._amplitudeL.dispose(),this._amplitudeL=null,this._amplitudeR.dispose(),this._amplitudeR=null,this.frequency=null,this.depth=null,this},e.default=i.default.Tremolo},function(t,e,n){n.r(e);var i=n(0);n(73),n(2),n(5),n(13),i.default.StereoWidener=function(){var t=i.default.defaults(arguments,["width"],i.default.StereoWidener);i.default.MidSideEffect.call(this,t),this.width=new i.default.Signal(t.width,i.default.Type.NormalRange),this._readOnly(["width"]),this._twoTimesWidthMid=new i.default.Multiply(2),this._twoTimesWidthSide=new i.default.Multiply(2),this._midMult=new i.default.Multiply,this._twoTimesWidthMid.connect(this._midMult,0,1),this.midSend.chain(this._midMult,this.midReturn),this._oneMinusWidth=new i.default.Subtract,this._oneMinusWidth.connect(this._twoTimesWidthMid),i.default.connect(this.context.getConstant(1),this._oneMinusWidth,0,0),this.width.connect(this._oneMinusWidth,0,1),this._sideMult=new i.default.Multiply,this.width.connect(this._twoTimesWidthSide),this._twoTimesWidthSide.connect(this._sideMult,0,1),this.sideSend.chain(this._sideMult,this.sideReturn)},i.default.extend(i.default.StereoWidener,i.default.MidSideEffect),i.default.StereoWidener.defaults={width:.5},i.default.StereoWidener.prototype.dispose=function(){return i.default.MidSideEffect.prototype.dispose.call(this),this._writable(["width"]),this.width.dispose(),this.width=null,this._midMult.dispose(),this._midMult=null,this._sideMult.dispose(),this._sideMult=null,this._twoTimesWidthMid.dispose(),this._twoTimesWidthMid=null,this._twoTimesWidthSide.dispose(),this._twoTimesWidthSide=null,this._oneMinusWidth.dispose(),this._oneMinusWidth=null,this},e.default=i.default.StereoWidener},function(t,e,n){n.r(e);var i=n(0);n(15),n(33),n(3),i.default.StereoFeedbackEffect=function(){var t=i.default.defaults(arguments,["feedback"],i.default.FeedbackEffect);i.default.StereoEffect.call(this,t),this.feedback=new i.default.Signal(t.feedback,i.default.Type.NormalRange),this._feedbackL=new i.default.Gain,this._feedbackR=new i.default.Gain,this.effectReturnL.chain(this._feedbackL,this.effectSendL),this.effectReturnR.chain(this._feedbackR,this.effectSendR),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),this._readOnly(["feedback"])},i.default.extend(i.default.StereoFeedbackEffect,i.default.StereoEffect),i.default.StereoFeedbackEffect.prototype.dispose=function(){return i.default.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackL.dispose(),this._feedbackL=null,this._feedbackR.dispose(),this._feedbackR=null,this},e.default=i.default.StereoFeedbackEffect},function(t,e,n){n.r(e);var i=n(0);n(77),n(9),n(10),n(39),n(3),n(74),i.default.Reverb=function(){var t=i.default.defaults(arguments,["decay"],i.default.Reverb);i.default.Effect.call(this,t),this._convolver=this.context.createConvolver(),this.decay=t.decay,this.preDelay=t.preDelay,this.connectEffect(this._convolver)},i.default.extend(i.default.Reverb,i.default.Effect),i.default.Reverb.defaults={decay:1.5,preDelay:.01},i.default.Reverb.prototype.generate=function(){return i.default.Offline(function(){var t=new i.default.Noise,e=new i.default.Noise,n=new i.default.Merge;t.connect(n.left),e.connect(n.right);var r=(new i.default.Gain).toMaster();n.connect(r),t.start(0),e.start(0),r.gain.setValueAtTime(0,0),r.gain.setValueAtTime(1,this.preDelay),r.gain.exponentialApproachValueAtTime(0,this.preDelay,this.decay+this.preDelay)}.bind(this),this.decay+this.preDelay).then(function(t){return this._convolver.buffer=t.get(),this}.bind(this))},i.default.Reverb.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._convolver.disconnect(),this._convolver=null,this},e.default=i.default.Reverb},function(t,e,n){n.r(e);var i=n(0);n(12),n(23),n(2),n(33),n(18),i.default.PitchShift=function(){var t=i.default.defaults(arguments,["pitch"],i.default.PitchShift);i.default.FeedbackEffect.call(this,t),this._frequency=new i.default.Signal(0),this._delayA=new i.default.Delay(0,1),this._lfoA=new i.default.LFO({min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new i.default.Delay(0,1),this._lfoB=new i.default.LFO({min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new i.default.CrossFade,this._crossFadeLFO=new i.default.LFO({min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new i.default.Delay(t.delayTime),this.delayTime=this._feedbackDelay.delayTime,this._readOnly("delayTime"),this._pitch=t.pitch,this._windowSize=t.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);var e=this.now();this._lfoA.start(e),this._lfoB.start(e),this._crossFadeLFO.start(e),this.windowSize=this._windowSize},i.default.extend(i.default.PitchShift,i.default.FeedbackEffect),i.default.PitchShift.defaults={pitch:0,windowSize:.1,delayTime:0,feedback:0},Object.defineProperty(i.default.PitchShift.prototype,"pitch",{get:function(){return this._pitch},set:function(t){this._pitch=t;var e=0;t<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,e=i.default.intervalToFrequencyRatio(t-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,e=i.default.intervalToFrequencyRatio(t)-1),this._frequency.value=e*(1.2/this._windowSize)}}),Object.defineProperty(i.default.PitchShift.prototype,"windowSize",{get:function(){return this._windowSize},set:function(t){this._windowSize=this.toSeconds(t),this.pitch=this._pitch}}),i.default.PitchShift.prototype.dispose=function(){return i.default.FeedbackEffect.prototype.dispose.call(this),this._frequency.dispose(),this._frequency=null,this._delayA.disconnect(),this._delayA=null,this._delayB.disconnect(),this._delayB=null,this._lfoA.dispose(),this._lfoA=null,this._lfoB.dispose(),this._lfoB=null,this._crossFade.dispose(),this._crossFade=null,this._crossFadeLFO.dispose(),this._crossFadeLFO=null,this._writable("delayTime"),this._feedbackDelay.dispose(),this._feedbackDelay=null,this.delayTime=null,this},e.default=i.default.PitchShift},function(t,e,n){n.r(e);var i=n(0);n(72),n(2),n(18),i.default.PingPongDelay=function(){var t=i.default.defaults(arguments,["delayTime","feedback"],i.default.PingPongDelay);i.default.StereoXFeedbackEffect.call(this,t),this._leftDelay=new i.default.Delay(0,t.maxDelayTime),this._rightDelay=new i.default.Delay(0,t.maxDelayTime),this._rightPreDelay=new i.default.Delay(0,t.maxDelayTime),this.delayTime=new i.default.Signal(t.delayTime,i.default.Type.Time),this.effectSendL.chain(this._leftDelay,this.effectReturnL),this.effectSendR.chain(this._rightPreDelay,this._rightDelay,this.effectReturnR),this.delayTime.fan(this._leftDelay.delayTime,this._rightDelay.delayTime,this._rightPreDelay.delayTime),this._feedbackLR.disconnect(),this._feedbackLR.connect(this._rightDelay),this._readOnly(["delayTime"])},i.default.extend(i.default.PingPongDelay,i.default.StereoXFeedbackEffect),i.default.PingPongDelay.defaults={delayTime:.25,maxDelayTime:1},i.default.PingPongDelay.prototype.dispose=function(){return i.default.StereoXFeedbackEffect.prototype.dispose.call(this),this._leftDelay.dispose(),this._leftDelay=null,this._rightDelay.dispose(),this._rightDelay=null,this._rightPreDelay.dispose(),this._rightPreDelay=null,this._writable(["delayTime"]),this.delayTime.dispose(),this.delayTime=null,this},e.default=i.default.PingPongDelay},function(t,e,n){n.r(e);var i=n(0);n(12),n(9),n(15),i.default.Phaser=function(){var t=i.default.defaults(arguments,["frequency","octaves","baseFrequency"],i.default.Phaser);i.default.StereoEffect.call(this,t),this._lfoL=new i.default.LFO(t.frequency,0,1),this._lfoR=new i.default.LFO(t.frequency,0,1),this._lfoR.phase=180,this._baseFrequency=t.baseFrequency,this._octaves=t.octaves,this.Q=new i.default.Signal(t.Q,i.default.Type.Positive),this._filtersL=this._makeFilters(t.stages,this._lfoL,this.Q),this._filtersR=this._makeFilters(t.stages,this._lfoR,this.Q),this.frequency=this._lfoL.frequency,this.frequency.value=t.frequency,this.effectSendL.connect(this._filtersL[0]),this.effectSendR.connect(this._filtersR[0]),i.default.connect(this._filtersL[t.stages-1],this.effectReturnL),i.default.connect(this._filtersR[t.stages-1],this.effectReturnR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=t.baseFrequency,this.octaves=t.octaves,this._lfoL.start(),this._lfoR.start(),this._readOnly(["frequency","Q"])},i.default.extend(i.default.Phaser,i.default.StereoEffect),i.default.Phaser.defaults={frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350},i.default.Phaser.prototype._makeFilters=function(t,e,n){for(var r=new Array(t),o=0;o<t;o++){var a=this.context.createBiquadFilter();a.type="allpass",n.connect(a.Q),e.connect(a.frequency),r[o]=a}return i.default.connectSeries.apply(i.default,r),r},Object.defineProperty(i.default.Phaser.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t;var e=this._baseFrequency*Math.pow(2,t);this._lfoL.max=e,this._lfoR.max=e}}),Object.defineProperty(i.default.Phaser.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(t){this._baseFrequency=t,this._lfoL.min=t,this._lfoR.min=t,this.octaves=this._octaves}}),i.default.Phaser.prototype.dispose=function(){i.default.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","Q"]),this.Q.dispose(),this.Q=null,this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null;for(var t=0;t<this._filtersL.length;t++)this._filtersL[t].disconnect(),this._filtersL[t]=null;this._filtersL=null;for(var e=0;e<this._filtersR.length;e++)this._filtersR[e].disconnect(),this._filtersR[e]=null;return this._filtersR=null,this.frequency=null,this},e.default=i.default.Phaser},function(t,e,n){n.r(e);var i=n(0),r=(n(59),n(15),n(26),[.06748,.06404,.08212,.09004]),o=[.773,.802,.753,.733],a=[347,113,37];i.default.JCReverb=function(){var t=i.default.defaults(arguments,["roomSize"],i.default.JCReverb);i.default.StereoEffect.call(this,t),this.roomSize=new i.default.Signal(t.roomSize,i.default.Type.NormalRange),this._scaleRoomSize=new i.default.Scale(-.733,.197),this._allpassFilters=[],this._feedbackCombFilters=[];for(var e=0;e<a.length;e++){var n=this.context.createBiquadFilter();n.type="allpass",n.frequency.value=a[e],this._allpassFilters.push(n)}for(var s=0;s<r.length;s++){var u=new i.default.FeedbackCombFilter(r[s],.1);this._scaleRoomSize.connect(u.resonance),u.resonance.value=o[s],i.default.connect(this._allpassFilters[this._allpassFilters.length-1],u),s<r.length/2?u.connect(this.effectReturnL):u.connect(this.effectReturnR),this._feedbackCombFilters.push(u)}this.roomSize.connect(this._scaleRoomSize),i.default.connectSeries.apply(i.default,this._allpassFilters),this.effectSendL.connect(this._allpassFilters[0]),this.effectSendR.connect(this._allpassFilters[0]),this._readOnly(["roomSize"])},i.default.extend(i.default.JCReverb,i.default.StereoEffect),i.default.JCReverb.defaults={roomSize:.5},i.default.JCReverb.prototype.dispose=function(){i.default.StereoEffect.prototype.dispose.call(this);for(var t=0;t<this._allpassFilters.length;t++)this._allpassFilters[t].disconnect(),this._allpassFilters[t]=null;this._allpassFilters=null;for(var e=0;e<this._feedbackCombFilters.length;e++)this._feedbackCombFilters[e].dispose(),this._feedbackCombFilters[e]=null;return this._feedbackCombFilters=null,this._writable(["roomSize"]),this.roomSize.dispose(),this.roomSize=null,this._scaleRoomSize.dispose(),this._scaleRoomSize=null,this},e.default=i.default.JCReverb},function(t,e,n){n.r(e);var i=n(0),r=(n(54),n(15),n(2),n(19),n(10),n(42),[1557/44100,1617/44100,1491/44100,1422/44100,1277/44100,1356/44100,1188/44100,1116/44100]),o=[225,556,441,341];i.default.Freeverb=function(){var t=i.default.defaults(arguments,["roomSize","dampening"],i.default.Freeverb);i.default.StereoEffect.call(this,t),this.roomSize=new i.default.Signal(t.roomSize,i.default.Type.NormalRange),this.dampening=new i.default.Signal(t.dampening,i.default.Type.Frequency),this._combFilters=[],this._allpassFiltersL=[],this._allpassFiltersR=[];for(var e=0;e<o.length;e++){var n=this.context.createBiquadFilter();n.type="allpass",n.frequency.value=o[e],this._allpassFiltersL.push(n)}for(var a=0;a<o.length;a++){var s=this.context.createBiquadFilter();s.type="allpass",s.frequency.value=o[a],this._allpassFiltersR.push(s)}for(var u=0;u<r.length;u++){var l=new i.default.LowpassCombFilter(r[u]);u<r.length/2?this.effectSendL.chain(l,this._allpassFiltersL[0]):this.effectSendR.chain(l,this._allpassFiltersR[0]),this.roomSize.connect(l.resonance),this.dampening.connect(l.dampening),this._combFilters.push(l)}i.default.connectSeries.apply(i.default,this._allpassFiltersL),i.default.connectSeries.apply(i.default,this._allpassFiltersR),i.default.connect(this._allpassFiltersL[this._allpassFiltersL.length-1],this.effectReturnL),i.default.connect(this._allpassFiltersR[this._allpassFiltersR.length-1],this.effectReturnR),this._readOnly(["roomSize","dampening"])},i.default.extend(i.default.Freeverb,i.default.StereoEffect),i.default.Freeverb.defaults={roomSize:.7,dampening:3e3},i.default.Freeverb.prototype.dispose=function(){i.default.StereoEffect.prototype.dispose.call(this);for(var t=0;t<this._allpassFiltersL.length;t++)this._allpassFiltersL[t].disconnect(),this._allpassFiltersL[t]=null;this._allpassFiltersL=null;for(var e=0;e<this._allpassFiltersR.length;e++)this._allpassFiltersR[e].disconnect(),this._allpassFiltersR[e]=null;this._allpassFiltersR=null;for(var n=0;n<this._combFilters.length;n++)this._combFilters[n].dispose(),this._combFilters[n]=null;return this._combFilters=null,this._writable(["roomSize","dampening"]),this.roomSize.dispose(),this.roomSize=null,this.dampening.dispose(),this.dampening=null,this},e.default=i.default.Freeverb},function(t,e,n){n.r(e);var i=n(0);n(33),n(2),n(18),i.default.FeedbackDelay=function(){var t=i.default.defaults(arguments,["delayTime","feedback"],i.default.FeedbackDelay);i.default.FeedbackEffect.call(this,t),this._delayNode=new i.default.Delay(t.delayTime,t.maxDelay),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),this._readOnly(["delayTime"])},i.default.extend(i.default.FeedbackDelay,i.default.FeedbackEffect),i.default.FeedbackDelay.defaults={delayTime:.25,maxDelay:1},i.default.FeedbackDelay.prototype.dispose=function(){return i.default.FeedbackEffect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._writable(["delayTime"]),this.delayTime=null,this},e.default=i.default.FeedbackDelay},function(t,e,n){n.r(e);var i=n(0);n(8),n(7),i.default.Distortion=function(){var t=i.default.defaults(arguments,["distortion"],i.default.Distortion);i.default.Effect.call(this,t),this._shaper=new i.default.WaveShaper(4096),this._distortion=t.distortion,this.connectEffect(this._shaper),this.distortion=t.distortion,this.oversample=t.oversample},i.default.extend(i.default.Distortion,i.default.Effect),i.default.Distortion.defaults={distortion:.4,oversample:"none"},Object.defineProperty(i.default.Distortion.prototype,"distortion",{get:function(){return this._distortion},set:function(t){this._distortion=t;var e=100*t,n=Math.PI/180;this._shaper.setMap((function(t){return Math.abs(t)<.001?0:(3+e)*t*20*n/(Math.PI+e*Math.abs(t))}))}}),Object.defineProperty(i.default.Distortion.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){this._shaper.oversample=t}}),i.default.Distortion.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},e.default=i.default.Distortion},function(t,e,n){n.r(e);var i=n(0);n(12),n(15),n(18),i.default.Chorus=function(){var t=i.default.defaults(arguments,["frequency","delayTime","depth"],i.default.Chorus);i.default.StereoEffect.call(this,t),this._depth=t.depth,this._delayTime=t.delayTime/1e3,this._lfoL=new i.default.LFO({frequency:t.frequency,min:0,max:1}),this._lfoR=new i.default.LFO({frequency:t.frequency,min:0,max:1,phase:180}),this._delayNodeL=new i.default.Delay,this._delayNodeR=new i.default.Delay,this.frequency=this._lfoL.frequency,this.effectSendL.chain(this._delayNodeL,this.effectReturnL),this.effectSendR.chain(this._delayNodeR,this.effectReturnR),this.effectSendL.connect(this.effectReturnL),this.effectSendR.connect(this.effectReturnR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this._lfoL.start(),this._lfoR.start(),this._lfoL.frequency.connect(this._lfoR.frequency),this.depth=this._depth,this.frequency.value=t.frequency,this.type=t.type,this._readOnly(["frequency"]),this.spread=t.spread},i.default.extend(i.default.Chorus,i.default.StereoEffect),i.default.Chorus.defaults={frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180},Object.defineProperty(i.default.Chorus.prototype,"depth",{get:function(){return this._depth},set:function(t){this._depth=t;var e=this._delayTime*t;this._lfoL.min=Math.max(this._delayTime-e,0),this._lfoL.max=this._delayTime+e,this._lfoR.min=Math.max(this._delayTime-e,0),this._lfoR.max=this._delayTime+e}}),Object.defineProperty(i.default.Chorus.prototype,"delayTime",{get:function(){return 1e3*this._delayTime},set:function(t){this._delayTime=t/1e3,this.depth=this._depth}}),Object.defineProperty(i.default.Chorus.prototype,"type",{get:function(){return this._lfoL.type},set:function(t){this._lfoL.type=t,this._lfoR.type=t}}),Object.defineProperty(i.default.Chorus.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}}),i.default.Chorus.prototype.dispose=function(){return i.default.StereoEffect.prototype.dispose.call(this),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._delayNodeL.dispose(),this._delayNodeL=null,this._delayNodeR.dispose(),this._delayNodeR=null,this._writable("frequency"),this.frequency=null,this},e.default=i.default.Chorus},function(t,e,n){n.r(e);var i=n(0);n(8),n(7),i.default.Chebyshev=function(){var t=i.default.defaults(arguments,["order"],i.default.Chebyshev);i.default.Effect.call(this,t),this._shaper=new i.default.WaveShaper(4096),this._order=t.order,this.connectEffect(this._shaper),this.order=t.order,this.oversample=t.oversample},i.default.extend(i.default.Chebyshev,i.default.Effect),i.default.Chebyshev.defaults={order:1,oversample:"none"},i.default.Chebyshev.prototype._getCoefficient=function(t,e,n){return n.hasOwnProperty(e)||(n[e]=0===e?0:1===e?t:2*t*this._getCoefficient(t,e-1,n)-this._getCoefficient(t,e-2,n)),n[e]},Object.defineProperty(i.default.Chebyshev.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t;for(var e=new Array(4096),n=e.length,i=0;i<n;++i){var r=2*i/n-1;e[i]=0===r?0:this._getCoefficient(r,t,{})}this._shaper.curve=e}}),Object.defineProperty(i.default.Chebyshev.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){this._shaper.oversample=t}}),i.default.Chebyshev.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},e.default=i.default.Chebyshev},function(t,e,n){n.r(e);var i=n(0);n(8),n(13),n(75),i.default.BitCrusher=function(){var t=i.default.defaults(arguments,["bits"],i.default.BitCrusher);i.default.Effect.call(this,t);var e=1/Math.pow(2,t.bits-1);this._subtract=new i.default.Subtract,this._modulo=new i.default.Modulo(e),this._bits=t.bits,this.effectSend.fan(this._subtract,this._modulo),this._modulo.connect(this._subtract,0,1),this._subtract.connect(this.effectReturn)},i.default.extend(i.default.BitCrusher,i.default.Effect),i.default.BitCrusher.defaults={bits:4},Object.defineProperty(i.default.BitCrusher.prototype,"bits",{get:function(){return this._bits},set:function(t){this._bits=t;var e=1/Math.pow(2,t-1);this._modulo.value=e}}),i.default.BitCrusher.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._subtract.dispose(),this._subtract=null,this._modulo.dispose(),this._modulo=null,this},e.default=i.default.BitCrusher},function(t,e,n){n.r(e);var i=n(0);n(58),n(42),n(8),n(9),i.default.AutoWah=function(){var t=i.default.defaults(arguments,["baseFrequency","octaves","sensitivity"],i.default.AutoWah);i.default.Effect.call(this,t),this.follower=new i.default.Follower(t.follower),this._sweepRange=new i.default.ScaleExp(0,1,.5),this._baseFrequency=t.baseFrequency,this._octaves=t.octaves,this._inputBoost=new i.default.Gain,this._bandpass=new i.default.Filter({rolloff:-48,frequency:0,Q:t.Q}),this._peaking=new i.default.Filter(0,"peaking"),this._peaking.gain.value=t.gain,this.gain=this._peaking.gain,this.Q=this._bandpass.Q,this.effectSend.chain(this._inputBoost,this.follower,this._sweepRange),this._sweepRange.connect(this._bandpass.frequency),this._sweepRange.connect(this._peaking.frequency),this.effectSend.chain(this._bandpass,this._peaking,this.effectReturn),this._setSweepRange(),this.sensitivity=t.sensitivity,this._readOnly(["gain","Q"])},i.default.extend(i.default.AutoWah,i.default.Effect),i.default.AutoWah.defaults={baseFrequency:100,octaves:6,sensitivity:0,Q:2,gain:2,follower:{attack:.3,release:.5}},Object.defineProperty(i.default.AutoWah.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._setSweepRange()}}),Object.defineProperty(i.default.AutoWah.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(t){this._baseFrequency=t,this._setSweepRange()}}),Object.defineProperty(i.default.AutoWah.prototype,"sensitivity",{get:function(){return i.default.gainToDb(1/this._inputBoost.gain.value)},set:function(t){this._inputBoost.gain.value=1/i.default.dbToGain(t)}}),i.default.AutoWah.prototype._setSweepRange=function(){this._sweepRange.min=this._baseFrequency,this._sweepRange.max=Math.min(this._baseFrequency*Math.pow(2,this._octaves),this.context.sampleRate/2)},i.default.AutoWah.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this.follower.dispose(),this.follower=null,this._sweepRange.dispose(),this._sweepRange=null,this._bandpass.dispose(),this._bandpass=null,this._peaking.dispose(),this._peaking=null,this._inputBoost.dispose(),this._inputBoost=null,this._writable(["gain","Q"]),this.gain=null,this.Q=null,this},e.default=i.default.AutoWah},function(t,e,n){n.r(e);var i=n(0);n(8),n(12),n(48),i.default.AutoPanner=function(){var t=i.default.defaults(arguments,["frequency"],i.default.AutoPanner);i.default.Effect.call(this,t),this._lfo=new i.default.LFO({frequency:t.frequency,amplitude:t.depth,min:-1,max:1}),this.depth=this._lfo.amplitude,this._panner=new i.default.Panner,this.frequency=this._lfo.frequency,this.connectEffect(this._panner),this._lfo.connect(this._panner.pan),this.type=t.type,this._readOnly(["depth","frequency"])},i.default.extend(i.default.AutoPanner,i.default.Effect),i.default.AutoPanner.defaults={frequency:1,type:"sine",depth:1},i.default.AutoPanner.prototype.start=function(t){return this._lfo.start(t),this},i.default.AutoPanner.prototype.stop=function(t){return this._lfo.stop(t),this},i.default.AutoPanner.prototype.sync=function(t){return this._lfo.sync(t),this},i.default.AutoPanner.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(i.default.AutoPanner.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),i.default.AutoPanner.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this._panner.dispose(),this._panner=null,this._writable(["depth","frequency"]),this.frequency=null,this.depth=null,this},e.default=i.default.AutoPanner},function(t,e,n){n.r(e);var i=n(0);n(8),n(12),n(9),i.default.AutoFilter=function(){var t=i.default.defaults(arguments,["frequency","baseFrequency","octaves"],i.default.AutoFilter);i.default.Effect.call(this,t),this._lfo=new i.default.LFO({frequency:t.frequency,amplitude:t.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.filter=new i.default.Filter(t.filter),this._octaves=0,this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.type=t.type,this._readOnly(["frequency","depth"]),this.octaves=t.octaves,this.baseFrequency=t.baseFrequency},i.default.extend(i.default.AutoFilter,i.default.Effect),i.default.AutoFilter.defaults={frequency:1,type:"sine",depth:1,baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}},i.default.AutoFilter.prototype.start=function(t){return this._lfo.start(t),this},i.default.AutoFilter.prototype.stop=function(t){return this._lfo.stop(t),this},i.default.AutoFilter.prototype.sync=function(t){return this._lfo.sync(t),this},i.default.AutoFilter.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(i.default.AutoFilter.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),Object.defineProperty(i.default.AutoFilter.prototype,"baseFrequency",{get:function(){return this._lfo.min},set:function(t){this._lfo.min=this.toFrequency(t),this.octaves=this._octaves}}),Object.defineProperty(i.default.AutoFilter.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._lfo.max=this.baseFrequency*Math.pow(2,t)}}),i.default.AutoFilter.prototype.dispose=function(){return i.default.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this.filter.dispose(),this.filter=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null,this},e.default=i.default.AutoFilter},function(t,e,n){n.r(e);var i=n(0);n(23),n(10),n(19),n(2),n(22),n(28),i.default.Listener=function(){i.default.call(this),this._orientation=[0,0,0,0,0,0],this._position=[0,0,0],i.default.getContext(function(){this.set(r.defaults)}.bind(this))},i.default.extend(i.default.Listener),i.default.Listener.defaults={positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:1,upX:0,upY:1,upZ:0},i.default.Listener.prototype.isListener=!0,i.default.Listener.prototype._rampTimeConstant=.01,i.default.Listener.prototype.setPosition=function(t,e,n){if(this.context.rawContext.listener.positionX){var i=this.now();this.context.rawContext.listener.positionX.setTargetAtTime(t,i,this._rampTimeConstant),this.context.rawContext.listener.positionY.setTargetAtTime(e,i,this._rampTimeConstant),this.context.rawContext.listener.positionZ.setTargetAtTime(n,i,this._rampTimeConstant)}else this.context.rawContext.listener.setPosition(t,e,n);return this._position=Array.prototype.slice.call(arguments),this},i.default.Listener.prototype.setOrientation=function(t,e,n,i,r,o){if(this.context.rawContext.listener.forwardX){var a=this.now();this.context.rawContext.listener.forwardX.setTargetAtTime(t,a,this._rampTimeConstant),this.context.rawContext.listener.forwardY.setTargetAtTime(e,a,this._rampTimeConstant),this.context.rawContext.listener.forwardZ.setTargetAtTime(n,a,this._rampTimeConstant),this.context.rawContext.listener.upX.setTargetAtTime(i,a,this._rampTimeConstant),this.context.rawContext.listener.upY.setTargetAtTime(r,a,this._rampTimeConstant),this.context.rawContext.listener.upZ.setTargetAtTime(o,a,this._rampTimeConstant)}else this.context.rawContext.listener.setOrientation(t,e,n,i,r,o);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(i.default.Listener.prototype,"positionX",{set:function(t){this._position[0]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(i.default.Listener.prototype,"positionY",{set:function(t){this._position[1]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(i.default.Listener.prototype,"positionZ",{set:function(t){this._position[2]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(i.default.Listener.prototype,"forwardX",{set:function(t){this._orientation[0]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(i.default.Listener.prototype,"forwardY",{set:function(t){this._orientation[1]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(i.default.Listener.prototype,"forwardZ",{set:function(t){this._orientation[2]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),Object.defineProperty(i.default.Listener.prototype,"upX",{set:function(t){this._orientation[3]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[3]}}),Object.defineProperty(i.default.Listener.prototype,"upY",{set:function(t){this._orientation[4]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[4]}}),Object.defineProperty(i.default.Listener.prototype,"upZ",{set:function(t){this._orientation[5]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[5]}}),i.default.Listener.prototype.dispose=function(){return this._orientation=null,this._position=null,this};var r=i.default.Listener;i.default.Listener=new r,i.default.Context.on("init",(function(t){t.listener&&t.listener.isListener?i.default.Listener=t.listener:i.default.Listener=new r})),e.default=i.default.Listener},function(t,e,n){n.r(e);var i=n(0);n(24),i.default.Draw=function(){i.default.call(this),this._events=new i.default.Timeline,this.expiration=.25,this.anticipation=.008,this._boundDrawLoop=this._drawLoop.bind(this)},i.default.extend(i.default.Draw),i.default.Draw.prototype.schedule=function(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&requestAnimationFrame(this._boundDrawLoop),this},i.default.Draw.prototype.cancel=function(t){return this._events.cancel(this.toSeconds(t)),this},i.default.Draw.prototype._drawLoop=function(){for(var t=i.default.context.currentTime;this._events.length&&this._events.peek().time-this.anticipation<=t;){var e=this._events.shift();t-e.time<=this.expiration&&e.callback()}this._events.length>0&&requestAnimationFrame(this._boundDrawLoop)},i.default.Draw=new i.default.Draw,e.default=i.default.Draw},function(t,e,n){n.r(e);var i=n(0),r=(n(3),{});i.default.prototype.send=function(t,e){r.hasOwnProperty(t)||(r[t]=this.context.createGain()),e=i.default.defaultArg(e,0);var n=new i.default.Gain(e,i.default.Type.Decibels);return this.connect(n),n.connect(r[t]),n},i.default.prototype.receive=function(t,e){return r.hasOwnProperty(t)||(r[t]=this.context.createGain()),i.default.connect(r[t],this,0,e),this},i.default.Context.on("init",(function(t){t.buses?r=t.buses:(r={},t.buses=r)})),e.default=i.default},function(t,e,n){n.r(e);var i=n(0);n(4),i.default.CtrlRandom=function(){var t=i.default.defaults(arguments,["min","max"],i.default.CtrlRandom);i.default.call(this),this.min=t.min,this.max=t.max,this.integer=t.integer},i.default.extend(i.default.CtrlRandom),i.default.CtrlRandom.defaults={min:0,max:1,integer:!1},Object.defineProperty(i.default.CtrlRandom.prototype,"value",{get:function(){var t=this.toSeconds(this.min),e=this.toSeconds(this.max),n=Math.random(),i=n*t+(1-n)*e;return this.integer&&(i=Math.floor(i)),i}}),e.default=i.default.CtrlRandom},function(t,e,n){n.r(e);var i=n(0);i.default.CtrlMarkov=function(t,e){i.default.call(this),this.values=i.default.defaultArg(t,{}),this.value=i.default.defaultArg(e,Object.keys(this.values)[0])},i.default.extend(i.default.CtrlMarkov),i.default.CtrlMarkov.prototype.next=function(){if(this.values.hasOwnProperty(this.value)){var t=this.values[this.value];if(i.default.isArray(t))for(var e=this._getProbDistribution(t),n=Math.random(),r=0,o=0;o<e.length;o++){var a=e[o];if(n>r&&n<r+a){var s=t[o];i.default.isObject(s)?this.value=s.value:this.value=s}r+=a}else this.value=t}return this.value},i.default.CtrlMarkov.prototype._getProbDistribution=function(t){for(var e=[],n=0,r=!1,o=0;o<t.length;o++){var a=t[o];i.default.isObject(a)?(r=!0,e[o]=a.probability):e[o]=1/t.length,n+=e[o]}if(r)for(var s=0;s<e.length;s++)e[s]=e[s]/n;return e},i.default.CtrlMarkov.prototype.dispose=function(){this.values=null},e.default=i.default.CtrlMarkov},function(t,e,n){n.r(e);var i=n(0);n(4),i.default.CtrlInterpolate=function(){var t=i.default.defaults(arguments,["values","index"],i.default.CtrlInterpolate);i.default.call(this),this.values=t.values,this.index=t.index},i.default.extend(i.default.CtrlInterpolate),i.default.CtrlInterpolate.defaults={index:0,values:[]},Object.defineProperty(i.default.CtrlInterpolate.prototype,"value",{get:function(){var t=this.index;t=Math.min(t,this.values.length-1);var e=Math.floor(t),n=this.values[e],i=this.values[Math.ceil(t)];return this._interpolate(t-e,n,i)}}),i.default.CtrlInterpolate.prototype._interpolate=function(t,e,n){if(i.default.isArray(e)){for(var r=[],o=0;o<e.length;o++)r[o]=this._interpolate(t,e[o],n[o]);return r}if(i.default.isObject(e)){var a={};for(var s in e)a[s]=this._interpolate(t,e[s],n[s]);return a}return(1-t)*(e=this._toNumber(e))+t*this._toNumber(n)},i.default.CtrlInterpolate.prototype._toNumber=function(t){return i.default.isNumber(t)?t:this.toSeconds(t)},i.default.CtrlInterpolate.prototype.dispose=function(){this.values=null},e.default=i.default.CtrlInterpolate},function(t,e,n){n.r(e);var i=n(0);n(36),n(1),i.default.Waveform=function(){var t=i.default.defaults(arguments,["size"],i.default.Waveform);t.type=i.default.Analyser.Type.Waveform,i.default.AudioNode.call(this),this._analyser=this.input=this.output=new i.default.Analyser(t)},i.default.extend(i.default.Waveform,i.default.AudioNode),i.default.Waveform.defaults={size:1024},i.default.Waveform.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(i.default.Waveform.prototype,"size",{get:function(){return this._analyser.size},set:function(t){this._analyser.size=t}}),i.default.Waveform.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},e.default=i.default.Waveform},function(t,e,n){n.r(e);var i=n(0);n(23),n(10),n(19),n(2),n(22),n(28),n(1),i.default.Panner3D=function(){var t=i.default.defaults(arguments,["positionX","positionY","positionZ"],i.default.Panner3D);i.default.AudioNode.call(this),this._panner=this.input=this.output=this.context.createPanner(),this._panner.panningModel=t.panningModel,this._panner.maxDistance=t.maxDistance,this._panner.distanceModel=t.distanceModel,this._panner.coneOuterGain=t.coneOuterGain,this._panner.coneOuterAngle=t.coneOuterAngle,this._panner.coneInnerAngle=t.coneInnerAngle,this._panner.refDistance=t.refDistance,this._panner.rolloffFactor=t.rolloffFactor,this._orientation=[t.orientationX,t.orientationY,t.orientationZ],this._position=[t.positionX,t.positionY,t.positionZ],this.orientationX=t.orientationX,this.orientationY=t.orientationY,this.orientationZ=t.orientationZ,this.positionX=t.positionX,this.positionY=t.positionY,this.positionZ=t.positionZ},i.default.extend(i.default.Panner3D,i.default.AudioNode),i.default.Panner3D.defaults={positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:0,panningModel:"equalpower",maxDistance:1e4,distanceModel:"inverse",coneOuterGain:0,coneOuterAngle:360,coneInnerAngle:360,refDistance:1,rolloffFactor:1},i.default.Panner3D.prototype._rampTimeConstant=.01,i.default.Panner3D.prototype.setPosition=function(t,e,n){if(this._panner.positionX){var i=this.now();this._panner.positionX.setTargetAtTime(t,i,this._rampTimeConstant),this._panner.positionY.setTargetAtTime(e,i,this._rampTimeConstant),this._panner.positionZ.setTargetAtTime(n,i,this._rampTimeConstant)}else this._panner.setPosition(t,e,n);return this._position=Array.prototype.slice.call(arguments),this},i.default.Panner3D.prototype.setOrientation=function(t,e,n){if(this._panner.orientationX){var i=this.now();this._panner.orientationX.setTargetAtTime(t,i,this._rampTimeConstant),this._panner.orientationY.setTargetAtTime(e,i,this._rampTimeConstant),this._panner.orientationZ.setTargetAtTime(n,i,this._rampTimeConstant)}else this._panner.setOrientation(t,e,n);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(i.default.Panner3D.prototype,"positionX",{set:function(t){this._position[0]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(i.default.Panner3D.prototype,"positionY",{set:function(t){this._position[1]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(i.default.Panner3D.prototype,"positionZ",{set:function(t){this._position[2]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(i.default.Panner3D.prototype,"orientationX",{set:function(t){this._orientation[0]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(i.default.Panner3D.prototype,"orientationY",{set:function(t){this._orientation[1]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(i.default.Panner3D.prototype,"orientationZ",{set:function(t){this._orientation[2]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),i.default.Panner3D._aliasProperty=function(t){Object.defineProperty(i.default.Panner3D.prototype,t,{set:function(e){this._panner[t]=e},get:function(){return this._panner[t]}})},i.default.Panner3D._aliasProperty("panningModel"),i.default.Panner3D._aliasProperty("refDistance"),i.default.Panner3D._aliasProperty("rolloffFactor"),i.default.Panner3D._aliasProperty("distanceModel"),i.default.Panner3D._aliasProperty("coneInnerAngle"),i.default.Panner3D._aliasProperty("coneOuterAngle"),i.default.Panner3D._aliasProperty("coneOuterGain"),i.default.Panner3D._aliasProperty("maxDistance"),i.default.Panner3D.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._panner.disconnect(),this._panner=null,this._orientation=null,this._position=null,this},e.default=i.default.Panner3D},function(t,e,n){n.r(e);var i=n(0);n(60),n(43),n(1),i.default.MultibandCompressor=function(t){i.default.AudioNode.call(this),t=i.default.defaultArg(arguments,i.default.MultibandCompressor.defaults),this._splitter=this.input=new i.default.MultibandSplit({lowFrequency:t.lowFrequency,highFrequency:t.highFrequency}),this.lowFrequency=this._splitter.lowFrequency,this.highFrequency=this._splitter.highFrequency,this.output=new i.default.Gain,this.low=new i.default.Compressor(t.low),this.mid=new i.default.Compressor(t.mid),this.high=new i.default.Compressor(t.high),this._splitter.low.chain(this.low,this.output),this._splitter.mid.chain(this.mid,this.output),this._splitter.high.chain(this.high,this.output),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},i.default.extend(i.default.MultibandCompressor,i.default.AudioNode),i.default.MultibandCompressor.defaults={low:i.default.Compressor.defaults,mid:i.default.Compressor.defaults,high:i.default.Compressor.defaults,lowFrequency:250,highFrequency:2e3},i.default.MultibandCompressor.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._splitter.dispose(),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this._splitter=null,this.low=null,this.mid=null,this.high=null,this.lowFrequency=null,this.highFrequency=null,this},e.default=i.default.MultibandCompressor},function(t,e,n){n.r(e);var i=n(0);n(10),n(1),i.default.Mono=function(){i.default.AudioNode.call(this),this.createInsOuts(1,0),this._merge=this.output=new i.default.Merge,i.default.connect(this.input,this._merge,0,0),i.default.connect(this.input,this._merge,0,1)},i.default.extend(i.default.Mono,i.default.AudioNode),i.default.Mono.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._merge.dispose(),this._merge=null,this},e.default=i.default.Mono},function(t,e,n){n.r(e);var i=n(0);n(53),n(52),n(43),n(1),i.default.MidSideCompressor=function(t){i.default.AudioNode.call(this),t=i.default.defaultArg(t,i.default.MidSideCompressor.defaults),this._midSideSplit=this.input=new i.default.MidSideSplit,this._midSideMerge=this.output=new i.default.MidSideMerge,this.mid=new i.default.Compressor(t.mid),this.side=new i.default.Compressor(t.side),this._midSideSplit.mid.chain(this.mid,this._midSideMerge.mid),this._midSideSplit.side.chain(this.side,this._midSideMerge.side),this._readOnly(["mid","side"])},i.default.extend(i.default.MidSideCompressor,i.default.AudioNode),i.default.MidSideCompressor.defaults={mid:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16},side:{ratio:6,threshold:-30,release:.25,attack:.03,knee:10}},i.default.MidSideCompressor.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["mid","side"]),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this},e.default=i.default.MidSideCompressor},function(t,e,n){n.r(e);var i=n(0);n(36),n(1),i.default.Meter=function(){var t=i.default.defaults(arguments,["smoothing"],i.default.Meter);i.default.AudioNode.call(this),this.smoothing=t.smoothing,this._rms=0,this.input=this.output=this._analyser=new i.default.Analyser("waveform",256)},i.default.extend(i.default.Meter,i.default.AudioNode),i.default.Meter.defaults={smoothing:.8},i.default.Meter.prototype.getLevel=function(){for(var t=this._analyser.getValue(),e=0,n=0;n<t.length;n++){var r=t[n];e+=r*r}var o=Math.sqrt(e/t.length);return this._rms=Math.max(o,this._rms*this.smoothing),i.default.gainToDb(this._rms)},i.default.Meter.prototype.getValue=function(){return this._analyser.getValue()[0]},i.default.Meter.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null,this},e.default=i.default.Meter},function(t,e,n){n.r(e);var i=n(0);n(43),n(1),i.default.Limiter=function(){var t=i.default.defaults(arguments,["threshold"],i.default.Limiter);i.default.AudioNode.call(this),this._compressor=this.input=this.output=new i.default.Compressor({attack:.001,decay:.001,threshold:t.threshold}),this.threshold=this._compressor.threshold,this._readOnly("threshold")},i.default.extend(i.default.Limiter,i.default.AudioNode),i.default.Limiter.defaults={threshold:-12},i.default.Limiter.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._compressor.dispose(),this._compressor=null,this._writable("threshold"),this.threshold=null,this},e.default=i.default.Limiter},function(t,e,n){n.r(e);var i=n(0);n(58),n(85),n(1),i.default.Gate=function(){var t=i.default.defaults(arguments,["threshold","smoothing"],i.default.Gate);i.default.AudioNode.call(this),this.createInsOuts(1,1),this._follower=new i.default.Follower(t.smoothing),this._gt=new i.default.GreaterThan(i.default.dbToGain(t.threshold)),i.default.connect(this.input,this.output),i.default.connectSeries(this.input,this._follower,this._gt,this.output.gain)},i.default.extend(i.default.Gate,i.default.AudioNode),i.default.Gate.defaults={smoothing:.1,threshold:-40},Object.defineProperty(i.default.Gate.prototype,"threshold",{get:function(){return i.default.gainToDb(this._gt.value)},set:function(t){this._gt.value=i.default.dbToGain(t)}}),Object.defineProperty(i.default.Gate.prototype,"smoothing",{get:function(){return this._follower.smoothing},set:function(t){this._follower.smoothing=t}}),i.default.Gate.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._follower.dispose(),this._gt.dispose(),this._follower=null,this._gt=null,this},e.default=i.default.Gate},function(t,e,n){n.r(e);var i=n(0);n(36),n(1),i.default.FFT=function(){var t=i.default.defaults(arguments,["size"],i.default.FFT);t.type=i.default.Analyser.Type.FFT,i.default.AudioNode.call(this),this._analyser=this.input=this.output=new i.default.Analyser(t)},i.default.extend(i.default.FFT,i.default.AudioNode),i.default.FFT.defaults={size:1024},i.default.FFT.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(i.default.FFT.prototype,"size",{get:function(){return this._analyser.size},set:function(t){this._analyser.size=t}}),i.default.FFT.prototype.dispose=function(){i.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},e.default=i.default.FFT},function(t,e,n){n.r(e);var i=n(0);n(60),n(3),n(1),i.default.EQ3=function(){var t=i.default.defaults(arguments,["low","mid","high"],i.default.EQ3);i.default.AudioNode.call(this),this.output=new i.default.Gain,this._multibandSplit=this.input=new i.default.MultibandSplit({lowFrequency:t.lowFrequency,highFrequency:t.highFrequency}),this._lowGain=new i.default.Gain(t.low,i.default.Type.Decibels),this._midGain=new i.default.Gain(t.mid,i.default.Type.Decibels),this._highGain=new i.default.Gain(t.high,i.default.Type.Decibels),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),this._readOnly(["low","mid","high","lowFrequency","highFrequency"])},i.default.extend(i.default.EQ3,i.default.AudioNode),i.default.EQ3.defaults={low:0,mid:0,high:0,lowFrequency:400,highFrequency:2500},i.default.EQ3.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this._multibandSplit=null,this.lowFrequency=null,this.highFrequency=null,this._lowGain.dispose(),this._lowGain=null,this._midGain.dispose(),this._midGain=null,this._highGain.dispose(),this._highGain=null,this.low=null,this.mid=null,this.high=null,this.Q=null,this},e.default=i.default.EQ3},function(t,e,n){n.r(e);var i=n(0);n(91),n(88),n(1),i.default.Channel=function(){var t=i.default.defaults(arguments,["volume","pan"],i.default.PanVol);i.default.AudioNode.call(this,t),this._solo=this.input=new i.default.Solo(t.solo),this._panVol=this.output=new i.default.PanVol({pan:t.pan,volume:t.volume,mute:t.mute}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),this._readOnly(["pan","volume"])},i.default.extend(i.default.Channel,i.default.AudioNode),i.default.Channel.defaults={pan:0,volume:0,mute:!1,solo:!1},Object.defineProperty(i.default.Channel.prototype,"solo",{get:function(){return this._solo.solo},set:function(t){this._solo.solo=t}}),Object.defineProperty(i.default.Channel.prototype,"muted",{get:function(){return this._solo.muted||this.mute}}),Object.defineProperty(i.default.Channel.prototype,"mute",{get:function(){return this._panVol.mute},set:function(t){this._panVol.mute=t}}),i.default.Channel.prototype.dispose=function(){return i.default.AudioNode.prototype.dispose.call(this),this._writable(["pan","volume"]),this._panVol.dispose(),this._panVol=null,this.pan=null,this.volume=null,this._solo.dispose(),this._solo=null,this},e.default=i.default.Channel},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==("undefined"==typeof window?"undefined":_typeof(window))&&(n=window)}t.exports=n},function(t,e,n){n(31),n(36),n(146),n(43),n(23),n(47),n(145),n(59),n(144),n(9),n(58),n(41),n(143),n(12),n(142),n(54),n(10),n(141),n(140),n(52),n(53),n(139),n(138),n(60),n(48),n(137),n(91),n(86),n(88),n(19),n(27),n(136),n(135),n(134),n(79),n(133),n(1),n(11),n(78),n(132),n(83),n(20),n(18),n(131),n(35),n(3),n(81),n(130),n(40),n(77),n(76),n(14),n(24),n(34),n(16),n(56),n(80),n(129),n(128),n(127),n(126),n(125),n(124),n(74),n(123),n(8),n(122),n(33),n(121),n(120),n(73),n(119),n(118),n(117),n(116),n(15),n(115),n(114),n(72),n(113),n(112),n(51),n(71),n(70),n(111),n(110),n(109),n(108),n(107),n(21),n(106),n(105),n(25),n(66),n(104),n(103),n(102),n(101),n(38),n(87),n(29),n(22),n(89),n(100),n(85),n(84),n(75),n(5),n(90),n(99),n(61),n(26),n(42),n(2),n(30),n(13),n(82),n(98),n(7),n(28),n(68),n(32),n(67),n(49),n(97),n(39),n(37),n(17),n(64),n(65),n(96),n(50),n(69),n(6),n(57),n(95),n(46),n(94),n(55),n(63),n(62),n(45),n(4),t.exports=n(0).default}]),self,e=function(__WEBPACK_EXTERNAL_MODULE__0__,__WEBPACK_EXTERNAL_MODULE__3__){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==_typeof(t)&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=68)}([function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(t,e,n){n.r(e),n.d(e,"DEFAULT_QUARTERS_PER_MINUTE",(function(){return i})),n.d(e,"DEFAULT_STEPS_PER_BAR",(function(){return r})),n.d(e,"DEFAULT_STEPS_PER_QUARTER",(function(){return o})),n.d(e,"DEFAULT_STEPS_PER_SECOND",(function(){return a})),n.d(e,"DEFAULT_VELOCITY",(function(){return s})),n.d(e,"DEFAULT_PROGRAM",(function(){return u})),n.d(e,"DEFAULT_TICKS_PER_QUARTER",(function(){return l})),n.d(e,"DEFAULT_CHANNEL",(function(){return c})),n.d(e,"DRUM_CHANNEL",(function(){return f})),n.d(e,"NON_DRUM_CHANNELS",(function(){return h})),n.d(e,"MIN_MIDI_VELOCITY",(function(){return d})),n.d(e,"MAX_MIDI_VELOCITY",(function(){return p})),n.d(e,"MIDI_VELOCITIES",(function(){return m})),n.d(e,"NO_CHORD",(function(){return y})),n.d(e,"NUM_PITCH_CLASSES",(function(){return g})),n.d(e,"MIN_MIDI_PITCH",(function(){return _})),n.d(e,"MAX_MIDI_PITCH",(function(){return v})),n.d(e,"MIDI_PITCHES",(function(){return S})),n.d(e,"MIN_PIANO_PITCH",(function(){return b})),n.d(e,"MAX_PIANO_PITCH",(function(){return w})),n.d(e,"MIN_DRUM_PITCH",(function(){return T})),n.d(e,"MAX_DRUM_PITCH",(function(){return P})),n.d(e,"MIN_MIDI_PROGRAM",(function(){return k})),n.d(e,"MAX_MIDI_PROGRAM",(function(){return O})),n.d(e,"LO_CLICK_PITCH",(function(){return A})),n.d(e,"HI_CLICK_PITCH",(function(){return x})),n.d(e,"LO_CLICK_CLASS",(function(){return M})),n.d(e,"HI_CLICK_CLASS",(function(){return N}));var i=120,r=16,o=4,a=100,s=80,u=0,l=220,c=0,f=9,h=[0,1,2,3,4,5,6,7,8,10,11,12,13,14,15],d=0,p=127,m=p-d+1,y="N.C.",g=12,_=0,v=127,S=v-_+1,b=21,w=108,T=35,P=81,k=0,O=127,A=89,x=90,M=9,N=10},function(t,e,n){n.d(e,"a",(function(){return i}));var i=n(16).tensorflow.magenta.NoteSequence},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__3__},function(t,e,n){n.r(e),n.d(e,"Level",(function(){return i})),n.d(e,"verbosity",(function(){return o})),n.d(e,"log",(function(){return a})),n.d(e,"logWithDuration",(function(){return s}));var i,r=n(6);!function(t){t[t.NONE=0]="NONE",t[t.WARN=5]="WARN",t[t.INFO=10]="INFO",t[t.DEBUG=20]="DEBUG"}(i||(i={}));var o=10;function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Magenta.js",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(0===n)throw Error("Logging level cannot be NONE.");o>=n&&(5===n?console.warn:console.log)("%c ".concat(e," "),"background:magenta; color:white",t)}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Magenta.js",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;a("".concat(t," in ").concat(((r.d.now()-e)/1e3).toPrecision(3),"s"),n,i)}},,function(t,e,n){(function(t){n.d(e,"a",(function(){return r})),n.d(e,"d",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"b",(function(){return u}));var i=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("cannot find the global object")}(),r=i.fetch.bind(i),o=i.performance,a=(i.navigator,!!i.webkitOfflineAudioContext),s=void 0!==i.WorkerGlobalScope;function u(t){if(t=a?44100:t,s)throw new Error("Cannot use offline audio context in a web worker.");var e=i.webkitOfflineAudioContext;return a?new e(1,t,t):new i.OfflineAudioContext(1,t,t)}}).call(this,n(9))},function(t,e,n){n.r(e),n.d(e,"MultipleTimeSignatureException",(function(){return o})),n.d(e,"BadTimeSignatureException",(function(){return a})),n.d(e,"NegativeTimeException",(function(){return s})),n.d(e,"MultipleTempoException",(function(){return u})),n.d(e,"QuantizationStatusException",(function(){return l})),n.d(e,"clone",(function(){return c})),n.d(e,"stepsPerQuarterToStepsPerSecond",(function(){return f})),n.d(e,"quantizeToStep",(function(){return h})),n.d(e,"quantizeNoteSequence",(function(){return m})),n.d(e,"isQuantizedSequence",(function(){return y})),n.d(e,"assertIsQuantizedSequence",(function(){return g})),n.d(e,"isRelativeQuantizedSequence",(function(){return _})),n.d(e,"assertIsRelativeQuantizedSequence",(function(){return v})),n.d(e,"isAbsoluteQuantizedSequence",(function(){return S})),n.d(e,"assertIsAbsoluteQuantizedSequence",(function(){return b})),n.d(e,"unquantizeSequence",(function(){return w})),n.d(e,"createQuantizedNoteSequence",(function(){return T})),n.d(e,"mergeInstruments",(function(){return P})),n.d(e,"replaceInstruments",(function(){return k})),n.d(e,"mergeConsecutiveNotes",(function(){return O})),n.d(e,"concatenate",(function(){return A})),n.d(e,"trim",(function(){return x})),n.d(e,"split",(function(){return q}));var i=n(2),r=n(1),o=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),a=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),s=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),u=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),l=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error));function c(t){return i.a.decode(i.a.encode(t).finish())}function f(t,e){return t*e/60}function h(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,i=t*e;return Math.floor(i+(1-n))}function d(t){return t.controlChanges.concat(t.textAnnotations)}function p(t){if(t.tempos&&0!==t.tempos.length){if(t.tempos.sort((function(t,e){return t.time-e.time})),0!==t.tempos[0].time&&t.tempos[0].qpm!==r.DEFAULT_QUARTERS_PER_MINUTE)throw new u("NoteSequence has an implicit tempo change from initial "+r.DEFAULT_QUARTERS_PER_MINUTE+" qpm to "+"".concat(t.tempos[0].qpm," qpm at ").concat(t.tempos[0].time," seconds."));for(var e=1;e<t.tempos.length;e++)if(t.tempos[e].qpm!==t.tempos[0].qpm)throw new u("NoteSequence has at least one tempo change from ".concat(t.tempos[0].qpm," qpm to ").concat(t.tempos[e].qpm,"qpm at ").concat(t.tempos[e].time," seconds."))}}function m(t,e){var n=c(t);if(n.quantizationInfo=i.a.QuantizationInfo.create({stepsPerQuarter:e}),n.timeSignatures.length>0){if(n.timeSignatures.sort((function(t,e){return t.time-e.time})),0!==n.timeSignatures[0].time&&(4!==n.timeSignatures[0].numerator||4!==n.timeSignatures[0].denominator))throw new o("NoteSequence has an implicit change from initial 4/4 time signature to ".concat(n.timeSignatures[0].numerator,"/")+n.timeSignatures[0].denominator+" at "+n.timeSignatures[0].time+" seconds.");for(var u=1;u<n.timeSignatures.length;u++){var l=n.timeSignatures[u];if(l.numerator!==n.timeSignatures[0].numerator||l.denominator!==n.timeSignatures[0].denominator)throw new o("NoteSequence has at least one time signature change from "+n.timeSignatures[0].numerator+"/"+n.timeSignatures[0].denominator+" to "+"".concat(l.numerator,"/").concat(l.denominator," ")+"at ".concat(l.time," seconds"))}n.timeSignatures[0].time=0,n.timeSignatures=[n.timeSignatures[0]]}else{var m=i.a.TimeSignature.create({numerator:4,denominator:4,time:0});n.timeSignatures.push(m)}var y,g=n.timeSignatures[0];if(!(y=g.denominator)||0!=(y&y-1))throw new a("Denominator is not a power of 2. Time signature: ".concat(g.numerator,"/").concat(g.denominator));if(0===g.numerator)throw new a("Numerator is 0. Time signature: ".concat(g.numerator,"/").concat(g.denominator));if(n.tempos.length>0)p(n),n.tempos[0].time=0,n.tempos=[n.tempos[0]];else{var _=i.a.Tempo.create({qpm:r.DEFAULT_QUARTERS_PER_MINUTE,time:0});n.tempos.push(_)}var v=f(e,n.tempos[0].qpm);return n.totalQuantizedSteps=h(t.totalTime,v),function(t,e){var n,i=_createForOfIteratorHelper(t.notes);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.quantizedStartStep=h(r.startTime,e),r.quantizedEndStep=h(r.endTime,e),r.quantizedEndStep===r.quantizedStartStep&&(r.quantizedEndStep+=1),r.quantizedStartStep<0||r.quantizedEndStep<0)throw new s("Got negative note time: start_step = "+r.quantizedStartStep+", end_step = "+r.quantizedEndStep);r.quantizedEndStep>t.totalQuantizedSteps&&(t.totalQuantizedSteps=r.quantizedEndStep)}}catch(t){i.e(t)}finally{i.f()}d(t).forEach((function(t){if(t.quantizedStep=h(t.time,e),t.quantizedStep<0)throw new s("Got negative event time: step = "+t.quantizedStep)}))}(n,v),n}function y(t){return t.quantizationInfo&&(t.quantizationInfo.stepsPerQuarter>0||t.quantizationInfo.stepsPerSecond>0)}function g(t){if(!y(t))throw new l("NoteSequence ".concat(t.id," is not quantized (missing quantizationInfo)"))}function _(t){return t.quantizationInfo&&t.quantizationInfo.stepsPerQuarter>0}function v(t){if(!_(t))throw new l("NoteSequence ".concat(t.id," is not quantized or is quantized based on absolute timing"))}function S(t){return t.quantizationInfo&&t.quantizationInfo.stepsPerSecond>0}function b(t){if(!S(t))throw new l("NoteSequence ".concat(t.id," is not quantized or is quantized based on relative timing"))}function w(t,e){v(t),p(t);var n=c(t);e?n.tempos&&n.tempos.length>0?n.tempos[0].qpm=e:n.tempos.push(i.a.Tempo.create({time:0,qpm:e})):e=t.tempos&&t.tempos.length>0?n.tempos[0].qpm:r.DEFAULT_QUARTERS_PER_MINUTE;var o=function(t){return t/n.quantizationInfo.stepsPerQuarter*(60/e)};return n.totalTime=o(n.totalQuantizedSteps),n.notes.forEach((function(t){t.startTime=o(t.quantizedStartStep),t.endTime=o(t.quantizedEndStep),n.totalTime=Math.max(n.totalTime,t.endTime),delete t.quantizedStartStep,delete t.quantizedEndStep})),d(n).forEach((function(t){t.time=o(t.time)})),delete n.totalQuantizedSteps,delete n.quantizationInfo,n}function T(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DEFAULT_STEPS_PER_QUARTER,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.DEFAULT_QUARTERS_PER_MINUTE;return i.a.create({quantizationInfo:{stepsPerQuarter:t},tempos:[{qpm:e}]})}function P(t){var e=c(t),n=e.notes.concat(e.pitchBends).concat(e.controlChanges),i=Array.from(new Set(n.filter((function(t){return!t.isDrum})).map((function(t){return t.program}))));return n.forEach((function(t){t.isDrum?(t.program=0,t.instrument=i.length):t.instrument=i.indexOf(t.program)})),e}function k(t,e){var n=new Set(t.notes.map((function(t){return t.instrument}))),r=new Set(e.notes.map((function(t){return t.instrument}))),o=[];t.notes.forEach((function(t){r.has(t.instrument)||o.push(i.a.Note.create(t))})),e.notes.forEach((function(t){n.has(t.instrument)&&o.push(i.a.Note.create(t))}));var a=c(t);return a.notes=o.sort((function(t,e){return t.instrument-e.instrument||t.quantizedStartStep-e.quantizedStartStep})),a}function O(t){g(t);var e=c(t);e.notes=[];var n=t.notes.sort((function(t,e){return t.instrument-e.instrument||t.quantizedStartStep-e.quantizedStartStep})),r=new i.a.Note;r.pitch=n[0].pitch,r.instrument=n[0].instrument,r.quantizedStartStep=n[0].quantizedStartStep,r.quantizedEndStep=n[0].quantizedEndStep,e.notes.push(r);for(var o=0,a=1;a<n.length;a++){var s=n[a],u=e.notes[o];if(u.instrument===s.instrument&&u.pitch===s.pitch&&s.quantizedStartStep===u.quantizedEndStep&&s.quantizedStartStep%16!=0)e.notes[o].quantizedEndStep+=s.quantizedEndStep-s.quantizedStartStep;else{var l=new i.a.Note;l.pitch=n[a].pitch,l.instrument=n[a].instrument,l.quantizedStartStep=n[a].quantizedStartStep,l.quantizedEndStep=n[a].quantizedEndStep,e.notes.push(l),o++}}return e}function A(t,e){if(e&&e.length!==t.length)throw new Error("Number of sequences to concatenate and their individual\n durations does not match.");if(y(t[0])){for(var n=0;n<t.length;++n)if(g(t[n]),t[n].quantizationInfo.stepsPerQuarter!==t[0].quantizationInfo.stepsPerQuarter)throw new Error("Not all sequences have the same quantizationInfo");return M(t,"totalQuantizedSteps","quantizedStartStep","quantizedEndStep",e)}return M(t,"totalTime","startTime","endTime",e)}function x(t,e,n,i){return y(t)?N(t,e,n,"totalQuantizedSteps","quantizedStartStep","quantizedEndStep",i):N(t,e,n,"totalTime","startTime","endTime",i)}function M(t,e,n,r,o){for(var a,s=0,u=0;u<t.length;++u){var l=o?o[u]:t[u][e];if(0===l)throw Error("Sequence ".concat(t[u].id," has no ").concat(e,", and no individual duration was provided."));0===u?a=c(t[0]):Array.prototype.push.apply(a.notes,t[u].notes.map((function(t){var e=i.a.Note.create(t);return e[n]+=s,e[r]+=s,e}))),s+=l}return a[e]=s,a}function N(t,e,n,i,r,o,a){var s=c(t);s[i]=n,s.notes=s.notes.filter((function(t){return t[r]>=e&&t[r]<=n&&(a||t[o]<=n)})),s[i]-=e;for(var u=0;u<s.notes.length;u++)s.notes[u][r]-=e,s.notes[u][o]-=e,a&&(s.notes[u][o]=Math.min(s.notes[u][o],s[i]));return s}function q(t,e){g(t);for(var n=c(t),r=n.notes.sort((function(t,e){return t.quantizedStartStep-e.quantizedStartStep})),o=[],a=0,s=[],u=0;u<r.length;u++){var l=r[u],f=l.quantizedStartStep,h=l.quantizedEndStep;if(l.quantizedStartStep-=a,l.quantizedEndStep-=a,!(l.quantizedStartStep<0))if(l.quantizedEndStep<=e)s.push(l);else{if(l.quantizedStartStep<e){var d=i.a.Note.create(l);d.quantizedEndStep=e,d.startTime=d.endTime=void 0,s.push(d),l.quantizedStartStep=a+e,l.quantizedEndStep=h}else l.quantizedStartStep=f,l.quantizedEndStep=h;if((l.quantizedEndStep>e||l.quantizedStartStep>e)&&(u-=1),0!==s.length){var p=c(n);p.notes=s,p.totalQuantizedSteps=e,o.push(p)}s=[],a+=e}}if(0!==s.length){var m=c(n);m.notes=s,m.totalQuantizedSteps=e,o.push(m)}return o}},function(t,e,n){(function(t){var i=e;function r(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;++r)void 0!==t[i[r]]&&n||(t[i[r]]=e[i[r]]);return t}function o(t){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}i.asPromise=n(22),i.base64=n(23),i.EventEmitter=n(24),i.float=n(25),i.inquire=n(26),i.utf8=n(27),i.pool=n(28),i.LongBits=n(29),i.isNode=Boolean(void 0!==t&&t&&t.process&&t.process.versions&&t.process.versions.node),i.global=i.isNode&&t||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},i.isString=function(t){return"string"==typeof t||t instanceof String},i.isObject=function(t){return t&&"object"==_typeof(t)},i.isset=i.isSet=function(t,e){var n=t[e];return!(null==n||!t.hasOwnProperty(e))&&("object"!=_typeof(n)||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},i.Buffer=function(){try{var t=i.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(t){return"number"==typeof t?i.Buffer?i._Buffer_allocUnsafe(t):new i.Array(t):i.Buffer?i._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(t){return t?i.LongBits.from(t).toHash():i.LongBits.zeroHash},i.longFromHash=function(t,e){var n=i.LongBits.fromHash(t);return i.Long?i.Long.fromBits(n.lo,n.hi,e):n.toNumber(Boolean(e))},i.merge=r,i.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var t=Object.keys(this),n=t.length-1;n>-1;--n)if(1===e[t[n]]&&void 0!==this[t[n]]&&null!==this[t[n]])return t[n]}},i.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var t=i.Buffer;t?(i._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,n){return new t(e,n)},i._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):i._Buffer_from=i._Buffer_allocUnsafe=null}}).call(this,n(9))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==("undefined"==typeof window?"undefined":_typeof(window))&&(n=window)}t.exports=n},function(t,e,n){n.r(e),n.d(e,"NO_EVENT",(function(){return a})),n.d(e,"NOTE_OFF",(function(){return s})),n.d(e,"Melody",(function(){return u})),n.d(e,"MelodyRhythm",(function(){return l})),n.d(e,"MelodyShape",(function(){return c})),n.d(e,"MelodyRegister",(function(){return f}));var i=n(0),r=n(2),o=n(7),a=0,s=1,u=function(){function t(e,n,i){_classCallCheck(this,t),this.events=e,this.minPitch=n,this.maxPitch=i}return _createClass(t,[{key:"toNoteSequence",value:function(t,e){for(var n=o.createQuantizedNoteSequence(t,e),i=null,u=0;u<this.events.length;++u){var l=this.events[u];switch(l){case a:break;case s:i&&(i.quantizedEndStep=u,n.notes.push(i),i=null);break;default:i&&(i.quantizedEndStep=u,n.notes.push(i)),i=r.a.Note.create({pitch:l-2+this.minPitch,quantizedStartStep:u})}}return i&&(i.quantizedEndStep=this.events.length,n.notes.push(i)),n.totalQuantizedSteps=this.events.length,n}}],[{key:"fromNoteSequence",value:function(e,n,i){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4?arguments[4]:void 0;o.assertIsQuantizedSequence(e);var u=e.notes.sort((function(t,e){return t.quantizedStartStep===e.quantizedStartStep?e.pitch-t.pitch:t.quantizedStartStep-e.quantizedStartStep})),l=new Int32Array(a||e.totalQuantizedSteps),c=-1;return u.forEach((function(t){if(t.quantizedStartStep===c){if(r)return;throw new Error("`NoteSequence` is not monophonic.")}if(t.pitch<n||t.pitch>i)throw Error("`NoteSequence` has a pitch outside of the valid range: "+t.pitch);l[t.quantizedStartStep]=t.pitch-n+2,l[t.quantizedEndStep]=s,c=t.quantizedStartStep})),new t(l,n,i)}}]),t}(),l=function(){function t(){_classCallCheck(this,t),this.depth=1}return _createClass(t,[{key:"extract",value:function(t){for(var e=t.events.length,n=i.buffer([e,1]),r=0;r<e;++r)n.set(t.events[r]>=2?1:0,r,0);return n.toTensor().as2D(e,1)}}]),t}(),c=function(){function t(){_classCallCheck(this,t),this.depth=3}return _createClass(t,[{key:"extract",value:function(t){for(var e=t.events.length,n=i.buffer([e,3]),r=null,o=null,a=0;a<e;++a)if(t.events[a]>=2){if(null!==r){var s;0===n.get(r,0)&&0===n.get(r,1)&&0===n.get(r,2)&&(r=-1),s=t.events[a]<o?0:t.events[a]>o?2:1;for(var u=a;u>r;--u)n.set(1,u,s)}r=a,o=t.events[a]}if(r!==e-1)if(null===r||0===n.get(r,0)&&0===n.get(r,1)&&0===n.get(r,2))for(var l=0;l<e;++l)n.set(1,l,1);else for(var c=e-1;c>r;--c)for(var f=0;f<3;f++)n.set(n.get(r,f),c,f);return n.toTensor().as2D(e,3)}}]),t}(),f=function(){function t(e){_classCallCheck(this,t),this.boundaryPitches=e,this.depth=e.length+1}return _createClass(t,[{key:"meanMelodyPitch",value:function(t){for(var e=0,n=0,i=null,r=0;r<t.events.length;++r)t.events[r]===s?i=null:t.events[r]>=2&&(i=t.minPitch+t.events[r]-2),null!==i&&(e+=i,n+=1);return n?e/n:null}},{key:"extract",value:function(t){var e=t.events.length,n=this.meanMelodyPitch(t);if(null===n)return i.zeros([e,this.depth]);for(var r=0;r<this.boundaryPitches.length&&n>=this.boundaryPitches[r];)r++;for(var o=i.buffer([e,this.depth]),a=0;a<e;++a)o.set(1,a,r);return o.toTensor().as2D(e,this.depth)}}]),t}()},,function(t,e,n){n.r(e),n.d(e,"DEFAULT_DRUM_PITCH_CLASSES",(function(){return c})),n.d(e,"converterFromSpec",(function(){return f})),n.d(e,"DataConverter",(function(){return h})),n.d(e,"DrumsConverter",(function(){return d})),n.d(e,"DrumRollConverter",(function(){return p})),n.d(e,"DrumsOneHotConverter",(function(){return m})),n.d(e,"MelodyConverter",(function(){return y})),n.d(e,"MelodyRhythmConverter",(function(){return _})),n.d(e,"MelodyShapeConverter",(function(){return v})),n.d(e,"TrioConverter",(function(){return S})),n.d(e,"MultitrackConverter",(function(){return b})),n.d(e,"GrooveConverter",(function(){return w}));var i=n(0),r=n(2),o=n(1),a=n(4),s=n(10),u=n(13),l=n(7),c=[[36,35],[38,27,28,31,32,33,34,37,39,40,56,65,66,75,85],[42,44,54,68,69,70,71,73,78,80],[46,67,72,74,79,81],[45,29,41,61,64,84],[48,47,60,63,77,86,87],[50,30,43,62,76,83],[49,55,57,58],[51,52,53,59,82]];function f(t){switch(t.type){case"MelodyConverter":return new y(t.args);case"MelodyRhythmConverter":return new _(t.args);case"MelodyShapeConverter":return new v(t.args);case"DrumsConverter":return new d(t.args);case"DrumRollConverter":return new p(t.args);case"TrioConverter":return new S(t.args);case"DrumsOneHotConverter":return new m(t.args);case"MultitrackConverter":return new b(t.args);case"GrooveConverter":return new w(t.args);default:throw new Error("Unknown DataConverter type: "+t)}}var h=function(){function t(e){_classCallCheck(this,t),this.NUM_SPLITS=0,this.SEGMENTED_BY_TRACK=!1,this.numSteps=e.numSteps,this.numSegments=e.numSegments}return _createClass(t,[{key:"tensorSteps",value:function(t){return i.scalar(t.shape[0],"int32")}}]),t}(),d=function(t){_inherits(o,t);var e,n=_createSuper(o);function o(t){var e;_classCallCheck(this,o),(e=n.call(this,t)).pitchClasses=t.pitchClasses||c,e.pitchToClass=new Map;for(var i=function(t){e.pitchClasses[t].forEach((function(n){e.pitchToClass.set(n,t)}))},r=0;r<e.pitchClasses.length;++r)i(r);return e.depth=e.pitchClasses.length+1,e}return _createClass(o,[{key:"toTensor",value:function(t){var e=this;l.assertIsQuantizedSequence(t);for(var n=this.numSteps||t.totalQuantizedSteps,r=i.buffer([n,this.pitchClasses.length+1],"int32"),o=0;o<n;++o)r.set(1,o,-1);return t.notes.forEach((function(t){r.set(1,t.quantizedStartStep,e.pitchToClass.get(t.pitch)),r.set(0,t.quantizedStartStep,-1)})),r.toTensor()}},{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,i){var o,a,s,u,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.createQuantizedNoteSequence(n,i),a=e.argMax(1),t.next=4,a.data();case 4:for(s=t.sent,a.dispose(),u=0;u<s.length;++u)for(c=0;c<this.pitchClasses.length;c++)s[u]>>c&1&&o.notes.push(r.a.Note.create({pitch:this.pitchClasses[c][0],quantizedStartStep:u,quantizedEndStep:u+1,isDrum:!0}));return t.abrupt("return",(o.totalQuantizedSteps=s.length,o));case 8:case"end":return t.stop()}}),t,this)}))),function(t,n,i){return e.apply(this,arguments)})}]),o}(h),p=function(t){_inherits(i,t);var e,n=_createSuper(i);function i(){return _classCallCheck(this,i),n.apply(this,arguments)}return _createClass(i,[{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,i){var o,a,s,u,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.createQuantizedNoteSequence(n,i),t.next=3,e.data();case 3:for(a=t.sent,s=0;s<e.shape[0];++s)for(u=a.slice(s*this.pitchClasses.length,(s+1)*this.pitchClasses.length),c=0;c<u.length;++c)u[c]&&o.notes.push(r.a.Note.create({pitch:this.pitchClasses[c][0],quantizedStartStep:s,quantizedEndStep:s+1,isDrum:!0}));return t.abrupt("return",(o.totalQuantizedSteps=e.shape[0],o));case 6:case"end":return t.stop()}}),t,this)}))),function(t,n,i){return e.apply(this,arguments)})}]),i}(d),m=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),(i=e.call(this,t)).depth=Math.pow(2,i.pitchClasses.length),i}return _createClass(n,[{key:"toTensor",value:function(t){var e=this;l.assertIsRelativeQuantizedSequence(t);var n,r=this.numSteps||t.totalQuantizedSteps,o=Array(r).fill(0),a=_createForOfIteratorHelper(t.notes);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=s.pitch,c=s.quantizedStartStep;o[c]+=Math.pow(2,this.pitchToClass.get(u))}}catch(t){a.e(t)}finally{a.f()}return i.tidy((function(){return i.oneHot(i.tensor1d(o,"int32"),e.depth)}))}}]),n}(d),y=function(t){_inherits(r,t);var e,n=_createSuper(r);function r(t){var e;return _classCallCheck(this,r),(e=n.call(this,t)).NOTE_OFF=1,e.FIRST_PITCH=2,e.minPitch=t.minPitch,e.maxPitch=t.maxPitch,e.ignorePolyphony=t.ignorePolyphony,e.depth=t.maxPitch-t.minPitch+1+e.FIRST_PITCH,e}return _createClass(r,[{key:"toTensor",value:function(t){var e=this,n=s.Melody.fromNoteSequence(t,this.minPitch,this.maxPitch,this.ignorePolyphony,this.numSteps);return i.tidy((function(){return i.oneHot(i.tensor(n.events,[n.events.length],"int32"),e.depth)}))}},{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,i){var r,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.argMax(1),t.next=3,r.data();case 3:return o=t.sent,r.dispose(),t.abrupt("return",new s.Melody(o,this.minPitch,this.maxPitch).toNoteSequence(n,i));case 6:case"end":return t.stop()}}),t,this)}))),function(t,n,i){return e.apply(this,arguments)})}]),r}(h),g=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r;return _classCallCheck(this,n),(r=e.call(this,t)).minPitch=t.minPitch,r.maxPitch=t.maxPitch,r.ignorePolyphony=t.ignorePolyphony,r.melodyControl=i,r.depth=i.depth,r}return _createClass(n,[{key:"toTensor",value:function(t){var e=s.Melody.fromNoteSequence(t,this.minPitch,this.maxPitch,this.ignorePolyphony,this.numSteps);return this.melodyControl.extract(e)}}]),n}(h),_=function(t){_inherits(i,t);var e,n=_createSuper(i);function i(t){return _classCallCheck(this,i),n.call(this,t,new s.MelodyRhythm)}return _createClass(i,[{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,i){var o,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.createQuantizedNoteSequence(n,i),t.next=3,e.data();case 3:for(a=t.sent,s=0;s<a.length;++s)a[s]&&o.notes.push(r.a.Note.create({pitch:c[1][0],quantizedStartStep:s,quantizedEndStep:s+1,isDrum:!0}));return t.abrupt("return",(o.totalQuantizedSteps=a.length,o));case 6:case"end":return t.stop()}}),t)}))),function(t,n,i){return e.apply(this,arguments)})}]),i}(g),v=function(t){_inherits(i,t);var e,n=_createSuper(i);function i(t){return _classCallCheck(this,i),n.call(this,t,new s.MelodyShape)}return _createClass(i,[{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,i){var o,s,u,c,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.createQuantizedNoteSequence(n,i),s=e.argMax(1),t.next=4,s.data();case 4:u=t.sent,s.dispose(),c=Math.round((this.maxPitch+this.minPitch)/2),f=0;case 8:if(!(f<u.length)){t.next=19;break}t.t0=u[f],t.next=0===t.t0?12:2===t.t0?14:15;break;case 12:return(c-=1)<this.minPitch&&(c=this.minPitch,a.log("Pitch range exceeded when creating NoteSequence from shape.","MelodyShapeConverter")),t.abrupt("break",15);case 14:(c+=1)>this.maxPitch&&(c=this.maxPitch,a.log("Pitch range exceeded when creating NoteSequence from shape.","MelodyShapeConverter"));case 15:o.notes.push(r.a.Note.create({pitch:c,quantizedStartStep:f,quantizedEndStep:f+1}));case 16:++f,t.next=8;break;case 19:return t.abrupt("return",(o.totalQuantizedSteps=u.length,o));case 20:case"end":return t.stop()}}),t,this)}))),function(t,n,i){return e.apply(this,arguments)})}]),i}(g),S=function(t){_inherits(r,t);var e,n=_createSuper(r);function r(t){var e;return _classCallCheck(this,r),(e=n.call(this,t)).NUM_SPLITS=3,e.MEL_PROG_RANGE=[0,31],e.BASS_PROG_RANGE=[32,39],t.melArgs.numSteps=t.numSteps,t.bassArgs.numSteps=t.numSteps,t.drumsArgs.numSteps=t.numSteps,e.melConverter=new y(t.melArgs),e.bassConverter=new y(t.bassArgs),e.drumsConverter=new m(t.drumsArgs),e.depth=e.melConverter.depth+e.bassConverter.depth+e.drumsConverter.depth,e}return _createClass(r,[{key:"toTensor",value:function(t){var e=this;l.assertIsQuantizedSequence(t);var n=l.clone(t),r=l.clone(t),o=l.clone(t);return n.notes=t.notes.filter((function(t){return!t.isDrum&&t.program>=e.MEL_PROG_RANGE[0]&&t.program<=e.MEL_PROG_RANGE[1]})),r.notes=t.notes.filter((function(t){return!t.isDrum&&t.program>=e.BASS_PROG_RANGE[0]&&t.program<=e.BASS_PROG_RANGE[1]})),o.notes=t.notes.filter((function(t){return t.isDrum})),i.tidy((function(){return i.concat([e.melConverter.toTensor(n),e.bassConverter.toTensor(r),e.drumsConverter.toTensor(o)],-1)}))}},{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n,r){var o,a,s,u,l,c,f=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=i.split(e,[this.melConverter.depth,this.bassConverter.depth,this.drumsConverter.depth],-1),t.next=3,this.melConverter.toNoteSequence(s[0],n,r);case 3:return(u=t.sent).notes.forEach((function(t){t.instrument=0,t.program=0})),t.next=7,this.bassConverter.toNoteSequence(s[1],n,r);case 7:return l=t.sent,(o=u.notes).push.apply(o,_toConsumableArray(l.notes.map((function(t){return t.instrument=1,t.program=f.BASS_PROG_RANGE[0],t})))),t.next=11,this.drumsConverter.toNoteSequence(s[2],n,r);case 11:return c=t.sent,t.abrupt("return",((a=u.notes).push.apply(a,_toConsumableArray(c.notes.map((function(t){return t.instrument=2,t})))),s.forEach((function(t){return t.dispose()})),u));case 13:case"end":return t.stop()}}),t,this)}))),function(t,n,i){return e.apply(this,arguments)})}]),r}(h),b=function(t){_inherits(r,t);var e,n=_createSuper(r);function r(t){var e;return _classCallCheck(this,r),(e=n.call(this,t)).SEGMENTED_BY_TRACK=!0,e.stepsPerQuarter=t.stepsPerQuarter,e.totalSteps=t.totalSteps,e.numVelocityBins=t.numVelocityBins,e.minPitch=t.minPitch?t.minPitch:o.MIN_MIDI_PITCH,e.maxPitch=t.maxPitch?t.maxPitch:o.MAX_MIDI_PITCH,e.numPitches=e.maxPitch-e.minPitch+1,e.performanceEventDepth=2*e.numPitches+e.totalSteps+e.numVelocityBins,e.numPrograms=o.MAX_MIDI_PROGRAM-o.MIN_MIDI_PROGRAM+2,e.endToken=e.performanceEventDepth+e.numPrograms,e.depth=e.endToken+1,e.endTensor=i.tidy((function(){return i.oneHot(i.tensor1d([e.endToken],"int32"),e.depth).as1D()})),e}return _createClass(r,[{key:"trackToTensor",value:function(t){var e=this,n=this.numSteps/this.numSegments,r=void 0;if(t){for(;t.events.length>n-2;)t.events.pop();(r=i.buffer([t.events.length+2],"int32")).set(this.performanceEventDepth+(t.isDrum?this.numPrograms-1:t.program),0),t.events.forEach((function(t,n){switch(t.type){case"note-on":r.set(t.pitch-e.minPitch,n+1);break;case"note-off":r.set(e.numPitches+t.pitch-e.minPitch,n+1);break;case"time-shift":r.set(2*e.numPitches+t.steps-1,n+1);break;case"velocity-change":r.set(2*e.numPitches+e.totalSteps+t.velocityBin-1,n+1);break;default:throw new Error("Unrecognized performance event: "+t)}})),r.set(this.endToken,t.events.length+1)}else r=i.buffer([1],"int32",new Int32Array([this.endToken]));return i.tidy((function(){var t=i.oneHot(r.toTensor(),e.depth);return t.pad([[0,n-t.shape[0]],[0,0]])}))}},{key:"toTensor",value:function(t){var e=this;if(l.assertIsRelativeQuantizedSequence(t),t.quantizationInfo.stepsPerQuarter!==this.stepsPerQuarter)throw new Error("Steps per quarter note mismatch: ".concat(t.quantizationInfo.stepsPerQuarter," != ").concat(this.stepsPerQuarter));var n=l.clone(t);n.notes=t.notes.filter((function(t){return t.pitch>=e.minPitch&&t.pitch<=e.maxPitch}));for(var r=new Set(n.notes.map((function(t){return t.instrument}))),o=Array.from(r).map((function(t){return u.Performance.fromNoteSequence(n,e.totalSteps,e.numVelocityBins,t)})).sort((function(t,e){return e.isDrum?-1:t.isDrum?1:t.program-e.program}));o.length>this.numSegments;)o.pop();for(o.forEach((function(t){return t.setNumSteps(e.totalSteps)}));o.length<this.numSegments;)o.push(void 0);return i.tidy((function(){return i.concat(o.map((function(t){return e.trackToTensor(t)})),0)}))}},{key:"tokensToTrack",value:function(t){var e=this,n=t.indexOf(this.endToken),i=n>=0?n:t.length,r=t.slice(0,i),o=r.filter((function(t){return t<e.performanceEventDepth})),a=r.filter((function(t){return t>=e.performanceEventDepth})),s=_slicedToArray(a.length?a[0]-this.performanceEventDepth<this.numPrograms-1?[a[0]-this.performanceEventDepth,!1]:[0,!0]:[0,!1],2),l=s[0],c=s[1],f=Array.from(o).map((function(t){if(t<e.numPitches)return{type:"note-on",pitch:e.minPitch+t};if(t<2*e.numPitches)return{type:"note-off",pitch:e.minPitch+t-e.numPitches};if(t<2*e.numPitches+e.totalSteps)return{type:"time-shift",steps:t-2*e.numPitches+1};if(t<2*e.numPitches+e.totalSteps+e.numVelocityBins)return{type:"velocity-change",velocityBin:t-2*e.numPitches-e.totalSteps+1};throw new Error("Invalid performance event token: "+t)}));return new u.Performance(f,this.totalSteps,this.numVelocityBins,l,c)}},{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e){var n,r,o,a,s=this,u=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:this.stepsPerQuarter,r=u.length>2?u[2]:void 0,(o=l.createQuantizedNoteSequence(n,r)).totalQuantizedSteps=this.totalSteps,a=i.tidy((function(){return i.split(e.argMax(1),s.numSegments)})),t.next=7,Promise.all(a.map(function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function t(e){var n,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.data();case 2:return n=t.sent,i=s.tokensToTrack(n),t.abrupt("return",(e.dispose(),i));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 7:return t.sent.forEach((function(t,e){var n;t.setNumSteps(s.totalSteps),(n=o.notes).push.apply(n,_toConsumableArray(t.toNoteSequence(e).notes))})),t.abrupt("return",o);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),r}(h),w=function(t){_inherits(a,t);var e,n=_createSuper(a);function a(t){var e;_classCallCheck(this,a),(e=n.call(this,t)).TAPIFY_CHANNEL=3,e.stepsPerQuarter=t.stepsPerQuarter||o.DEFAULT_STEPS_PER_QUARTER,e.pitchClasses=t.pitchClasses||c,e.pitchToClass=new Map;for(var i=function(t){e.pitchClasses[t].forEach((function(n){e.pitchToClass.set(n,t)}))},r=0;r<e.pitchClasses.length;++r)i(r);return e.humanize=t.humanize||!1,e.tapify=t.tapify||!1,e.splitInstruments=t.splitInstruments||!1,e.depth=3,e}return _createClass(a,[{key:"toTensor",value:function(t){for(var e=this,n=l.isRelativeQuantizedSequence(t)?t:l.quantizeNoteSequence(t,this.stepsPerQuarter),r=this.numSteps,a=n.tempos&&n.tempos.length?n.tempos[0].qpm:o.DEFAULT_QUARTERS_PER_MINUTE,s=60/a/this.stepsPerQuarter,u=[],c=0;c<r;++c)u.push(new Map);n.notes.forEach((function(t){if(e.tapify||e.pitchToClass.has(t.pitch)){var n=t.quantizedStartStep;if(n>=u.length)throw Error("Model does not support sequences with more than ".concat(r," steps (").concat(r*s," seconds at qpm ").concat(a,")."));var i=e.tapify?e.TAPIFY_CHANNEL:e.pitchToClass.get(t.pitch);(!u[n].has(i)||u[n].get(i).velocity<t.velocity)&&u[n].set(i,t)}}));var f=this.pitchClasses.length,h=i.buffer([r,f]),d=i.buffer([r,f]),p=i.buffer([r,f]);function m(t){if(void 0===t.startTime)return 0;var e=t.startTime;return 2*(t.quantizedStartStep*s-e)/s}for(var y=0;y<r;++y)for(var g=0;g<f;++g){var _=u[y].get(g);h.set(_?1:0,y,g),this.humanize||this.tapify||d.set(_?_.velocity/o.MAX_MIDI_VELOCITY:0,y,g),this.humanize||p.set(_?m(_):0,y,g)}return i.tidy((function(){var t=h.toTensor(),n=d.toTensor(),o=p.toTensor(),a=e.splitInstruments?r*f:r;return i.concat([t.as2D(a,-1),n.as2D(a,-1),o.as2D(a,-1)],1)}))}},{key:"toNoteSequence",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e,n){var i,a,s,u,l,c,f,h,d,p,m,y,g,_,v,S=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c=function(t,e,n){return Math.min(Math.max(t,e),n)},i=S.length>2&&void 0!==S[2]?S[2]:o.DEFAULT_QUARTERS_PER_MINUTE,!n||n===this.stepsPerQuarter){t.next=4;break}throw Error("`stepsPerQuarter` is set by the model.");case 4:return n=this.stepsPerQuarter,a=this.splitInstruments?e.shape[0]/this.pitchClasses.length:e.shape[0],s=60/i/this.stepsPerQuarter,u=r.a.create({totalTime:a*s,tempos:[{qpm:i}]}),t.next=10,e.data();case 10:for(l=t.sent,f=this.pitchClasses.length,h=0;h<a;++h)for(d=l.slice(h*f*this.depth,(h+1)*f*this.depth),p=0;p<f;++p)m=d[this.splitInstruments?p*this.depth:p],y=d[this.splitInstruments?p*this.depth+1:f+p],g=d[this.splitInstruments?p*this.depth+2:2*f+p],m>.5&&(_=c(Math.round(y*o.MAX_MIDI_VELOCITY),o.MIN_MIDI_VELOCITY,o.MAX_MIDI_VELOCITY),v=c(g/2,-.5,.5),u.notes.push(r.a.Note.create({pitch:this.pitchClasses[p][0],startTime:(h-v)*s,endTime:(h-v+1)*s,velocity:_,isDrum:!0})));return t.abrupt("return",u);case 14:case"end":return t.stop()}}),t,this)}))),function(t,n){return e.apply(this,arguments)})}]),a}(h)},function(t,e,n){n.r(e),n.d(e,"Performance",(function(){return s}));var i=n(2),r=n(1),o=n(7),a=n(4),s=function(){function t(e,n,i,r,o){_classCallCheck(this,t),this.events=e,this.maxShiftSteps=n,this.numVelocityBins=i,this.program=r,this.isDrum=o}return _createClass(t,[{key:"getNumSteps",value:function(){return this.events.filter((function(t){return"time-shift"===t.type})).map((function(t){return t.steps})).reduce((function(t,e){return t+e}),0)}},{key:"setNumSteps",value:function(t){var e=this.getNumSteps();if(e<t){if(this.events.length){var n=this.events[this.events.length-1];if("time-shift"===n.type){var i=Math.min(t-e,this.maxShiftSteps-n.steps);n.steps+=i,e+=i}}for(;e<t;)e+this.maxShiftSteps>t?(this.events.push({type:"time-shift",steps:t-e}),e=t):(this.events.push({type:"time-shift",steps:this.maxShiftSteps}),e+=this.maxShiftSteps)}else if(e>t)for(;this.events.length&&e>t;){var r=this.events[this.events.length-1];"time-shift"===r.type?e-r.steps<t?(r.steps-=e-t,e=t):(this.events.pop(),e-=r.steps):this.events.pop()}}},{key:"toNoteSequence",value:function(t){for(var e=this,n=this.numVelocityBins?Math.ceil((r.MIDI_VELOCITIES-1)/this.numVelocityBins):void 0,o=i.a.create(),s=0,u=void 0,l=new Map,c=r.MIN_MIDI_PITCH;c<=r.MAX_MIDI_PITCH;++c)l.set(c,[]);var f,h=_createForOfIteratorHelper(this.events);try{for(h.s();!(f=h.n()).done;){var d=f.value;switch(d.type){case"note-on":l.get(d.pitch).push([s,u]);break;case"note-off":var p=l.get(d.pitch);if(p.length){var m=_slicedToArray(p.shift(),2),y=m[0],g=m[1];s>y?o.notes.push(i.a.Note.create({pitch:d.pitch,velocity:g,instrument:t,quantizedStartStep:y,quantizedEndStep:s,program:this.program,isDrum:this.isDrum})):a.log("Ignoring zero-length note: (pitch = ".concat(d.pitch,", step = ").concat(s,")"),"Performance")}else a.log("Ignoring note-off with no previous note-on:(pitch = ".concat(d.pitch,", step = ").concat(s,")"),"Performance");break;case"time-shift":s+=d.steps;break;case"velocity-change":if(!n)throw new Error("Unexpected velocity change event: "+d);u=r.MIN_MIDI_VELOCITY+(d.velocityBin-1)*n+1;break;default:throw new Error("Unrecognized performance event: "+d)}}}catch(t){h.e(t)}finally{h.f()}return l.forEach((function(n,r){var u,l=_createForOfIteratorHelper(n);try{for(l.s();!(u=l.n()).done;){var c=_slicedToArray(u.value,2),f=c[0],h=c[1];s>f?o.notes.push(i.a.Note.create({pitch:r,velocity:h,instrument:t,quantizedStartStep:f,quantizedEndStep:s,program:e.program,isDrum:e.isDrum})):a.log("Ignoring zero-length note: (pitch = ".concat(r,", step = ").concat(s,")"),"Performance")}}catch(t){l.e(t)}finally{l.f()}})),o.totalQuantizedSteps=s,o}}],[{key:"fromNoteSequence",value:function(e,n,i,a){o.assertIsQuantizedSequence(e);var s,u=e.notes.filter((function(t,e){return void 0===a||t.instrument===a})),l=u.sort((function(t,e){return t.startTime===e.startTime?t.pitch-e.pitch:t.startTime-e.startTime})),c=l.map((function(t,e){return{step:t.quantizedStartStep,index:e,isOffset:0}})),f=l.map((function(t,e){return{step:t.quantizedEndStep,index:e,isOffset:1}})),h=c.concat(f).sort((function(t,e){return t.step===e.step?t.index===e.index?t.isOffset-e.isOffset:t.index-e.index:t.step-e.step})),d=i?Math.ceil((r.MIDI_VELOCITIES-1)/i):void 0,p=[],m=0,y=i,g=_createForOfIteratorHelper(h);try{for(g.s();!(s=g.n()).done;){var _=s.value;if(_.step>m){for(;_.step>m+n;)p.push({type:"time-shift",steps:n}),m+=n;p.push({type:"time-shift",steps:_.step-m}),m=_.step}if(_.isOffset)p.push({type:"note-off",pitch:l[_.index].pitch});else{if(d){var v=Math.floor((l[_.index].velocity-r.MIN_MIDI_VELOCITY-1)/d)+1;v!==y&&(p.push({type:"velocity-change",velocityBin:v}),y=v)}p.push({type:"note-on",pitch:l[_.index].pitch})}}}catch(t){g.e(t)}finally{g.f()}var S=!!u.some((function(t){return t.isDrum}))&&(!u.some((function(t){return!t.isDrum}))||void 0),b=Array.from(new Set(u.map((function(t){return t.program})))),w=new t(p,n,i,S||1!==b.length?void 0:b[0],S);return w.setNumSteps(e.totalQuantizedSteps),w}}]),t}()},function(t,e,n){t.exports=f;var i,r=n(8),o=r.LongBits,a=r.base64,s=r.utf8;function u(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function l(){}function c(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function f(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var h=function(){return r.Buffer?function(){return(f.create=function(){return new i})()}:function(){return new f}};function d(t,e,n){e[n]=255&t}function p(t,e){this.len=t,this.next=void 0,this.val=e}function m(t,e,n){for(;t.hi;)e[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=127&t.lo|128,t.lo=t.lo>>>7;e[n++]=t.lo}function y(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}f.create=h(),f.alloc=function(t){return new r.Array(t)},r.Array!==Array&&(f.alloc=r.pool(f.alloc,r.Array.prototype.subarray)),f.prototype._push=function(t,e,n){return this.tail=this.tail.next=new u(t,e,n),this.len+=e,this},p.prototype=Object.create(u.prototype),p.prototype.fn=function(t,e,n){for(;t>127;)e[n++]=127&t|128,t>>>=7;e[n]=t},f.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new p((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},f.prototype.int32=function(t){return t<0?this._push(m,10,o.fromNumber(t)):this.uint32(t)},f.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},f.prototype.uint64=function(t){var e=o.from(t);return this._push(m,e.length(),e)},f.prototype.int64=f.prototype.uint64,f.prototype.sint64=function(t){var e=o.from(t).zzEncode();return this._push(m,e.length(),e)},f.prototype.bool=function(t){return this._push(d,1,t?1:0)},f.prototype.fixed32=function(t){return this._push(y,4,t>>>0)},f.prototype.sfixed32=f.prototype.fixed32,f.prototype.fixed64=function(t){var e=o.from(t);return this._push(y,4,e.lo)._push(y,4,e.hi)},f.prototype.sfixed64=f.prototype.fixed64,f.prototype.float=function(t){return this._push(r.float.writeFloatLE,4,t)},f.prototype.double=function(t){return this._push(r.float.writeDoubleLE,8,t)};var g=r.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};f.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(d,1,0);if(r.isString(t)){var n=f.alloc(e=a.length(t));a.decode(t,n,0),t=n}return this.uint32(e)._push(g,e,t)},f.prototype.string=function(t){var e=s.length(t);return e?this.uint32(e)._push(s.write,e,t):this._push(d,1,0)},f.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new u(l,0,0),this.len=0,this},f.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},f.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this},f.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e},f._configure=function(t){i=t,f.create=h(),i._configure()}},function(t,e,n){t.exports=u;var i,r=n(8),o=r.LongBits,a=r.utf8;function s(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function u(t){this.buf=t,this.pos=0,this.len=t.length}var l,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new u(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new u(t);throw Error("illegal buffer")},f=function(){return r.Buffer?function(t){return(u.create=function(t){return r.Buffer.isBuffer(t)?new i(t):c(t)})(t)}:c};function h(){var t=new o(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw s(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw s(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function d(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}u.create=f(),u.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return d(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|d(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var t=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var t=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},u.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw s(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)},u.prototype.string=function(){var t=this.bytes();return a.read(t,0,t.length)},u.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw s(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},u._configure=function(t){i=t,u.create=f(),i._configure();var e=r.Long?"toLong":"toNumber";r.merge(u.prototype,{int64:function(){return h.call(this)[e](!1)},uint64:function(){return h.call(this)[e](!0)},sint64:function(){return h.call(this).zzDecode()[e](!1)},fixed64:function(){return p.call(this)[e](!0)},sfixed64:function(){return p.call(this)[e](!1)}})}},function(t,e,n){var i,r,o=n(20),a=o.Reader,s=o.Writer,u=o.util,l=o.roots.default||(o.roots.default={});l.tensorflow=((r={}).magenta=((i={}).NoteSequence=function(){function t(t){if(this.timeSignatures=[],this.keySignatures=[],this.tempos=[],this.notes=[],this.pitchBends=[],this.controlChanges=[],this.partInfos=[],this.textAnnotations=[],this.sectionAnnotations=[],this.sectionGroups=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}var e,n;return t.prototype.id="",t.prototype.filename="",t.prototype.referenceNumber=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.collectionName="",t.prototype.ticksPerQuarter=0,t.prototype.timeSignatures=u.emptyArray,t.prototype.keySignatures=u.emptyArray,t.prototype.tempos=u.emptyArray,t.prototype.notes=u.emptyArray,t.prototype.totalTime=0,t.prototype.totalQuantizedSteps=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.pitchBends=u.emptyArray,t.prototype.controlChanges=u.emptyArray,t.prototype.partInfos=u.emptyArray,t.prototype.sourceInfo=null,t.prototype.textAnnotations=u.emptyArray,t.prototype.sectionAnnotations=u.emptyArray,t.prototype.sectionGroups=u.emptyArray,t.prototype.quantizationInfo=null,t.prototype.subsequenceInfo=null,t.prototype.sequenceMetadata=null,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=s.create()),null!=t.id&&t.hasOwnProperty("id")&&e.uint32(10).string(t.id),null!=t.filename&&t.hasOwnProperty("filename")&&e.uint32(18).string(t.filename),null!=t.collectionName&&t.hasOwnProperty("collectionName")&&e.uint32(26).string(t.collectionName),null!=t.ticksPerQuarter&&t.hasOwnProperty("ticksPerQuarter")&&e.uint32(32).int32(t.ticksPerQuarter),null!=t.timeSignatures&&t.timeSignatures.length)for(var n=0;n<t.timeSignatures.length;++n)l.tensorflow.magenta.NoteSequence.TimeSignature.encode(t.timeSignatures[n],e.uint32(42).fork()).ldelim();if(null!=t.keySignatures&&t.keySignatures.length)for(n=0;n<t.keySignatures.length;++n)l.tensorflow.magenta.NoteSequence.KeySignature.encode(t.keySignatures[n],e.uint32(50).fork()).ldelim();if(null!=t.tempos&&t.tempos.length)for(n=0;n<t.tempos.length;++n)l.tensorflow.magenta.NoteSequence.Tempo.encode(t.tempos[n],e.uint32(58).fork()).ldelim();if(null!=t.notes&&t.notes.length)for(n=0;n<t.notes.length;++n)l.tensorflow.magenta.NoteSequence.Note.encode(t.notes[n],e.uint32(66).fork()).ldelim();if(null!=t.totalTime&&t.hasOwnProperty("totalTime")&&e.uint32(73).double(t.totalTime),null!=t.pitchBends&&t.pitchBends.length)for(n=0;n<t.pitchBends.length;++n)l.tensorflow.magenta.NoteSequence.PitchBend.encode(t.pitchBends[n],e.uint32(82).fork()).ldelim();if(null!=t.controlChanges&&t.controlChanges.length)for(n=0;n<t.controlChanges.length;++n)l.tensorflow.magenta.NoteSequence.ControlChange.encode(t.controlChanges[n],e.uint32(90).fork()).ldelim();if(null!=t.partInfos&&t.partInfos.length)for(n=0;n<t.partInfos.length;++n)l.tensorflow.magenta.NoteSequence.PartInfo.encode(t.partInfos[n],e.uint32(98).fork()).ldelim();if(null!=t.sourceInfo&&t.hasOwnProperty("sourceInfo")&&l.tensorflow.magenta.NoteSequence.SourceInfo.encode(t.sourceInfo,e.uint32(106).fork()).ldelim(),null!=t.textAnnotations&&t.textAnnotations.length)for(n=0;n<t.textAnnotations.length;++n)l.tensorflow.magenta.NoteSequence.TextAnnotation.encode(t.textAnnotations[n],e.uint32(114).fork()).ldelim();if(null!=t.quantizationInfo&&t.hasOwnProperty("quantizationInfo")&&l.tensorflow.magenta.NoteSequence.QuantizationInfo.encode(t.quantizationInfo,e.uint32(122).fork()).ldelim(),null!=t.totalQuantizedSteps&&t.hasOwnProperty("totalQuantizedSteps")&&e.uint32(128).int64(t.totalQuantizedSteps),null!=t.subsequenceInfo&&t.hasOwnProperty("subsequenceInfo")&&l.tensorflow.magenta.NoteSequence.SubsequenceInfo.encode(t.subsequenceInfo,e.uint32(138).fork()).ldelim(),null!=t.referenceNumber&&t.hasOwnProperty("referenceNumber")&&e.uint32(144).int64(t.referenceNumber),null!=t.sequenceMetadata&&t.hasOwnProperty("sequenceMetadata")&&l.tensorflow.magenta.SequenceMetadata.encode(t.sequenceMetadata,e.uint32(154).fork()).ldelim(),null!=t.sectionAnnotations&&t.sectionAnnotations.length)for(n=0;n<t.sectionAnnotations.length;++n)l.tensorflow.magenta.NoteSequence.SectionAnnotation.encode(t.sectionAnnotations[n],e.uint32(162).fork()).ldelim();if(null!=t.sectionGroups&&t.sectionGroups.length)for(n=0;n<t.sectionGroups.length;++n)l.tensorflow.magenta.NoteSequence.SectionGroup.encode(t.sectionGroups[n],e.uint32(170).fork()).ldelim();return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.id=t.string();break;case 2:i.filename=t.string();break;case 18:i.referenceNumber=u.Long?t.int64().toNumber():t.int64();break;case 3:i.collectionName=t.string();break;case 4:i.ticksPerQuarter=t.int32();break;case 5:i.timeSignatures&&i.timeSignatures.length||(i.timeSignatures=[]),i.timeSignatures.push(l.tensorflow.magenta.NoteSequence.TimeSignature.decode(t,t.uint32()));break;case 6:i.keySignatures&&i.keySignatures.length||(i.keySignatures=[]),i.keySignatures.push(l.tensorflow.magenta.NoteSequence.KeySignature.decode(t,t.uint32()));break;case 7:i.tempos&&i.tempos.length||(i.tempos=[]),i.tempos.push(l.tensorflow.magenta.NoteSequence.Tempo.decode(t,t.uint32()));break;case 8:i.notes&&i.notes.length||(i.notes=[]),i.notes.push(l.tensorflow.magenta.NoteSequence.Note.decode(t,t.uint32()));break;case 9:i.totalTime=t.double();break;case 16:i.totalQuantizedSteps=u.Long?t.int64().toNumber():t.int64();break;case 10:i.pitchBends&&i.pitchBends.length||(i.pitchBends=[]),i.pitchBends.push(l.tensorflow.magenta.NoteSequence.PitchBend.decode(t,t.uint32()));break;case 11:i.controlChanges&&i.controlChanges.length||(i.controlChanges=[]),i.controlChanges.push(l.tensorflow.magenta.NoteSequence.ControlChange.decode(t,t.uint32()));break;case 12:i.partInfos&&i.partInfos.length||(i.partInfos=[]),i.partInfos.push(l.tensorflow.magenta.NoteSequence.PartInfo.decode(t,t.uint32()));break;case 13:i.sourceInfo=l.tensorflow.magenta.NoteSequence.SourceInfo.decode(t,t.uint32());break;case 14:i.textAnnotations&&i.textAnnotations.length||(i.textAnnotations=[]),i.textAnnotations.push(l.tensorflow.magenta.NoteSequence.TextAnnotation.decode(t,t.uint32()));break;case 20:i.sectionAnnotations&&i.sectionAnnotations.length||(i.sectionAnnotations=[]),i.sectionAnnotations.push(l.tensorflow.magenta.NoteSequence.SectionAnnotation.decode(t,t.uint32()));break;case 21:i.sectionGroups&&i.sectionGroups.length||(i.sectionGroups=[]),i.sectionGroups.push(l.tensorflow.magenta.NoteSequence.SectionGroup.decode(t,t.uint32()));break;case 15:i.quantizationInfo=l.tensorflow.magenta.NoteSequence.QuantizationInfo.decode(t,t.uint32());break;case 17:i.subsequenceInfo=l.tensorflow.magenta.NoteSequence.SubsequenceInfo.decode(t,t.uint32());break;case 19:i.sequenceMetadata=l.tensorflow.magenta.SequenceMetadata.decode(t,t.uint32());break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.id&&t.hasOwnProperty("id")&&!u.isString(t.id))return"id: string expected";if(null!=t.filename&&t.hasOwnProperty("filename")&&!u.isString(t.filename))return"filename: string expected";if(null!=t.referenceNumber&&t.hasOwnProperty("referenceNumber")&&!(u.isInteger(t.referenceNumber)||t.referenceNumber&&u.isInteger(t.referenceNumber.low)&&u.isInteger(t.referenceNumber.high)))return"referenceNumber: integer|Long expected";if(null!=t.collectionName&&t.hasOwnProperty("collectionName")&&!u.isString(t.collectionName))return"collectionName: string expected";if(null!=t.ticksPerQuarter&&t.hasOwnProperty("ticksPerQuarter")&&!u.isInteger(t.ticksPerQuarter))return"ticksPerQuarter: integer expected";if(null!=t.timeSignatures&&t.hasOwnProperty("timeSignatures")){if(!Array.isArray(t.timeSignatures))return"timeSignatures: array expected";for(var e=0;e<t.timeSignatures.length;++e)if(n=l.tensorflow.magenta.NoteSequence.TimeSignature.verify(t.timeSignatures[e]))return"timeSignatures."+n}if(null!=t.keySignatures&&t.hasOwnProperty("keySignatures")){if(!Array.isArray(t.keySignatures))return"keySignatures: array expected";for(e=0;e<t.keySignatures.length;++e)if(n=l.tensorflow.magenta.NoteSequence.KeySignature.verify(t.keySignatures[e]))return"keySignatures."+n}if(null!=t.tempos&&t.hasOwnProperty("tempos")){if(!Array.isArray(t.tempos))return"tempos: array expected";for(e=0;e<t.tempos.length;++e)if(n=l.tensorflow.magenta.NoteSequence.Tempo.verify(t.tempos[e]))return"tempos."+n}if(null!=t.notes&&t.hasOwnProperty("notes")){if(!Array.isArray(t.notes))return"notes: array expected";for(e=0;e<t.notes.length;++e)if(n=l.tensorflow.magenta.NoteSequence.Note.verify(t.notes[e]))return"notes."+n}if(null!=t.totalTime&&t.hasOwnProperty("totalTime")&&"number"!=typeof t.totalTime)return"totalTime: number expected";if(null!=t.totalQuantizedSteps&&t.hasOwnProperty("totalQuantizedSteps")&&!(u.isInteger(t.totalQuantizedSteps)||t.totalQuantizedSteps&&u.isInteger(t.totalQuantizedSteps.low)&&u.isInteger(t.totalQuantizedSteps.high)))return"totalQuantizedSteps: integer|Long expected";if(null!=t.pitchBends&&t.hasOwnProperty("pitchBends")){if(!Array.isArray(t.pitchBends))return"pitchBends: array expected";for(e=0;e<t.pitchBends.length;++e)if(n=l.tensorflow.magenta.NoteSequence.PitchBend.verify(t.pitchBends[e]))return"pitchBends."+n}if(null!=t.controlChanges&&t.hasOwnProperty("controlChanges")){if(!Array.isArray(t.controlChanges))return"controlChanges: array expected";for(e=0;e<t.controlChanges.length;++e)if(n=l.tensorflow.magenta.NoteSequence.ControlChange.verify(t.controlChanges[e]))return"controlChanges."+n}if(null!=t.partInfos&&t.hasOwnProperty("partInfos")){if(!Array.isArray(t.partInfos))return"partInfos: array expected";for(e=0;e<t.partInfos.length;++e)if(n=l.tensorflow.magenta.NoteSequence.PartInfo.verify(t.partInfos[e]))return"partInfos."+n}if(null!=t.sourceInfo&&t.hasOwnProperty("sourceInfo")&&(n=l.tensorflow.magenta.NoteSequence.SourceInfo.verify(t.sourceInfo)))return"sourceInfo."+n;if(null!=t.textAnnotations&&t.hasOwnProperty("textAnnotations")){if(!Array.isArray(t.textAnnotations))return"textAnnotations: array expected";for(e=0;e<t.textAnnotations.length;++e)if(n=l.tensorflow.magenta.NoteSequence.TextAnnotation.verify(t.textAnnotations[e]))return"textAnnotations."+n}if(null!=t.sectionAnnotations&&t.hasOwnProperty("sectionAnnotations")){if(!Array.isArray(t.sectionAnnotations))return"sectionAnnotations: array expected";for(e=0;e<t.sectionAnnotations.length;++e)if(n=l.tensorflow.magenta.NoteSequence.SectionAnnotation.verify(t.sectionAnnotations[e]))return"sectionAnnotations."+n}if(null!=t.sectionGroups&&t.hasOwnProperty("sectionGroups")){if(!Array.isArray(t.sectionGroups))return"sectionGroups: array expected";for(e=0;e<t.sectionGroups.length;++e){var n;if(n=l.tensorflow.magenta.NoteSequence.SectionGroup.verify(t.sectionGroups[e]))return"sectionGroups."+n}}return null!=t.quantizationInfo&&t.hasOwnProperty("quantizationInfo")&&(n=l.tensorflow.magenta.NoteSequence.QuantizationInfo.verify(t.quantizationInfo))?"quantizationInfo."+n:null!=t.subsequenceInfo&&t.hasOwnProperty("subsequenceInfo")&&(n=l.tensorflow.magenta.NoteSequence.SubsequenceInfo.verify(t.subsequenceInfo))?"subsequenceInfo."+n:null!=t.sequenceMetadata&&t.hasOwnProperty("sequenceMetadata")&&(n=l.tensorflow.magenta.SequenceMetadata.verify(t.sequenceMetadata))?"sequenceMetadata."+n:null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence)return t;var e=new l.tensorflow.magenta.NoteSequence;if(null!=t.id&&(e.id=String(t.id)),null!=t.filename&&(e.filename=String(t.filename)),null!=t.referenceNumber&&(u.Long?(e.referenceNumber=u.Long.fromValue(t.referenceNumber)).unsigned=!1:"string"==typeof t.referenceNumber?e.referenceNumber=parseInt(t.referenceNumber,10):"number"==typeof t.referenceNumber?e.referenceNumber=t.referenceNumber:"object"==_typeof(t.referenceNumber)&&(e.referenceNumber=new u.LongBits(t.referenceNumber.low>>>0,t.referenceNumber.high>>>0).toNumber())),null!=t.collectionName&&(e.collectionName=String(t.collectionName)),null!=t.ticksPerQuarter&&(e.ticksPerQuarter=0|t.ticksPerQuarter),t.timeSignatures){if(!Array.isArray(t.timeSignatures))throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: array expected");e.timeSignatures=[];for(var n=0;n<t.timeSignatures.length;++n){if("object"!=_typeof(t.timeSignatures[n]))throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: object expected");e.timeSignatures[n]=l.tensorflow.magenta.NoteSequence.TimeSignature.fromObject(t.timeSignatures[n])}}if(t.keySignatures){if(!Array.isArray(t.keySignatures))throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: array expected");for(e.keySignatures=[],n=0;n<t.keySignatures.length;++n){if("object"!=_typeof(t.keySignatures[n]))throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: object expected");e.keySignatures[n]=l.tensorflow.magenta.NoteSequence.KeySignature.fromObject(t.keySignatures[n])}}if(t.tempos){if(!Array.isArray(t.tempos))throw TypeError(".tensorflow.magenta.NoteSequence.tempos: array expected");for(e.tempos=[],n=0;n<t.tempos.length;++n){if("object"!=_typeof(t.tempos[n]))throw TypeError(".tensorflow.magenta.NoteSequence.tempos: object expected");e.tempos[n]=l.tensorflow.magenta.NoteSequence.Tempo.fromObject(t.tempos[n])}}if(t.notes){if(!Array.isArray(t.notes))throw TypeError(".tensorflow.magenta.NoteSequence.notes: array expected");for(e.notes=[],n=0;n<t.notes.length;++n){if("object"!=_typeof(t.notes[n]))throw TypeError(".tensorflow.magenta.NoteSequence.notes: object expected");e.notes[n]=l.tensorflow.magenta.NoteSequence.Note.fromObject(t.notes[n])}}if(null!=t.totalTime&&(e.totalTime=Number(t.totalTime)),null!=t.totalQuantizedSteps&&(u.Long?(e.totalQuantizedSteps=u.Long.fromValue(t.totalQuantizedSteps)).unsigned=!1:"string"==typeof t.totalQuantizedSteps?e.totalQuantizedSteps=parseInt(t.totalQuantizedSteps,10):"number"==typeof t.totalQuantizedSteps?e.totalQuantizedSteps=t.totalQuantizedSteps:"object"==_typeof(t.totalQuantizedSteps)&&(e.totalQuantizedSteps=new u.LongBits(t.totalQuantizedSteps.low>>>0,t.totalQuantizedSteps.high>>>0).toNumber())),t.pitchBends){if(!Array.isArray(t.pitchBends))throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: array expected");for(e.pitchBends=[],n=0;n<t.pitchBends.length;++n){if("object"!=_typeof(t.pitchBends[n]))throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: object expected");e.pitchBends[n]=l.tensorflow.magenta.NoteSequence.PitchBend.fromObject(t.pitchBends[n])}}if(t.controlChanges){if(!Array.isArray(t.controlChanges))throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: array expected");for(e.controlChanges=[],n=0;n<t.controlChanges.length;++n){if("object"!=_typeof(t.controlChanges[n]))throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: object expected");e.controlChanges[n]=l.tensorflow.magenta.NoteSequence.ControlChange.fromObject(t.controlChanges[n])}}if(t.partInfos){if(!Array.isArray(t.partInfos))throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: array expected");for(e.partInfos=[],n=0;n<t.partInfos.length;++n){if("object"!=_typeof(t.partInfos[n]))throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: object expected");e.partInfos[n]=l.tensorflow.magenta.NoteSequence.PartInfo.fromObject(t.partInfos[n])}}if(null!=t.sourceInfo){if("object"!=_typeof(t.sourceInfo))throw TypeError(".tensorflow.magenta.NoteSequence.sourceInfo: object expected");e.sourceInfo=l.tensorflow.magenta.NoteSequence.SourceInfo.fromObject(t.sourceInfo)}if(t.textAnnotations){if(!Array.isArray(t.textAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: array expected");for(e.textAnnotations=[],n=0;n<t.textAnnotations.length;++n){if("object"!=_typeof(t.textAnnotations[n]))throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: object expected");e.textAnnotations[n]=l.tensorflow.magenta.NoteSequence.TextAnnotation.fromObject(t.textAnnotations[n])}}if(t.sectionAnnotations){if(!Array.isArray(t.sectionAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: array expected");for(e.sectionAnnotations=[],n=0;n<t.sectionAnnotations.length;++n){if("object"!=_typeof(t.sectionAnnotations[n]))throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: object expected");e.sectionAnnotations[n]=l.tensorflow.magenta.NoteSequence.SectionAnnotation.fromObject(t.sectionAnnotations[n])}}if(t.sectionGroups){if(!Array.isArray(t.sectionGroups))throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: array expected");for(e.sectionGroups=[],n=0;n<t.sectionGroups.length;++n){if("object"!=_typeof(t.sectionGroups[n]))throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: object expected");e.sectionGroups[n]=l.tensorflow.magenta.NoteSequence.SectionGroup.fromObject(t.sectionGroups[n])}}if(null!=t.quantizationInfo){if("object"!=_typeof(t.quantizationInfo))throw TypeError(".tensorflow.magenta.NoteSequence.quantizationInfo: object expected");e.quantizationInfo=l.tensorflow.magenta.NoteSequence.QuantizationInfo.fromObject(t.quantizationInfo)}if(null!=t.subsequenceInfo){if("object"!=_typeof(t.subsequenceInfo))throw TypeError(".tensorflow.magenta.NoteSequence.subsequenceInfo: object expected");e.subsequenceInfo=l.tensorflow.magenta.NoteSequence.SubsequenceInfo.fromObject(t.subsequenceInfo)}if(null!=t.sequenceMetadata){if("object"!=_typeof(t.sequenceMetadata))throw TypeError(".tensorflow.magenta.NoteSequence.sequenceMetadata: object expected");e.sequenceMetadata=l.tensorflow.magenta.SequenceMetadata.fromObject(t.sequenceMetadata)}return e},t.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.timeSignatures=[],n.keySignatures=[],n.tempos=[],n.notes=[],n.pitchBends=[],n.controlChanges=[],n.partInfos=[],n.textAnnotations=[],n.sectionAnnotations=[],n.sectionGroups=[]),e.defaults){if(n.id="",n.filename="",n.collectionName="",n.ticksPerQuarter=0,n.totalTime=0,n.sourceInfo=null,n.quantizationInfo=null,u.Long){var i=new u.Long(0,0,!1);n.totalQuantizedSteps=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.totalQuantizedSteps=e.longs===String?"0":0;n.subsequenceInfo=null,u.Long?(i=new u.Long(0,0,!1),n.referenceNumber=e.longs===String?i.toString():e.longs===Number?i.toNumber():i):n.referenceNumber=e.longs===String?"0":0,n.sequenceMetadata=null}if(null!=t.id&&t.hasOwnProperty("id")&&(n.id=t.id),null!=t.filename&&t.hasOwnProperty("filename")&&(n.filename=t.filename),null!=t.collectionName&&t.hasOwnProperty("collectionName")&&(n.collectionName=t.collectionName),null!=t.ticksPerQuarter&&t.hasOwnProperty("ticksPerQuarter")&&(n.ticksPerQuarter=t.ticksPerQuarter),t.timeSignatures&&t.timeSignatures.length){n.timeSignatures=[];for(var r=0;r<t.timeSignatures.length;++r)n.timeSignatures[r]=l.tensorflow.magenta.NoteSequence.TimeSignature.toObject(t.timeSignatures[r],e)}if(t.keySignatures&&t.keySignatures.length)for(n.keySignatures=[],r=0;r<t.keySignatures.length;++r)n.keySignatures[r]=l.tensorflow.magenta.NoteSequence.KeySignature.toObject(t.keySignatures[r],e);if(t.tempos&&t.tempos.length)for(n.tempos=[],r=0;r<t.tempos.length;++r)n.tempos[r]=l.tensorflow.magenta.NoteSequence.Tempo.toObject(t.tempos[r],e);if(t.notes&&t.notes.length)for(n.notes=[],r=0;r<t.notes.length;++r)n.notes[r]=l.tensorflow.magenta.NoteSequence.Note.toObject(t.notes[r],e);if(null!=t.totalTime&&t.hasOwnProperty("totalTime")&&(n.totalTime=e.json&&!isFinite(t.totalTime)?String(t.totalTime):t.totalTime),t.pitchBends&&t.pitchBends.length)for(n.pitchBends=[],r=0;r<t.pitchBends.length;++r)n.pitchBends[r]=l.tensorflow.magenta.NoteSequence.PitchBend.toObject(t.pitchBends[r],e);if(t.controlChanges&&t.controlChanges.length)for(n.controlChanges=[],r=0;r<t.controlChanges.length;++r)n.controlChanges[r]=l.tensorflow.magenta.NoteSequence.ControlChange.toObject(t.controlChanges[r],e);if(t.partInfos&&t.partInfos.length)for(n.partInfos=[],r=0;r<t.partInfos.length;++r)n.partInfos[r]=l.tensorflow.magenta.NoteSequence.PartInfo.toObject(t.partInfos[r],e);if(null!=t.sourceInfo&&t.hasOwnProperty("sourceInfo")&&(n.sourceInfo=l.tensorflow.magenta.NoteSequence.SourceInfo.toObject(t.sourceInfo,e)),t.textAnnotations&&t.textAnnotations.length)for(n.textAnnotations=[],r=0;r<t.textAnnotations.length;++r)n.textAnnotations[r]=l.tensorflow.magenta.NoteSequence.TextAnnotation.toObject(t.textAnnotations[r],e);if(null!=t.quantizationInfo&&t.hasOwnProperty("quantizationInfo")&&(n.quantizationInfo=l.tensorflow.magenta.NoteSequence.QuantizationInfo.toObject(t.quantizationInfo,e)),null!=t.totalQuantizedSteps&&t.hasOwnProperty("totalQuantizedSteps")&&("number"==typeof t.totalQuantizedSteps?n.totalQuantizedSteps=e.longs===String?String(t.totalQuantizedSteps):t.totalQuantizedSteps:n.totalQuantizedSteps=e.longs===String?u.Long.prototype.toString.call(t.totalQuantizedSteps):e.longs===Number?new u.LongBits(t.totalQuantizedSteps.low>>>0,t.totalQuantizedSteps.high>>>0).toNumber():t.totalQuantizedSteps),null!=t.subsequenceInfo&&t.hasOwnProperty("subsequenceInfo")&&(n.subsequenceInfo=l.tensorflow.magenta.NoteSequence.SubsequenceInfo.toObject(t.subsequenceInfo,e)),null!=t.referenceNumber&&t.hasOwnProperty("referenceNumber")&&("number"==typeof t.referenceNumber?n.referenceNumber=e.longs===String?String(t.referenceNumber):t.referenceNumber:n.referenceNumber=e.longs===String?u.Long.prototype.toString.call(t.referenceNumber):e.longs===Number?new u.LongBits(t.referenceNumber.low>>>0,t.referenceNumber.high>>>0).toNumber():t.referenceNumber),null!=t.sequenceMetadata&&t.hasOwnProperty("sequenceMetadata")&&(n.sequenceMetadata=l.tensorflow.magenta.SequenceMetadata.toObject(t.sequenceMetadata,e)),t.sectionAnnotations&&t.sectionAnnotations.length)for(n.sectionAnnotations=[],r=0;r<t.sectionAnnotations.length;++r)n.sectionAnnotations[r]=l.tensorflow.magenta.NoteSequence.SectionAnnotation.toObject(t.sectionAnnotations[r],e);if(t.sectionGroups&&t.sectionGroups.length)for(n.sectionGroups=[],r=0;r<t.sectionGroups.length;++r)n.sectionGroups[r]=l.tensorflow.magenta.NoteSequence.SectionGroup.toObject(t.sectionGroups[r],e);return n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t.Note=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.pitch=0,t.prototype.pitchName=0,t.prototype.velocity=0,t.prototype.startTime=0,t.prototype.quantizedStartStep=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.endTime=0,t.prototype.quantizedEndStep=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.numerator=0,t.prototype.denominator=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.prototype.part=0,t.prototype.voice=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.pitch&&t.hasOwnProperty("pitch")&&e.uint32(8).int32(t.pitch),null!=t.velocity&&t.hasOwnProperty("velocity")&&e.uint32(16).int32(t.velocity),null!=t.startTime&&t.hasOwnProperty("startTime")&&e.uint32(25).double(t.startTime),null!=t.endTime&&t.hasOwnProperty("endTime")&&e.uint32(33).double(t.endTime),null!=t.numerator&&t.hasOwnProperty("numerator")&&e.uint32(40).int32(t.numerator),null!=t.denominator&&t.hasOwnProperty("denominator")&&e.uint32(48).int32(t.denominator),null!=t.instrument&&t.hasOwnProperty("instrument")&&e.uint32(56).int32(t.instrument),null!=t.program&&t.hasOwnProperty("program")&&e.uint32(64).int32(t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&e.uint32(72).bool(t.isDrum),null!=t.part&&t.hasOwnProperty("part")&&e.uint32(80).int32(t.part),null!=t.pitchName&&t.hasOwnProperty("pitchName")&&e.uint32(88).int32(t.pitchName),null!=t.voice&&t.hasOwnProperty("voice")&&e.uint32(96).int32(t.voice),null!=t.quantizedStartStep&&t.hasOwnProperty("quantizedStartStep")&&e.uint32(104).int64(t.quantizedStartStep),null!=t.quantizedEndStep&&t.hasOwnProperty("quantizedEndStep")&&e.uint32(112).int64(t.quantizedEndStep),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.Note;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.pitch=t.int32();break;case 11:i.pitchName=t.int32();break;case 2:i.velocity=t.int32();break;case 3:i.startTime=t.double();break;case 13:i.quantizedStartStep=u.Long?t.int64().toNumber():t.int64();break;case 4:i.endTime=t.double();break;case 14:i.quantizedEndStep=u.Long?t.int64().toNumber():t.int64();break;case 5:i.numerator=t.int32();break;case 6:i.denominator=t.int32();break;case 7:i.instrument=t.int32();break;case 8:i.program=t.int32();break;case 9:i.isDrum=t.bool();break;case 10:i.part=t.int32();break;case 12:i.voice=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.pitch&&t.hasOwnProperty("pitch")&&!u.isInteger(t.pitch))return"pitch: integer expected";if(null!=t.pitchName&&t.hasOwnProperty("pitchName"))switch(t.pitchName){default:return"pitchName: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:}return null!=t.velocity&&t.hasOwnProperty("velocity")&&!u.isInteger(t.velocity)?"velocity: integer expected":null!=t.startTime&&t.hasOwnProperty("startTime")&&"number"!=typeof t.startTime?"startTime: number expected":null!=t.quantizedStartStep&&t.hasOwnProperty("quantizedStartStep")&&!(u.isInteger(t.quantizedStartStep)||t.quantizedStartStep&&u.isInteger(t.quantizedStartStep.low)&&u.isInteger(t.quantizedStartStep.high))?"quantizedStartStep: integer|Long expected":null!=t.endTime&&t.hasOwnProperty("endTime")&&"number"!=typeof t.endTime?"endTime: number expected":null!=t.quantizedEndStep&&t.hasOwnProperty("quantizedEndStep")&&!(u.isInteger(t.quantizedEndStep)||t.quantizedEndStep&&u.isInteger(t.quantizedEndStep.low)&&u.isInteger(t.quantizedEndStep.high))?"quantizedEndStep: integer|Long expected":null!=t.numerator&&t.hasOwnProperty("numerator")&&!u.isInteger(t.numerator)?"numerator: integer expected":null!=t.denominator&&t.hasOwnProperty("denominator")&&!u.isInteger(t.denominator)?"denominator: integer expected":null!=t.instrument&&t.hasOwnProperty("instrument")&&!u.isInteger(t.instrument)?"instrument: integer expected":null!=t.program&&t.hasOwnProperty("program")&&!u.isInteger(t.program)?"program: integer expected":null!=t.isDrum&&t.hasOwnProperty("isDrum")&&"boolean"!=typeof t.isDrum?"isDrum: boolean expected":null!=t.part&&t.hasOwnProperty("part")&&!u.isInteger(t.part)?"part: integer expected":null!=t.voice&&t.hasOwnProperty("voice")&&!u.isInteger(t.voice)?"voice: integer expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.Note)return t;var e=new l.tensorflow.magenta.NoteSequence.Note;switch(null!=t.pitch&&(e.pitch=0|t.pitch),t.pitchName){case"UNKNOWN_PITCH_NAME":case 0:e.pitchName=0;break;case"F_FLAT_FLAT":case 1:e.pitchName=1;break;case"C_FLAT_FLAT":case 2:e.pitchName=2;break;case"G_FLAT_FLAT":case 3:e.pitchName=3;break;case"D_FLAT_FLAT":case 4:e.pitchName=4;break;case"A_FLAT_FLAT":case 5:e.pitchName=5;break;case"E_FLAT_FLAT":case 6:e.pitchName=6;break;case"B_FLAT_FLAT":case 7:e.pitchName=7;break;case"F_FLAT":case 8:e.pitchName=8;break;case"C_FLAT":case 9:e.pitchName=9;break;case"G_FLAT":case 10:e.pitchName=10;break;case"D_FLAT":case 11:e.pitchName=11;break;case"A_FLAT":case 12:e.pitchName=12;break;case"E_FLAT":case 13:e.pitchName=13;break;case"B_FLAT":case 14:e.pitchName=14;break;case"F":case 15:e.pitchName=15;break;case"C":case 16:e.pitchName=16;break;case"G":case 17:e.pitchName=17;break;case"D":case 18:e.pitchName=18;break;case"A":case 19:e.pitchName=19;break;case"E":case 20:e.pitchName=20;break;case"B":case 21:e.pitchName=21;break;case"F_SHARP":case 22:e.pitchName=22;break;case"C_SHARP":case 23:e.pitchName=23;break;case"G_SHARP":case 24:e.pitchName=24;break;case"D_SHARP":case 25:e.pitchName=25;break;case"A_SHARP":case 26:e.pitchName=26;break;case"E_SHARP":case 27:e.pitchName=27;break;case"B_SHARP":case 28:e.pitchName=28;break;case"F_SHARP_SHARP":case 29:e.pitchName=29;break;case"C_SHARP_SHARP":case 30:e.pitchName=30;break;case"G_SHARP_SHARP":case 31:e.pitchName=31;break;case"D_SHARP_SHARP":case 32:e.pitchName=32;break;case"A_SHARP_SHARP":case 33:e.pitchName=33;break;case"E_SHARP_SHARP":case 34:e.pitchName=34;break;case"B_SHARP_SHARP":case 35:e.pitchName=35}return null!=t.velocity&&(e.velocity=0|t.velocity),null!=t.startTime&&(e.startTime=Number(t.startTime)),null!=t.quantizedStartStep&&(u.Long?(e.quantizedStartStep=u.Long.fromValue(t.quantizedStartStep)).unsigned=!1:"string"==typeof t.quantizedStartStep?e.quantizedStartStep=parseInt(t.quantizedStartStep,10):"number"==typeof t.quantizedStartStep?e.quantizedStartStep=t.quantizedStartStep:"object"==_typeof(t.quantizedStartStep)&&(e.quantizedStartStep=new u.LongBits(t.quantizedStartStep.low>>>0,t.quantizedStartStep.high>>>0).toNumber())),null!=t.endTime&&(e.endTime=Number(t.endTime)),null!=t.quantizedEndStep&&(u.Long?(e.quantizedEndStep=u.Long.fromValue(t.quantizedEndStep)).unsigned=!1:"string"==typeof t.quantizedEndStep?e.quantizedEndStep=parseInt(t.quantizedEndStep,10):"number"==typeof t.quantizedEndStep?e.quantizedEndStep=t.quantizedEndStep:"object"==_typeof(t.quantizedEndStep)&&(e.quantizedEndStep=new u.LongBits(t.quantizedEndStep.low>>>0,t.quantizedEndStep.high>>>0).toNumber())),null!=t.numerator&&(e.numerator=0|t.numerator),null!=t.denominator&&(e.denominator=0|t.denominator),null!=t.instrument&&(e.instrument=0|t.instrument),null!=t.program&&(e.program=0|t.program),null!=t.isDrum&&(e.isDrum=Boolean(t.isDrum)),null!=t.part&&(e.part=0|t.part),null!=t.voice&&(e.voice=0|t.voice),e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults){if(n.pitch=0,n.velocity=0,n.startTime=0,n.endTime=0,n.numerator=0,n.denominator=0,n.instrument=0,n.program=0,n.isDrum=!1,n.part=0,n.pitchName=e.enums===String?"UNKNOWN_PITCH_NAME":0,n.voice=0,u.Long){var i=new u.Long(0,0,!1);n.quantizedStartStep=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.quantizedStartStep=e.longs===String?"0":0;u.Long?(i=new u.Long(0,0,!1),n.quantizedEndStep=e.longs===String?i.toString():e.longs===Number?i.toNumber():i):n.quantizedEndStep=e.longs===String?"0":0}return null!=t.pitch&&t.hasOwnProperty("pitch")&&(n.pitch=t.pitch),null!=t.velocity&&t.hasOwnProperty("velocity")&&(n.velocity=t.velocity),null!=t.startTime&&t.hasOwnProperty("startTime")&&(n.startTime=e.json&&!isFinite(t.startTime)?String(t.startTime):t.startTime),null!=t.endTime&&t.hasOwnProperty("endTime")&&(n.endTime=e.json&&!isFinite(t.endTime)?String(t.endTime):t.endTime),null!=t.numerator&&t.hasOwnProperty("numerator")&&(n.numerator=t.numerator),null!=t.denominator&&t.hasOwnProperty("denominator")&&(n.denominator=t.denominator),null!=t.instrument&&t.hasOwnProperty("instrument")&&(n.instrument=t.instrument),null!=t.program&&t.hasOwnProperty("program")&&(n.program=t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&(n.isDrum=t.isDrum),null!=t.part&&t.hasOwnProperty("part")&&(n.part=t.part),null!=t.pitchName&&t.hasOwnProperty("pitchName")&&(n.pitchName=e.enums===String?l.tensorflow.magenta.NoteSequence.PitchName[t.pitchName]:t.pitchName),null!=t.voice&&t.hasOwnProperty("voice")&&(n.voice=t.voice),null!=t.quantizedStartStep&&t.hasOwnProperty("quantizedStartStep")&&("number"==typeof t.quantizedStartStep?n.quantizedStartStep=e.longs===String?String(t.quantizedStartStep):t.quantizedStartStep:n.quantizedStartStep=e.longs===String?u.Long.prototype.toString.call(t.quantizedStartStep):e.longs===Number?new u.LongBits(t.quantizedStartStep.low>>>0,t.quantizedStartStep.high>>>0).toNumber():t.quantizedStartStep),null!=t.quantizedEndStep&&t.hasOwnProperty("quantizedEndStep")&&("number"==typeof t.quantizedEndStep?n.quantizedEndStep=e.longs===String?String(t.quantizedEndStep):t.quantizedEndStep:n.quantizedEndStep=e.longs===String?u.Long.prototype.toString.call(t.quantizedEndStep):e.longs===Number?new u.LongBits(t.quantizedEndStep.low>>>0,t.quantizedEndStep.high>>>0).toNumber():t.quantizedEndStep),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.PitchName=(e={},(n=Object.create(e))[e[0]="UNKNOWN_PITCH_NAME"]=0,n[e[1]="F_FLAT_FLAT"]=1,n[e[2]="C_FLAT_FLAT"]=2,n[e[3]="G_FLAT_FLAT"]=3,n[e[4]="D_FLAT_FLAT"]=4,n[e[5]="A_FLAT_FLAT"]=5,n[e[6]="E_FLAT_FLAT"]=6,n[e[7]="B_FLAT_FLAT"]=7,n[e[8]="F_FLAT"]=8,n[e[9]="C_FLAT"]=9,n[e[10]="G_FLAT"]=10,n[e[11]="D_FLAT"]=11,n[e[12]="A_FLAT"]=12,n[e[13]="E_FLAT"]=13,n[e[14]="B_FLAT"]=14,n[e[15]="F"]=15,n[e[16]="C"]=16,n[e[17]="G"]=17,n[e[18]="D"]=18,n[e[19]="A"]=19,n[e[20]="E"]=20,n[e[21]="B"]=21,n[e[22]="F_SHARP"]=22,n[e[23]="C_SHARP"]=23,n[e[24]="G_SHARP"]=24,n[e[25]="D_SHARP"]=25,n[e[26]="A_SHARP"]=26,n[e[27]="E_SHARP"]=27,n[e[28]="B_SHARP"]=28,n[e[29]="F_SHARP_SHARP"]=29,n[e[30]="C_SHARP_SHARP"]=30,n[e[31]="G_SHARP_SHARP"]=31,n[e[32]="D_SHARP_SHARP"]=32,n[e[33]="A_SHARP_SHARP"]=33,n[e[34]="E_SHARP_SHARP"]=34,n[e[35]="B_SHARP_SHARP"]=35,n),t.TimeSignature=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.numerator=0,t.prototype.denominator=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.numerator&&t.hasOwnProperty("numerator")&&e.uint32(16).int32(t.numerator),null!=t.denominator&&t.hasOwnProperty("denominator")&&e.uint32(24).int32(t.denominator),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.TimeSignature;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 2:i.numerator=t.int32();break;case 3:i.denominator=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time?"time: number expected":null!=t.numerator&&t.hasOwnProperty("numerator")&&!u.isInteger(t.numerator)?"numerator: integer expected":null!=t.denominator&&t.hasOwnProperty("denominator")&&!u.isInteger(t.denominator)?"denominator: integer expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.TimeSignature)return t;var e=new l.tensorflow.magenta.NoteSequence.TimeSignature;return null!=t.time&&(e.time=Number(t.time)),null!=t.numerator&&(e.numerator=0|t.numerator),null!=t.denominator&&(e.denominator=0|t.denominator),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.time=0,n.numerator=0,n.denominator=0),null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.numerator&&t.hasOwnProperty("numerator")&&(n.numerator=t.numerator),null!=t.denominator&&t.hasOwnProperty("denominator")&&(n.denominator=t.denominator),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.KeySignature=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.key=0,t.prototype.mode=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.key&&t.hasOwnProperty("key")&&e.uint32(16).int32(t.key),null!=t.mode&&t.hasOwnProperty("mode")&&e.uint32(24).int32(t.mode),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.KeySignature;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 2:i.key=t.int32();break;case 3:i.mode=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time)return"time: number expected";if(null!=t.key&&t.hasOwnProperty("key"))switch(t.key){default:return"key: enum value expected";case 0:case 1:case 1:case 2:case 3:case 3:case 4:case 5:case 6:case 6:case 7:case 8:case 8:case 9:case 10:case 10:case 11:}if(null!=t.mode&&t.hasOwnProperty("mode"))switch(t.mode){default:return"mode: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.KeySignature)return t;var e=new l.tensorflow.magenta.NoteSequence.KeySignature;switch(null!=t.time&&(e.time=Number(t.time)),t.key){case"C":case 0:e.key=0;break;case"C_SHARP":case 1:e.key=1;break;case"D_FLAT":case 1:e.key=1;break;case"D":case 2:e.key=2;break;case"D_SHARP":case 3:e.key=3;break;case"E_FLAT":case 3:e.key=3;break;case"E":case 4:e.key=4;break;case"F":case 5:e.key=5;break;case"F_SHARP":case 6:e.key=6;break;case"G_FLAT":case 6:e.key=6;break;case"G":case 7:e.key=7;break;case"G_SHARP":case 8:e.key=8;break;case"A_FLAT":case 8:e.key=8;break;case"A":case 9:e.key=9;break;case"A_SHARP":case 10:e.key=10;break;case"B_FLAT":case 10:e.key=10;break;case"B":case 11:e.key=11}switch(t.mode){case"MAJOR":case 0:e.mode=0;break;case"MINOR":case 1:e.mode=1;break;case"NOT_SPECIFIED":case 2:e.mode=2;break;case"MIXOLYDIAN":case 3:e.mode=3;break;case"DORIAN":case 4:e.mode=4;break;case"PHRYGIAN":case 5:e.mode=5;break;case"LYDIAN":case 6:e.mode=6;break;case"LOCRIAN":case 7:e.mode=7}return e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.time=0,n.key=e.enums===String?"C":0,n.mode=e.enums===String?"MAJOR":0),null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.key&&t.hasOwnProperty("key")&&(n.key=e.enums===String?l.tensorflow.magenta.NoteSequence.KeySignature.Key[t.key]:t.key),null!=t.mode&&t.hasOwnProperty("mode")&&(n.mode=e.enums===String?l.tensorflow.magenta.NoteSequence.KeySignature.Mode[t.mode]:t.mode),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t.Key=function(){var t={},e=Object.create(t);return e[t[0]="C"]=0,e[t[1]="C_SHARP"]=1,e.D_FLAT=1,e[t[2]="D"]=2,e[t[3]="D_SHARP"]=3,e.E_FLAT=3,e[t[4]="E"]=4,e[t[5]="F"]=5,e[t[6]="F_SHARP"]=6,e.G_FLAT=6,e[t[7]="G"]=7,e[t[8]="G_SHARP"]=8,e.A_FLAT=8,e[t[9]="A"]=9,e[t[10]="A_SHARP"]=10,e.B_FLAT=10,e[t[11]="B"]=11,e}(),t.Mode=function(){var t={},e=Object.create(t);return e[t[0]="MAJOR"]=0,e[t[1]="MINOR"]=1,e[t[2]="NOT_SPECIFIED"]=2,e[t[3]="MIXOLYDIAN"]=3,e[t[4]="DORIAN"]=4,e[t[5]="PHRYGIAN"]=5,e[t[6]="LYDIAN"]=6,e[t[7]="LOCRIAN"]=7,e}(),t}(),t.Tempo=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.qpm=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.qpm&&t.hasOwnProperty("qpm")&&e.uint32(17).double(t.qpm),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.Tempo;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 2:i.qpm=t.double();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time?"time: number expected":null!=t.qpm&&t.hasOwnProperty("qpm")&&"number"!=typeof t.qpm?"qpm: number expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.Tempo)return t;var e=new l.tensorflow.magenta.NoteSequence.Tempo;return null!=t.time&&(e.time=Number(t.time)),null!=t.qpm&&(e.qpm=Number(t.qpm)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.time=0,n.qpm=0),null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.qpm&&t.hasOwnProperty("qpm")&&(n.qpm=e.json&&!isFinite(t.qpm)?String(t.qpm):t.qpm),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.PitchBend=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.bend=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.bend&&t.hasOwnProperty("bend")&&e.uint32(16).int32(t.bend),null!=t.instrument&&t.hasOwnProperty("instrument")&&e.uint32(24).int32(t.instrument),null!=t.program&&t.hasOwnProperty("program")&&e.uint32(32).int32(t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&e.uint32(40).bool(t.isDrum),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.PitchBend;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 2:i.bend=t.int32();break;case 3:i.instrument=t.int32();break;case 4:i.program=t.int32();break;case 5:i.isDrum=t.bool();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time?"time: number expected":null!=t.bend&&t.hasOwnProperty("bend")&&!u.isInteger(t.bend)?"bend: integer expected":null!=t.instrument&&t.hasOwnProperty("instrument")&&!u.isInteger(t.instrument)?"instrument: integer expected":null!=t.program&&t.hasOwnProperty("program")&&!u.isInteger(t.program)?"program: integer expected":null!=t.isDrum&&t.hasOwnProperty("isDrum")&&"boolean"!=typeof t.isDrum?"isDrum: boolean expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.PitchBend)return t;var e=new l.tensorflow.magenta.NoteSequence.PitchBend;return null!=t.time&&(e.time=Number(t.time)),null!=t.bend&&(e.bend=0|t.bend),null!=t.instrument&&(e.instrument=0|t.instrument),null!=t.program&&(e.program=0|t.program),null!=t.isDrum&&(e.isDrum=Boolean(t.isDrum)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.time=0,n.bend=0,n.instrument=0,n.program=0,n.isDrum=!1),null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.bend&&t.hasOwnProperty("bend")&&(n.bend=t.bend),null!=t.instrument&&t.hasOwnProperty("instrument")&&(n.instrument=t.instrument),null!=t.program&&t.hasOwnProperty("program")&&(n.program=t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&(n.isDrum=t.isDrum),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.ControlChange=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.quantizedStep=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.controlNumber=0,t.prototype.controlValue=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.controlNumber&&t.hasOwnProperty("controlNumber")&&e.uint32(16).int32(t.controlNumber),null!=t.controlValue&&t.hasOwnProperty("controlValue")&&e.uint32(24).int32(t.controlValue),null!=t.instrument&&t.hasOwnProperty("instrument")&&e.uint32(32).int32(t.instrument),null!=t.program&&t.hasOwnProperty("program")&&e.uint32(40).int32(t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&e.uint32(48).bool(t.isDrum),null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&e.uint32(56).int64(t.quantizedStep),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.ControlChange;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 7:i.quantizedStep=u.Long?t.int64().toNumber():t.int64();break;case 2:i.controlNumber=t.int32();break;case 3:i.controlValue=t.int32();break;case 4:i.instrument=t.int32();break;case 5:i.program=t.int32();break;case 6:i.isDrum=t.bool();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time?"time: number expected":null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&!(u.isInteger(t.quantizedStep)||t.quantizedStep&&u.isInteger(t.quantizedStep.low)&&u.isInteger(t.quantizedStep.high))?"quantizedStep: integer|Long expected":null!=t.controlNumber&&t.hasOwnProperty("controlNumber")&&!u.isInteger(t.controlNumber)?"controlNumber: integer expected":null!=t.controlValue&&t.hasOwnProperty("controlValue")&&!u.isInteger(t.controlValue)?"controlValue: integer expected":null!=t.instrument&&t.hasOwnProperty("instrument")&&!u.isInteger(t.instrument)?"instrument: integer expected":null!=t.program&&t.hasOwnProperty("program")&&!u.isInteger(t.program)?"program: integer expected":null!=t.isDrum&&t.hasOwnProperty("isDrum")&&"boolean"!=typeof t.isDrum?"isDrum: boolean expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.ControlChange)return t;var e=new l.tensorflow.magenta.NoteSequence.ControlChange;return null!=t.time&&(e.time=Number(t.time)),null!=t.quantizedStep&&(u.Long?(e.quantizedStep=u.Long.fromValue(t.quantizedStep)).unsigned=!1:"string"==typeof t.quantizedStep?e.quantizedStep=parseInt(t.quantizedStep,10):"number"==typeof t.quantizedStep?e.quantizedStep=t.quantizedStep:"object"==_typeof(t.quantizedStep)&&(e.quantizedStep=new u.LongBits(t.quantizedStep.low>>>0,t.quantizedStep.high>>>0).toNumber())),null!=t.controlNumber&&(e.controlNumber=0|t.controlNumber),null!=t.controlValue&&(e.controlValue=0|t.controlValue),null!=t.instrument&&(e.instrument=0|t.instrument),null!=t.program&&(e.program=0|t.program),null!=t.isDrum&&(e.isDrum=Boolean(t.isDrum)),e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults)if(n.time=0,n.controlNumber=0,n.controlValue=0,n.instrument=0,n.program=0,n.isDrum=!1,u.Long){var i=new u.Long(0,0,!1);n.quantizedStep=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.quantizedStep=e.longs===String?"0":0;return null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.controlNumber&&t.hasOwnProperty("controlNumber")&&(n.controlNumber=t.controlNumber),null!=t.controlValue&&t.hasOwnProperty("controlValue")&&(n.controlValue=t.controlValue),null!=t.instrument&&t.hasOwnProperty("instrument")&&(n.instrument=t.instrument),null!=t.program&&t.hasOwnProperty("program")&&(n.program=t.program),null!=t.isDrum&&t.hasOwnProperty("isDrum")&&(n.isDrum=t.isDrum),null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&("number"==typeof t.quantizedStep?n.quantizedStep=e.longs===String?String(t.quantizedStep):t.quantizedStep:n.quantizedStep=e.longs===String?u.Long.prototype.toString.call(t.quantizedStep):e.longs===Number?new u.LongBits(t.quantizedStep.low>>>0,t.quantizedStep.high>>>0).toNumber():t.quantizedStep),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.PartInfo=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.part=0,t.prototype.name="",t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.part&&t.hasOwnProperty("part")&&e.uint32(8).int32(t.part),null!=t.name&&t.hasOwnProperty("name")&&e.uint32(18).string(t.name),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.PartInfo;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.part=t.int32();break;case 2:i.name=t.string();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.part&&t.hasOwnProperty("part")&&!u.isInteger(t.part)?"part: integer expected":null!=t.name&&t.hasOwnProperty("name")&&!u.isString(t.name)?"name: string expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.PartInfo)return t;var e=new l.tensorflow.magenta.NoteSequence.PartInfo;return null!=t.part&&(e.part=0|t.part),null!=t.name&&(e.name=String(t.name)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.part=0,n.name=""),null!=t.part&&t.hasOwnProperty("part")&&(n.part=t.part),null!=t.name&&t.hasOwnProperty("name")&&(n.name=t.name),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.SourceInfo=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.sourceType=0,t.prototype.encodingType=0,t.prototype.parser=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.sourceType&&t.hasOwnProperty("sourceType")&&e.uint32(8).int32(t.sourceType),null!=t.encodingType&&t.hasOwnProperty("encodingType")&&e.uint32(16).int32(t.encodingType),null!=t.parser&&t.hasOwnProperty("parser")&&e.uint32(24).int32(t.parser),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.SourceInfo;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.sourceType=t.int32();break;case 2:i.encodingType=t.int32();break;case 3:i.parser=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.sourceType&&t.hasOwnProperty("sourceType"))switch(t.sourceType){default:return"sourceType: enum value expected";case 0:case 1:case 2:}if(null!=t.encodingType&&t.hasOwnProperty("encodingType"))switch(t.encodingType){default:return"encodingType: enum value expected";case 0:case 1:case 2:case 3:case 4:}if(null!=t.parser&&t.hasOwnProperty("parser"))switch(t.parser){default:return"parser: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.SourceInfo)return t;var e=new l.tensorflow.magenta.NoteSequence.SourceInfo;switch(t.sourceType){case"UNKNOWN_SOURCE_TYPE":case 0:e.sourceType=0;break;case"SCORE_BASED":case 1:e.sourceType=1;break;case"PERFORMANCE_BASED":case 2:e.sourceType=2}switch(t.encodingType){case"UNKNOWN_ENCODING_TYPE":case 0:e.encodingType=0;break;case"MUSIC_XML":case 1:e.encodingType=1;break;case"ABC":case 2:e.encodingType=2;break;case"MIDI":case 3:e.encodingType=3;break;case"MUSICNET":case 4:e.encodingType=4}switch(t.parser){case"UNKNOWN_PARSER":case 0:e.parser=0;break;case"MUSIC21":case 1:e.parser=1;break;case"PRETTY_MIDI":case 2:e.parser=2;break;case"MAGENTA_MUSIC_XML":case 3:e.parser=3;break;case"MAGENTA_MUSICNET":case 4:e.parser=4;break;case"MAGENTA_ABC":case 5:e.parser=5;break;case"TONEJS_MIDI_CONVERT":case 6:e.parser=6}return e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.sourceType=e.enums===String?"UNKNOWN_SOURCE_TYPE":0,n.encodingType=e.enums===String?"UNKNOWN_ENCODING_TYPE":0,n.parser=e.enums===String?"UNKNOWN_PARSER":0),null!=t.sourceType&&t.hasOwnProperty("sourceType")&&(n.sourceType=e.enums===String?l.tensorflow.magenta.NoteSequence.SourceInfo.SourceType[t.sourceType]:t.sourceType),null!=t.encodingType&&t.hasOwnProperty("encodingType")&&(n.encodingType=e.enums===String?l.tensorflow.magenta.NoteSequence.SourceInfo.EncodingType[t.encodingType]:t.encodingType),null!=t.parser&&t.hasOwnProperty("parser")&&(n.parser=e.enums===String?l.tensorflow.magenta.NoteSequence.SourceInfo.Parser[t.parser]:t.parser),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t.SourceType=function(){var t={},e=Object.create(t);return e[t[0]="UNKNOWN_SOURCE_TYPE"]=0,e[t[1]="SCORE_BASED"]=1,e[t[2]="PERFORMANCE_BASED"]=2,e}(),t.EncodingType=function(){var t={},e=Object.create(t);return e[t[0]="UNKNOWN_ENCODING_TYPE"]=0,e[t[1]="MUSIC_XML"]=1,e[t[2]="ABC"]=2,e[t[3]="MIDI"]=3,e[t[4]="MUSICNET"]=4,e}(),t.Parser=function(){var t={},e=Object.create(t);return e[t[0]="UNKNOWN_PARSER"]=0,e[t[1]="MUSIC21"]=1,e[t[2]="PRETTY_MIDI"]=2,e[t[3]="MAGENTA_MUSIC_XML"]=3,e[t[4]="MAGENTA_MUSICNET"]=4,e[t[5]="MAGENTA_ABC"]=5,e[t[6]="TONEJS_MIDI_CONVERT"]=6,e}(),t}(),t.TextAnnotation=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.quantizedStep=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.text="",t.prototype.annotationType=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.text&&t.hasOwnProperty("text")&&e.uint32(18).string(t.text),null!=t.annotationType&&t.hasOwnProperty("annotationType")&&e.uint32(24).int32(t.annotationType),null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&e.uint32(32).int64(t.quantizedStep),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.TextAnnotation;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 4:i.quantizedStep=u.Long?t.int64().toNumber():t.int64();break;case 2:i.text=t.string();break;case 3:i.annotationType=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time)return"time: number expected";if(null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&!(u.isInteger(t.quantizedStep)||t.quantizedStep&&u.isInteger(t.quantizedStep.low)&&u.isInteger(t.quantizedStep.high)))return"quantizedStep: integer|Long expected";if(null!=t.text&&t.hasOwnProperty("text")&&!u.isString(t.text))return"text: string expected";if(null!=t.annotationType&&t.hasOwnProperty("annotationType"))switch(t.annotationType){default:return"annotationType: enum value expected";case 0:case 1:case 2:}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.TextAnnotation)return t;var e=new l.tensorflow.magenta.NoteSequence.TextAnnotation;switch(null!=t.time&&(e.time=Number(t.time)),null!=t.quantizedStep&&(u.Long?(e.quantizedStep=u.Long.fromValue(t.quantizedStep)).unsigned=!1:"string"==typeof t.quantizedStep?e.quantizedStep=parseInt(t.quantizedStep,10):"number"==typeof t.quantizedStep?e.quantizedStep=t.quantizedStep:"object"==_typeof(t.quantizedStep)&&(e.quantizedStep=new u.LongBits(t.quantizedStep.low>>>0,t.quantizedStep.high>>>0).toNumber())),null!=t.text&&(e.text=String(t.text)),t.annotationType){case"UNKNOWN":case 0:e.annotationType=0;break;case"CHORD_SYMBOL":case 1:e.annotationType=1;break;case"BEAT":case 2:e.annotationType=2}return e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults)if(n.time=0,n.text="",n.annotationType=e.enums===String?"UNKNOWN":0,u.Long){var i=new u.Long(0,0,!1);n.quantizedStep=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.quantizedStep=e.longs===String?"0":0;return null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.text&&t.hasOwnProperty("text")&&(n.text=t.text),null!=t.annotationType&&t.hasOwnProperty("annotationType")&&(n.annotationType=e.enums===String?l.tensorflow.magenta.NoteSequence.TextAnnotation.TextAnnotationType[t.annotationType]:t.annotationType),null!=t.quantizedStep&&t.hasOwnProperty("quantizedStep")&&("number"==typeof t.quantizedStep?n.quantizedStep=e.longs===String?String(t.quantizedStep):t.quantizedStep:n.quantizedStep=e.longs===String?u.Long.prototype.toString.call(t.quantizedStep):e.longs===Number?new u.LongBits(t.quantizedStep.low>>>0,t.quantizedStep.high>>>0).toNumber():t.quantizedStep),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t.TextAnnotationType=function(){var t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="CHORD_SYMBOL"]=1,e[t[2]="BEAT"]=2,e}(),t}(),t.QuantizationInfo=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}var e;return t.prototype.stepsPerQuarter=0,t.prototype.stepsPerSecond=0,Object.defineProperty(t.prototype,"resolution",{get:u.oneOfGetter(e=["stepsPerQuarter","stepsPerSecond"]),set:u.oneOfSetter(e)}),t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.stepsPerQuarter&&t.hasOwnProperty("stepsPerQuarter")&&e.uint32(8).int32(t.stepsPerQuarter),null!=t.stepsPerSecond&&t.hasOwnProperty("stepsPerSecond")&&e.uint32(16).int32(t.stepsPerSecond),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.QuantizationInfo;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.stepsPerQuarter=t.int32();break;case 2:i.stepsPerSecond=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";var e={};if(null!=t.stepsPerQuarter&&t.hasOwnProperty("stepsPerQuarter")&&(e.resolution=1,!u.isInteger(t.stepsPerQuarter)))return"stepsPerQuarter: integer expected";if(null!=t.stepsPerSecond&&t.hasOwnProperty("stepsPerSecond")){if(1===e.resolution)return"resolution: multiple values";if(e.resolution=1,!u.isInteger(t.stepsPerSecond))return"stepsPerSecond: integer expected"}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.QuantizationInfo)return t;var e=new l.tensorflow.magenta.NoteSequence.QuantizationInfo;return null!=t.stepsPerQuarter&&(e.stepsPerQuarter=0|t.stepsPerQuarter),null!=t.stepsPerSecond&&(e.stepsPerSecond=0|t.stepsPerSecond),e},t.toObject=function(t,e){e||(e={});var n={};return null!=t.stepsPerQuarter&&t.hasOwnProperty("stepsPerQuarter")&&(n.stepsPerQuarter=t.stepsPerQuarter,e.oneofs&&(n.resolution="stepsPerQuarter")),null!=t.stepsPerSecond&&t.hasOwnProperty("stepsPerSecond")&&(n.stepsPerSecond=t.stepsPerSecond,e.oneofs&&(n.resolution="stepsPerSecond")),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.SubsequenceInfo=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.startTimeOffset=0,t.prototype.endTimeOffset=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.startTimeOffset&&t.hasOwnProperty("startTimeOffset")&&e.uint32(9).double(t.startTimeOffset),null!=t.endTimeOffset&&t.hasOwnProperty("endTimeOffset")&&e.uint32(17).double(t.endTimeOffset),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.SubsequenceInfo;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.startTimeOffset=t.double();break;case 2:i.endTimeOffset=t.double();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.startTimeOffset&&t.hasOwnProperty("startTimeOffset")&&"number"!=typeof t.startTimeOffset?"startTimeOffset: number expected":null!=t.endTimeOffset&&t.hasOwnProperty("endTimeOffset")&&"number"!=typeof t.endTimeOffset?"endTimeOffset: number expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.SubsequenceInfo)return t;var e=new l.tensorflow.magenta.NoteSequence.SubsequenceInfo;return null!=t.startTimeOffset&&(e.startTimeOffset=Number(t.startTimeOffset)),null!=t.endTimeOffset&&(e.endTimeOffset=Number(t.endTimeOffset)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.startTimeOffset=0,n.endTimeOffset=0),null!=t.startTimeOffset&&t.hasOwnProperty("startTimeOffset")&&(n.startTimeOffset=e.json&&!isFinite(t.startTimeOffset)?String(t.startTimeOffset):t.startTimeOffset),null!=t.endTimeOffset&&t.hasOwnProperty("endTimeOffset")&&(n.endTimeOffset=e.json&&!isFinite(t.endTimeOffset)?String(t.endTimeOffset):t.endTimeOffset),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.SectionAnnotation=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.time=0,t.prototype.sectionId=u.Long?u.Long.fromBits(0,0,!1):0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.time&&t.hasOwnProperty("time")&&e.uint32(9).double(t.time),null!=t.sectionId&&t.hasOwnProperty("sectionId")&&e.uint32(32).int64(t.sectionId),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.SectionAnnotation;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.time=t.double();break;case 4:i.sectionId=u.Long?t.int64().toNumber():t.int64();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.time&&t.hasOwnProperty("time")&&"number"!=typeof t.time?"time: number expected":null!=t.sectionId&&t.hasOwnProperty("sectionId")&&!(u.isInteger(t.sectionId)||t.sectionId&&u.isInteger(t.sectionId.low)&&u.isInteger(t.sectionId.high))?"sectionId: integer|Long expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.SectionAnnotation)return t;var e=new l.tensorflow.magenta.NoteSequence.SectionAnnotation;return null!=t.time&&(e.time=Number(t.time)),null!=t.sectionId&&(u.Long?(e.sectionId=u.Long.fromValue(t.sectionId)).unsigned=!1:"string"==typeof t.sectionId?e.sectionId=parseInt(t.sectionId,10):"number"==typeof t.sectionId?e.sectionId=t.sectionId:"object"==_typeof(t.sectionId)&&(e.sectionId=new u.LongBits(t.sectionId.low>>>0,t.sectionId.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults)if(n.time=0,u.Long){var i=new u.Long(0,0,!1);n.sectionId=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else n.sectionId=e.longs===String?"0":0;return null!=t.time&&t.hasOwnProperty("time")&&(n.time=e.json&&!isFinite(t.time)?String(t.time):t.time),null!=t.sectionId&&t.hasOwnProperty("sectionId")&&("number"==typeof t.sectionId?n.sectionId=e.longs===String?String(t.sectionId):t.sectionId:n.sectionId=e.longs===String?u.Long.prototype.toString.call(t.sectionId):e.longs===Number?new u.LongBits(t.sectionId.low>>>0,t.sectionId.high>>>0).toNumber():t.sectionId),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.Section=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}var e;return t.prototype.sectionId=u.Long?u.Long.fromBits(0,0,!1):0,t.prototype.sectionGroup=null,Object.defineProperty(t.prototype,"sectionType",{get:u.oneOfGetter(e=["sectionId","sectionGroup"]),set:u.oneOfSetter(e)}),t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.sectionId&&t.hasOwnProperty("sectionId")&&e.uint32(8).int64(t.sectionId),null!=t.sectionGroup&&t.hasOwnProperty("sectionGroup")&&l.tensorflow.magenta.NoteSequence.SectionGroup.encode(t.sectionGroup,e.uint32(18).fork()).ldelim(),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.Section;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.sectionId=u.Long?t.int64().toNumber():t.int64();break;case 2:i.sectionGroup=l.tensorflow.magenta.NoteSequence.SectionGroup.decode(t,t.uint32());break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";var e={};if(null!=t.sectionId&&t.hasOwnProperty("sectionId")&&(e.sectionType=1,!(u.isInteger(t.sectionId)||t.sectionId&&u.isInteger(t.sectionId.low)&&u.isInteger(t.sectionId.high))))return"sectionId: integer|Long expected";if(null!=t.sectionGroup&&t.hasOwnProperty("sectionGroup")){if(1===e.sectionType)return"sectionType: multiple values";e.sectionType=1;var n=l.tensorflow.magenta.NoteSequence.SectionGroup.verify(t.sectionGroup);if(n)return"sectionGroup."+n}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.Section)return t;var e=new l.tensorflow.magenta.NoteSequence.Section;if(null!=t.sectionId&&(u.Long?(e.sectionId=u.Long.fromValue(t.sectionId)).unsigned=!1:"string"==typeof t.sectionId?e.sectionId=parseInt(t.sectionId,10):"number"==typeof t.sectionId?e.sectionId=t.sectionId:"object"==_typeof(t.sectionId)&&(e.sectionId=new u.LongBits(t.sectionId.low>>>0,t.sectionId.high>>>0).toNumber())),null!=t.sectionGroup){if("object"!=_typeof(t.sectionGroup))throw TypeError(".tensorflow.magenta.NoteSequence.Section.sectionGroup: object expected");e.sectionGroup=l.tensorflow.magenta.NoteSequence.SectionGroup.fromObject(t.sectionGroup)}return e},t.toObject=function(t,e){e||(e={});var n={};return null!=t.sectionId&&t.hasOwnProperty("sectionId")&&("number"==typeof t.sectionId?n.sectionId=e.longs===String?String(t.sectionId):t.sectionId:n.sectionId=e.longs===String?u.Long.prototype.toString.call(t.sectionId):e.longs===Number?new u.LongBits(t.sectionId.low>>>0,t.sectionId.high>>>0).toNumber():t.sectionId,e.oneofs&&(n.sectionType="sectionId")),null!=t.sectionGroup&&t.hasOwnProperty("sectionGroup")&&(n.sectionGroup=l.tensorflow.magenta.NoteSequence.SectionGroup.toObject(t.sectionGroup,e),e.oneofs&&(n.sectionType="sectionGroup")),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t.SectionGroup=function(){function t(t){if(this.sections=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.sections=u.emptyArray,t.prototype.numTimes=0,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=s.create()),null!=t.sections&&t.sections.length)for(var n=0;n<t.sections.length;++n)l.tensorflow.magenta.NoteSequence.Section.encode(t.sections[n],e.uint32(10).fork()).ldelim();return null!=t.numTimes&&t.hasOwnProperty("numTimes")&&e.uint32(16).int32(t.numTimes),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.NoteSequence.SectionGroup;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.sections&&i.sections.length||(i.sections=[]),i.sections.push(l.tensorflow.magenta.NoteSequence.Section.decode(t,t.uint32()));break;case 2:i.numTimes=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.sections&&t.hasOwnProperty("sections")){if(!Array.isArray(t.sections))return"sections: array expected";for(var e=0;e<t.sections.length;++e){var n=l.tensorflow.magenta.NoteSequence.Section.verify(t.sections[e]);if(n)return"sections."+n}}return null!=t.numTimes&&t.hasOwnProperty("numTimes")&&!u.isInteger(t.numTimes)?"numTimes: integer expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.NoteSequence.SectionGroup)return t;var e=new l.tensorflow.magenta.NoteSequence.SectionGroup;if(t.sections){if(!Array.isArray(t.sections))throw TypeError(".tensorflow.magenta.NoteSequence.SectionGroup.sections: array expected");e.sections=[];for(var n=0;n<t.sections.length;++n){if("object"!=_typeof(t.sections[n]))throw TypeError(".tensorflow.magenta.NoteSequence.SectionGroup.sections: object expected");e.sections[n]=l.tensorflow.magenta.NoteSequence.Section.fromObject(t.sections[n])}}return null!=t.numTimes&&(e.numTimes=0|t.numTimes),e},t.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.sections=[]),e.defaults&&(n.numTimes=0),t.sections&&t.sections.length){n.sections=[];for(var i=0;i<t.sections.length;++i)n.sections[i]=l.tensorflow.magenta.NoteSequence.Section.toObject(t.sections[i],e)}return null!=t.numTimes&&t.hasOwnProperty("numTimes")&&(n.numTimes=t.numTimes),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),t}(),i.SequenceMetadata=function(){function t(t){if(this.genre=[],this.composers=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.title="",t.prototype.artist="",t.prototype.genre=u.emptyArray,t.prototype.composers=u.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=s.create()),null!=t.title&&t.hasOwnProperty("title")&&e.uint32(10).string(t.title),null!=t.artist&&t.hasOwnProperty("artist")&&e.uint32(18).string(t.artist),null!=t.genre&&t.genre.length)for(var n=0;n<t.genre.length;++n)e.uint32(26).string(t.genre[n]);if(null!=t.composers&&t.composers.length)for(n=0;n<t.composers.length;++n)e.uint32(34).string(t.composers[n]);return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.SequenceMetadata;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.title=t.string();break;case 2:i.artist=t.string();break;case 3:i.genre&&i.genre.length||(i.genre=[]),i.genre.push(t.string());break;case 4:i.composers&&i.composers.length||(i.composers=[]),i.composers.push(t.string());break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=_typeof(t)||null===t)return"object expected";if(null!=t.title&&t.hasOwnProperty("title")&&!u.isString(t.title))return"title: string expected";if(null!=t.artist&&t.hasOwnProperty("artist")&&!u.isString(t.artist))return"artist: string expected";if(null!=t.genre&&t.hasOwnProperty("genre")){if(!Array.isArray(t.genre))return"genre: array expected";for(var e=0;e<t.genre.length;++e)if(!u.isString(t.genre[e]))return"genre: string[] expected"}if(null!=t.composers&&t.hasOwnProperty("composers")){if(!Array.isArray(t.composers))return"composers: array expected";for(e=0;e<t.composers.length;++e)if(!u.isString(t.composers[e]))return"composers: string[] expected"}return null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.SequenceMetadata)return t;var e=new l.tensorflow.magenta.SequenceMetadata;if(null!=t.title&&(e.title=String(t.title)),null!=t.artist&&(e.artist=String(t.artist)),t.genre){if(!Array.isArray(t.genre))throw TypeError(".tensorflow.magenta.SequenceMetadata.genre: array expected");e.genre=[];for(var n=0;n<t.genre.length;++n)e.genre[n]=String(t.genre[n])}if(t.composers){if(!Array.isArray(t.composers))throw TypeError(".tensorflow.magenta.SequenceMetadata.composers: array expected");for(e.composers=[],n=0;n<t.composers.length;++n)e.composers[n]=String(t.composers[n])}return e},t.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.genre=[],n.composers=[]),e.defaults&&(n.title="",n.artist=""),null!=t.title&&t.hasOwnProperty("title")&&(n.title=t.title),null!=t.artist&&t.hasOwnProperty("artist")&&(n.artist=t.artist),t.genre&&t.genre.length){n.genre=[];for(var i=0;i<t.genre.length;++i)n.genre[i]=t.genre[i]}if(t.composers&&t.composers.length)for(n.composers=[],i=0;i<t.composers.length;++i)n.composers[i]=t.composers[i];return n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),i.VelocityRange=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.min=0,t.prototype.max=0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=s.create()),null!=t.min&&t.hasOwnProperty("min")&&e.uint32(8).int32(t.min),null!=t.max&&t.hasOwnProperty("max")&&e.uint32(16).int32(t.max),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof a||(t=a.create(t));for(var n=void 0===e?t.len:t.pos+e,i=new l.tensorflow.magenta.VelocityRange;t.pos<n;){var r=t.uint32();switch(r>>>3){case 1:i.min=t.int32();break;case 2:i.max=t.int32();break;default:t.skipType(7&r)}}return i},t.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=_typeof(t)||null===t?"object expected":null!=t.min&&t.hasOwnProperty("min")&&!u.isInteger(t.min)?"min: integer expected":null!=t.max&&t.hasOwnProperty("max")&&!u.isInteger(t.max)?"max: integer expected":null},t.fromObject=function(t){if(t instanceof l.tensorflow.magenta.VelocityRange)return t;var e=new l.tensorflow.magenta.VelocityRange;return null!=t.min&&(e.min=0|t.min),null!=t.max&&(e.max=0|t.max),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.min=0,n.max=0),null!=t.min&&t.hasOwnProperty("min")&&(n.min=t.min),null!=t.max&&t.hasOwnProperty("max")&&(n.max=t.max),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},t}(),i),r),t.exports=l},,function(t,e,n){n.r(e),n.d(e,"ChordQuality",(function(){return dt})),n.d(e,"ChordSymbolException",(function(){return yt})),n.d(e,"ChordEncodingException",(function(){return gt})),n.d(e,"ChordSymbols",(function(){return _t})),n.d(e,"ChordEncoder",(function(){return vt})),n.d(e,"chordEncoderFromType",(function(){return St})),n.d(e,"MajorMinorChordEncoder",(function(){return bt})),n.d(e,"TriadChordEncoder",(function(){return wt})),n.d(e,"PitchChordEncoder",(function(){return Tt}));var i={};n.r(i),n.d(i,"names",(function(){return s})),n.d(i,"tokenize",(function(){return f})),n.d(i,"props",(function(){return p})),n.d(i,"name",(function(){return m})),n.d(i,"pc",(function(){return y})),n.d(i,"midi",(function(){return g})),n.d(i,"midiToFreq",(function(){return _})),n.d(i,"freq",(function(){return v})),n.d(i,"freqToMidi",(function(){return w})),n.d(i,"chroma",(function(){return T})),n.d(i,"oct",(function(){return P})),n.d(i,"stepToLetter",(function(){return k})),n.d(i,"altToAcc",(function(){return A})),n.d(i,"from",(function(){return x})),n.d(i,"build",(function(){return M})),n.d(i,"fromMidi",(function(){return N})),n.d(i,"simplify",(function(){return q})),n.d(i,"enharmonic",(function(){return E}));var r={};n.r(r),n.d(r,"names",(function(){return it})),n.d(r,"props",(function(){return ot})),n.d(r,"intervals",(function(){return at})),n.d(r,"notes",(function(){return st})),n.d(r,"exists",(function(){return ut})),n.d(r,"supersets",(function(){return lt})),n.d(r,"subsets",(function(){return ct})),n.d(r,"tokenize",(function(){return ht}));var o=n(0),a="C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B".split(" "),s=function(t){return"string"!=typeof t?a.slice():a.filter((function(e){var n=e[1]||" ";return-1!==t.indexOf(n)}))},u=s(" #"),l=s(" b"),c=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function f(t){"string"!=typeof t&&(t="");var e=c.exec(t);return[e[1].toUpperCase(),e[2].replace(/x/g,"##"),e[3],e[4]]}var h=Object.freeze({pc:null,name:null,step:null,alt:null,oct:null,octStr:null,chroma:null,midi:null,freq:null}),d=[0,2,4,5,7,9,11],p=function(t,e){return void 0===e&&(e={}),function(t){return e[t]||(e[t]=function(t){var e=f(t);if(""===e[0]||""!==e[3])return h;var n=e[0],i=e[1],r=e[2],o={letter:n,acc:i,octStr:r,pc:n+i,name:n+i+r,step:(n.charCodeAt(0)+3)%7,alt:"b"===i[0]?-i.length:i.length,oct:r.length?+r:null,chroma:0,midi:null,freq:null};return o.chroma=(d[o.step]+o.alt+120)%12,o.midi=null!==o.oct?d[o.step]+o.alt+12*(o.oct+1):null,o.freq=_(o.midi),Object.freeze(o)}(t))}}(),m=function(t){return p(t).name},y=function(t){return p(t).pc},g=function(t){if("number"!=typeof t&&"string"!=typeof t)return null;var e,n=p(t).midi,i=n||0===n?n:+t;return(e=i)>=0&&e<=127?i:null},_=function(t,e){return void 0===e&&(e=440),"number"==typeof t?Math.pow(2,(t-69)/12)*e:null},v=function(t){return p(t).freq||_(t)},S=Math.log(2),b=Math.log(440),w=function(t){var e=12*(Math.log(t)-b)/S+69;return Math.round(100*e)/100},T=function(t){return p(t).chroma},P=function(t){return p(t).oct},k=function(t){return"CDEFGAB"[t]},O=function(t,e){return Array(e+1).join(t)},A=function(t){return function(t,e){return"number"!=typeof t?"":function(t){return t<0?O("b",-t):O("#",t)}(t)}(t)},x=function(t,e){void 0===t&&(t={}),void 0===e&&(e=null);var n=e?Object.assign({},p(e),t):t,i=n.step,r=n.alt,o=n.oct;if("number"!=typeof i)return null;var a=k(i);if(!a)return null;var s=a+A(r);return o||0===o?s+o:s},M=x;function N(t,e){return void 0===e&&(e=!1),t=Math.round(t),(!0===e?u:l)[t%12]+(Math.floor(t/12)-1)}var q=function(t,e){void 0===e&&(e=!0);var n=p(t),i=n.alt,r=n.chroma,o=n.midi;if(null===r)return null;var a=!1===e?i<0:i>0;return null===o?y(N(r,a)):N(o,a)},E=function(t){return q(t,!1)},C=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),I=[0,2,4,5,7,9,11],R=Object.freeze({name:null,num:null,q:null,step:null,alt:null,dir:null,type:null,simple:null,semitones:null,chroma:null,oct:null}),F=function(t){var e=function(t){var e=C.exec(""+t);return null===e?null:e[1]?[e[1],e[2]]:[e[4],e[3]]}(t);if(null===e)return R;var n,i,r={num:0,q:"d",name:"",type:"M",step:0,dir:-1,simple:1,alt:0,oct:0,semitones:0,chroma:0,ic:0};return r.num=+e[0],r.q=e[1],r.step=function(t){return(Math.abs(t)-1)%7}(r.num),r.type="PMMPPMM"[r.step],"M"===r.type&&"P"===r.q?R:(r.name=""+r.num+r.q,r.dir=r.num<0?-1:1,r.simple=8===r.num||-8===r.num?r.num:r.dir*(r.step+1),r.alt=(n=r.type,"M"===(i=r.q)&&"M"===n||"P"===i&&"P"===n?0:"m"===i&&"M"===n?-1:/^A+$/.test(i)?i.length:/^d+$/.test(i)?"P"===n?-i.length:-i.length-1:null),r.oct=Math.floor((Math.abs(r.num)-1)/7),r.semitones=r.dir*(I[r.step]+r.alt+12*r.oct),r.chroma=(r.dir*(I[r.step]+r.alt)%12+12)%12,Object.freeze(r))},z={};function L(t){return"string"!=typeof t?R:z[t]||(z[t]=F(t))}var j=[0,2,4,-1,1,3,5],D=j.map((function(t){return Math.floor(7*t/12)})),B=[3,0,4,1,5,2,6],U=function(t,e,n){var i=B[function(t){var e=(t+1)%7;return e<0?7+e:e}(t)],r=Math.floor((t+1)/7);return void 0===e?{step:i,alt:r,dir:n}:{step:i,alt:r,oct:e+4*r+D[i],dir:n}},G=function(t){return function(t,e){return void 0===e&&(e={}),function(n){return e[n]||(e[n]=t(n))}}((function(e){var n=t(e);return null===n.name?null:function(t){var e=t.step,n=t.alt,i=t.oct,r=t.dir;void 0===r&&(r=1);var o=j[e]+7*n;return null===i?[r*o]:[r*o,r*(i-D[e]-4*n)]}(n)}))},V=G(p),Q=G(L);function H(t,e){if(1===arguments.length)return function(e){return H(t,e)};var n=V(t),i=Q(e);if(null===n||null===i)return null;var r=1===n.length?[n[0]+i[0]]:[n[0]+i[0],n[1]+i[1]];return M(U(r[0],r[1]))}var W=n(37),K=n(38),J=function(t){return T(t)||function(t){return L(t).chroma}(t)||0},X=function(t){return parseInt(Y(t),2)};function Y(t){if(function(t){return $.test(t)}(t))return t;if(!Array.isArray(t))return"";var e=[0,0,0,0,0,0,0,0,0,0,0,0];return t.map(J).forEach((function(t){e[t]=1})),e.join("")}var $=/^[01]{12}$/;function Z(t,e){return arguments.length>1?Z(t)(e):(t=X(t),function(e){return(e=X(e))!==t&&(e&t)===e})}function tt(t,e){return arguments.length>1?tt(t)(e):(t=X(t),function(e){return(e=X(e))!==t&&(e|t)===e})}var et=function(t){var e=Object.keys(t).sort(),n=[],i=[],r=function(t,e,r){n[t]=e,i[r]=i[r]||[],i[r].push(t)};e.forEach((function(e){var n=t[e][0].split(" "),i=t[e][1],o=Y(n);r(e,n,o),i&&i.forEach((function(t){return r(t,n,o)}))}));var o=Object.keys(n).sort(),a=function(t){return n[t]};return a.names=function(t){return"string"==typeof t?(i[t]||[]).slice():(!0===t?o:e).slice()},a},nt=(et(W),et(K));Object.freeze({name:null,intervals:[],names:[],chroma:null,setnum:null});var it=nt.names,rt=Object.freeze({name:null,names:[],intervals:[],chroma:null,setnum:null}),ot=function(t,e){return void 0===e&&(e={}),function(t){return e[t]||(e[t]=function(t){var e=nt(t);if(!e)return rt;var n={intervals:e,name:t};return n.chroma=Y(e),n.setnum=parseInt(n.chroma,2),n.names=nt.names(n.chroma),n}(t))}}(),at=function(t){return ot(ht(t)[1]).intervals};function st(t,e){if(e)return ot(e).intervals.map(H(t));var n=ht(t),i=n[0],r=n[1];return ot(r).intervals.map(H(i))}var ut=function(t){return void 0!==nt(ht(t)[1])},lt=function(t){if(!at(t).length)return[];var e=tt(at(t));return nt.names().filter((function(t){return e(nt(t))}))},ct=function(t){var e=Z(at(t));return nt.names().filter((function(t){return e(nt(t))}))},ft=/^(6|64|7|9|11|13)$/;function ht(t){var e=f(t);return""===e[0]?["",t]:"A"===e[0]&&"ug"===e[3]?["","aug"]:ft.test(e[2])?[e[0]+e[1],e[2]+e[3]]:[e[0]+e[1]+e[2],e[3]]}var dt,pt=n(1),mt=[["1P","3M","5P"],["1P","3m","5P"],["1P","3M","5A"],["1P","3m","5d"]];!function(t){t[t.Major=0]="Major",t[t.Minor=1]="Minor",t[t.Augmented=2]="Augmented",t[t.Diminished=3]="Diminished",t[t.Other=4]="Other"}(dt||(dt={}));var yt=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),gt=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error)),_t=function(){function t(){_classCallCheck(this,t)}return _createClass(t,null,[{key:"pitches",value:function(t){if(!r.tokenize(t)[0]||!r.exists(t))throw new yt("Unrecognized chord symbol: "+t);return r.notes(t).map(i.chroma)}},{key:"root",value:function(t){var e=r.tokenize(t)[0];if(!e)throw new yt("Chord symbol has unknown root: "+t);return i.chroma(e)}},{key:"quality",value:function(t){if(!r.exists(t))throw new yt("Unrecognized chord symbol: "+t);var e=r.intervals(t),n=mt.map((function(t){return t.every((function(t){return e.includes(t)}))})),i=n.indexOf(!0),o=n.lastIndexOf(!0);return i>=0&&i===o?i:dt.Other}}]),t}(),vt=function(){function t(){_classCallCheck(this,t)}return _createClass(t,[{key:"encodeProgression",value:function(t,e){var n=this,i=t.map((function(t){return n.encode(t)})),r=Array.from(Array(e).keys()).map((function(t){return Math.floor(t*i.length/e)}));return o.stack(r.map((function(t){return i[t]})))}}]),t}();function St(t){switch(t){case"MajorMinorChordEncoder":return new bt;case"TriadChordEncoder":return new wt;case"PitchChordEncoder":return new Tt;default:throw new Error("Unknown chord encoder type: "+t)}}var bt=function(t){_inherits(n,t);var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.apply(this,arguments)).depth=1+2*pt.NUM_PITCH_CLASSES,t}return _createClass(n,[{key:"index",value:function(t){if(t===pt.NO_CHORD)return 0;var e=_t.root(t),n=1+_t.quality(t)*pt.NUM_PITCH_CLASSES+e;if(n>=this.depth)throw new gt("Chord is neither major nor minor: "+t);return n}},{key:"encode",value:function(t){var e=this;return o.tidy((function(){return o.oneHot(o.tensor1d([e.index(t)],"int32"),e.depth).as1D()}))}}]),n}(vt),wt=function(t){_inherits(n,t);var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.apply(this,arguments)).depth=1+4*pt.NUM_PITCH_CLASSES,t}return _createClass(n,[{key:"index",value:function(t){if(t===pt.NO_CHORD)return 0;var e=_t.root(t),n=1+_t.quality(t)*pt.NUM_PITCH_CLASSES+e;if(n>=this.depth)throw new gt("Chord is not a standard triad: "+t);return n}},{key:"encode",value:function(t){var e=this;return o.tidy((function(){return o.oneHot(o.tensor1d([e.index(t)],"int32"),e.depth).as1D()}))}}]),n}(vt),Tt=function(t){_inherits(n,t);var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.apply(this,arguments)).depth=1+3*pt.NUM_PITCH_CLASSES,t}return _createClass(n,[{key:"encode",value:function(t){var e=this;return o.tidy((function(){if(t===pt.NO_CHORD)return o.oneHot(o.tensor1d([0],"int32"),e.depth).as1D();var n=_t.root(t),i=o.oneHot(o.tensor1d([n],"int32"),pt.NUM_PITCH_CLASSES).as1D(),r=o.buffer([pt.NUM_PITCH_CLASSES]);_t.pitches(t).forEach((function(t){return r.set(1,t)}));var a=r.toTensor().as1D(),s=i;return o.concat1d([o.tensor1d([0]),i,a,s])}))}}]),n}(vt)},,function(t,e,n){t.exports=n(21)},function(t,e,n){var i=e;function r(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=n(14),i.BufferWriter=n(30),i.Reader=n(15),i.BufferReader=n(31),i.util=n(8),i.rpc=n(32),i.roots=n(34),i.configure=r,r()},function(t,e,n){t.exports=function(t,e){for(var n=new Array(arguments.length-1),i=0,r=2,o=!0;r<arguments.length;)n[i++]=arguments[r++];return new Promise((function(r,a){n[i]=function(t){if(o)if(o=!1,t)a(t);else{for(var e=new Array(arguments.length-1),n=0;n<e.length;)e[n++]=arguments[n];r.apply(null,e)}};try{t.apply(e||null,n)}catch(t){o&&(o=!1,a(t))}}))}},function(t,e,n){var i=e;i.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&"="===t.charAt(e);)++n;return Math.ceil(3*t.length)/4-n};for(var r=new Array(64),o=new Array(123),a=0;a<64;)o[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(t,e,n){for(var i,o=null,a=[],s=0,u=0;e<n;){var l=t[e++];switch(u){case 0:a[s++]=r[l>>2],i=(3&l)<<4,u=1;break;case 1:a[s++]=r[i|l>>4],i=(15&l)<<2,u=2;break;case 2:a[s++]=r[i|l>>6],a[s++]=r[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=r[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))},i.decode=function(t,e,n){for(var i,r=n,a=0,s=0;s<t.length;){var u=t.charCodeAt(s++);if(61===u&&a>1)break;if(void 0===(u=o[u]))throw Error("invalid encoding");switch(a){case 0:i=u,a=1;break;case 1:e[n++]=i<<2|(48&u)>>4,i=u,a=2;break;case 2:e[n++]=(15&i)<<4|(60&u)>>2,i=u,a=3;break;case 3:e[n++]=(3&i)<<6|u,a=0}}if(1===a)throw Error("invalid encoding");return n-r},i.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},function(t,e,n){function i(){this._listeners={}}t.exports=i,i.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this},i.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this},i.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}},function(t,e,n){function i(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),n=new Uint8Array(e.buffer),i=128===n[3];function r(t,i,r){e[0]=t,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3]}function o(t,i,r){e[0]=t,i[r]=n[3],i[r+1]=n[2],i[r+2]=n[1],i[r+3]=n[0]}function a(t,i){return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n[3]=t[i+3],e[0]}function s(t,i){return n[3]=t[i],n[2]=t[i+1],n[1]=t[i+2],n[0]=t[i+3],e[0]}t.writeFloatLE=i?r:o,t.writeFloatBE=i?o:r,t.readFloatLE=i?a:s,t.readFloatBE=i?s:a}():function(){function e(t,e,n,i){var r=e<0?1:0;if(r&&(e=-e),0===e)t(1/e>0?0:2147483648,n,i);else if(isNaN(e))t(2143289344,n,i);else if(e>34028234663852886e22)t((r<<31|2139095040)>>>0,n,i);else if(e<11754943508222875e-54)t((r<<31|Math.round(e/1401298464324817e-60))>>>0,n,i);else{var o=Math.floor(Math.log(e)/Math.LN2);t((r<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,n,i)}}function n(t,e,n){var i=t(e,n),r=2*(i>>31)+1,o=i>>>23&255,a=8388607&i;return 255===o?a?NaN:r*(1/0):0===o?1401298464324817e-60*r*a:r*Math.pow(2,o-150)*(a+8388608)}t.writeFloatLE=e.bind(null,r),t.writeFloatBE=e.bind(null,o),t.readFloatLE=n.bind(null,a),t.readFloatBE=n.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),n=new Uint8Array(e.buffer),i=128===n[7];function r(t,i,r){e[0]=t,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3],i[r+4]=n[4],i[r+5]=n[5],i[r+6]=n[6],i[r+7]=n[7]}function o(t,i,r){e[0]=t,i[r]=n[7],i[r+1]=n[6],i[r+2]=n[5],i[r+3]=n[4],i[r+4]=n[3],i[r+5]=n[2],i[r+6]=n[1],i[r+7]=n[0]}function a(t,i){return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n[3]=t[i+3],n[4]=t[i+4],n[5]=t[i+5],n[6]=t[i+6],n[7]=t[i+7],e[0]}function s(t,i){return n[7]=t[i],n[6]=t[i+1],n[5]=t[i+2],n[4]=t[i+3],n[3]=t[i+4],n[2]=t[i+5],n[1]=t[i+6],n[0]=t[i+7],e[0]}t.writeDoubleLE=i?r:o,t.writeDoubleBE=i?o:r,t.readDoubleLE=i?a:s,t.readDoubleBE=i?s:a}():function(){function e(t,e,n,i,r,o){var a=i<0?1:0;if(a&&(i=-i),0===i)t(0,r,o+e),t(1/i>0?0:2147483648,r,o+n);else if(isNaN(i))t(0,r,o+e),t(2146959360,r,o+n);else if(i>17976931348623157e292)t(0,r,o+e),t((a<<31|2146435072)>>>0,r,o+n);else{var s;if(i<22250738585072014e-324)t((s=i/5e-324)>>>0,r,o+e),t((a<<31|s/4294967296)>>>0,r,o+n);else{var u=Math.floor(Math.log(i)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(s=i*Math.pow(2,-u))>>>0,r,o+e),t((a<<31|u+1023<<20|1048576*s&1048575)>>>0,r,o+n)}}}function n(t,e,n,i,r){var o=t(i,r+e),a=t(i,r+n),s=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===u?l?NaN:s*(1/0):0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}t.writeDoubleLE=e.bind(null,r,0,4),t.writeDoubleBE=e.bind(null,o,4,0),t.readDoubleLE=n.bind(null,a,0,4),t.readDoubleBE=n.bind(null,s,4,0)}(),t}function r(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function o(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=255&t}function a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function s(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.exports=i(i)},function(module,exports,__webpack_require__){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},function(t,e,n){var i=e;i.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)(n=t.charCodeAt(i))<128?e+=1:n<2048?e+=2:55296==(64512&n)&&56320==(64512&t.charCodeAt(i+1))?(++i,e+=4):e+=3;return e},i.read=function(t,e,n){if(n-e<1)return"";for(var i,r=null,o=[],a=0;e<n;)(i=t[e++])<128?o[a++]=i:i>191&&i<224?o[a++]=(31&i)<<6|63&t[e++]:i>239&&i<365?(i=((7&i)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(i>>10),o[a++]=56320+(1023&i)):o[a++]=(15&i)<<12|(63&t[e++])<<6|63&t[e++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))},i.write=function(t,e,n){for(var i,r,o=n,a=0;a<t.length;++a)(i=t.charCodeAt(a))<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&56320==(64512&(r=t.charCodeAt(a+1)))?(i=65536+((1023&i)<<10)+(1023&r),++a,e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128);return n-o}},function(t,e,n){t.exports=function(t,e,n){var i=n||8192,r=i>>>1,o=null,a=i;return function(n){if(n<1||n>r)return t(n);a+n>i&&(o=t(i),a=0);var s=e.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}},function(t,e,n){t.exports=r;var i=n(8);function r(t,e){this.lo=t>>>0,this.hi=e>>>0}var o=r.zero=new r(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(t){if(0===t)return o;var e=t<0;e&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)},r.from=function(t){if("number"==typeof t)return r.fromNumber(t);if(i.isString(t)){if(!i.Long)return r.fromNumber(parseInt(t,10));t=i.Long.fromString(t)}return t.low||t.high?new r(t.low>>>0,t.high>>>0):o},r.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+4294967296*n)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(t){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var s=String.prototype.charCodeAt;r.fromHash=function(t){return t===a?o:new r((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},r.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},r.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}},function(t,e,n){t.exports=o;var i=n(14);(o.prototype=Object.create(i.prototype)).constructor=o;var r=n(8);function o(){i.call(this)}function a(t,e,n){t.length<40?r.utf8.write(t,e,n):e.utf8Write?e.utf8Write(t,n):e.write(t,n)}o._configure=function(){o.alloc=r._Buffer_allocUnsafe,o.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}},o.prototype.bytes=function(t){r.isString(t)&&(t=r._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(o.writeBytesBuffer,e,t),this},o.prototype.string=function(t){var e=r.Buffer.byteLength(t);return this.uint32(e),e&&this._push(a,e,t),this},o._configure()},function(t,e,n){t.exports=o;var i=n(15);(o.prototype=Object.create(i.prototype)).constructor=o;var r=n(8);function o(t){i.call(this,t)}o._configure=function(){r.Buffer&&(o.prototype._slice=r.Buffer.prototype.slice)},o.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},o._configure()},function(t,e,n){e.Service=n(33)},function(t,e,n){t.exports=r;var i=n(8);function r(t,e,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(n)}(r.prototype=Object.create(i.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function t(e,n,r,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return i.asPromise(t,s,e,n,r,o);if(s.rpcImpl)try{return s.rpcImpl(e,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(t,n){if(t)return s.emit("error",t,e),a(t);if(null!==n){if(!(n instanceof r))try{n=r[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(t){return s.emit("error",t,e),a(t)}return s.emit("data",n,e),a(null,n)}s.end(!0)}))}catch(t){return s.emit("error",t,e),void setTimeout((function(){a(t)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},r.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(t,e,n){t.exports={}},,function(t,e,n){n.r(e),n.d(e,"auxiliaryInputFromSpec",(function(){return r})),n.d(e,"AuxiliaryInput",(function(){return o})),n.d(e,"BinaryCounter",(function(){return a}));var i=n(0);function r(t){switch(t.type){case"BinaryCounter":return new a(t.args);default:throw new Error("Unknown auxiliary input: "+t)}}var o=function t(e){_classCallCheck(this,t),this.depth=e},a=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t.numBits)}return _createClass(n,[{key:"getTensors",value:function(t){for(var e=i.buffer([t,this.depth]),n=0;n<t;++n)for(var r=0;r<this.depth;++r)e.set(Math.floor((n+1)/Math.pow(2,r))%2?1:-1,n,r);return e.toTensor().as2D(t,this.depth)}}]),n}(o)},function(t){t.exports=JSON.parse('{"chromatic":["1P 2m 2M 3m 3M 4P 4A 5P 6m 6M 7m 7M"],"lydian":["1P 2M 3M 4A 5P 6M 7M"],"major":["1P 2M 3M 4P 5P 6M 7M",["ionian"]],"mixolydian":["1P 2M 3M 4P 5P 6M 7m",["dominant"]],"dorian":["1P 2M 3m 4P 5P 6M 7m"],"aeolian":["1P 2M 3m 4P 5P 6m 7m",["minor"]],"phrygian":["1P 2m 3m 4P 5P 6m 7m"],"locrian":["1P 2m 3m 4P 5d 6m 7m"],"melodic minor":["1P 2M 3m 4P 5P 6M 7M"],"melodic minor second mode":["1P 2m 3m 4P 5P 6M 7m"],"lydian augmented":["1P 2M 3M 4A 5A 6M 7M"],"lydian dominant":["1P 2M 3M 4A 5P 6M 7m",["lydian b7"]],"melodic minor fifth mode":["1P 2M 3M 4P 5P 6m 7m",["hindu","mixolydian b6M"]],"locrian #2":["1P 2M 3m 4P 5d 6m 7m",["half-diminished"]],"altered":["1P 2m 3m 3M 5d 6m 7m",["super locrian","diminished whole tone","pomeroy"]],"harmonic minor":["1P 2M 3m 4P 5P 6m 7M"],"phrygian dominant":["1P 2m 3M 4P 5P 6m 7m",["spanish","phrygian major"]],"half-whole diminished":["1P 2m 3m 3M 4A 5P 6M 7m",["dominant diminished"]],"diminished":["1P 2M 3m 4P 5d 6m 6M 7M",["whole-half diminished"]],"major pentatonic":["1P 2M 3M 5P 6M",["pentatonic"]],"lydian pentatonic":["1P 3M 4A 5P 7M",["chinese"]],"mixolydian pentatonic":["1P 3M 4P 5P 7m",["indian"]],"locrian pentatonic":["1P 3m 4P 5d 7m",["minor seven flat five pentatonic"]],"minor pentatonic":["1P 3m 4P 5P 7m"],"minor six pentatonic":["1P 3m 4P 5P 6M"],"minor hexatonic":["1P 2M 3m 4P 5P 7M"],"flat three pentatonic":["1P 2M 3m 5P 6M",["kumoi"]],"flat six pentatonic":["1P 2M 3M 5P 6m"],"major flat two pentatonic":["1P 2m 3M 5P 6M"],"whole tone pentatonic":["1P 3M 5d 6m 7m"],"ionian pentatonic":["1P 3M 4P 5P 7M"],"lydian #5P pentatonic":["1P 3M 4A 5A 7M"],"lydian dominant pentatonic":["1P 3M 4A 5P 7m"],"minor #7M pentatonic":["1P 3m 4P 5P 7M"],"super locrian pentatonic":["1P 3m 4d 5d 7m"],"in-sen":["1P 2m 4P 5P 7m"],"iwato":["1P 2m 4P 5d 7m"],"hirajoshi":["1P 2M 3m 5P 6m"],"kumoijoshi":["1P 2m 4P 5P 6m"],"pelog":["1P 2m 3m 5P 6m"],"vietnamese 1":["1P 3m 4P 5P 6m"],"vietnamese 2":["1P 3m 4P 5P 7m"],"prometheus":["1P 2M 3M 4A 6M 7m"],"prometheus neopolitan":["1P 2m 3M 4A 6M 7m"],"ritusen":["1P 2M 4P 5P 6M"],"scriabin":["1P 2m 3M 5P 6M"],"piongio":["1P 2M 4P 5P 6M 7m"],"major blues":["1P 2M 3m 3M 5P 6M"],"minor blues":["1P 3m 4P 5d 5P 7m",["blues"]],"composite blues":["1P 2M 3m 3M 4P 5d 5P 6M 7m"],"augmented":["1P 2A 3M 5P 5A 7M"],"augmented heptatonic":["1P 2A 3M 4P 5P 5A 7M"],"dorian #4":["1P 2M 3m 4A 5P 6M 7m"],"lydian diminished":["1P 2M 3m 4A 5P 6M 7M"],"whole tone":["1P 2M 3M 4A 5A 7m"],"leading whole tone":["1P 2M 3M 4A 5A 7m 7M"],"lydian minor":["1P 2M 3M 4A 5P 6m 7m"],"locrian major":["1P 2M 3M 4P 5d 6m 7m",["arabian"]],"neopolitan":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan minor":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan major":["1P 2m 3m 4P 5P 6M 7M",["dorian b2"]],"neopolitan major pentatonic":["1P 3M 4P 5d 7m"],"romanian minor":["1P 2M 3m 5d 5P 6M 7m"],"double harmonic lydian":["1P 2m 3M 4A 5P 6m 7M"],"harmonic major":["1P 2M 3M 4P 5P 6m 7M"],"double harmonic major":["1P 2m 3M 4P 5P 6m 7M",["gypsy"]],"egyptian":["1P 2M 4P 5P 7m"],"hungarian minor":["1P 2M 3m 4A 5P 6m 7M"],"hungarian major":["1P 2A 3M 4A 5P 6M 7m"],"oriental":["1P 2m 3M 4P 5d 6M 7m"],"spanish heptatonic":["1P 2m 3m 3M 4P 5P 6m 7m"],"flamenco":["1P 2m 3m 3M 4A 5P 7m"],"balinese":["1P 2m 3m 4P 5P 6m 7M"],"todi raga":["1P 2m 3m 4A 5P 6m 7M"],"malkos raga":["1P 3m 4P 6m 7m"],"kafi raga":["1P 3m 3M 4P 5P 6M 7m 7M"],"purvi raga":["1P 2m 3M 4P 4A 5P 6m 7M"],"persian":["1P 2m 3M 4P 5d 6m 7M"],"bebop":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop dominant":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop minor":["1P 2M 3m 3M 4P 5P 6M 7m"],"bebop major":["1P 2M 3M 4P 5P 5A 6M 7M"],"bebop locrian":["1P 2m 3m 4P 5d 5P 6m 7m"],"minor bebop":["1P 2M 3m 4P 5P 6m 7m 7M"],"mystery #1":["1P 2m 3M 5d 6m 7m"],"enigmatic":["1P 2m 3M 5d 6m 7m 7M"],"minor six diminished":["1P 2M 3m 4P 5P 6m 6M 7M"],"ionian augmented":["1P 2M 3M 4P 5A 6M 7M"],"lydian #9":["1P 2m 3M 4A 5P 6M 7M"],"ichikosucho":["1P 2M 3M 4P 5d 5P 6M 7M"],"six tone symmetric":["1P 2m 3M 4P 5A 6M"]}')},function(t){t.exports=JSON.parse('{"4":["1P 4P 7m 10m",["quartal"]],"5":["1P 5P"],"7":["1P 3M 5P 7m",["Dominant","Dom"]],"9":["1P 3M 5P 7m 9M",["79"]],"11":["1P 5P 7m 9M 11P"],"13":["1P 3M 5P 7m 9M 13M",["13_"]],"64":["5P 8P 10M"],"M":["1P 3M 5P",["Major",""]],"M#5":["1P 3M 5A",["augmented","maj#5","Maj#5","+","aug"]],"M#5add9":["1P 3M 5A 9M",["+add9"]],"M13":["1P 3M 5P 7M 9M 13M",["maj13","Maj13"]],"M13#11":["1P 3M 5P 7M 9M 11A 13M",["maj13#11","Maj13#11","M13+4","M13#4"]],"M6":["1P 3M 5P 13M",["6"]],"M6#11":["1P 3M 5P 6M 11A",["M6b5","6#11","6b5"]],"M69":["1P 3M 5P 6M 9M",["69"]],"M69#11":["1P 3M 5P 6M 9M 11A"],"M7#11":["1P 3M 5P 7M 11A",["maj7#11","Maj7#11","M7+4","M7#4"]],"M7#5":["1P 3M 5A 7M",["maj7#5","Maj7#5","maj9#5","M7+"]],"M7#5sus4":["1P 4P 5A 7M"],"M7#9#11":["1P 3M 5P 7M 9A 11A"],"M7add13":["1P 3M 5P 6M 7M 9M"],"M7b5":["1P 3M 5d 7M"],"M7b6":["1P 3M 6m 7M"],"M7b9":["1P 3M 5P 7M 9m"],"M7sus4":["1P 4P 5P 7M"],"M9":["1P 3M 5P 7M 9M",["maj9","Maj9"]],"M9#11":["1P 3M 5P 7M 9M 11A",["maj9#11","Maj9#11","M9+4","M9#4"]],"M9#5":["1P 3M 5A 7M 9M",["Maj9#5"]],"M9#5sus4":["1P 4P 5A 7M 9M"],"M9b5":["1P 3M 5d 7M 9M"],"M9sus4":["1P 4P 5P 7M 9M"],"Madd9":["1P 3M 5P 9M",["2","add9","add2"]],"Maj7":["1P 3M 5P 7M",["maj7","M7"]],"Mb5":["1P 3M 5d"],"Mb6":["1P 3M 13m"],"Msus2":["1P 2M 5P",["add9no3","sus2"]],"Msus4":["1P 4P 5P",["sus","sus4"]],"Maddb9":["1P 3M 5P 9m"],"11b9":["1P 5P 7m 9m 11P"],"13#11":["1P 3M 5P 7m 9M 11A 13M",["13+4","13#4"]],"13#9":["1P 3M 5P 7m 9A 13M",["13#9_"]],"13#9#11":["1P 3M 5P 7m 9A 11A 13M"],"13b5":["1P 3M 5d 6M 7m 9M"],"13b9":["1P 3M 5P 7m 9m 13M"],"13b9#11":["1P 3M 5P 7m 9m 11A 13M"],"13no5":["1P 3M 7m 9M 13M"],"13sus4":["1P 4P 5P 7m 9M 13M",["13sus"]],"69#11":["1P 3M 5P 6M 9M 11A"],"7#11":["1P 3M 5P 7m 11A",["7+4","7#4","7#11_","7#4_"]],"7#11b13":["1P 3M 5P 7m 11A 13m",["7b5b13"]],"7#5":["1P 3M 5A 7m",["+7","7aug","aug7"]],"7#5#9":["1P 3M 5A 7m 9A",["7alt","7#5#9_","7#9b13_"]],"7#5b9":["1P 3M 5A 7m 9m"],"7#5b9#11":["1P 3M 5A 7m 9m 11A"],"7#5sus4":["1P 4P 5A 7m"],"7#9":["1P 3M 5P 7m 9A",["7#9_"]],"7#9#11":["1P 3M 5P 7m 9A 11A",["7b5#9"]],"7#9#11b13":["1P 3M 5P 7m 9A 11A 13m"],"7#9b13":["1P 3M 5P 7m 9A 13m"],"7add6":["1P 3M 5P 7m 13M",["67","7add13"]],"7b13":["1P 3M 7m 13m"],"7b5":["1P 3M 5d 7m"],"7b6":["1P 3M 5P 6m 7m"],"7b9":["1P 3M 5P 7m 9m"],"7b9#11":["1P 3M 5P 7m 9m 11A",["7b5b9"]],"7b9#9":["1P 3M 5P 7m 9m 9A"],"7b9b13":["1P 3M 5P 7m 9m 13m"],"7b9b13#11":["1P 3M 5P 7m 9m 11A 13m",["7b9#11b13","7b5b9b13"]],"7no5":["1P 3M 7m"],"7sus4":["1P 4P 5P 7m",["7sus"]],"7sus4b9":["1P 4P 5P 7m 9m",["susb9","7susb9","7b9sus","7b9sus4","phryg"]],"7sus4b9b13":["1P 4P 5P 7m 9m 13m",["7b9b13sus4"]],"9#11":["1P 3M 5P 7m 9M 11A",["9+4","9#4","9#11_","9#4_"]],"9#11b13":["1P 3M 5P 7m 9M 11A 13m",["9b5b13"]],"9#5":["1P 3M 5A 7m 9M",["9+"]],"9#5#11":["1P 3M 5A 7m 9M 11A"],"9b13":["1P 3M 7m 9M 13m"],"9b5":["1P 3M 5d 7m 9M"],"9no5":["1P 3M 7m 9M"],"9sus4":["1P 4P 5P 7m 9M",["9sus"]],"m":["1P 3m 5P"],"m#5":["1P 3m 5A",["m+","mb6"]],"m11":["1P 3m 5P 7m 9M 11P",["_11"]],"m11A 5":["1P 3m 6m 7m 9M 11P"],"m11b5":["1P 3m 7m 12d 2M 4P",["h11","_11b5"]],"m13":["1P 3m 5P 7m 9M 11P 13M",["_13"]],"m6":["1P 3m 4P 5P 13M",["_6"]],"m69":["1P 3m 5P 6M 9M",["_69"]],"m7":["1P 3m 5P 7m",["minor7","_","_7"]],"m7#5":["1P 3m 6m 7m"],"m7add11":["1P 3m 5P 7m 11P",["m7add4"]],"m7b5":["1P 3m 5d 7m",["half-diminished","h7","_7b5"]],"m9":["1P 3m 5P 7m 9M",["_9"]],"m9#5":["1P 3m 6m 7m 9M"],"m9b5":["1P 3m 7m 12d 2M",["h9","-9b5"]],"mMaj7":["1P 3m 5P 7M",["mM7","_M7"]],"mMaj7b6":["1P 3m 5P 6m 7M",["mM7b6"]],"mM9":["1P 3m 5P 7M 9M",["mMaj9","-M9"]],"mM9b6":["1P 3m 5P 6m 7M 9M",["mMaj9b6"]],"mb6M7":["1P 3m 6m 7M"],"mb6b9":["1P 3m 6m 9m"],"o":["1P 3m 5d",["mb5","dim"]],"o7":["1P 3m 5d 13M",["diminished","m6b5","dim7"]],"o7M7":["1P 3m 5d 6M 7M"],"oM7":["1P 3m 5d 7M"],"sus24":["1P 2M 4P 5P",["sus4add9"]],"+add#9":["1P 3M 5A 9A"],"madd4":["1P 3m 4P 5P"],"madd9":["1P 3m 5P 9M"]}')},,function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(52),r=new WeakMap;e.keySignatureKeys=["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#"];var o=function(){function t(t){var n=this;this.tempos=[],this.timeSignatures=[],this.keySignatures=[],this.meta=[],this.name="",r.set(this,480),t&&(r.set(this,t.header.ticksPerBeat),t.tracks[0].forEach((function(t){t.meta&&("timeSignature"===t.type?n.timeSignatures.push({ticks:t.absoluteTime,timeSignature:[t.numerator,t.denominator]}):"setTempo"===t.type?n.tempos.push({bpm:6e7/t.microsecondsPerBeat,ticks:t.absoluteTime}):"keySignature"===t.type?n.keySignatures.push({key:e.keySignatureKeys[t.key+7],scale:0===t.scale?"major":"minor",ticks:t.absoluteTime}):"trackName"===t.type?n.name=t.text:"endOfTrack"!==t.type&&n.meta.push({text:t.text,ticks:t.absoluteTime,type:t.type}))})),this.update())}return t.prototype.update=function(){var t=this,e=0,n=0;this.tempos.sort((function(t,e){return t.ticks-e.ticks})),this.tempos.forEach((function(i,r){var o=r>0?t.tempos[r-1].bpm:t.tempos[0].bpm,a=i.ticks/t.ppq-n,s=60/o*a;i.time=s+e,e=i.time,n+=a})),this.timeSignatures.sort((function(t,e){return t.ticks-e.ticks})),this.timeSignatures.forEach((function(e,n){var i=n>0?t.timeSignatures[n-1]:t.timeSignatures[0],r=(e.ticks-i.ticks)/t.ppq/i.timeSignature[0]/(i.timeSignature[1]/4);i.measures=i.measures||0,e.measures=r+i.measures}))},t.prototype.ticksToSeconds=function(t){var e=i.search(this.tempos,t);if(-1!==e){var n=this.tempos[e],r=n.time,o=(t-n.ticks)/this.ppq;return r+60/n.bpm*o}return t/this.ppq*.5},t.prototype.ticksToMeasures=function(t){var e=i.search(this.timeSignatures,t);if(-1!==e){var n=this.timeSignatures[e],r=(t-n.ticks)/this.ppq;return n.measures+r/(n.timeSignature[0]/n.timeSignature[1])/4}return t/this.ppq/4},Object.defineProperty(t.prototype,"ppq",{get:function(){return r.get(this)},enumerable:!0,configurable:!0}),t.prototype.secondsToTicks=function(t){var e=i.search(this.tempos,t,"time");if(-1!==e){var n=this.tempos[e],r=(t-n.time)/(60/n.bpm);return Math.round(n.ticks+r*this.ppq)}var o=t/.5;return Math.round(o*this.ppq)},t.prototype.toJSON=function(){return{keySignatures:this.keySignatures,meta:this.meta,name:this.name,ppq:this.ppq,tempos:this.tempos.map((function(t){return{bpm:t.bpm,ticks:t.ticks}})),timeSignatures:this.timeSignatures}},t.prototype.fromJSON=function(t){this.name=t.name,this.tempos=t.tempos.map((function(t){return Object.assign({},t)})),this.timeSignatures=t.timeSignatures.map((function(t){return Object.assign({},t)})),this.keySignatures=t.keySignatures.map((function(t){return Object.assign({},t)})),this.meta=t.meta.map((function(t){return Object.assign({},t)})),r.set(this,t.ppq),this.update()},t.prototype.setTempo=function(t){this.tempos=[{bpm:t,ticks:0}],this.update()},t}();e.Header=o},,,,,,function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(51),a=n(82),s=n(40),u=n(53),l=function(){function t(t){var e=this,n=null;t&&(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(n=o.parseMidi(t)).tracks.forEach((function(t){var e=0;t.forEach((function(t){e+=t.deltaTime,t.absoluteTime=e}))})),n.tracks=function(t){for(var e=[],n=0;n<t.length;n++)for(var i=e.length,r=new Map,o=Array(16).fill(0),a=0,s=t[n];a<s.length;a++){var u=s[a],l=i,c=u.channel;if(void 0!==c){"programChange"===u.type&&(o[c]=u.programNumber);var f=o[c]+" "+c;r.has(f)?l=r.get(f):(l=i+r.size,r.set(f,l))}e[l]||e.push([]),e[l].push(u)}return e}(n.tracks)),this.header=new s.Header(n),this.tracks=[],t&&(this.tracks=n.tracks.map((function(t){return new u.Track(t,e.header)})),1===n.header.format&&0===this.tracks[0].duration&&this.tracks.shift())}return t.fromUrl=function(e){return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return[4,fetch(e)];case 1:return(n=i.sent()).ok?[4,n.arrayBuffer()]:[3,3];case 2:return[2,new t(i.sent())];case 3:throw new Error("could not load "+e)}}))}))},Object.defineProperty(t.prototype,"name",{get:function(){return this.header.name},set:function(t){this.header.name=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){var t=this.tracks.map((function(t){return t.duration}));return Math.max.apply(Math,t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"durationTicks",{get:function(){var t=this.tracks.map((function(t){return t.durationTicks}));return Math.max.apply(Math,t)},enumerable:!0,configurable:!0}),t.prototype.addTrack=function(){var t=new u.Track(void 0,this.header);return this.tracks.push(t),t},t.prototype.toArray=function(){return a.encode(this)},t.prototype.toJSON=function(){return{header:this.header.toJSON(),tracks:this.tracks.map((function(t){return t.toJSON()}))}},t.prototype.fromJSON=function(t){var e=this;this.header=new s.Header,this.header.fromJSON(t.header),this.tracks=t.tracks.map((function(t){var n=new u.Track(void 0,e.header);return n.fromJSON(t),n}))},t.prototype.clone=function(){var e=new t;return e.fromJSON(this.toJSON()),e},t}();e.Midi=l;var c=n(53);e.Track=c.Track;var f=n(40);e.Header=f.Header},,,,,function(t,e,n){e.parseMidi=n(80),e.writeMidi=n(81)},function(t,e,n){function i(t,e,n){void 0===n&&(n="ticks");var i=0,r=t.length,o=r;if(r>0&&t[r-1][n]<=e)return r-1;for(;i<o;){var a=Math.floor(i+(o-i)/2),s=t[a],u=t[a+1];if(s[n]===e){for(var l=a;l<t.length;l++)t[l][n]===e&&(a=l);return a}if(s[n]<e&&u[n]>e)return a;s[n]>e?o=a:s[n]<e&&(i=a+1)}return-1}Object.defineProperty(e,"__esModule",{value:!0}),e.search=i,e.insert=function(t,e,n){if(void 0===n&&(n="ticks"),t.length){var r=i(t,e[n],n);t.splice(r+1,0,e)}else t.push(e)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(52),r=n(54),o=n(84),a=n(85),s=n(86),u=n(88),l=new WeakMap,c=function(){function t(t,e){var n=this;if(this.name="",this.notes=[],this.controlChanges=o.createControlChanges(),this.pitchBends=[],l.set(this,e),t){var i=t.find((function(t){return"trackName"===t.type}));this.name=i?i.text:""}if(this.instrument=new s.Instrument(t,this),this.channel=0,t){for(var r=t.filter((function(t){return"noteOn"===t.type})),a=t.filter((function(t){return"noteOff"===t.type})),u=function(){var t=r.shift();c.channel=t.channel;var e=a.findIndex((function(e){return e.noteNumber===t.noteNumber&&e.absoluteTime>=t.absoluteTime}));if(-1!==e){var n=a.splice(e,1)[0];c.addNote({durationTicks:n.absoluteTime-t.absoluteTime,midi:t.noteNumber,noteOffVelocity:n.velocity/127,ticks:t.absoluteTime,velocity:t.velocity/127})}},c=this;r.length;)u();t.filter((function(t){return"controller"===t.type})).forEach((function(t){n.addCC({number:t.controllerType,ticks:t.absoluteTime,value:t.value/127})})),t.filter((function(t){return"pitchBend"===t.type})).forEach((function(t){n.addPitchBend({ticks:t.absoluteTime,value:t.value/Math.pow(2,13)})}))}}return t.prototype.addNote=function(t){var e=l.get(this),n=new u.Note({midi:0,ticks:0,velocity:1},{ticks:0,velocity:0},e);return Object.assign(n,t),i.insert(this.notes,n,"ticks"),this},t.prototype.addCC=function(t){var e=l.get(this),n=new r.ControlChange({controllerType:t.number},e);return delete t.number,Object.assign(n,t),Array.isArray(this.controlChanges[n.number])||(this.controlChanges[n.number]=[]),i.insert(this.controlChanges[n.number],n,"ticks"),this},t.prototype.addPitchBend=function(t){var e=l.get(this),n=new a.PitchBend({},e);return Object.assign(n,t),i.insert(this.pitchBends,n,"ticks"),this},Object.defineProperty(t.prototype,"duration",{get:function(){if(!this.notes.length)return 0;for(var t=this.notes[this.notes.length-1].time+this.notes[this.notes.length-1].duration,e=0;e<this.notes.length-1;e++){var n=this.notes[e].time+this.notes[e].duration;t<n&&(t=n)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"durationTicks",{get:function(){if(!this.notes.length)return 0;for(var t=this.notes[this.notes.length-1].ticks+this.notes[this.notes.length-1].durationTicks,e=0;e<this.notes.length-1;e++){var n=this.notes[e].ticks+this.notes[e].durationTicks;t<n&&(t=n)}return t},enumerable:!0,configurable:!0}),t.prototype.fromJSON=function(t){var e=this;for(var n in this.name=t.name,this.channel=t.channel,this.instrument=new s.Instrument(void 0,this),this.instrument.fromJSON(t.instrument),t.controlChanges)t.controlChanges[n]&&t.controlChanges[n].forEach((function(t){e.addCC({number:t.number,ticks:t.ticks,value:t.value})}));t.notes.forEach((function(t){e.addNote({durationTicks:t.durationTicks,midi:t.midi,ticks:t.ticks,velocity:t.velocity})}))},t.prototype.toJSON=function(){for(var t={},e=0;e<127;e++)this.controlChanges.hasOwnProperty(e)&&(t[e]=this.controlChanges[e].map((function(t){return t.toJSON()})));return{channel:this.channel,controlChanges:t,pitchBends:this.pitchBends.map((function(t){return t.toJSON()})),instrument:this.instrument.toJSON(),name:this.name,notes:this.notes.map((function(t){return t.toJSON()}))}},t}();e.Track=c},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.controlChangeNames={1:"modulationWheel",2:"breath",4:"footController",5:"portamentoTime",7:"volume",8:"balance",10:"pan",64:"sustain",65:"portamentoTime",66:"sostenuto",67:"softPedal",68:"legatoFootswitch",84:"portamentoControl"},e.controlChangeIds=Object.keys(e.controlChangeNames).reduce((function(t,n){return t[e.controlChangeNames[n]]=n,t}),{});var i=new WeakMap,r=new WeakMap,o=function(){function t(t,e){i.set(this,e),r.set(this,t.controllerType),this.ticks=t.absoluteTime,this.value=t.value}return Object.defineProperty(t.prototype,"number",{get:function(){return r.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return e.controlChangeNames[this.number]?e.controlChangeNames[this.number]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return i.get(this).ticksToSeconds(this.ticks)},set:function(t){var e=i.get(this);this.ticks=e.secondsToTicks(t)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{number:this.number,ticks:this.ticks,time:this.time,value:this.value}},t}();e.ControlChange=o},function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==_typeof(t)&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){n.r(e),n.d(e,"SVGNS",(function(){return i})),n.d(e,"drawSVGPath",(function(){return r})),n.d(e,"drawSVGText",(function(){return o})),n.d(e,"createSVGGroupChild",(function(){return a})),n.d(e,"setFade",(function(){return s}));var i="http://www.w3.org/2000/svg";function r(t,e,n,r,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,u=document.createElementNS(i,"path");return u.setAttributeNS(null,"d",e),u.setAttributeNS(null,"transform","translate(".concat(n,", ").concat(r,") scale(").concat(o,", ").concat(a,")")),u.setAttributeNS(null,"opacity",""+s),t.appendChild(u),u}function o(t,e,n,r,o){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,l=document.createElementNS(i,"text");l.setAttributeNS(null,"font-family","Times"),l.setAttributeNS(null,"font-size",o),a&&l.setAttributeNS(null,"font-weight","bold"),l.setAttributeNS(null,"transform","translate(".concat(n,", ").concat(r,") scale(").concat(s,", ").concat(u,")"));var c=document.createTextNode(e);return l.appendChild(c),t.appendChild(l),l}function a(t,e){var n=document.createElementNS(i,"g");return n.setAttribute("data-id",e),t.appendChild(n),n}function s(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=t.querySelector("animate");if(!o){(o=document.createElementNS(i,"animate")).setAttributeNS(null,"attributeName","opacity"),o.setAttributeNS(null,"dur","4s"),o.setAttributeNS(null,"fill","freeze"),o.setAttributeNS(null,"keyTimes","0; 0.25; 0.5; 0.75; 1");var a=(n+3*r)/4;o.setAttributeNS(null,"values","".concat(n,"; ").concat(a,"; ").concat(r,"; ").concat(a,"; ").concat(n))}return e?o.setAttributeNS(null,"repeatCount","indefinite"):o.setAttributeNS(null,"repeatCount","1"),t.appendChild(o),t}},function(t,e,n){n.r(e),n.d(e,"PATH_SCALE",(function(){return i})),n.d(e,"staffLinePath",(function(){return o})),n.d(e,"extraLinePath",(function(){return a})),n.d(e,"barPath",(function(){return s})),n.d(e,"stemPath",(function(){return u})),n.d(e,"singleFlagPath",(function(){return l})),n.d(e,"multiFlagPath",(function(){return c})),n.d(e,"tiePath",(function(){return f})),n.d(e,"dotPath",(function(){return h})),n.d(e,"NOTE_PATHS",(function(){return d})),n.d(e,"REST_PATHS",(function(){return p})),n.d(e,"CLEF_PATHS",(function(){return m})),n.d(e,"ACCIDENTAL_PATHS",(function(){return y}));var i=100,r="M 0,10 C 0,-15 35,-50 80,-50 110,-50 125,-35 125,-10 \n125,15 90,50 45,50 15,50 0,35 0,10 Z",o="m 0,0 h 100",a="m -25,0 h 175",s="m 0,-200 v 400",u="m 0,0 v 100 h 15 v -100 z",l="M0,0 h 12 c 7,100 175,156 62,314 79,-177 -49,\n-193 -61,-200 l -13,-5 z",c="m 0,0 h 10 c 6,72 173,64 84,227 44,-120 -44,\n-123 -94,-167 z",f="M 0,25 C 10,46 30,67 50,67 69,67 90,47 100,25 94,\n65 73,89 50,89 26,89 5,63 0,25 Z",h="M 5 -20 a 20 20 0 1 0 0.00001 0 z",d={4:{path:"m 0,0 c 0,-37 49,-51 79,-51 31,0 83,13 83,51 0,39 \n-55,51 -84,51 C 49,51 0,37 0,0 Z m 111,31 c 13,-19 0,-58 -22,-68 -33,-15 \n-53,10 -39,49 9,27 48,39 61,19 z",width:150,stemVSteps:0,stemAnchor:0,flags:0},2:{path:"m 0,10 c 0,-25 35,-60 80,-60 15,0 45,4 45,40 C 125,16 \n89,50 45,50 17,50 0,36 0,10 Z m 71,7 c 17,-11 45,-34 38,-45 -7,-10 -39,1 \n-57,12 -19,11 -42,31 -36,42 6,10 37,2 55,-9 z",width:125,stemVSteps:7,stemAnchor:-10,flags:0},1:{path:r,width:125,stemVSteps:7,stemAnchor:-10,flags:0},.5:{path:r,width:125,stemVSteps:7,stemAnchor:-10,flags:1},.25:{path:r,width:125,stemVSteps:9,stemAnchor:-10,flags:2},.125:{path:r,width:125,stemVSteps:11,stemAnchor:-10,flags:3},.0625:{path:r,width:125,stemVSteps:13,stemAnchor:-10,flags:4}},p={4:"m 0,-50 h 125 v -50 H 0 Z",2:"M 0,0 H 125 V -50 H 0 Z",1:"m 0,-25 c 39,-39 37,-75 8,-120 l 6,-5 61,103 C \n40,-13 31,4 73,71 l -5,5 C 14,52 16,125 67,144 l -4,6 C -37,102 -1,22 59,60 Z",.5:"m 52,-47 c 26,-2 42,-21 48,-42 l 12,4 L 64,83 52,79 \n88,-49 c 0,0 -17,22 -57,22 -16,0 -31,-13 -31,-27 0,-18 10,-31 27,-31 17,0 \n33,15 25,38 z",.25:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 l -36,128 12,4 77,-270 z",.125:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 L 68,20 C 61,37 46,51 24,52 32,29 16,14 -1,14 c \n-17,0 -27,13 -27,31 0,14 15,27 31,27 38,0 55,-20 57,-22 l -36,128 12,4 \n105,-369 z",.0625:"m 158,-292 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -17,61 \nv 0 c -6,21 -22,40 -48,42 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 \n15,27 31,27 40,0 57,-22 57,-22 l -20,69 c -7,18 -22,33 -45,35 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 L 68,20 C \n61,37 46,51 24,52 32,29 16,14 -1,14 c -17,0 -27,13 -27,31 0,14 15,27 31,27 \n38,0 55,-20 57,-22 l -36,128 12,4 134,-469 z"},m={50:{path:"m 101,-199 c -49,0 -100,28 -100,83 0,39 58,57 82,26 15,-20 \n-4,-47 -32,-47 -23,1 -25,0 -25,-8 0,-22 40,-46 71,-41 91,16 67,208 -105,302 \n75,-27 198,-94 211,-201 6,-66 -42,-114 -102,-114 z m 143,33 c -13,0 -23,11 \n-23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 z m 2,83 c \n-13,0 -23,11 -23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 \nz",upper:-4,lower:3},71:{path:"M 139,48 C 102,57 76,120 131,151 41,128 64,24 129,2 L \n117,-57 C -32,47 26,217 166,182 Z m 12,-1 27,131 C 242,153 216,46 151,47 \nZ m -35,-177 c 34,-23 82,-117 50,-140 -23,-17 -71,33 -50,140 z m -10,10 c \n-23,-77 -20,-200 48,-213 19,-4 89,171 -26,266 l 13,66 c 120,-6 137,155 \n39,191 l 12,58 c 30,131 -137,145 -138,47 0,-29 37,-59 63,-37 21,18 25,71 \n-25,70 32,42 103,0 91,-65 L 167,193 C 56,232 -112,63 106,-120 Z",upper:-7,lower:8}},y=[null,"m -49,-121 v 52 l -29,9 v -48 h -8 v 51 l -20,6 v 29 l \n20,-6 v 70 l -20,6 v 30 l 20,-6 v 51 h 8 V 69 l 30,-8 v 50 h 8 V 58 l 20,-6 \nV 23 l -20,6 v -71 l 20,-6 v -29 l -20,6 v -50 z m 1,82 v 71 l -29,9 v -71 z","M -106,-166 V 67 c 52,-42 85,-56 85,-94 0,-47 -46,-51 \n-73,-22 v -117 z m 31,120 c 20,0 42,46 -20,91 V -7 c 0,-28 10,-39 20,-39 z","m -81,-58 v -48 H -92 V 73 l 60,-13 v 50 h 11 V -72 Z m \n50,24 v 58 l -50,11 v -58 z"]},function(t,e,n){n.r(e),n.d(e,"MIN_RESOLUTION",(function(){return i})),n.d(e,"STEM_WIDTH",(function(){return r})),n.d(e,"LINE_STROKE",(function(){return o})),n.d(e,"COMPACT_SPACING",(function(){return a}));var i=.0625,r=15,o=1,a=150},function(t,e,n){n.r(e),n.d(e,"MAX_QUARTER_DIVISION",(function(){return l})),n.d(e,"ScrollType",(function(){return i})),n.d(e,"StaffSVGRender",(function(){return c}));var i,r=n(2),o=n(0),a=n(1),s=[{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,0,1,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,0,3,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,2,0,0,2,0,2,0,0,3]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-7],accidental:[3,0,3,0,3,0,0,3,0,3,0,0]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,2,0,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,3,0,0]}],u=[{accidental:1,pitches:[]},{accidental:2,pitches:[70,75,68,73,66]},{accidental:1,pitches:[78,73]},{accidental:2,pitches:[70,75,68]},{accidental:1,pitches:[78,73,80,75]},{accidental:2,pitches:[70]},{accidental:2,pitches:[70,75,68,73,66,71]},{accidental:1,pitches:[78]},{accidental:2,pitches:[70,75,68,73]},{accidental:1,pitches:[78,73,80]},{accidental:2,pitches:[70,75]},{accidental:1,pitches:[78,73,80,75,70]}],l=16;!function(t){t[t.PAGE=0]="PAGE",t[t.NOTE=1]="NOTE",t[t.BAR=2]="BAR"}(i||(i={}));var c=function(){function t(e,n,o){var s=this;_classCallCheck(this,t),this.handleScrollEvent=function(t){s.lastKnownScrollLeft=s.parentElement.scrollLeft,s.ticking||window.requestAnimationFrame((function(){s.changeAndDrawSignaturesIfNeeded(s.lastKnownScrollLeft),s.ticking=!1})),s.ticking=!0},this.scoreInfo=e,this.config={noteHeight:n.noteHeight||6,noteSpacing:n.noteSpacing||1,pixelsPerTimeStep:n.pixelsPerTimeStep||30,noteRGB:n.noteRGB||"8, 41, 64",activeNoteRGB:n.activeNoteRGB||"240, 84, 119"},this.div=o,this.timeSignatureNumerator=4,this.timeSignatureDenominator=4,this.key=n.defaultKey||0,this.scrollType=n.scrollType||i.PAGE,this.scale=this.config.noteHeight/a.PATH_SCALE,(void 0===n.pixelsPerTimeStep||n.pixelsPerTimeStep<=0)&&(this.config.pixelsPerTimeStep=0,this.config.noteSpacing=r.COMPACT_SPACING*this.scale),this.clear(),this.redraw()}return _createClass(t,[{key:"clear",value:function(){for(;this.div.lastChild;)this.div.removeChild(this.div.lastChild);this.div.style.overflow="visible",this.div.style.position="relative",this.overlaySVG=document.createElementNS(o.SVGNS,"svg"),this.overlaySVG.style.position="absolute",this.div.appendChild(this.overlaySVG),this.overlayG=Object(o.createSVGGroupChild)(this.overlaySVG,"overlay"),this.signaturesBlinking=!1,this.signaturesQuarters=0,this.parentElement=document.createElement("div"),this.parentElement.style.overflow="auto",this.div.appendChild(this.parentElement),this.ticking=!1,this.lastKnownScrollLeft=0,this.parentElement.addEventListener("scroll",this.handleScrollEvent),this.staffSVG=document.createElementNS(o.SVGNS,"svg"),this.parentElement.appendChild(this.staffSVG),this.staffG=Object(o.createSVGGroupChild)(this.staffSVG,"staff"),this.linesG=Object(o.createSVGGroupChild)(this.staffSVG,"lines"),this.setStroke(this.linesG),this.staffG.appendChild(this.linesG),this.musicG=Object(o.createSVGGroupChild)(this.staffSVG,"music"),this.setFill(this.musicG),this.setStroke(this.musicG,0),this.staffG.appendChild(this.musicG),this.signaturesG=Object(o.createSVGGroupChild)(this.staffSVG,"signatures"),this.staffG.appendChild(this.signaturesG);var t=0,e=0;this.scoreInfo.notes.forEach((function(n){t+=n.pitch,++e}));var n=t/e;this.clef=n<60?50:71,this.signaturesList=[{x:0,q:0}],this.signatureCurrent=0,this.signatureNext=0,this.changeKeySignatureIfNeeded(0),this.changeTimeSignatureIfNeeded(0),this.vStepSize=this.config.noteHeight/2,this.hStepSize=this.config.pixelsPerTimeStep,this.staffOffset=0,this.height=0,this.width=0,this.musicBlockMap=new Map,this.playingNotes=[],this.lastBar=0,this.barAccidentals={},this.lastQ=-1}},{key:"isPaintingActiveNote",value:function(t,e){var n=t.start===e.start,i=t.start<=e.start&&t.start+t.length>=e.start+e.length;return n||i}},{key:"redraw",value:function(t,e){var n=this,r=-1,a=0===this.config.pixelsPerTimeStep;if(t){var s=[];this.playingNotes.forEach((function(e){n.isPaintingActiveNote(e,t)?s.push(e):n.highlightElement(n.getGroup(e),!1)})),this.playingNotes=s;var u=this.getGroup(t);if(u){this.playingNotes.push(t),this.highlightElement(u,!0),r=u.getBoundingClientRect().left-this.staffSVG.getBoundingClientRect().left;var l=t.start,c=u.getAttribute("data-is-bar-beginning");(this.scrollType!==i.BAR||c)&&this.scrollIntoViewIfNeeded(e,r),!a&&this.signaturesBlinking&&l>=this.signaturesQuarters&&(this.signaturesBlinking=!1,Object(o.setFade)(this.overlayG,this.signaturesBlinking))}}else{this.setDetails();var f=-1===this.lastQ,h=0,d=0;f?(d=this.drawSignatures(this.overlayG,h,!0,!0,!0),a&&(this.width=0,d+=this.config.noteSpacing),d+=this.drawRests(this.initialRest,h+d)):h=this.width,this.musicBlockMap.forEach((function(t,e){a||(h=n.quartersToTime(e)*n.hStepSize),e>n.lastQ?(d+=n.drawMusicBlock(t,h+d),n.lastQ=e):e===n.lastQ&&(d+=n.drawRests(t,h+d))}));var p=this.staffSVG.getBoundingClientRect(),m=this.musicG.getBoundingClientRect();if(this.updateVerticalBoundaries(m.top-p.top,m.bottom-p.top),a)this.width+=d;else{var y=this.musicBlockMap.get(this.lastQ),g=this.quartersToTime(this.lastQ+y.notes[0].length);this.width=g*this.config.pixelsPerTimeStep}this.staffSVG.setAttributeNS(null,"width",""+this.width),this.redrawStaff(this.linesG,0,this.width)}return r}},{key:"drawMusicBlock",value:function(t,e){var n=this,i=t.notes[0].start,s=this.drawBarIfNeeded(i,e);s+=this.drawSignaturesIfNeeded(i,e+s);for(var u=0,l=4;l>=r.MIN_RESOLUTION&&!u;l/=2)l<=t.notes[0].length&&(u=l);if(0===u){var c=0===t.notes[0].length?"[infinite]":""+4/t.notes[0].length;console.warn(" StaffRender ","background:orange; color:white","StaffRender does not handle notes shorther than 1/".concat(4/r.MIN_RESOLUTION,"th, and this score tries to draw a 1/").concat(c,"th. Shortest possible note will be drawn instead.")),u=r.MIN_RESOLUTION}var f,h=a.NOTE_PATHS[u];if(h.stemAnchor&&(f=Object(o.createSVGGroupChild)(this.musicG,"stem")),t.notes.forEach((function(i){for(var r=i.vSteps*n.vStepSize,l=2*(i.vSteps>0?Math.floor(i.vSteps/2):Math.ceil(i.vSteps/2)),c=i.vSteps>0?-2:2,f=l;Math.abs(f)>4;f+=c)Object(o.drawSVGPath)(n.linesG,a.extraLinePath,e+s,f*n.vStepSize,n.scale,1);if(i.g=i.tiedFrom?i.tiedFrom.g:Object(o.createSVGGroupChild)(n.musicG,"".concat(i.start,"-").concat(i.pitch)),t.isBarBeginning&&i.g.setAttribute("data-is-bar-beginning","true"),i.tiedFrom){var d=e+s-i.tiedFrom.xHeadRight;Object(o.drawSVGPath)(i.g,a.tiePath,i.tiedFrom.xHeadRight,r,d/a.PATH_SCALE,n.scale*(i.vSteps<0?-1:1),i.opacity)}Object(o.drawSVGPath)(i.g,h.path,e+s,r,n.scale,n.scale,i.opacity),i.xHeadRight=e+s+h.width*n.scale,1.5*u<=i.length&&Object(o.drawSVGPath)(i.g,a.dotPath,e+s+h.width*n.scale+n.vStepSize/2,r-n.vStepSize/2,n.scale,n.scale,i.opacity),0!==i.accidental&&Object(o.drawSVGPath)(i.g,a.ACCIDENTAL_PATHS[i.accidental],e+s,r,n.scale,n.scale,i.opacity)})),h.stemAnchor){var d,p,m=e+s,y=h.stemAnchor*this.scale,g=t.minVStep+t.maxVStep<0,_=h.flags>2?2*(h.flags-2):0;if(g?(d=t.maxVStep*this.vStepSize-y,p=(t.minVStep+7+_)*this.vStepSize):(m+=(h.width-r.STEM_WIDTH)*this.scale,d=t.minVStep*this.vStepSize+y,p=(t.maxVStep-7-_)*this.vStepSize),Object(o.drawSVGPath)(f,a.stemPath,m,d,this.scale,(p-d)/a.PATH_SCALE),1===h.flags)Object(o.drawSVGPath)(f,a.singleFlagPath,m,p,this.scale,this.scale*(g?-1:1),1);else if(h.flags>1)for(var v=0;v<h.flags;++v)Object(o.drawSVGPath)(f,a.multiFlagPath,m,p,this.scale,this.scale*(g?-1:1),1),p+=(g?-2:2)*this.vStepSize}return 0===this.config.pixelsPerTimeStep&&(s+=h.width*this.scale,f&&(s+=f.getBoundingClientRect().width),s+=this.config.noteSpacing),s+=this.drawRests(t,e+s)}},{key:"drawBarIfNeeded",value:function(t,e){var n=0,i=this.lastBar+this.getBarLength();return 0!==t&&t>=i&&(this.config.pixelsPerTimeStep>0?e-=this.config.noteSpacing:n=this.config.noteSpacing,Object(o.drawSVGPath)(this.linesG,a.barPath,e,0,1,this.scale),this.lastBar=i),n}},{key:"drawRests",value:function(t,e){var n=0,i=t.restToNextLength;if(i){this.config.pixelsPerTimeStep>0&&(e+=this.quartersToTime(t.notes[0].length)*this.hStepSize);var s,u=t.notes[0].start+t.notes[0].length,l=0,c=this.lastBar+this.getBarLength()-u;for(i>c&&(l=i-c,i=c),s=4;s>this.getBarLength()&&s>=r.MIN_RESOLUTION;s/=2);for(var f=s;(i||l)&&f>=r.MIN_RESOLUTION;){if(f<=i){n+=this.drawBarIfNeeded(u,e+n),n+=this.drawSignaturesIfNeeded(u,e+n);var h=Object(o.drawSVGPath)(this.musicG,a.REST_PATHS[f],e+n,0,this.scale,this.scale);this.config.pixelsPerTimeStep>0?e+=this.quartersToTime(f)*this.hStepSize:(n+=h.getBoundingClientRect().width,n+=this.config.noteSpacing),u+=f,i-=f}if(l&&i<=0){var d=this.getBarLength();for(l>d?(i=d,l-=d):(i=l,l=0),s=4;s>this.getBarLength()&&s>=r.MIN_RESOLUTION;s/=2);f=s}i<f&&(f/=2)}}return n}},{key:"redrawStaff",value:function(t,e,n){var i=t.querySelector('g[data-id="staff-five-lines"]');if(i)i.setAttributeNS(null,"transform","scale(".concat(n/a.PATH_SCALE,", 1)"));else{i=Object(o.createSVGGroupChild)(t,"staff-five-lines");for(var r=-4;r<=4;r+=2)Object(o.drawSVGPath)(i,a.staffLinePath,e,0+r*this.vStepSize,n/a.PATH_SCALE,1)}return i}},{key:"clearSignatureOverlay",value:function(){for(;this.overlayG.lastChild;)this.overlayG.removeChild(this.overlayG.lastChild)}},{key:"drawSignaturesIfNeeded",value:function(t,e){var n=0,i=this.changeKeySignatureIfNeeded(t),a=this.changeTimeSignatureIfNeeded(t);if(i||a){var s=r.COMPACT_SPACING*this.scale*(this.config.pixelsPerTimeStep>0?3:2);this.signaturesList.push({x:e-s,q:t}),null===this.signatureNext&&(this.signatureNext=e);var u=t>0?Object(o.createSVGGroupChild)(this.signaturesG,"signatures"):this.overlayG;n+=this.drawSignatures(u,e+n,!1,i,a)}return 0===this.config.pixelsPerTimeStep?n:0}},{key:"drawSignatures",value:function(t,e,n,i,s){var l,c=this,f=r.COMPACT_SPACING*this.scale,h=f,d=t===this.overlayG||this.config.pixelsPerTimeStep>0;if(d){(l=document.createElementNS(o.SVGNS,"rect")).setAttributeNS(null,"x",""+e),l.setAttributeNS(null,"y","0"),l.setAttributeNS(null,"width","1"),l.setAttributeNS(null,"height","1"),l.setAttribute("data-id","background"),t.appendChild(l);var p=document.defaultView.getComputedStyle(this.div.parentElement);l.setAttributeNS(null,"fill",p.getPropertyValue("background-color"))}if(n){var m=Object(o.drawSVGPath)(t,a.CLEF_PATHS[this.clef].path,e+h,0,this.scale,this.scale);this.setFill(m),h+=3*f}if(i){var y=u[this.key].accidental,g=71===this.clef?0:14;u[this.key].pitches.forEach((function(n){var i=c.getPitchDetails(n).vSteps,r=Object(o.drawSVGPath)(t,a.ACCIDENTAL_PATHS[y],e+h,(g+i)*c.vStepSize,c.scale,c.scale);c.setFill(r),h+=r.getBoundingClientRect().width}))}if(s){var _=Object(o.createSVGGroupChild)(t,"time-key"),v=2.85*this.config.noteHeight+"px";Object(o.drawSVGText)(_,""+this.timeSignatureNumerator,e+h,-.5,v,!0),Object(o.drawSVGText)(_,""+this.timeSignatureDenominator,e+h,4*this.vStepSize-.5,v,!0),this.setFill(_),h+=_.getBoundingClientRect().width+f}var S=this.redrawStaff(t,e,h);this.setStroke(S);var b=this.div.getBoundingClientRect(),w=t.getBoundingClientRect();if(this.updateVerticalBoundaries(w.top-b.top,w.bottom-b.top),d&&(l.setAttributeNS(null,"y",""+-this.staffOffset),l.setAttributeNS(null,"height",""+this.height),l.setAttributeNS(null,"width",""+h)),t===this.overlayG){this.overlaySVG.setAttributeNS(null,"width",""+(h+5));for(var T=0;T<5;++T){var P=Object(o.drawSVGPath)(t,a.stemPath,h+T,T*T-this.staffOffset,1/r.STEM_WIDTH,(this.height-2*T*T)/a.PATH_SCALE,(T-5)*(T-5)*2/a.PATH_SCALE);this.setFill(P)}}if(this.config.pixelsPerTimeStep>0){var k=0===this.signaturesQuarters;return k&&(this.signaturesQuarters=this.timeToQuarters(h/this.hStepSize)),(k||e>0)&&(this.signaturesBlinking=!0,Object(o.setFade)(t,this.signaturesBlinking)),0}return h}},{key:"changeKeySignatureIfNeeded",value:function(t){if(this.scoreInfo.keySignatures){for(var e=this.key,n=0;n<this.scoreInfo.keySignatures.length&&this.scoreInfo.keySignatures[n].start<=t;++n)e=this.scoreInfo.keySignatures[n].key;if(e!==this.key)return this.key=e,!0}return!1}},{key:"changeTimeSignatureIfNeeded",value:function(t){if(this.scoreInfo.timeSignatures){for(var e=this.timeSignatureNumerator,n=this.timeSignatureDenominator,i=0;i<this.scoreInfo.timeSignatures.length&&this.scoreInfo.timeSignatures[i].start<=t;++i)e=this.scoreInfo.timeSignatures[i].numerator,n=this.scoreInfo.timeSignatures[i].denominator;if(e!==this.timeSignatureNumerator||n!==this.timeSignatureDenominator)return this.timeSignatureNumerator=e,this.timeSignatureDenominator=n,!0}return!1}},{key:"changeAndDrawSignaturesIfNeeded",value:function(t){var e;if(t<this.signatureCurrent||null!==this.signatureNext&&this.signatureNext<=t){e=this.signaturesList[0].q,this.signatureNext=null;for(var n=0;n<this.signaturesList.length;++n){if(t<this.signaturesList[n].x){this.signatureNext=this.signaturesList[n].x;break}this.signatureCurrent=this.signaturesList[n].x,e=this.signaturesList[n].q}}if(void 0!==e){var i=this.key,r=this.timeSignatureNumerator,a=this.timeSignatureDenominator;this.changeKeySignatureIfNeeded(e),this.changeTimeSignatureIfNeeded(e),this.clearSignatureOverlay(),this.drawSignatures(this.overlayG,0,!0,!0,!0),this.key=i,this.timeSignatureNumerator=r,this.timeSignatureDenominator=a}this.config.pixelsPerTimeStep>0&&0===t&&(this.signatureNext=0,this.signaturesBlinking=!0,Object(o.setFade)(this.overlayG,this.signaturesBlinking))}},{key:"getBarLength",value:function(){return 4*this.timeSignatureNumerator/this.timeSignatureDenominator}},{key:"scrollIntoViewIfNeeded",value:function(t,e){if(t)if(this.scrollType===i.PAGE){var n=this.parentElement.getBoundingClientRect().width;e>this.parentElement.scrollLeft+n&&(this.parentElement.scrollLeft=e-20)}else{var r=this.parentElement.getBoundingClientRect().width;this.parentElement.scrollLeft=e-.5*r}}},{key:"updateVerticalBoundaries",value:function(t,e){var n=0;if(t<0){this.staffOffset-=t;var i="translate(0, ".concat(this.staffOffset,")");this.overlayG.setAttributeNS(null,"transform",i),this.staffG.setAttributeNS(null,"transform",i),n=this.height-t}if((n=Math.max(n,e-t))>this.height){this.height=n,this.overlaySVG.setAttributeNS(null,"height",""+this.height),this.staffSVG.setAttributeNS(null,"height",""+this.height);for(var r=this.div.querySelectorAll('rect[data-id="background"]'),o=0;o<r.length;++o){var a=r[o];a.setAttributeNS(null,"y",""+-this.staffOffset),a.setAttributeNS(null,"height",""+this.height)}}}},{key:"setFill",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.setAttributeNS(null,"fill",this.getColor(e))}},{key:"setStroke",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.LINE_STROKE,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.setAttributeNS(null,"stroke",this.getColor(n)),t.setAttributeNS(null,"stroke-width",""+e)}},{key:"getColor",value:function(t){return"rgb(".concat(t?this.config.activeNoteRGB:this.config.noteRGB,")")}},{key:"getOpacity",value:function(t){return t?t/127*.8+.2:1}},{key:"getGroup",value:function(t){var e=t.start,n=t.pitch;return this.staffSVG.querySelector('g[data-id="'.concat(e,"-").concat(n,'"]'))}},{key:"highlightElement",value:function(t,e){t.setAttribute("fill",this.getColor(e)),t.setAttribute("stroke",this.getColor(e))}},{key:"getBarBeginnings",value:function(){var t=new Set,e=0;this.scoreInfo.notes.forEach((function(t){t.start+t.length>e&&(e=t.start+t.length)}));var n=this.scoreInfo.timeSignatures?this.scoreInfo.timeSignatures.slice(0):[{start:0,numerator:4,denominator:4}];n.sort((function(t,e){return t.start-e.start}));for(var i=0,r=0;r<n.length;++r)for(var o=r===n.length-1?e:n[r].start,a=4*n[r].numerator/n[r].denominator;i<o;i+=a)t.add(i);return t}},{key:"quartersToTime",value:function(t){return t/this.scoreInfo.tempos[0].qpm*60}},{key:"timeToQuarters",value:function(t){return t*this.scoreInfo.tempos[0].qpm/60}},{key:"setDetails",value:function(){var t=this,e=new Map,n=this.getBarBeginnings(),i=new Set(n);this.scoreInfo.notes.slice().sort((function(t,e){return t.start-e.start})).forEach((function(n){var r=t.getQNote(n);i.add(r.start),i.add(r.start+r.length),e.has(r.start)?e.get(r.start).push(r):e.set(r.start,[r])})),Array.from(i).sort((function(t,e){return t-e})).forEach((function(n){var i=[];e.forEach((function(e){e.forEach((function(e){var r=t.splitQNote(e,n);r&&i.push(r)}))})),i.forEach((function(t){e.has(t.start)?e.get(t.start).push(t):e.set(t.start,[t])}))})),e=new Map(Array.from(e).sort((function(t,e){return t[0]-e[0]})));var r=this.key,o=null,a=0,s=n[Symbol.iterator](),u=s.next();e.forEach((function(e,n){var i={maxVStep:Number.MAX_SAFE_INTEGER,minVStep:Number.MIN_SAFE_INTEGER,restToNextLength:0,isBarBeginning:!1,notes:[]};t.changeKeySignatureIfNeeded(n);var r=u.value+t.getBarLength();!u.done&&n>=r&&(u=s.next(),t.barAccidentals={},i.isBarBeginning=!0),e.forEach((function(e){t.analyzePitch(e,n),i.minVStep=Math.max(e.vSteps,i.minVStep),i.maxVStep=Math.min(e.vSteps,i.maxVStep),i.notes.push(e)})),o&&(o.restToNextLength=n-a),t.musicBlockMap.set(n,i),o=i,a=n+i.notes[0].length})),this.initialRest={maxVStep:0,minVStep:0,restToNextLength:this.musicBlockMap.values().next().value.notes[0].start,isBarBeginning:!0,notes:[{start:0,length:0,vSteps:0,accidental:0,opacity:0,pitch:0,xHeadRight:0}]},this.key=r}},{key:"getQNote",value:function(t){return{start:t.start,length:t.length,vSteps:0,accidental:0,opacity:this.getOpacity(t.intensity),pitch:t.pitch,xHeadRight:0}}},{key:"splitQNote",value:function(t,e){var n=t.start+t.length-e;return e>t.start&&n>0?(t.length-=n,{start:e,length:n,vSteps:t.vSteps,accidental:t.accidental,opacity:t.opacity,pitch:t.pitch,xHeadRight:0,tiedFrom:t}):null}},{key:"analyzePitch",value:function(t,e){var n=this.getPitchDetails(t.pitch);n.vSteps in this.barAccidentals?n.accidental===this.barAccidentals[n.vSteps]?n.accidental=0:(3===this.barAccidentals[n.vSteps]?n.accidental=n.keyAccidental:0===n.accidental&&(n.accidental=3),this.barAccidentals[n.vSteps]=n.accidental):(t.tiedFrom&&(n.accidental=0),this.barAccidentals[n.vSteps]=n.accidental),t.vSteps=n.vSteps,t.accidental=n.accidental}},{key:"getPitchDetails",value:function(t){var e=t-60,n=Math.floor(e/12),i=e-12*n,r=s[this.key].steps[i],o=71===this.clef?6:-6,a=1===u[this.key].accidental?69+(i+3)%12:64+(i+8)%12;return{vSteps:o-7*n+r,accidental:s[this.key].accidental[i],keyAccidental:u[this.key].pitches.indexOf(a)>-1?u[this.key].accidental:0}}}]),t}()},function(t,e,n){n.r(e);var i=n(3);n.d(e,"MAX_QUARTER_DIVISION",(function(){return i.MAX_QUARTER_DIVISION})),n.d(e,"ScrollType",(function(){return i.ScrollType})),n.d(e,"StaffSVGRender",(function(){return i.StaffSVGRender}))}])},,,,,,,,,,,,,function(t,e,n){n.r(e),n.d(e,"aux_inputs",(function(){return i})),n.d(e,"chords",(function(){return r})),n.d(e,"constants",(function(){return o})),n.d(e,"data",(function(){return a})),n.d(e,"logging",(function(){return s})),n.d(e,"melodies",(function(){return u})),n.d(e,"performance",(function(){return l})),n.d(e,"sequences",(function(){return c})),n.d(e,"MetronomeCallbackObject",(function(){return h})),n.d(e,"Metronome",(function(){return d})),n.d(e,"MidiConversionError",(function(){return g})),n.d(e,"midiToSequenceProto",(function(){return _})),n.d(e,"sequenceProtoToMidi",(function(){return v})),n.d(e,"urlToBlob",(function(){return S})),n.d(e,"blobToNoteSequence",(function(){return b})),n.d(e,"urlToNoteSequence",(function(){return w})),n.d(e,"BasePlayerCallback",(function(){return O})),n.d(e,"BasePlayer",(function(){return A})),n.d(e,"Player",(function(){return M})),n.d(e,"SoundFontPlayer",(function(){return q})),n.d(e,"PlayerWithClick",(function(){return E})),n.d(e,"MIDIPlayer",(function(){return C})),n.d(e,"BaseRecorderCallback",(function(){return I})),n.d(e,"Recorder",(function(){return R})),n.d(e,"BaseVisualizer",(function(){return z})),n.d(e,"PianoRollCanvasVisualizer",(function(){return L})),n.d(e,"Visualizer",(function(){return j})),n.d(e,"BaseSVGVisualizer",(function(){return D})),n.d(e,"PianoRollSVGVisualizer",(function(){return B})),n.d(e,"WaterfallSVGVisualizer",(function(){return U})),n.d(e,"ScrollType",(function(){return N})),n.d(e,"StaffSVGVisualizer",(function(){return G}));var i=n(36),r=n(18),o=n(1),a=n(12),s=n(4),u=n(10),l=n(13),c=n(7),f=n(3),h=function t(){_classCallCheck(this,t)},d=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;_classCallCheck(this,t),this.clicksPerQuarter=1,this.muted=!1,this.loClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.loClickNote="c5",this.hiClickNote="g5",this.ticking=!1,this.startedAt=null,this.step=-1,this.reset(),this.callbackObject=e,this.clicksPerQuarter=n}return _createClass(t,[{key:"isTicking",value:function(){return this.ticking}},{key:"getStartedAt",value:function(){return this.startedAt}},{key:"getOffsetTime",value:function(){return f.immediate()-this.startedAt}},{key:"start",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:120;this.reset(),this.ticking=!0,this.callbackObject.click||(this.callbackObject.click=function(){}),this.callbackObject.quarter||(this.callbackObject.quarter=function(){}),this.callbackObject.bar||(this.callbackObject.bar=function(){});var n=0,i=4*this.clicksPerQuarter;f.Transport.scheduleRepeat((function(e){t.startedAt||(t.startedAt=e);var r=e-t.startedAt;t.step++;var o=t.step%i,a=Math.floor(o/t.clicksPerQuarter),s=o%t.clicksPerQuarter;t.callbackObject.click(r,o),0===s&&t.callbackObject.quarter(r,a),t.muted||(0===o?t.hiClick.triggerAttack(t.hiClickNote,e,.1):t.loClick.triggerAttack(t.loClickNote,e,.1)),0===o&&(t.callbackObject.bar(r,n),n++)}),i+"n"),f.Transport.bpm.value=e,f.Transport.start()}},{key:"stop",value:function(){this.ticking=!1,f.Transport.cancel(),f.Transport.stop()}},{key:"reset",value:function(){this.muted=!1,this.ticking=!1,this.step=-1,this.startedAt=null}}]),t}(),p=n(46),m=n(6),y=n(2),g=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i;return _classCallCheck(this,n),i=e.call(this,t),Object.setPrototypeOf(_assertThisInitialized(i),(this instanceof n?this.constructor:void 0).prototype),i}return n}(_wrapNativeSuper(Error));function _(t){var e=new p.Midi(t),n=y.a.create();n.ticksPerQuarter=e.header.ppq,n.sourceInfo=y.a.SourceInfo.create({parser:y.a.SourceInfo.Parser.TONEJS_MIDI_CONVERT,encodingType:y.a.SourceInfo.EncodingType.MIDI});var i,r=_createForOfIteratorHelper(e.header.timeSignatures);try{for(r.s();!(i=r.n()).done;){var a=i.value;n.timeSignatures.push(y.a.TimeSignature.create({time:e.header.ticksToSeconds(a.ticks),numerator:a.timeSignature[0],denominator:a.timeSignature[1]}))}}catch(t){r.e(t)}finally{r.f()}n.timeSignatures.length||n.timeSignatures.push(y.a.TimeSignature.create({time:0,numerator:4,denominator:4}));var s,u=_createForOfIteratorHelper(e.header.tempos);try{for(u.s();!(s=u.n()).done;){var l=s.value;n.tempos.push(y.a.Tempo.create({time:l.time,qpm:l.bpm}))}}catch(t){u.e(t)}finally{u.f()}var c,f=-1,h=_createForOfIteratorHelper(e.tracks);try{for(h.s();!(c=h.n()).done;){var d=c.value;d.notes.length>0&&(f+=1);var m,g=_createForOfIteratorHelper(d.notes);try{for(g.s();!(m=g.n()).done;){var _=m.value,v=_.time,S=v+_.duration;n.notes.push(y.a.Note.create({instrument:f,program:d.instrument.number,startTime:v,endTime:S,pitch:_.midi,velocity:Math.floor(_.velocity*o.MIDI_VELOCITIES),isDrum:d.instrument.percussion})),S>n.totalTime&&(n.totalTime=S)}}catch(t){g.e(t)}finally{g.f()}}}catch(t){h.e(t)}finally{h.f()}return n}function v(t){c.isQuantizedSequence(t)&&(t=c.unquantizeSequence(t));var e=new p.Midi;e.fromJSON({header:{name:"",ppq:t.ticksPerQuarter||o.DEFAULT_TICKS_PER_QUARTER,tempos:[],timeSignatures:[],keySignatures:[],meta:[]},tracks:[]});var n=Array.from(t.tempos||[]);0===n.length&&n.push({time:0,qpm:o.DEFAULT_QUARTERS_PER_MINUTE}),n.sort((function(t,e){return t.time-e.time}));for(var i=0,r=n;i<r.length;i++){var a=r[i];e.header.tempos.push({ticks:e.header.secondsToTicks(a.time),bpm:a.qpm}),e.header.update()}if(t.timeSignatures&&0!==t.timeSignatures.length){var s,u=_createForOfIteratorHelper(t.timeSignatures);try{for(u.s();!(s=u.n()).done;){var l=s.value;e.header.timeSignatures.push({ticks:e.header.secondsToTicks(l.time),timeSignature:[l.numerator,l.denominator]})}}catch(t){u.e(t)}finally{u.f()}}else e.header.timeSignatures.push({ticks:0,timeSignature:[4,4]});e.header.update();var f,h=new Map,d=_createForOfIteratorHelper(t.notes);try{for(d.s();!(f=d.n()).done;){var m=f.value,y=m.instrument?m.instrument:0,g=void 0===m.program?o.DEFAULT_PROGRAM:m.program,_=!!m.isDrum,v=JSON.stringify([y,g,_]);h.has(v)||h.set(v,[]),h.get(v).push(m)}}catch(t){d.e(t)}finally{d.f()}return h.forEach((function(t,n){var i=_slicedToArray(JSON.parse(n).slice(1),2),r=i[0],a=i[1],s=e.addTrack();s.channel=a?o.DRUM_CHANNEL:o.NON_DRUM_CHANNELS[(e.tracks.length-1)%o.NON_DRUM_CHANNELS.length],s.instrument.number=r;var u,l=_createForOfIteratorHelper(t);try{for(l.s();!(u=l.n()).done;){var c=u.value,f=void 0===c.velocity?o.DEFAULT_VELOCITY:c.velocity;s.addNote({midi:c.pitch,time:c.startTime,duration:c.endTime-c.startTime,velocity:(f+1)/o.MIDI_VELOCITIES})}}catch(t){l.e(t)}finally{l.f()}})),e.toArray()}function S(t){return new Promise((function(e,n){Object(m.a)(t).then((function(t){return t.blob()})).then((function(t){e(t)})).catch((function(t){return n(t)}))}))}function b(t){return new Promise((function(e,n){var i=new FileReader;i.onload=function(t){try{var r=_(i.result);e(r)}catch(t){n(t)}},i.onerror=function(t){return n(t)},i.readAsArrayBuffer(t)}))}function w(t){return S(t).then(b)}var T=function(){function t(e){_classCallCheck(this,t),this.FADE_SECONDS=.1,this.baseURL=e,this.buffers=new f.Buffers([]),this.sourceMap=new Map,this.initialized=!1}var e,n;return _createClass(t,[{key:"initialize",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(m.a)(this.baseURL+"/instrument.json").then((function(t){return t.json()})).then((function(t){e.name=t.name,e.minPitch=t.minPitch,e.maxPitch=t.maxPitch,e.durationSeconds=t.durationSeconds,e.releaseSeconds=t.releaseSeconds,e.percussive=t.percussive,e.velocities=t.velocities,e.initialized=!0}));case 2:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"sampleInfoToName",value:function(t){return this.velocities?"p".concat(t.pitch,"_v").concat(t.velocity):"p"+t.pitch}},{key:"sampleNameToURL",value:function(t){return"".concat(this.baseURL,"/").concat(t,".mp3")}},{key:"nearestVelocity",value:function(t){if(!this.velocities)return t;t||(t=o.DEFAULT_VELOCITY);var e=void 0,n=o.MIDI_VELOCITIES;return this.velocities.forEach((function(i){var r=Math.abs(i-t);r<n&&(e=i,n=r)})),e}},{key:"loadSamples",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e){var n,i,r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:if(n=e.filter((function(t){return!(t.pitch<r.minPitch||t.pitch>r.maxPitch)||(s.log("Pitch ".concat(t.pitch," is outside the valid range for ").concat(r.name,", ignoring."),"SoundFont"),!1)})).map((function(t){return r.sampleInfoToName({pitch:t.pitch,velocity:r.nearestVelocity(t.velocity)})})),i=Array.from(new Set(n)).filter((function(t){return!r.buffers.has(t)})).map((function(t){return{name:t,url:r.sampleNameToURL(t)}})),t.t1=i.length>0,!t.t1){t.next=11;break}return i.forEach((function(t){return r.buffers.add(t.name,t.url)})),t.next=10,new Promise((function(t){return f.Buffer.on("load",t)}));case 10:s.log("Loaded samples for ".concat(this.name,"."),"SoundFont");case 11:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"playNote",value:function(t,e,n,i,r){var o=this.getBuffer(t,e);i>this.durationSeconds&&s.log("Requested note duration longer than sample duration: ".concat(i," > ").concat(this.durationSeconds),"SoundFont");var a=new f.BufferSource({buffer:o,fadeOut:this.FADE_SECONDS}).connect(r);if(a.start(n,0,void 0,1,0),!this.percussive&&i<this.durationSeconds){var u=new f.BufferSource(o).connect(r);a.stop(n+i+this.FADE_SECONDS),u.start(n+i,this.durationSeconds,void 0,1,this.FADE_SECONDS)}}},{key:"playNoteDown",value:function(t,e,n){var i=this.getBuffer(t,e),r=new f.BufferSource(i).connect(n);r.start(0,0,void 0,1,0),this.sourceMap.has(t)&&this.sourceMap.get(t).stop(f.now()+this.FADE_SECONDS,this.FADE_SECONDS),this.sourceMap.set(t,r)}},{key:"playNoteUp",value:function(t,e,n){if(this.sourceMap.has(t)){var i=this.getBuffer(t,e);new f.BufferSource(i).connect(n).start(0,this.durationSeconds,void 0,1,this.FADE_SECONDS),this.sourceMap.get(t).stop(f.now()+this.FADE_SECONDS,this.FADE_SECONDS),this.sourceMap.delete(t)}}},{key:"getBuffer",value:function(t,e){if(!this.initialized)throw new Error("Instrument is not initialized.");if(!(t<this.minPitch||t>this.maxPitch)){var n=this.sampleInfoToName({pitch:t,velocity:this.nearestVelocity(e)});if(!this.buffers.has(n))throw new Error("Buffer not found for ".concat(this.name,": ").concat(n));var i=this.buffers.get(n);if(!i.loaded)throw new Error("Buffer not loaded for ".concat(this.name,": ").concat(n));return i}s.log("Pitch ".concat(t," is outside the valid range for ").concat(this.name," (").concat(this.minPitch,"-").concat(this.maxPitch,")"),"SoundFont")}}]),t}(),P=function(){function t(e){_classCallCheck(this,t),this.baseURL=e,this.instruments=new Map,this.initialized=!1}var e,n;return _createClass(t,[{key:"initialize",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(m.a)(this.baseURL+"/soundfont.json").then((function(t){return t.json()})).then((function(t){for(var n in e.name=t.name,t.instruments){var i="".concat(e.baseURL,"/").concat(t.instruments[n]);e.instruments.set("drums"===n?"drums":+n,new T(i))}e.initialized=!0}));case 2:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"loadSamples",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(e){var n,i=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:return n=new Map,e.forEach((function(t){t.isDrum=t.isDrum||!1,t.program=t.program||0;var e=t.isDrum?"drums":t.program,r={pitch:t.pitch,velocity:t.velocity};n.has(e)?n.get(e).push(r):i.instruments.has(e)?n.set(e,[r]):s.log("No instrument in ".concat(i.name," for: program=").concat(t.program,", isDrum=").concat(t.isDrum),"SoundFont")})),t.next=8,Promise.all(Array.from(n.keys()).map((function(t){return i.instruments.get(t).loadSamples(n.get(t))})));case 8:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"playNote",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6?arguments[6]:void 0,u=o?"drums":r;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(u)?this.instruments.get(u).playNote(t,e,n,i,a):s.log("No instrument in ".concat(this.name," for: program=").concat(r,", isDrum=").concat(o),"SoundFont")}},{key:"playNoteDown",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4?arguments[4]:void 0,o=i?"drums":n;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(o)?this.instruments.get(o).playNoteDown(t,e,r):s.log("No instrument in ".concat(this.name," for: program=").concat(n,", isDrum=").concat(i),"SoundFont")}},{key:"playNoteUp",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4?arguments[4]:void 0,o=i?"drums":n;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(o)?this.instruments.get(o).playNoteUp(t,e,r):s.log("No instrument in ".concat(this.name," for: program=").concat(n,", isDrum=").concat(i),"SoundFont")}}]),t}();function k(t,e){return t.quantizedStartStep<e.quantizedStartStep?-1:t.quantizedStartStep>e.quantizedStartStep?1:t.pitch<e.pitch?-1:1}var O=function t(){_classCallCheck(this,t)},A=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1?arguments[1]:void 0;_classCallCheck(this,t),this.playClick=e,this.callbackObject=n,this.desiredQPM=void 0}return _createClass(t,[{key:"setTempo",value:function(t){this.desiredQPM=t,"started"===f.Transport.state&&(f.Transport.bpm.value=t)}},{key:"makeClickSequence",value:function(t){for(var e=c.clone(t),n=e.notes.map((function(t){return t.quantizedEndStep})),i=Math.max.apply(Math,_toConsumableArray(n)),r=0;r<i;r+=4){var a={pitch:r%16==0?o.LO_CLICK_PITCH:o.HI_CLICK_PITCH,quantizedStartStep:r,isDrum:!0,quantizedEndStep:r+1};e.notes.push(a)}return e.notes.sort(k),e}},{key:"resumeContext",value:function(){f.context.resume()}},{key:"start",value:function(t,e){var n=this;if("started"===this.getPlayState())throw new Error("Cannot start playback; player is already playing.");if("paused"===this.getPlayState())throw new Error("Cannot `start()` a paused player; use `resume()`.");if("stopped"!==f.Transport.state)throw new Error("Cannot start playback while `Tone.Transport` is in use.");this.resumeContext();var i=c.isQuantizedSequence(t);if(this.playClick&&i&&(t=this.makeClickSequence(t)),e?f.Transport.bpm.value=e:t.tempos&&t.tempos.length>0&&t.tempos[0].qpm>0?f.Transport.bpm.value=t.tempos[0].qpm:f.Transport.bpm.value=o.DEFAULT_QUARTERS_PER_MINUTE,i)t=c.unquantizeSequence(t,e);else if(e)throw new Error("Cannot specify a `qpm` for a non-quantized sequence.");var r=new f.Part((function(t,e){n.currentPart===r&&((n.playClick||e.pitch!==o.LO_CLICK_PITCH&&e.pitch!==o.HI_CLICK_PITCH)&&n.playNote(t,e),n.callbackObject&&f.Draw.schedule((function(){n.callbackObject.run(e,t)}),t))}),t.notes.map((function(t){return[t.startTime,t]})));return this.currentPart=r,this.desiredQPM&&(f.Transport.bpm.value=this.desiredQPM),this.currentPart.start(),"started"!==f.Transport.state&&f.Transport.start(),new Promise((function(e){n.scheduledStop=f.Transport.schedule((function(){n.stop(),e(),n.callbackObject&&n.callbackObject.stop()}),"+"+t.totalTime)}))}},{key:"stop",value:function(){this.isPlaying()&&(this.currentPart.stop(),f.Transport.stop(),this.currentPart=null),f.Transport.clear(this.scheduledStop),this.scheduledStop=void 0,this.desiredQPM=void 0}},{key:"pause",value:function(){if(!this.isPlaying())throw new Error("Cannot pause playback while the player is stopped.");f.Transport.pause()}},{key:"resume",value:function(){if("paused"!==this.getPlayState())throw new Error('Cannot resume playback while "'.concat(this.getPlayState(),'".'));f.Transport.start()}},{key:"seekTo",value:function(t){if(!this.isPlaying())throw new Error("Cannot seek while the player is stopped.");f.Transport.seconds=t}},{key:"isPlaying",value:function(){return!!this.currentPart}},{key:"getPlayState",value:function(){return this.isPlaying()?f.Transport.state:"stopped"}}]),t}(),x=function(){function t(){var e=this;_classCallCheck(this,t),this.DRUM_PITCH_TO_CLASS=new Map,this.kick=(new f.MembraneSynth).toMaster(),this.tomLow=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.tomMid=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.tomHigh=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.closedHihat=new f.MetalSynth({frequency:400,envelope:{attack:.001,decay:.1,release:.8},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1}).toMaster(),this.openHihat=new f.MetalSynth({frequency:400,envelope:{attack:.001,decay:.5,release:.8,sustain:1},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1}).toMaster(),this.ride=(new f.MetalSynth).toMaster(),this.crash=new f.MetalSynth({frequency:300,envelope:{attack:.001,decay:1,release:3},harmonicity:5.1,modulationIndex:64,resonance:4e3,octaves:1.5}).toMaster(),this.snare=new f.NoiseSynth({noise:{type:"white"},envelope:{attack:.005,decay:.05,sustain:.1,release:.4}}).toMaster(),this.loClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.pitchPlayers=[function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.kick.triggerAttackRelease("C2","8n",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.snare.triggerAttackRelease("16n",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.closedHihat.triggerAttack(t,.3,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.openHihat.triggerAttack(t,.3,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e.tomLow.triggerAttack("G3",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e.tomMid.triggerAttack("C4",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e.tomHigh.triggerAttack("F4",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.crash.triggerAttack(t,1,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.ride.triggerAttack(t,.5,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e.loClick.triggerAttack("G5",t,n)},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e.hiClick.triggerAttack("C6",t,n)}];for(var n=function(t){a.DEFAULT_DRUM_PITCH_CLASSES[t].forEach((function(n){e.DRUM_PITCH_TO_CLASS.set(n,t)}))},i=0;i<a.DEFAULT_DRUM_PITCH_CLASSES.length;++i)n(i);this.DRUM_PITCH_TO_CLASS.set(o.LO_CLICK_PITCH,o.LO_CLICK_CLASS),this.DRUM_PITCH_TO_CLASS.set(o.HI_CLICK_PITCH,o.HI_CLICK_CLASS)}return _createClass(t,[{key:"playNote",value:function(t,e,n){this.pitchPlayers[this.DRUM_PITCH_TO_CLASS.get(t)](e,n)}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t}(),M=function(t){_inherits(n,t);var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.apply(this,arguments)).drumKit=x.getInstance(),t.bassSynth=new f.Synth({volume:5,oscillator:{type:"triangle"}}).toMaster(),t.polySynth=new f.PolySynth(10).toMaster(),t}return _createClass(n,[{key:"playNote",value:function(t,e){var n=e.hasOwnProperty("velocity")?e.velocity/o.MAX_MIDI_VELOCITY:void 0;if(e.isDrum)this.drumKit.playNote(e.pitch,t,n);else{var i=new f.Frequency(e.pitch,"midi"),r=e.endTime-e.startTime;this.getSynth(e.instrument,e.program).triggerAttackRelease(i,r,t,n)}}},{key:"getSynth",value:function(t,e){return void 0!==e&&e>=32&&e<=39?this.bassSynth:this.polySynth}}]),n}(A);M.tone=f;var N,q=function(t){_inherits(r,t);var e,n,i=_createSuper(r);function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.Master,o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return _classCallCheck(this,r),(e=i.call(this,!1,s)).soundFont=new P(t),e.output=n,e.programOutputs=o,e.drumOutputs=a,e}return _createClass(r,[{key:"loadSamples",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.soundFont.loadSamples(e.notes.map((function(t){return{pitch:t.pitch,velocity:t.velocity,program:t.program||0,isDrum:t.isDrum||!1}})));case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"loadAllSamples",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(){var e,n,i,r,a,s,u,l=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=l.length>0&&void 0!==l[0]?l[0]:0,n=l.length>1&&void 0!==l[1]&&l[1],i=y.a.create(),r=n?o.MIN_DRUM_PITCH:o.MIN_PIANO_PITCH,a=n?o.MAX_DRUM_PITCH:o.MAX_PIANO_PITCH,s=r;s<=a;s++)for(u=o.MIN_MIDI_VELOCITY;u<o.MAX_MIDI_VELOCITY;u++)i.notes.push({pitch:s,velocity:u,program:e,isDrum:n});return t.abrupt("return",this.loadSamples(i));case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"resumeContext",value:function(){f.context.resume()}},{key:"start",value:function(t,e){var n=this;return this.resumeContext(),this.loadSamples(t).then((function(){return _get(_getPrototypeOf(r.prototype),"start",n).call(n,t,e)}))}},{key:"playNote",value:function(t,e){this.soundFont.playNote(e.pitch,e.velocity,t,e.endTime-e.startTime,e.program,e.isDrum,this.getAudioNodeOutput(e))}},{key:"playNoteDown",value:function(t){this.soundFont.playNoteDown(t.pitch,t.velocity,t.program,t.isDrum,this.getAudioNodeOutput(t))}},{key:"playNoteUp",value:function(t){this.soundFont.playNoteUp(t.pitch,t.velocity,t.program,t.isDrum,this.getAudioNodeOutput(t))}},{key:"getAudioNodeOutput",value:function(t){var e=this.output;return this.programOutputs&&!t.isDrum?this.programOutputs.has(t.program)&&(e=this.programOutputs.get(t.program)):this.drumOutputs&&t.isDrum&&this.drumOutputs.has(t.pitch)&&(e=this.drumOutputs.get(t.pitch)),e}}]),r}(A),E=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,!0,t)}return n}(M),C=function(t){_inherits(i,t);var e,n=_createSuper(i);function i(t){var e;return _classCallCheck(this,i),(e=n.call(this,!1,t)).outputs=[],e.outputChannel=0,e.availableOutputs=[],e.NOTE_ON=144,e.NOTE_OFF=128,e}return _createClass(i,[{key:"requestMIDIAccess",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",navigator.requestMIDIAccess?new Promise((function(t,n){navigator.requestMIDIAccess().then((function(n){n.addEventListener("statechange",(function(t){return e.initOutputs(n)})),t(e.initOutputs(n))}),(function(t){return console.log("Something went wrong",n(t))}))})):null);case 1:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"initOutputs",value:function(t){for(var e=t.outputs.values(),n=e.next();n&&!n.done;n=e.next())this.availableOutputs.push(n.value);return this.availableOutputs}},{key:"playNote",value:function(t,e){for(var n=e.velocity||100,i=1e3*(e.endTime-e.startTime),r=[this.NOTE_ON+this.outputChannel,e.pitch,n],o=[this.NOTE_OFF+this.outputChannel,e.pitch,n],a=this.outputs?this.outputs:this.availableOutputs,s=0;s<a.length;s++)this.sendMessageToOutput(a[s],r),this.sendMessageToOutput(a[s],o,m.d.now()+i)}},{key:"sendMessageToOutput",value:function(t,e,n){t&&t.send(e,n)}},{key:"playNoteDown",value:function(t){for(var e=[this.NOTE_ON,t.pitch,t.velocity],n=this.outputs?this.outputs:this.availableOutputs,i=0;i<n.length;i++)this.sendMessageToOutput(n[i],e)}},{key:"playNoteUp",value:function(t){for(var e=[this.NOTE_OFF,t.pitch,t.velocity],n=this.outputs?this.outputs:this.availableOutputs,i=0;i<n.length;i++)this.sendMessageToOutput(n[i],e,t.endTime-t.startTime)}}]),i}(A),I=function t(){_classCallCheck(this,t)},R=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;_classCallCheck(this,t),this.notes=[],this.midiInputs=[],this.loClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new f.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.config={playClick:e.playClick,qpm:e.qpm||o.DEFAULT_QUARTERS_PER_MINUTE,playCountIn:e.playCountIn,startRecordingAtFirstNote:e.startRecordingAtFirstNote||!1},this.callbackObject=n,this.recording=!1,this.onNotes=new Map}var e;return _createClass(t,[{key:"initialize",value:(e=_asyncToGenerator(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,navigator.requestMIDIAccess().then((function(t){return e.midiReady(t)}),(function(t){return console.log("Something went wrong",t)}));case 2:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"midiReady",value:function(t){s.log("Initialized Recorder","Recorder");for(var e=t.inputs.values(),n=e.next();n&&!n.done;n=e.next())this.midiInputs.push(n.value)}},{key:"isRecording",value:function(){return this.recording}},{key:"setTempo",value:function(t){this.config.qpm=t,"started"===f.Transport.state&&(f.Transport.bpm.value=t)}},{key:"enablePlayClick",value:function(t){this.config.playClick=t}},{key:"enablePlayCountIn",value:function(t){this.config.playCountIn=t}},{key:"initClickLoop",value:function(){var t=this,e=0;this.clickLoop=new f.Loop((function(n){e%4==0?t.loClick.triggerAttack("G5",n):t.hiClick.triggerAttack("C6",n),e++,t.config.playCountIn&&4===e&&(f.Transport.stop(),t.clickLoop.stop())}),"4n")}},{key:"getMIDIInputs",value:function(){return this.midiInputs}},{key:"start",value:function(t){var e,n=this,i=_createForOfIteratorHelper(t||this.midiInputs);try{for(i.s();!(e=i.n()).done;)e.value.onmidimessage=function(t){n.midiMessageReceived(t)}}catch(t){i.e(t)}finally{i.f()}if(this.config.playClick||this.config.playCountIn?(this.initClickLoop(),f.Transport.bpm.value=this.config.qpm,f.Transport.start(),this.clickLoop.start()):this.clickLoop=null,this.recording=!0,this.firstNoteTimestamp=void 0,this.notes=[],this.onNotes=new Map,!this.startRecordingAtFirstNote){var r=Date.now();this.firstNoteTimestamp=r}}},{key:"stop",value:function(){var t=this;this.recording=!1;var e=Date.now();this.onNotes.forEach((function(n,i){t.noteOff(i,e)}));var n,i=_createForOfIteratorHelper(this.midiInputs);try{for(i.s();!(n=i.n()).done;)n.value.onmidimessage=null}catch(t){i.e(t)}finally{i.f()}return this.clickLoop&&(f.Transport.stop(),this.clickLoop.stop()),0===this.notes.length?null:this.getNoteSequence()}},{key:"getNoteSequence",value:function(){return 0===this.notes.length?null:y.a.create({notes:this.notes,totalTime:this.notes[this.notes.length-1].endTime})}},{key:"reset",value:function(){var t=this.stop();return this.firstNoteTimestamp=void 0,this.notes=[],this.onNotes=new Map,t}},{key:"midiMessageReceived",value:function(t){if(this.recording){var e=(void 0!==t.timeStamp&&0!==t.timeStamp?t.timeStamp:m.d.now())+m.d.timing.navigationStart;void 0===this.firstNoteTimestamp&&(this.firstNoteTimestamp=e);var n=t.data[0]>>4,i=t.data[1],r=t.data.length>2?t.data[2]:1,o=t.srcElement;8===n||9===n&&0===r?(this.callbackObject&&this.callbackObject.noteOff&&this.callbackObject.noteOff(i,r,o),this.noteOff(i,e),this.callbackObject&&this.callbackObject.run&&this.callbackObject.run(this.getNoteSequence())):9===n&&(this.callbackObject&&this.callbackObject.noteOn&&this.callbackObject.noteOn(i,r,o),this.noteOn(i,r,e))}}},{key:"noteOn",value:function(t,e,n){var i=new y.a.Note;i.pitch=t,i.startTime=(n-this.firstNoteTimestamp)/1e3,i.velocity=e,this.onNotes.set(t,i)}},{key:"noteOff",value:function(t,e){var n=this.onNotes.get(t);n&&(n.endTime=(e-this.firstNoteTimestamp)/1e3,this.notes.push(n)),this.onNotes.delete(t)}}]),t}(),F=n(55),z=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(_classCallCheck(this,t),this.noteSequence=e,this.sequenceIsQuantized=c.isQuantizedSequence(this.noteSequence),this.config={noteHeight:n.noteHeight||6,noteSpacing:n.noteSpacing||1,pixelsPerTimeStep:n.pixelsPerTimeStep||30,noteRGB:n.noteRGB||"8, 41, 64",activeNoteRGB:n.activeNoteRGB||"240, 84, 119",minPitch:n.minPitch,maxPitch:n.maxPitch},this.sequenceIsQuantized){var i=e.quantizationInfo.stepsPerQuarter;this.config.pixelsPerTimeStep=i?this.config.pixelsPerTimeStep/i:7}var r=this.getSize();this.width=r.width,this.height=r.height}return _createClass(t,[{key:"updateMinMaxPitches",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.config.minPitch||!this.config.maxPitch){void 0===this.config.minPitch&&(this.config.minPitch=o.MAX_MIDI_PITCH),void 0===this.config.maxPitch&&(this.config.maxPitch=o.MIN_MIDI_PITCH);var e,n=_createForOfIteratorHelper(this.noteSequence.notes);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.config.minPitch=Math.min(i.pitch,this.config.minPitch),this.config.maxPitch=Math.max(i.pitch,this.config.maxPitch)}}catch(t){n.e(t)}finally{n.f()}t||(this.config.minPitch-=2,this.config.maxPitch+=2)}}},{key:"getSize",value:function(){this.updateMinMaxPitches();var t=(this.config.maxPitch-this.config.minPitch)*this.config.noteHeight,e=this.sequenceIsQuantized?this.noteSequence.totalQuantizedSteps:this.noteSequence.totalTime;if(!e)throw new Error("The sequence you are using with the visualizer does not have a "+(this.sequenceIsQuantized?"totalQuantizedSteps":"totalTime")+" field set, so the visualizer can't be horizontally sized correctly.");return{width:e*this.config.pixelsPerTimeStep,height:t}}},{key:"getNotePosition",value:function(t,e){var n=this.getNoteEndTime(t)-this.getNoteStartTime(t),i=this.getNoteStartTime(t)*this.config.pixelsPerTimeStep,r=Math.max(this.config.pixelsPerTimeStep*n-this.config.noteSpacing,1);return{x:i,y:this.height-(t.pitch-this.config.minPitch)*this.config.noteHeight,w:r,h:this.config.noteHeight}}},{key:"scrollIntoViewIfNeeded",value:function(t,e){if(t&&this.parentElement){var n=this.parentElement.getBoundingClientRect().width;e>this.parentElement.scrollLeft+n&&(this.parentElement.scrollLeft=e-20)}}},{key:"getNoteStartTime",value:function(t){return this.sequenceIsQuantized?t.quantizedStartStep:Math.round(1e8*t.startTime)/1e8}},{key:"getNoteEndTime",value:function(t){return this.sequenceIsQuantized?t.quantizedEndStep:Math.round(1e8*t.endTime)/1e8}},{key:"isPaintingActiveNote",value:function(t,e){var n=this.getNoteStartTime(t)===this.getNoteStartTime(e),i=this.getNoteStartTime(t)<=this.getNoteStartTime(e)&&this.getNoteEndTime(t)>=this.getNoteEndTime(e);return n||i}}]),t}(),L=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,n),(r=e.call(this,t,o)).ctx=i.getContext("2d"),r.parentElement=i.parentElement;var a=window.devicePixelRatio||1;return r.ctx&&(r.ctx.canvas.width=a*r.width,r.ctx.canvas.height=a*r.height,i.style.width=r.width+"px",i.style.height=r.height+"px",r.ctx.scale(a,a)),r.redraw(),r}return _createClass(n,[{key:"redraw",value:function(t,e){var n;this.clear();for(var i=0;i<this.noteSequence.notes.length;i++){var r=this.noteSequence.notes[i],o=this.getNotePosition(r,i),a=r.velocity?r.velocity/100+.2:1,s=t&&this.isPaintingActiveNote(r,t),u="rgba(".concat(s?this.config.activeNoteRGB:this.config.noteRGB,",\n  ").concat(a,")");this.redrawNote(o.x,o.y,o.w,o.h,u),s&&r===t&&(n=o.x)}return this.scrollIntoViewIfNeeded(e,n),n}},{key:"clear",value:function(){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}},{key:"clearActiveNotes",value:function(){this.redraw()}},{key:"redrawNote",value:function(t,e,n,i,r){this.ctx.fillStyle=r,this.ctx.fillRect(Math.round(t),Math.round(e),Math.round(n),Math.round(i))}}]),n}(z),j=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return _classCallCheck(this,n),r=e.call(this,t,i,o),s.log("mm.Visualizer is deprecated, and will be removed in a future          version. Please use mm.PianoRollCanvasVisualizer instead","mm.Visualizer",5),r}return n}(L),D=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,n),(i=e.call(this,t,r)).drawn=!1,i}return _createClass(n,[{key:"redraw",value:function(t,e){if(this.drawn||this.draw(),!t)return null;var n;this.unfillActiveRect(this.svg);for(var i=0;i<this.noteSequence.notes.length;i++){var r=this.noteSequence.notes[i];if(t&&this.isPaintingActiveNote(r,t)){var o=this.svg.querySelector('rect[data-index="'.concat(i,'"]'));this.fillActiveRect(o,r),r===t&&(n=parseFloat(o.getAttribute("x")))}}return this.scrollIntoViewIfNeeded(e,n),n}},{key:"fillActiveRect",value:function(t,e){t.setAttribute("fill",this.getNoteFillColor(e,!0)),t.classList.add("active")}},{key:"unfillActiveRect",value:function(t){for(var e=t.querySelectorAll("rect.active"),n=0;n<e.length;++n){var i=e[n],r=this.getNoteFillColor(this.noteSequence.notes[parseInt(i.getAttribute("data-index"),10)],!1);i.setAttribute("fill",r),i.classList.remove("active")}}},{key:"draw",value:function(){for(var t=0;t<this.noteSequence.notes.length;t++){var e=this.noteSequence.notes[t],n=this.getNotePosition(e,t),i=this.getNoteFillColor(e,!1),r=[["index",t],["instrument",e.instrument],["program",e.program],["isDrum",!0===e.isDrum],["pitch",e.pitch]],o=[["--midi-velocity",String(void 0!==e.velocity?e.velocity:127)]];this.drawNote(n.x,n.y,n.w,n.h,i,r,o)}this.drawn=!0}},{key:"getNoteFillColor",value:function(t,e){var n=t.velocity?t.velocity/100+.2:1;return"rgba(".concat(e?this.config.activeNoteRGB:this.config.noteRGB,",\n  ").concat(n,")")}},{key:"drawNote",value:function(t,e,n,i,r,o,a){if(this.svg){var s=document.createElementNS("http://www.w3.org/2000/svg","rect");s.classList.add("note"),s.setAttribute("fill",r),s.setAttribute("x",""+Math.round(t)),s.setAttribute("y",""+Math.round(e)),s.setAttribute("width",""+Math.round(n)),s.setAttribute("height",""+Math.round(i)),o.forEach((function(t){var e=_slicedToArray(t,2),n=e[0],i=e[1];void 0!==i&&(s.dataset[n]=""+i)})),a.forEach((function(t){var e=_slicedToArray(t,2),n=e[0],i=e[1];s.style.setProperty(n,i)})),this.svg.appendChild(s)}}},{key:"clear",value:function(){this.svg.innerHTML="",this.drawn=!1}},{key:"clearActiveNotes",value:function(){this.unfillActiveRect(this.svg)}}]),n}(z),B=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,n),r=e.call(this,t,o),!(i instanceof SVGSVGElement))throw new Error("This visualizer requires an <svg> element to display the visualization");r.svg=i,r.parentElement=i.parentElement;var a=r.getSize();return r.width=a.width,r.height=a.height,r.svg.style.width=r.width+"px",r.svg.style.height=r.height+"px",r.clear(),r.draw(),_possibleConstructorReturn(r)}return n}(D),U=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,n),(r=e.call(this,t,o)).NOTES_PER_OCTAVE=12,r.WHITE_NOTES_PER_OCTAVE=7,r.LOW_C=24,r.firstDrawnOctave=0,r.lastDrawnOctave=6,!(i instanceof HTMLDivElement))throw new Error("This visualizer requires a <div> element to display the visualization");r.config.whiteNoteWidth=o.whiteNoteWidth||20,r.config.blackNoteWidth=o.blackNoteWidth||2*r.config.whiteNoteWidth/3,r.config.whiteNoteHeight=o.whiteNoteHeight||70,r.config.blackNoteHeight=o.blackNoteHeight||140/3,r.config.showOnlyOctavesUsed=o.showOnlyOctavesUsed,r.setupDOM(i);var a=r.getSize();return r.width=a.width,r.height=a.height,r.svg.style.width=r.width+"px",r.svg.style.height=r.height+"px",r.svgPiano.style.width=r.width+"px",r.svgPiano.style.height=r.config.whiteNoteHeight+"px",r.parentElement.style.width=r.width+r.config.whiteNoteWidth+"px",r.parentElement.scrollTop=r.parentElement.scrollHeight,r.clear(),r.drawPiano(),r.draw(),_possibleConstructorReturn(r)}return _createClass(n,[{key:"setupDOM",value:function(t){this.parentElement=document.createElement("div"),this.parentElement.classList.add("waterfall-notes-container");var e=Math.max(t.getBoundingClientRect().height,200);this.parentElement.style.paddingTop=e-this.config.whiteNoteHeight+"px",this.parentElement.style.height=e-this.config.whiteNoteHeight+"px",this.parentElement.style.boxSizing="border-box",this.parentElement.style.overflowX="hidden",this.parentElement.style.overflowY="auto",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svgPiano=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("waterfall-notes"),this.svgPiano.classList.add("waterfall-piano"),this.parentElement.appendChild(this.svg),t.innerHTML="",t.appendChild(this.parentElement),t.appendChild(this.svgPiano)}},{key:"redraw",value:function(t,e){if(this.drawn||this.draw(),!t)return null;this.clearActiveNotes(),this.parentElement.style.paddingTop=this.parentElement.style.height;for(var n=0;n<this.noteSequence.notes.length;n++){var i=this.noteSequence.notes[n];if(t&&this.isPaintingActiveNote(i,t)){var r=this.svg.querySelector('rect[data-index="'.concat(n,'"]'));this.fillActiveRect(r,i);var o=this.svgPiano.querySelector('rect[data-pitch="'.concat(i.pitch,'"]'));if(this.fillActiveRect(o,i),i===t){var a=parseFloat(r.getAttribute("y")),s=parseFloat(r.getAttribute("height"));return a<this.parentElement.scrollTop-s&&(this.parentElement.scrollTop=a+s),a}}}return null}},{key:"getSize",value:function(){this.updateMinMaxPitches(!0);var t=52;if(this.config.showOnlyOctavesUsed){for(var e=!1,n=!1,i=1;i<7;i++){var r=this.LOW_C+this.NOTES_PER_OCTAVE*i;!e&&r>this.config.minPitch&&(this.firstDrawnOctave=i-1,e=!0),!n&&r>this.config.maxPitch&&(this.lastDrawnOctave=i-1,n=!0)}t=(this.lastDrawnOctave-this.firstDrawnOctave+1)*this.WHITE_NOTES_PER_OCTAVE}var o=t*this.config.whiteNoteWidth,a=this.sequenceIsQuantized?this.noteSequence.totalQuantizedSteps:this.noteSequence.totalTime;if(!a)throw new Error("The sequence you are using with the visualizer does not have a "+(this.sequenceIsQuantized?"totalQuantizedSteps":"totalTime")+" field set, so the visualizer can't be horizontally sized correctly.");return{width:o,height:Math.max(a*this.config.pixelsPerTimeStep,1)}}},{key:"getNotePosition",value:function(t,e){var n=this.svgPiano.querySelector('rect[data-pitch="'.concat(t.pitch,'"]'));if(!n)return null;var i=this.getNoteEndTime(t)-this.getNoteStartTime(t),r=Number(n.getAttribute("x")),o=Number(n.getAttribute("width")),a=Math.max(this.config.pixelsPerTimeStep*i-this.config.noteSpacing,1);return{x:r,y:this.height-this.getNoteStartTime(t)*this.config.pixelsPerTimeStep-a,w:o,h:a}}},{key:"drawPiano",value:function(){this.svgPiano.innerHTML="";var t=this.config.whiteNoteWidth-this.config.blackNoteWidth/2,e=[1,3,6,8,10],n=0,i=0;this.config.showOnlyOctavesUsed?i=this.firstDrawnOctave*this.NOTES_PER_OCTAVE+this.LOW_C:(i=this.LOW_C-3,this.drawWhiteKey(i,n),this.drawWhiteKey(i+2,this.config.whiteNoteWidth),i+=3,n=2*this.config.whiteNoteWidth);for(var r=this.firstDrawnOctave;r<=this.lastDrawnOctave;r++)for(var o=0;o<this.NOTES_PER_OCTAVE;o++)-1===e.indexOf(o)&&(this.drawWhiteKey(i,n),n+=this.config.whiteNoteWidth),i++;this.config.showOnlyOctavesUsed?(i=this.firstDrawnOctave*this.NOTES_PER_OCTAVE+this.LOW_C,n=-this.config.whiteNoteWidth):(this.drawWhiteKey(i,n),i=this.LOW_C-3,this.drawBlackKey(i+1,t),i+=3,n=this.config.whiteNoteWidth);for(var a=this.firstDrawnOctave;a<=this.lastDrawnOctave;a++)for(var s=0;s<this.NOTES_PER_OCTAVE;s++)-1!==e.indexOf(s)?this.drawBlackKey(i,n+t):n+=this.config.whiteNoteWidth,i++}},{key:"drawWhiteKey",value:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.dataset.pitch=String(t),n.setAttribute("x",String(e)),n.setAttribute("y","0"),n.setAttribute("width",String(this.config.whiteNoteWidth)),n.setAttribute("height",String(this.config.whiteNoteHeight)),n.setAttribute("fill","white"),n.setAttribute("original-fill","white"),n.setAttribute("stroke","black"),n.setAttribute("stroke-width","3px"),n.classList.add("white"),this.svgPiano.appendChild(n),n}},{key:"drawBlackKey",value:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.dataset.pitch=String(t),n.setAttribute("x",String(e)),n.setAttribute("y","0"),n.setAttribute("width",String(this.config.blackNoteWidth)),n.setAttribute("height",String(this.config.blackNoteHeight)),n.setAttribute("fill","black"),n.setAttribute("original-fill","black"),n.setAttribute("stroke","black"),n.setAttribute("stroke-width","3px"),n.classList.add("black"),this.svgPiano.appendChild(n),n}},{key:"clearActiveNotes",value:function(){_get(_getPrototypeOf(n.prototype),"unfillActiveRect",this).call(this,this.svg);for(var t=this.svgPiano.querySelectorAll("rect.active"),e=0;e<t.length;++e){var i=t[e];i.setAttribute("fill",i.getAttribute("original-fill")),i.classList.remove("active")}}}]),n}(D);!function(t){t[t.PAGE=0]="PAGE",t[t.NOTE=1]="NOTE",t[t.BAR=2]="BAR"}(N||(N={}));var G=function(t){_inherits(n,t);var e=_createSuper(n);function n(t,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return _classCallCheck(this,n),r=e.call(this,t,o),(void 0===o.pixelsPerTimeStep||o.pixelsPerTimeStep<=0)&&(r.config.pixelsPerTimeStep=0),r.instruments=o.instruments||[],r.render=new F.StaffSVGRender(r.getScoreInfo(t),{noteHeight:r.config.noteHeight,noteSpacing:r.config.noteSpacing,pixelsPerTimeStep:r.config.pixelsPerTimeStep,noteRGB:r.config.noteRGB,activeNoteRGB:r.config.activeNoteRGB,defaultKey:o.defaultKey||0,scrollType:o.scrollType||N.PAGE},i),r.drawnNotes=t.notes.length,r.clear(),r.redraw(),r}return _createClass(n,[{key:"clear",value:function(){this.render.clear()}},{key:"redraw",value:function(t,e){this.drawnNotes!==this.noteSequence.notes.length&&(this.render.scoreInfo=this.getScoreInfo(this.noteSequence));var n=t?this.getNoteInfo(t):void 0;return this.render.redraw(n,e)}},{key:"isNoteInInstruments",value:function(t){return void 0===t.instrument||0===this.instruments.length||this.instruments.indexOf(t.instrument)>=0}},{key:"timeToQuarters",value:function(t){var e=t*this.noteSequence.tempos[0].qpm/60;return Math.round(16*e)/16}},{key:"quantizedStepsToQuarters",value:function(t){var e=t/this.noteSequence.quantizationInfo.stepsPerQuarter;return Math.round(16*e)/16}},{key:"getNoteInfo",value:function(t){var e=this.sequenceIsQuantized?this.quantizedStepsToQuarters(t.quantizedStartStep):this.timeToQuarters(t.startTime);return{start:e,length:(this.sequenceIsQuantized?this.quantizedStepsToQuarters(t.quantizedEndStep):this.timeToQuarters(t.endTime))-e,pitch:t.pitch,intensity:t.velocity}}},{key:"getScoreInfo",value:function(t){var e=this,n=[];return t.notes.forEach((function(t){e.isNoteInInstruments(t)&&n.push(e.getNoteInfo(t))})),{notes:n,tempos:t.tempos?t.tempos.map((function(t){return{start:e.timeToQuarters(t.time),qpm:t.qpm}})):[],keySignatures:t.keySignatures?t.keySignatures.map((function(t){return{start:e.timeToQuarters(t.time),key:t.key}})):[],timeSignatures:t.timeSignatures?t.timeSignatures.map((function(t){return{start:e.timeToQuarters(t.time),numerator:t.numerator,denominator:t.denominator}})):[]}}},{key:"clearActiveNotes",value:function(){this.redraw()}}]),n}(z)},,,,,,,,,,,,function(t,e){function n(t){for(var e,n=new i(t),r=[];!n.eof();){var o=a();r.push(o)}return r;function a(){var t={};t.deltaTime=n.readVarInt();var i=n.readUInt8();if(240==(240&i)){if(255!==i){if(240==i)return t.type="sysEx",o=n.readVarInt(),t.data=n.readBytes(o),t;if(247==i)return t.type="endSysEx",o=n.readVarInt(),t.data=n.readBytes(o),t;throw"Unrecognised MIDI event type byte: "+i}t.meta=!0;var r=n.readUInt8(),o=n.readVarInt();switch(r){case 0:if(t.type="sequenceNumber",2!==o)throw"Expected length for sequenceNumber event is 2, got "+o;return t.number=n.readUInt16(),t;case 1:return t.type="text",t.text=n.readString(o),t;case 2:return t.type="copyrightNotice",t.text=n.readString(o),t;case 3:return t.type="trackName",t.text=n.readString(o),t;case 4:return t.type="instrumentName",t.text=n.readString(o),t;case 5:return t.type="lyrics",t.text=n.readString(o),t;case 6:return t.type="marker",t.text=n.readString(o),t;case 7:return t.type="cuePoint",t.text=n.readString(o),t;case 32:if(t.type="channelPrefix",1!=o)throw"Expected length for channelPrefix event is 1, got "+o;return t.channel=n.readUInt8(),t;case 33:if(t.type="portPrefix",1!=o)throw"Expected length for portPrefix event is 1, got "+o;return t.port=n.readUInt8(),t;case 47:if(t.type="endOfTrack",0!=o)throw"Expected length for endOfTrack event is 0, got "+o;return t;case 81:if(t.type="setTempo",3!=o)throw"Expected length for setTempo event is 3, got "+o;return t.microsecondsPerBeat=n.readUInt24(),t;case 84:if(t.type="smpteOffset",5!=o)throw"Expected length for smpteOffset event is 5, got "+o;var a=n.readUInt8();return t.frameRate={0:24,32:25,64:29,96:30}[96&a],t.hour=31&a,t.min=n.readUInt8(),t.sec=n.readUInt8(),t.frame=n.readUInt8(),t.subFrame=n.readUInt8(),t;case 88:if(t.type="timeSignature",4!=o)throw"Expected length for timeSignature event is 4, got "+o;return t.numerator=n.readUInt8(),t.denominator=1<<n.readUInt8(),t.metronome=n.readUInt8(),t.thirtyseconds=n.readUInt8(),t;case 89:if(t.type="keySignature",2!=o)throw"Expected length for keySignature event is 2, got "+o;return t.key=n.readInt8(),t.scale=n.readUInt8(),t;case 127:return t.type="sequencerSpecific",t.data=n.readBytes(o),t;default:return t.type="unknownMeta",t.data=n.readBytes(o),t.metatypeByte=r,t}}else{var s;if(0==(128&i)){if(null===e)throw"Running status byte encountered before status byte";s=i,i=e,t.running=!0}else s=n.readUInt8(),e=i;var u=i>>4;switch(t.channel=15&i,u){case 8:return t.type="noteOff",t.noteNumber=s,t.velocity=n.readUInt8(),t;case 9:var l=n.readUInt8();return t.type=0===l?"noteOff":"noteOn",t.noteNumber=s,t.velocity=l,0===l&&(t.byte9=!0),t;case 10:return t.type="noteAftertouch",t.noteNumber=s,t.amount=n.readUInt8(),t;case 11:return t.type="controller",t.controllerType=s,t.value=n.readUInt8(),t;case 12:return t.type="programChange",t.programNumber=s,t;case 13:return t.type="channelAftertouch",t.amount=s,t;case 14:return t.type="pitchBend",t.value=s+(n.readUInt8()<<7)-8192,t;default:throw"Unrecognised MIDI event type: "+u}}}}function i(t){this.buffer=t,this.bufferLen=this.buffer.length,this.pos=0}i.prototype.eof=function(){return this.pos>=this.bufferLen},i.prototype.readUInt8=function(){var t=this.buffer[this.pos];return this.pos+=1,t},i.prototype.readInt8=function(){var t=this.readUInt8();return 128&t?t-256:t},i.prototype.readUInt16=function(){return(this.readUInt8()<<8)+this.readUInt8()},i.prototype.readInt16=function(){var t=this.readUInt16();return 32768&t?t-65536:t},i.prototype.readUInt24=function(){return(this.readUInt8()<<16)+(this.readUInt8()<<8)+this.readUInt8()},i.prototype.readInt24=function(){var t=this.readUInt24();return 8388608&t?t-16777216:t},i.prototype.readUInt32=function(){return(this.readUInt8()<<24)+(this.readUInt8()<<16)+(this.readUInt8()<<8)+this.readUInt8()},i.prototype.readBytes=function(t){var e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=t,e},i.prototype.readString=function(t){var e=this.readBytes(t);return String.fromCharCode.apply(null,e)},i.prototype.readVarInt=function(){for(var t=0;!this.eof();){var e=this.readUInt8();if(!(128&e))return t+e;t+=127&e,t<<=7}return t},i.prototype.readChunk=function(){var t=this.readString(4),e=this.readUInt32();return{id:t,length:e,data:this.readBytes(e)}},t.exports=function(t){var e=new i(t),r=e.readChunk();if("MThd"!=r.id)throw"Bad MIDI file.  Expected 'MHdr', got: '"+r.id+"'";for(var o=function(t){var e=new i(t),n={format:e.readUInt16(),numTracks:e.readUInt16()},r=e.readUInt16();return 32768&r?(n.framesPerSecond=256-(r>>8),n.ticksPerFrame=255&r):n.ticksPerBeat=r,n}(r.data),a=[],s=0;!e.eof()&&s<o.numTracks;s++){var u=e.readChunk();if("MTrk"!=u.id)throw"Bad MIDI file.  Expected 'MTrk', got: '"+u.id+"'";var l=n(u.data);a.push(l)}return{header:o,tracks:a}}},function(t,e){function n(t,e,n){var o,a=new r,s=e.length,u=null;for(o=0;o<s;o++)!1!==n.running&&(n.running||e[o].running)||(u=null),u=i(a,e[o],u,n.useByte9ForNoteOff);t.writeChunk("MTrk",a.buffer)}function i(t,e,n,i){var r=e.type,o=e.deltaTime,a=e.text||"",s=e.data||[],u=null;switch(t.writeVarInt(o),r){case"sequenceNumber":t.writeUInt8(255),t.writeUInt8(0),t.writeVarInt(2),t.writeUInt16(e.number);break;case"text":t.writeUInt8(255),t.writeUInt8(1),t.writeVarInt(a.length),t.writeString(a);break;case"copyrightNotice":t.writeUInt8(255),t.writeUInt8(2),t.writeVarInt(a.length),t.writeString(a);break;case"trackName":t.writeUInt8(255),t.writeUInt8(3),t.writeVarInt(a.length),t.writeString(a);break;case"instrumentName":t.writeUInt8(255),t.writeUInt8(4),t.writeVarInt(a.length),t.writeString(a);break;case"lyrics":t.writeUInt8(255),t.writeUInt8(5),t.writeVarInt(a.length),t.writeString(a);break;case"marker":t.writeUInt8(255),t.writeUInt8(6),t.writeVarInt(a.length),t.writeString(a);break;case"cuePoint":t.writeUInt8(255),t.writeUInt8(7),t.writeVarInt(a.length),t.writeString(a);break;case"channelPrefix":t.writeUInt8(255),t.writeUInt8(32),t.writeVarInt(1),t.writeUInt8(e.channel);break;case"portPrefix":t.writeUInt8(255),t.writeUInt8(33),t.writeVarInt(1),t.writeUInt8(e.port);break;case"endOfTrack":t.writeUInt8(255),t.writeUInt8(47),t.writeVarInt(0);break;case"setTempo":t.writeUInt8(255),t.writeUInt8(81),t.writeVarInt(3),t.writeUInt24(e.microsecondsPerBeat);break;case"smpteOffset":t.writeUInt8(255),t.writeUInt8(84),t.writeVarInt(5);var l=31&e.hour|{24:0,25:32,29:64,30:96}[e.frameRate];t.writeUInt8(l),t.writeUInt8(e.min),t.writeUInt8(e.sec),t.writeUInt8(e.frame),t.writeUInt8(e.subFrame);break;case"timeSignature":t.writeUInt8(255),t.writeUInt8(88),t.writeVarInt(4),t.writeUInt8(e.numerator);var c=255&Math.floor(Math.log(e.denominator)/Math.LN2);t.writeUInt8(c),t.writeUInt8(e.metronome),t.writeUInt8(e.thirtyseconds||8);break;case"keySignature":t.writeUInt8(255),t.writeUInt8(89),t.writeVarInt(2),t.writeInt8(e.key),t.writeUInt8(e.scale);break;case"sequencerSpecific":t.writeUInt8(255),t.writeUInt8(127),t.writeVarInt(s.length),t.writeBytes(s);break;case"unknownMeta":null!=e.metatypeByte&&(t.writeUInt8(255),t.writeUInt8(e.metatypeByte),t.writeVarInt(s.length),t.writeBytes(s));break;case"sysEx":t.writeUInt8(240),t.writeVarInt(s.length),t.writeBytes(s);break;case"endSysEx":t.writeUInt8(247),t.writeVarInt(s.length),t.writeBytes(s);break;case"noteOff":(u=(!1!==i&&e.byte9||i&&0==e.velocity?144:128)|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.noteNumber),t.writeUInt8(e.velocity);break;case"noteOn":(u=144|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.noteNumber),t.writeUInt8(e.velocity);break;case"noteAftertouch":(u=160|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.noteNumber),t.writeUInt8(e.amount);break;case"controller":(u=176|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.controllerType),t.writeUInt8(e.value);break;case"programChange":(u=192|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.programNumber);break;case"channelAftertouch":(u=208|e.channel)!==n&&t.writeUInt8(u),t.writeUInt8(e.amount);break;case"pitchBend":(u=224|e.channel)!==n&&t.writeUInt8(u);var f=8192+e.value,h=127&f,d=f>>7&127;t.writeUInt8(h),t.writeUInt8(d);break;default:throw"Unrecognized event type: "+r}return u}function r(){this.buffer=[]}r.prototype.writeUInt8=function(t){this.buffer.push(255&t)},r.prototype.writeInt8=r.prototype.writeUInt8,r.prototype.writeUInt16=function(t){var e=t>>8&255,n=255&t;this.writeUInt8(e),this.writeUInt8(n)},r.prototype.writeInt16=r.prototype.writeUInt16,r.prototype.writeUInt24=function(t){var e=t>>16&255,n=t>>8&255,i=255&t;this.writeUInt8(e),this.writeUInt8(n),this.writeUInt8(i)},r.prototype.writeInt24=r.prototype.writeUInt24,r.prototype.writeUInt32=function(t){var e=t>>24&255,n=t>>16&255,i=t>>8&255,r=255&t;this.writeUInt8(e),this.writeUInt8(n),this.writeUInt8(i),this.writeUInt8(r)},r.prototype.writeInt32=r.prototype.writeUInt32,r.prototype.writeBytes=function(t){this.buffer=this.buffer.concat(Array.prototype.slice.call(t,0))},r.prototype.writeString=function(t){var e,n=t.length,i=[];for(e=0;e<n;e++)i.push(t.codePointAt(e));this.writeBytes(i)},r.prototype.writeVarInt=function(t){if(t<0)throw"Cannot write negative variable-length integer";if(t<=127)this.writeUInt8(t);else{var e=t,n=[];for(n.push(127&e),e>>=7;e;){var i=127&e|128;n.push(i),e>>=7}this.writeBytes(n.reverse())}},r.prototype.writeChunk=function(t,e){this.writeString(t),this.writeUInt32(e.length),this.writeBytes(e)},t.exports=function(t,e){if("object"!=_typeof(t))throw"Invalid MIDI data";e=e||{};var i,o=t.header||{},a=t.tracks||[],s=a.length,u=new r;for(function(t,e,n){var i=null==e.format?1:e.format,o=128;e.timeDivision?o=e.timeDivision:e.ticksPerFrame&&e.framesPerSecond?o=-(255&e.framesPerSecond)<<8|255&e.ticksPerFrame:e.ticksPerBeat&&(o=32767&e.ticksPerBeat);var a=new r;a.writeUInt16(i),a.writeUInt16(n),a.writeUInt16(o),t.writeChunk("MThd",a.buffer)}(u,o,s),i=0;i<s;i++)n(u,a[i],e);return u.buffer}},function(t,e,n){var i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(51),a=n(40),s=r(n(83));function u(t,e){return{absoluteTime:t.ticks,channel:e,controllerType:t.number,deltaTime:0,type:"controller",value:t.value}}function l(t){return{absoluteTime:0,channel:t.channel,deltaTime:0,programNumber:t.instrument.number,type:"programChange"}}e.encode=function(t){var e={header:{format:1,numTracks:t.tracks.length+1,ticksPerBeat:t.header.ppq},tracks:i([i([{absoluteTime:0,deltaTime:0,meta:!0,text:t.header.name,type:"trackName"}],t.header.keySignatures.map((function(t){return function(t){var e=a.keySignatureKeys.indexOf(t.key);return{absoluteTime:t.ticks,deltaTime:0,key:e+7,meta:!0,scale:"major"===t.scale?0:1,type:"keySignature"}}(t)})),t.header.meta.map((function(t){return{absoluteTime:(e=t).ticks,deltaTime:0,meta:!0,text:e.text,type:e.type};var e})),t.header.tempos.map((function(t){return function(t){return{absoluteTime:t.ticks,deltaTime:0,meta:!0,microsecondsPerBeat:Math.floor(6e7/t.bpm),type:"setTempo"}}(t)})),t.header.timeSignatures.map((function(t){return function(t){return{absoluteTime:t.ticks,deltaTime:0,denominator:t.timeSignature[1],meta:!0,metronome:24,numerator:t.timeSignature[0],thirtyseconds:8,type:"timeSignature"}}(t)})))],t.tracks.map((function(t){return i([(e=t.name,{absoluteTime:0,deltaTime:0,meta:!0,text:e,type:"trackName"}),l(t)],function(t){return s.default(t.notes.map((function(e){return function(t,e){return[{absoluteTime:t.ticks,channel:e,deltaTime:0,noteNumber:t.midi,type:"noteOn",velocity:Math.floor(127*t.velocity)},{absoluteTime:t.ticks+t.durationTicks,channel:e,deltaTime:0,noteNumber:t.midi,type:"noteOff",velocity:Math.floor(127*t.noteOffVelocity)}]}(e,t.channel)})))}(t),function(t){for(var e=[],n=0;n<127;n++)t.controlChanges.hasOwnProperty(n)&&t.controlChanges[n].forEach((function(n){e.push(u(n,t.channel))}));return e}(t),function(t){var e=[];return t.pitchBends.forEach((function(n){e.push(function(t,e){return{absoluteTime:t.ticks,channel:e,deltaTime:0,type:"pitchBend",value:t.value}}(n,t.channel))})),e}(t));var e})))};return e.tracks=e.tracks.map((function(t){t=t.sort((function(t,e){return t.absoluteTime-e.absoluteTime}));var e=0;return t.forEach((function(t){t.deltaTime=t.absoluteTime-e,e=t.absoluteTime,delete t.absoluteTime})),t.push({deltaTime:0,meta:!0,type:"endOfTrack"}),t})),new Uint8Array(o.writeMidi(e))}},function(t,e,n){function i(t){return function t(e,n){for(var i=0;i<e.length;i++){var r=e[i];Array.isArray(r)?t(r,n):n.push(r)}return n}(t,[])}function r(t,e){if("number"!=typeof e)throw new TypeError("Expected the depth to be a number");return function t(e,n,i){i--;for(var r=0;r<e.length;r++){var o=e[r];i>-1&&Array.isArray(o)?t(o,n,i):n.push(o)}return n}(t,[],e)}t.exports=function(t){if(!Array.isArray(t))throw new TypeError("Expected value to be an array");return i(t)},t.exports.from=i,t.exports.depth=function(t,e){if(!Array.isArray(t))throw new TypeError("Expected value to be an array");return r(t,e)},t.exports.fromDepth=r},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(54);e.createControlChanges=function(){return new Proxy({},{get:function(t,e){return t[e]?t[e]:i.controlChangeIds.hasOwnProperty(e)?t[i.controlChangeIds[e]]:void 0},set:function(t,e,n){return i.controlChangeIds.hasOwnProperty(e)?t[i.controlChangeIds[e]]=n:t[e]=n,!0}})}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=new WeakMap,r=function(){function t(t,e){i.set(this,e),this.ticks=t.absoluteTime,this.value=t.value}return Object.defineProperty(t.prototype,"time",{get:function(){return i.get(this).ticksToSeconds(this.ticks)},set:function(t){var e=i.get(this);this.ticks=e.secondsToTicks(t)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{ticks:this.ticks,time:this.time,value:this.value}},t}();e.PitchBend=r},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(87),r=new WeakMap,o=function(){function t(t,e){if(this.number=0,r.set(this,e),this.number=0,t){var n=t.find((function(t){return"programChange"===t.type}));n&&(this.number=n.programNumber)}}return Object.defineProperty(t.prototype,"name",{get:function(){return this.percussion?i.DrumKitByPatchID[this.number]:i.instrumentByPatchID[this.number]},set:function(t){var e=i.instrumentByPatchID.indexOf(t);-1!==e&&(this.number=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"family",{get:function(){return this.percussion?"drums":i.InstrumentFamilyByID[Math.floor(this.number/8)]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"percussion",{get:function(){return 9===r.get(this).channel},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{family:this.family,name:this.name,number:this.number}},t.prototype.fromJSON=function(t){this.number=t.number},t}();e.Instrument=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.instrumentByPatchID=["acoustic grand piano","bright acoustic piano","electric grand piano","honky-tonk piano","electric piano 1","electric piano 2","harpsichord","clavi","celesta","glockenspiel","music box","vibraphone","marimba","xylophone","tubular bells","dulcimer","drawbar organ","percussive organ","rock organ","church organ","reed organ","accordion","harmonica","tango accordion","acoustic guitar (nylon)","acoustic guitar (steel)","electric guitar (jazz)","electric guitar (clean)","electric guitar (muted)","overdriven guitar","distortion guitar","guitar harmonics","acoustic bass","electric bass (finger)","electric bass (pick)","fretless bass","slap bass 1","slap bass 2","synth bass 1","synth bass 2","violin","viola","cello","contrabass","tremolo strings","pizzicato strings","orchestral harp","timpani","string ensemble 1","string ensemble 2","synthstrings 1","synthstrings 2","choir aahs","voice oohs","synth voice","orchestra hit","trumpet","trombone","tuba","muted trumpet","french horn","brass section","synthbrass 1","synthbrass 2","soprano sax","alto sax","tenor sax","baritone sax","oboe","english horn","bassoon","clarinet","piccolo","flute","recorder","pan flute","blown bottle","shakuhachi","whistle","ocarina","lead 1 (square)","lead 2 (sawtooth)","lead 3 (calliope)","lead 4 (chiff)","lead 5 (charang)","lead 6 (voice)","lead 7 (fifths)","lead 8 (bass + lead)","pad 1 (new age)","pad 2 (warm)","pad 3 (polysynth)","pad 4 (choir)","pad 5 (bowed)","pad 6 (metallic)","pad 7 (halo)","pad 8 (sweep)","fx 1 (rain)","fx 2 (soundtrack)","fx 3 (crystal)","fx 4 (atmosphere)","fx 5 (brightness)","fx 6 (goblins)","fx 7 (echoes)","fx 8 (sci-fi)","sitar","banjo","shamisen","koto","kalimba","bag pipe","fiddle","shanai","tinkle bell","agogo","steel drums","woodblock","taiko drum","melodic tom","synth drum","reverse cymbal","guitar fret noise","breath noise","seashore","bird tweet","telephone ring","helicopter","applause","gunshot"],e.InstrumentFamilyByID=["piano","chromatic percussion","organ","guitar","bass","strings","ensemble","brass","reed","pipe","synth lead","synth pad","synth effects","world","percussive","sound effects"],e.DrumKitByPatchID={0:"standard kit",8:"room kit",16:"power kit",24:"electronic kit",25:"tr-808 kit",32:"jazz kit",40:"brush kit",48:"orchestra kit",56:"sound fx kit"}},function(t,e,n){function i(t){return["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][t%12]}Object.defineProperty(e,"__esModule",{value:!0});var r,o,a=(r=/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,o={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},function(t){var e=r.exec(t),n=e[1],i=e[2];return o[n.toLowerCase()]+12*(parseInt(i,10)+1)}),s=new WeakMap,u=function(){function t(t,e,n){s.set(this,n),this.midi=t.midi,this.velocity=t.velocity,this.noteOffVelocity=e.velocity,this.ticks=t.ticks,this.durationTicks=e.ticks-t.ticks}return Object.defineProperty(t.prototype,"name",{get:function(){return t=this.midi,e=Math.floor(t/12)-1,i(t)+e.toString();var t,e},set:function(t){this.midi=a(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"octave",{get:function(){return Math.floor(this.midi/12)-1},set:function(t){var e=t-this.octave;this.midi+=12*e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pitch",{get:function(){return i(this.midi)},set:function(t){this.midi=12*(this.octave+1)+["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"].indexOf(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){var t=s.get(this);return t.ticksToSeconds(this.ticks+this.durationTicks)-t.ticksToSeconds(this.ticks)},set:function(t){var e=s.get(this).secondsToTicks(this.time+t);this.durationTicks=e-this.ticks},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return s.get(this).ticksToSeconds(this.ticks)},set:function(t){var e=s.get(this);this.ticks=e.secondsToTicks(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bars",{get:function(){return s.get(this).ticksToMeasures(this.ticks)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{duration:this.duration,durationTicks:this.durationTicks,midi:this.midi,name:this.name,ticks:this.ticks,time:this.time,velocity:this.velocity}},t}();e.Note=u}])},module.exports=e(require$$0__default.default,require$$1__default.default),function(){function t(t){var e=!0,n=!1,i=null,r={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function o(t){return!!(t&&t!==document&&"HTML"!==t.nodeName&&"BODY"!==t.nodeName&&"classList"in t&&"contains"in t.classList)}function a(t){t.classList.contains("focus-visible")||(t.classList.add("focus-visible"),t.setAttribute("data-focus-visible-added",""))}function s(t){e=!1}function u(){document.addEventListener("mousemove",l),document.addEventListener("mousedown",l),document.addEventListener("mouseup",l),document.addEventListener("pointermove",l),document.addEventListener("pointerdown",l),document.addEventListener("pointerup",l),document.addEventListener("touchmove",l),document.addEventListener("touchstart",l),document.addEventListener("touchend",l)}function l(t){t.target.nodeName&&"html"===t.target.nodeName.toLowerCase()||(e=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mousedown",l),document.removeEventListener("mouseup",l),document.removeEventListener("pointermove",l),document.removeEventListener("pointerdown",l),document.removeEventListener("pointerup",l),document.removeEventListener("touchmove",l),document.removeEventListener("touchstart",l),document.removeEventListener("touchend",l))}document.addEventListener("keydown",(function(n){n.metaKey||n.altKey||n.ctrlKey||(o(t.activeElement)&&a(t.activeElement),e=!0)}),!0),document.addEventListener("mousedown",s,!0),document.addEventListener("pointerdown",s,!0),document.addEventListener("touchstart",s,!0),document.addEventListener("visibilitychange",(function(t){"hidden"===document.visibilityState&&(n&&(e=!0),u())}),!0),u(),t.addEventListener("focus",(function(t){var n,i,s;o(t.target)&&(e||(i=(n=t.target).type,"INPUT"===(s=n.tagName)&&r[i]&&!n.readOnly||"TEXTAREA"===s&&!n.readOnly||n.isContentEditable))&&a(t.target)}),!0),t.addEventListener("blur",(function(t){var e;o(t.target)&&(t.target.classList.contains("focus-visible")||t.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(i),i=window.setTimeout((function(){n=!1}),100),(e=t.target).hasAttribute("data-focus-visible-added")&&(e.classList.remove("focus-visible"),e.removeAttribute("data-focus-visible-added")))}),!0),t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host?t.host.setAttribute("data-js-focus-visible",""):t.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var e;window.applyFocusVisiblePolyfill=t;try{e=new CustomEvent("focus-visible-polyfill-ready")}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(e)}"undefined"!=typeof document&&t(document)}(),function(t,e){function n(t,e,n,i,r,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(i,r)}function i(t){return function(){var e=this,i=arguments;return new Promise((function(r,o){var a=t.apply(e,i);function s(t){n(a,r,o,s,u,"next",t)}function u(t){n(a,r,o,s,u,"throw",t)}s(void 0)}))}}var r=document.createElement("template");function o(t){var e=t<0,n=(t=Math.floor(Math.abs(t||0)))%60,i=(t-n)/60,r=(t-n-60*i)/3600,o=n>9?"".concat(n):"0".concat(n),a=i>9||!r?"".concat(i,":"):"0".concat(i,":");return(e?"-":"")+(r?"".concat(r,":"):"")+a+o}r.innerHTML="\n<style>\n".concat(":host {\n  display: inline-block;\n  width: 300px;\n  margin: 3px;\n  vertical-align: bottom;\n  font-family: sans-serif;\n  font-size: 14px;\n}\n\n:focus:not(.focus-visible) {\n  outline: none;\n}\n\n.controls {\n  width: inherit;\n  height: inherit;\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  border-radius: 100px;\n  background: #f2f5f6;\n  padding: 0 0.2rem;\n  user-select: none;\n}\n.controls > * {\n  margin: 0.7rem 0.4rem;\n}\n.controls input, .controls button {\n  cursor: pointer;\n}\n.controls input:disabled, .controls button:disabled {\n  cursor: inherit;\n}\n.controls button {\n  text-align: center;\n  background: rgba(204, 204, 204, 0);\n  border: none;\n  width: 32px;\n  height: 32px;\n  border-radius: 100%;\n  transition: background-color 0.25s ease 0s;\n  padding: 0;\n}\n.controls button:not(:disabled):hover {\n  background: rgba(204, 204, 204, 0.3);\n}\n.controls button:active {\n  background: rgba(204, 204, 204, 0.6);\n}\n.controls .seek-bar {\n  flex: 1;\n  min-width: 0;\n  margin-right: 1rem;\n  background: transparent;\n}\n.controls .seek-bar::-moz-range-track {\n  background-color: #555;\n}\n.controls.playing .play-icon, .controls.stopped .stop-icon {\n  display: none;\n}\n.controls.frozen > div, .controls > button:disabled .icon {\n  opacity: 0.5;\n}",'\n</style>\n<div class="controls stopped frozen" part="control-panel">\n  <button class="play" part="play-button" disabled>\n    <img src="').concat("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20version%3D%221.1%22%20viewBox%3D%220%200%206.35%206.35%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%3Cpath%20d%3D%22m4.4979%203.175-2.1167%201.5875v-3.175z%22%20stroke-width%3D%22.70201%22%2F%3E%3C%2Fsvg%3E",'" class="icon play-icon">\n    <img src="').concat("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20version%3D%221.1%22%20viewBox%3D%220%200%206.35%206.35%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%3Cpath%20d%3D%22m1.5875%201.5875h3.175v3.175h-3.175z%22%20stroke-width%3D%22.75001%22%2F%3E%3C%2Fsvg%3E",'" class="icon stop-icon">\n  </button>\n  <div part="time"><span class="current-time" part="current-time">0:00</span> / <span class="total-time" part="total-time">0:00</span></div>\n  <input type="range" min="0" max="0" value="0" step="any" class="seek-bar" part="seek-bar" disabled>\n</div>\n');var a=["piano-roll","waterfall","staff"],s=function(t){_inherits(r,t);var n=_createSuper(r);function r(){var t;return _classCallCheck(this,r),(t=n.apply(this,arguments)).domInitialized=!1,t.ns=null,t._config={},t}return _createClass(r,[{key:"connectedCallback",value:function(){this.domInitialized||(this.domInitialized=!0,this.wrapper=document.createElement("div"),this.appendChild(this.wrapper),this.initVisualizerNow())}},{key:"attributeChangedCallback",value:function(t,e,n){"src"!==t&&"type"!==t||this.initVisualizer()}},{key:"initVisualizer",value:function(){var t=this;null==this.initTimeout&&(this.initTimeout=window.setTimeout((function(){return t.initVisualizerNow()})))}},{key:"initVisualizerNow",value:function(){var t=this;return i(regeneratorRuntime.mark((function n(){var i,r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.initTimeout=null,n.t0=t.domInitialized,!n.t0){n.next=11;break}if(n.t1=t.src,!n.t1){n.next=9;break}return t.ns=null,n.next=8,e.urlToNoteSequence(t.src);case 8:t.ns=n.sent;case 9:t.wrapper.innerHTML="",n.t0=t.ns;case 11:if(!n.t0){n.next=13;break}"piano-roll"===t.type?(t.wrapper.classList.add("piano-roll-visualizer"),i=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.wrapper.appendChild(i),t.visualizer=new e.PianoRollSVGVisualizer(t.ns,i,t._config)):"waterfall"===t.type?(t.wrapper.classList.add("waterfall-visualizer"),t.visualizer=new e.WaterfallSVGVisualizer(t.ns,t.wrapper,t._config)):"staff"===t.type&&(t.wrapper.classList.add("staff-visualizer"),r=document.createElement("div"),t.wrapper.appendChild(r),t.visualizer=new e.StaffSVGVisualizer(t.ns,r,t._config));case 13:case"end":return n.stop()}}),n)})))()}},{key:"redraw",value:function(t){this.visualizer&&this.visualizer.redraw(t,null!=t)}},{key:"clearActiveNotes",value:function(){this.visualizer&&this.visualizer.clearActiveNotes()}},{key:"noteSequence",get:function(){return this.ns},set:function(t){this.ns=t,this.removeAttribute("src"),this.initVisualizer()}},{key:"src",get:function(){return this.getAttribute("src")},set:function(t){this.ns=null,this.setOrRemoveAttribute("src",t),this.initVisualizer()}},{key:"type",get:function(){var t=this.getAttribute("type");return a.indexOf(t)<0&&(t="piano-roll"),t},set:function(t){if(null!=t&&a.indexOf(t)<0)throw new Error("Unknown visualizer type ".concat(t,". Allowed values: ").concat(a.join(", ")));this.setOrRemoveAttribute("type",t)}},{key:"config",get:function(){return this._config},set:function(t){this._config=t,this.initVisualizer()}},{key:"setOrRemoveAttribute",value:function(t,e){null==e?this.removeAttribute(t):this.setAttribute(t,e)}}],[{key:"observedAttributes",get:function(){return["src","type"]}}]),r}(_wrapNativeSuper(HTMLElement)),u=["start","stop","note"],l=null,c=function(t){_inherits(a,t);var n=_createSuper(a);function a(){var t;return _classCallCheck(this,a),(t=n.call(this)).domInitialized=!1,t.needInitNs=!1,t.visualizerListeners=new Map,t.ns=null,t._playing=!1,t.attachShadow({mode:"open"}),t.shadowRoot.appendChild(r.content.cloneNode(!0)),t.controlPanel=t.shadowRoot.querySelector(".controls"),t.playButton=t.controlPanel.querySelector(".play"),t.currentTimeLabel=t.controlPanel.querySelector(".current-time"),t.totalTimeLabel=t.controlPanel.querySelector(".total-time"),t.seekBar=t.controlPanel.querySelector(".seek-bar"),t}return _createClass(a,[{key:"connectedCallback",value:function(){var t=this;if(!this.domInitialized){this.domInitialized=!0;var e=window.applyFocusVisiblePolyfill;null!=e&&e(this.shadowRoot),this.playButton.addEventListener("click",(function(){t.player.isPlaying()?t.stop():t.start()})),this.seekBar.addEventListener("input",(function(){t.player&&"started"===t.player.getPlayState()&&t.player.pause()})),this.seekBar.addEventListener("change",(function(){var e=t.currentTime;t.currentTimeLabel.textContent=o(e),t.player&&t.player.isPlaying()&&(t.player.seekTo(e),"paused"===t.player.getPlayState()&&t.player.resume())})),this.initPlayerNow()}}},{key:"attributeChangedCallback",value:function(t,e,n){var i=this;if(this.hasAttribute(t)||(n=null),"sound-font"===t||"src"===t)this.initPlayer();else if("visualizer"===t){var r=function(){i.setVisualizerSelector(n)};"loading"===document.readyState?window.addEventListener("DOMContentLoaded",r):r()}}},{key:"initPlayer",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.needInitNs=this.needInitNs||e,null==this.initTimeout&&(this.stop(),this.freeze(),this.initTimeout=window.setTimeout((function(){return t.initPlayerNow(t.needInitNs)})))}},{key:"initPlayerNow",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this;return i(regeneratorRuntime.mark((function i(){var r,a,s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(n.initTimeout=null,n.needInitNs=!1,!n.domInitialized){i.next=23;break}if(i.t0=t,!i.t0){i.next=10;break}if(i.t1=n.src,!i.t1){i.next=9;break}return n.ns=null,i.next=8,e.urlToNoteSequence(n.src);case 8:n.ns=i.sent;case 9:n.currentTime=0;case 10:if(r=n.ns){i.next=12;break}return i.abrupt("return",(n.seekBar.max="0",void(n.totalTimeLabel.textContent=o(0))));case 12:if(n.seekBar.max=String(r.totalTime),n.totalTimeLabel.textContent=o(r.totalTime),a=n.soundFont,s={run:function(t){return n.ns===r&&n.noteCallback(t)},stop:function(){}},null!==a){i.next=18;break}n.player=new e.Player(!1,s),i.next=22;break;case 18:return""===a&&(a="https://storage.googleapis.com/magentadata/js/soundfonts/sgm_plus"),n.player=new e.SoundFontPlayer(a,void 0,void 0,void 0,s),i.next=22,n.player.loadSamples(r);case 22:n.ns===r&&(n.unfreeze(),n.dispatchEvent(new CustomEvent("load")));case 23:case"end":return i.stop()}}),i)})))()}},{key:"start",value:function(){var t=this;i(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.player){e.next=17;break}if("stopped"!=t.player.getPlayState()){e.next=16;break}return l&&l.playing&&l.stop(),l=t,t._playing=!0,t.controlPanel.classList.remove("stopped"),t.controlPanel.classList.add("playing"),e.prev=3,n=t.player.start(t.ns),t.dispatchEvent(new CustomEvent("start")),e.next=8,n;case 8:t.handleStop(!0),e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(3),t.handleStop(),e.t0;case 14:e.next=17;break;case 16:"paused"==t.player.getPlayState()&&t.player.resume();case 17:case"end":return e.stop()}}),e,null,[[3,11]])})))()}},{key:"stop",value:function(){this.player&&this.player.isPlaying()&&this.player.stop(),this.handleStop(!1)}},{key:"addVisualizer",value:function(t){var e,n=this,i={start:function(){t.noteSequence=n.noteSequence},stop:function(){t.clearActiveNotes()},note:function(e){t.redraw(e.detail.note)}},r=_createForOfIteratorHelper(u);try{for(r.s();!(e=r.n()).done;){var o=e.value;this.addEventListener(o,i[o])}}catch(t){r.e(t)}finally{r.f()}this.visualizerListeners.set(t,i)}},{key:"removeVisualizer",value:function(t){var e,n=this.visualizerListeners.get(t),i=_createForOfIteratorHelper(u);try{for(i.s();!(e=i.n()).done;){var r=e.value;this.removeEventListener(r,n[r])}}catch(t){i.e(t)}finally{i.f()}this.visualizerListeners.delete(t)}},{key:"noteCallback",value:function(t){this.playing&&(this.dispatchEvent(new CustomEvent("note",{detail:{note:t}})),this.seekBar.value=String(t.startTime),this.currentTimeLabel.textContent=o(t.startTime))}},{key:"handleStop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&(this.currentTime=this.duration),this.controlPanel.classList.remove("playing"),this.controlPanel.classList.add("stopped"),this._playing&&(this._playing=!1,this.dispatchEvent(new CustomEvent("stop",{detail:{finished:t}})))}},{key:"setVisualizerSelector",value:function(t){var e,n=_createForOfIteratorHelper(this.visualizerListeners.values());try{for(n.s();!(e=n.n()).done;){var i,r=e.value,o=_createForOfIteratorHelper(u);try{for(o.s();!(i=o.n()).done;){var a=i.value;this.removeEventListener(a,r[a])}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}if(this.visualizerListeners.clear(),null!=t){var l,c=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(c.s();!(l=c.n()).done;){var f=l.value;f instanceof s?this.addVisualizer(f):console.warn("Selector ".concat(t," matched non-visualizer element"),f)}}catch(t){c.e(t)}finally{c.f()}}}},{key:"freeze",value:function(){this.playButton.disabled=!0,this.seekBar.disabled=!0,this.controlPanel.classList.add("frozen")}},{key:"unfreeze",value:function(){this.controlPanel.classList.remove("frozen"),this.playButton.disabled=!1,this.seekBar.disabled=!1}},{key:"noteSequence",get:function(){return this.ns},set:function(t){this.ns=t,this.removeAttribute("src"),this.initPlayer()}},{key:"src",get:function(){return this.getAttribute("src")},set:function(t){this.ns=null,this.setOrRemoveAttribute("src",t),this.initPlayer()}},{key:"soundFont",get:function(){return this.getAttribute("sound-font")},set:function(t){this.setOrRemoveAttribute("sound-font",t)}},{key:"currentTime",get:function(){return parseFloat(this.seekBar.value)},set:function(t){this.seekBar.value=String(t),this.currentTimeLabel.textContent=o(this.currentTime),this.player&&this.player.isPlaying()&&this.player.seekTo(t)}},{key:"duration",get:function(){return parseFloat(this.seekBar.max)}},{key:"playing",get:function(){return this._playing}},{key:"setOrRemoveAttribute",value:function(t,e){null==e?this.removeAttribute(t):this.setAttribute(t,e)}}],[{key:"observedAttributes",get:function(){return["sound-font","src","visualizer"]}}]),a}(_wrapNativeSuper(HTMLElement));window.customElements.define("midi-player",c),window.customElements.define("midi-visualizer",s),t.PlayerElement=c,t.VisualizerElement=s,Object.defineProperty(t,"__esModule",{value:!0})}(exports,require$$2__default.default)})),htmlMidiPlayer$1=getDefaultExportFromCjs(htmlMidiPlayer),$$0=Object.freeze(Object.assign(Object.create(null),htmlMidiPlayer,{default:htmlMidiPlayer$1})),_templateObject,_templateObject2,MusicPlayer=function(t){_inherits(n,t);var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.call(this)).noWaterfall=!1,t.noVisual=!1,t.visualizer="staff",t}return _createClass(n,[{key:"render",value:function(){return lit.html(_templateObject||(_templateObject=_taggedTemplateLiteral(['\n      <midi-visualizer\n        type="','"\n        src="','"\n      ></midi-visualizer>\n      <midi-player src="','" sound-font></midi-player>\n    '])),this.visualizer,this.source,this.source)}},{key:"firstUpdated",value:function(){var t=this;this.visualizerElement=this.shadowRoot.querySelector("midi-visualizer"),setTimeout((function(){Promise.resolve($$0).then((function(e){t.shadowRoot.querySelector("midi-player").addVisualizer(t.visualizerElement)}))}),0)}}],[{key:"tag",get:function(){return"music-player"}},{key:"styles",get:function(){return[lit.css(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n        :host {\n          display: block;\n        }\n\n        :host([hidden]) {\n          display: none;\n        }\n        midi-player {\n          display: block;\n          width: var(--music-player-midi-player-width, unset);\n          margin: var(--music-player-midi-player-margin, 4px);\n        }\n        :host([no-visual]) midi-visualizer {\n          display: none;\n        }\n\n        :host([no-waterfall]) midi-visualizer .waterfall-notes-container {\n          display: none;\n        }\n        midi-visualizer .waterfall-visualizer {\n          overflow: auto;\n        }\n      "])))]}},{key:"properties",get:function(){return{source:{type:String},visualizer:{type:String},noWaterfall:{type:Boolean,attribute:"no-waterfall",reflect:!0},noVisual:{type:Boolean,attribute:"no-visual",reflect:!0}}}},{key:"haxProperties",get:function(){return{canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Music player",description:"Play music in context with a data visualization",icon:"image:music-note",color:"blue",groups:["Media","Music"],handles:[{type:"audio",source:"source"}],meta:{author:"ELMS:LN"}},settings:{configure:[{property:"source",title:"Source",description:"Source of the file to play",inputMethod:"haxupload"},{property:"visualizer",title:"Visualization",description:"How to visualize the music file",inputMethod:"select",options:{staff:"Staff","piano-roll":"Piano roll",waterfall:"Piano + waterfall"}},{property:"noWaterfall",title:"Hide waterfall",description:"Disable the waterfall of notes when visualized as a piano",inputMethod:"boolean"}],advanced:[]},demoSchema:[{tag:"music-player",content:"",properties:{source:"https://magenta.github.io/magenta-js/music/demos/melody.mid"}}]}}}]),n}(lit.LitElement);customElements.define(MusicPlayer.tag,MusicPlayer),exports.MusicPlayer=MusicPlayer,Object.defineProperty(exports,"__esModule",{value:!0})}));
  