UNPKG

p5.gibber.js

Version:

Music and audio programming for p5.js

10 lines 294 kB
!function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n?n:e)},l,l.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e){p5.prototype.Gibber=e("gibber.core.lib"),p5.prototype.Gibber.Audio=e("gibber.audio.lib")(p5.prototype.Gibber),p5.prototype.Gibber.init({globalize:!1,target:p5.prototype}),p5.prototype.Gibber.export(p5.prototype),p5.prototype.Gibber.Master=p5.prototype.Gibber.Audio.Master},{"gibber.audio.lib":37,"gibber.core.lib":62}],2:[function(e,t,n){function i(e,t,n){if(!(this instanceof i))return new i(e,t,n);var r,o=typeof e;if("number"===o)r=e>0?e>>>0:0;else if("string"===o)"base64"===t&&(e=q(e)),r=i.byteLength(e,t);else{if("object"!==o||null===e)throw new Error("First argument needs to be a number, array or string.");"Buffer"===e.type&&C(e.data)&&(e=e.data),r=+e.length>0?Math.floor(+e.length):0}var s;H?s=i._augment(new Uint8Array(r)):(s=this,s.length=r,s._isBuffer=!0);var a;if(H&&"number"==typeof e.byteLength)s._set(e);else if(M(e))if(i.isBuffer(e))for(a=0;r>a;a++)s[a]=e.readUInt8(a);else for(a=0;r>a;a++)s[a]=(e[a]%256+256)%256;else if("string"===o)s.write(e,0,t);else if("number"===o&&!H&&!n)for(a=0;r>a;a++)s[a]=0;return s}function r(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i),i>r&&(i=r)):i=r;var o=t.length;D(o%2===0,"Invalid hex string"),i>o/2&&(i=o/2);for(var s=0;i>s;s++){var a=parseInt(t.substr(2*s,2),16);D(!isNaN(a),"Invalid hex string"),e[n+s]=a}return s}function o(e,t,n,i){var r=E(R(t),e,n,i);return r}function s(e,t,n,i){var r=E(L(t),e,n,i);return r}function a(e,t,n,i){return s(e,t,n,i)}function u(e,t,n,i){var r=E(N(t),e,n,i);return r}function c(e,t,n,i){var r=E(I(t),e,n,i);return r}function l(e,t,n){return V.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function f(e,t,n){var i="",r="";n=Math.min(e.length,n);for(var o=t;n>o;o++)e[o]<=127?(i+=T(r)+String.fromCharCode(e[o]),r=""):r+="%"+e[o].toString(16);return i+T(r)}function h(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;n>r;r++)i+=String.fromCharCode(e[r]);return i}function p(e,t,n){return h(e,t,n)}function d(e,t,n){var i=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>i)&&(n=i);for(var r="",o=t;n>o;o++)r+=O(e[o]);return r}function b(e,t,n){for(var i=e.slice(t,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function m(e,t,n,i){i||(D("boolean"==typeof n,"missing or invalid endian"),D(void 0!==t&&null!==t,"missing offset"),D(t+1<e.length,"Trying to read beyond buffer length"));var r=e.length;if(!(t>=r)){var o;return n?(o=e[t],r>t+1&&(o|=e[t+1]<<8)):(o=e[t]<<8,r>t+1&&(o|=e[t+1])),o}}function g(e,t,n,i){i||(D("boolean"==typeof n,"missing or invalid endian"),D(void 0!==t&&null!==t,"missing offset"),D(t+3<e.length,"Trying to read beyond buffer length"));var r=e.length;if(!(t>=r)){var o;return n?(r>t+2&&(o=e[t+2]<<16),r>t+1&&(o|=e[t+1]<<8),o|=e[t],r>t+3&&(o+=e[t+3]<<24>>>0)):(r>t+1&&(o=e[t+1]<<16),r>t+2&&(o|=e[t+2]<<8),r>t+3&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}}function y(e,t,n,i){i||(D("boolean"==typeof n,"missing or invalid endian"),D(void 0!==t&&null!==t,"missing offset"),D(t+1<e.length,"Trying to read beyond buffer length"));var r=e.length;if(!(t>=r)){var o=m(e,t,n,!0),s=32768&o;return s?-1*(65535-o+1):o}}function v(e,t,n,i){i||(D("boolean"==typeof n,"missing or invalid endian"),D(void 0!==t&&null!==t,"missing offset"),D(t+3<e.length,"Trying to read beyond buffer length"));var r=e.length;if(!(t>=r)){var o=g(e,t,n,!0),s=2147483648&o;return s?-1*(4294967295-o+1):o}}function x(e,t,n,i){return i||(D("boolean"==typeof n,"missing or invalid endian"),D(t+3<e.length,"Trying to read beyond buffer length")),z.read(e,t,n,23,4)}function k(e,t,n,i){return i||(D("boolean"==typeof n,"missing or invalid endian"),D(t+7<e.length,"Trying to read beyond buffer length")),z.read(e,t,n,52,8)}function w(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+1<e.length,"trying to write beyond buffer length"),F(t,65535));var o=e.length;if(!(n>=o)){for(var s=0,a=Math.min(o-n,2);a>s;s++)e[n+s]=(t&255<<8*(i?s:1-s))>>>8*(i?s:1-s);return n+2}}function _(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+3<e.length,"trying to write beyond buffer length"),F(t,4294967295));var o=e.length;if(!(n>=o)){for(var s=0,a=Math.min(o-n,4);a>s;s++)e[n+s]=t>>>8*(i?s:3-s)&255;return n+4}}function G(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+1<e.length,"Trying to write beyond buffer length"),B(t,32767,-32768));var o=e.length;if(!(n>=o))return t>=0?w(e,t,n,i,r):w(e,65535+t+1,n,i,r),n+2}function j(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+3<e.length,"Trying to write beyond buffer length"),B(t,2147483647,-2147483648));var o=e.length;if(!(n>=o))return t>=0?_(e,t,n,i,r):_(e,4294967295+t+1,n,i,r),n+4}function A(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+3<e.length,"Trying to write beyond buffer length"),U(t,3.4028234663852886e38,-3.4028234663852886e38));var o=e.length;if(!(n>=o))return z.write(e,t,n,i,23,4),n+4}function S(e,t,n,i,r){r||(D(void 0!==t&&null!==t,"missing value"),D("boolean"==typeof i,"missing or invalid endian"),D(void 0!==n&&null!==n,"missing offset"),D(n+7<e.length,"Trying to write beyond buffer length"),U(t,1.7976931348623157e308,-1.7976931348623157e308));var o=e.length;if(!(n>=o))return z.write(e,t,n,i,52,8),n+8}function q(e){for(e=P(e).replace(X,"");e.length%4!==0;)e+="=";return e}function P(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function C(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function M(e){return C(e)||i.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function O(e){return 16>e?"0"+e.toString(16):e.toString(16)}function R(e){for(var t=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);if(127>=i)t.push(i);else{var r=n;i>=55296&&57343>=i&&n++;for(var o=encodeURIComponent(e.slice(r,n+1)).substr(1).split("%"),s=0;s<o.length;s++)t.push(parseInt(o[s],16))}}return t}function L(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function I(e){for(var t,n,i,r=[],o=0;o<e.length;o++)t=e.charCodeAt(o),n=t>>8,i=t%256,r.push(i),r.push(n);return r}function N(e){return V.toByteArray(e)}function E(e,t,n,i){for(var r=0;i>r&&!(r+n>=t.length||r>=e.length);r++)t[r+n]=e[r];return r}function T(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function F(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(e>=0,"specified a negative value for writing an unsigned value"),D(t>=e,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function B(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(t>=e,"value larger than maximum allowed value"),D(e>=n,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function U(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(t>=e,"value larger than maximum allowed value"),D(e>=n,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}var V=e("base64-js"),z=e("ieee754");n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192;var H=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}();i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.byteLength=function(e,t){var n;switch(e=e.toString(),t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=R(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=N(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},i.concat=function(e,t){if(D(C(e),"Usage: Buffer.concat(list[, length])"),0===e.length)return new i(0);if(1===e.length)return e[0];var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var r=new i(t),o=0;for(n=0;n<e.length;n++){var s=e[n];s.copy(r,o),o+=s.length}return r},i.compare=function(e,t){D(i.isBuffer(e)&&i.isBuffer(t),"Arguments must be Buffers");for(var n=e.length,r=t.length,o=0,s=Math.min(n,r);s>o&&e[o]===t[o];o++);return o!==s&&(n=e[o],r=t[o]),r>n?-1:n>r?1:0},i.prototype.write=function(e,t,n,i){if(isFinite(t))isFinite(n)||(i=n,n=void 0);else{var l=i;i=t,t=n,n=l}t=Number(t)||0;var f=this.length-t;n?(n=Number(n),n>f&&(n=f)):n=f,i=String(i||"utf8").toLowerCase();var h;switch(i){case"hex":h=r(this,e,t,n);break;case"utf8":case"utf-8":h=o(this,e,t,n);break;case"ascii":h=s(this,e,t,n);break;case"binary":h=a(this,e,t,n);break;case"base64":h=u(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":h=c(this,e,t,n);break;default:throw new Error("Unknown encoding")}return h},i.prototype.toString=function(e,t,n){var i=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,n=void 0===n?i.length:Number(n),n===t)return"";var r;switch(e){case"hex":r=d(i,t,n);break;case"utf8":case"utf-8":r=f(i,t,n);break;case"ascii":r=h(i,t,n);break;case"binary":r=p(i,t,n);break;case"base64":r=l(i,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=b(i,t,n);break;default:throw new Error("Unknown encoding")}return r},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.equals=function(e){return D(i.isBuffer(e),"Argument must be a Buffer"),0===i.compare(this,e)},i.prototype.compare=function(e){return D(i.isBuffer(e),"Argument must be a Buffer"),i.compare(this,e)},i.prototype.copy=function(e,t,n,i){var r=this;if(n||(n=0),i||0===i||(i=this.length),t||(t=0),i!==n&&0!==e.length&&0!==r.length){D(i>=n,"sourceEnd < sourceStart"),D(t>=0&&t<e.length,"targetStart out of bounds"),D(n>=0&&n<r.length,"sourceStart out of bounds"),D(i>=0&&i<=r.length,"sourceEnd out of bounds"),i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var o=i-n;if(100>o||!H)for(var s=0;o>s;s++)e[s+t]=this[s+n];else e._set(this.subarray(n,n+o),t)}},i.prototype.slice=function(e,t){var n=this.length;if(e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e),H)return i._augment(this.subarray(e,t));for(var r=t-e,o=new i(r,void 0,!0),s=0;r>s;s++)o[s]=this[s+e];return o},i.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},i.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},i.prototype.readUInt8=function(e,t){return t||(D(void 0!==e&&null!==e,"missing offset"),D(e<this.length,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},i.prototype.readUInt16LE=function(e,t){return m(this,e,!0,t)},i.prototype.readUInt16BE=function(e,t){return m(this,e,!1,t)},i.prototype.readUInt32LE=function(e,t){return g(this,e,!0,t)},i.prototype.readUInt32BE=function(e,t){return g(this,e,!1,t)},i.prototype.readInt8=function(e,t){if(t||(D(void 0!==e&&null!==e,"missing offset"),D(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length)){var n=128&this[e];return n?-1*(255-this[e]+1):this[e]}},i.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},i.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},i.prototype.readInt32LE=function(e,t){return v(this,e,!0,t)},i.prototype.readInt32BE=function(e,t){return v(this,e,!1,t)},i.prototype.readFloatLE=function(e,t){return x(this,e,!0,t)},i.prototype.readFloatBE=function(e,t){return x(this,e,!1,t)},i.prototype.readDoubleLE=function(e,t){return k(this,e,!0,t)},i.prototype.readDoubleBE=function(e,t){return k(this,e,!1,t)},i.prototype.writeUInt8=function(e,t,n){return n||(D(void 0!==e&&null!==e,"missing value"),D(void 0!==t&&null!==t,"missing offset"),D(t<this.length,"trying to write beyond buffer length"),F(e,255)),t>=this.length?void 0:(this[t]=e,t+1)},i.prototype.writeUInt16LE=function(e,t,n){return w(this,e,t,!0,n)},i.prototype.writeUInt16BE=function(e,t,n){return w(this,e,t,!1,n)},i.prototype.writeUInt32LE=function(e,t,n){return _(this,e,t,!0,n)},i.prototype.writeUInt32BE=function(e,t,n){return _(this,e,t,!1,n)},i.prototype.writeInt8=function(e,t,n){return n||(D(void 0!==e&&null!==e,"missing value"),D(void 0!==t&&null!==t,"missing offset"),D(t<this.length,"Trying to write beyond buffer length"),B(e,127,-128)),t>=this.length?void 0:(e>=0?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n),t+1)},i.prototype.writeInt16LE=function(e,t,n){return G(this,e,t,!0,n)},i.prototype.writeInt16BE=function(e,t,n){return G(this,e,t,!1,n)},i.prototype.writeInt32LE=function(e,t,n){return j(this,e,t,!0,n)},i.prototype.writeInt32BE=function(e,t,n){return j(this,e,t,!1,n)},i.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return S(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return S(this,e,t,!1,n)},i.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),D(n>=t,"end < start"),n!==t&&0!==this.length){D(t>=0&&t<this.length,"start out of bounds"),D(n>=0&&n<=this.length,"end out of bounds");var i;if("number"==typeof e)for(i=t;n>i;i++)this[i]=e;else{var r=R(e.toString()),o=r.length;for(i=t;n>i;i++)this[i]=r[i%o]}return this}},i.prototype.inspect=function(){for(var e=[],t=this.length,i=0;t>i;i++)if(e[i]=O(this[i]),i===n.INSPECT_MAX_BYTES){e[i+1]="...";break}return"<Buffer "+e.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(H)return new i(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var $=i.prototype;i._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=$.get,e.set=$.set,e.write=$.write,e.toString=$.toString,e.toLocaleString=$.toString,e.toJSON=$.toJSON,e.equals=$.equals,e.compare=$.compare,e.copy=$.copy,e.slice=$.slice,e.readUInt8=$.readUInt8,e.readUInt16LE=$.readUInt16LE,e.readUInt16BE=$.readUInt16BE,e.readUInt32LE=$.readUInt32LE,e.readUInt32BE=$.readUInt32BE,e.readInt8=$.readInt8,e.readInt16LE=$.readInt16LE,e.readInt16BE=$.readInt16BE,e.readInt32LE=$.readInt32LE,e.readInt32BE=$.readInt32BE,e.readFloatLE=$.readFloatLE,e.readFloatBE=$.readFloatBE,e.readDoubleLE=$.readDoubleLE,e.readDoubleBE=$.readDoubleBE,e.writeUInt8=$.writeUInt8,e.writeUInt16LE=$.writeUInt16LE,e.writeUInt16BE=$.writeUInt16BE,e.writeUInt32LE=$.writeUInt32LE,e.writeUInt32BE=$.writeUInt32BE,e.writeInt8=$.writeInt8,e.writeInt16LE=$.writeInt16LE,e.writeInt16BE=$.writeInt16BE,e.writeInt32LE=$.writeInt32LE,e.writeInt32BE=$.writeInt32BE,e.writeFloatLE=$.writeFloatLE,e.writeFloatBE=$.writeFloatBE,e.writeDoubleLE=$.writeDoubleLE,e.writeDoubleBE=$.writeDoubleBE,e.fill=$.fill,e.inspect=$.inspect,e.toArrayBuffer=$.toArrayBuffer,e};var X=/[^+\/0-9A-z]/g},{"base64-js":3,ieee754:4}],3:[function(e,t,n){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s?62:t===a?63:u>t?-1:u+10>t?t-u+26+26:l+26>t?t-l:c+26>t?t-c+26:void 0}function n(e){function n(e){c[f++]=e}var i,r,s,a,u,c;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;u="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,c=new o(3*e.length/4-u),s=u>0?e.length-4:e.length;var f=0;for(i=0,r=0;s>i;i+=4,r+=3)a=t(e.charAt(i))<<18|t(e.charAt(i+1))<<12|t(e.charAt(i+2))<<6|t(e.charAt(i+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=t(e.charAt(i))<<2|t(e.charAt(i+1))>>4,n(255&a)):1===u&&(a=t(e.charAt(i))<<10|t(e.charAt(i+1))<<4|t(e.charAt(i+2))>>2,n(a>>8&255),n(255&a)),c}function r(e){function t(e){return i.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var r,o,s,a=e.length%3,u="";for(r=0,s=e.length-a;s>r;r+=3)o=(e[r]<<16)+(e[r+1]<<8)+e[r+2],u+=n(o);switch(a){case 1:o=e[e.length-1],u+=t(o>>2),u+=t(o<<4&63),u+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],u+=t(o>>10),u+=t(o>>4&63),u+=t(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),c="a".charCodeAt(0),l="A".charCodeAt(0);e.toByteArray=n,e.fromByteArray=r}("undefined"==typeof n?this.base64js={}:n)},{}],4:[function(e,t,n){n.read=function(e,t,n,i,r){var o,s,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?r-1:0,h=n?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?0/0:1/0*(p?-1:1);s+=Math.pow(2,i),o-=c}return(p?-1:1)*s*Math.pow(2,o-i)},n.write=function(e,t,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,f=l>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,d=i?1:-1,b=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,r),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&a,p+=d,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[n+p]=255&s,p+=d,s/=256,c-=8);e[n+p-d]|=128*b}},{}],5:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function r(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,r,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,a=new Array(r-1),u=1;r>u;u++)a[u-1]=arguments[u];n.apply(this,a)}else if(o(n)){for(r=arguments.length,a=new Array(r-1),u=1;r>u;u++)a[u-1]=arguments[u];for(c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned){var r;r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,r,s,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],6:[function(e,t){var n=t.exports,i=(e("events").EventEmitter,e("./lib/request")),r=e("url");n.request=function(e,t){"string"==typeof e&&(e=r.parse(e)),e||(e={}),e.host||e.port||(e.port=parseInt(window.location.port,10)),!e.host&&e.hostname&&(e.host=e.hostname),e.scheme||(e.scheme=window.location.protocol.split(":")[0]),e.host||(e.host=window.location.hostname||window.location.host),/:/.test(e.host)&&(e.port||(e.port=e.host.split(":")[1]),e.host=e.host.split(":")[0]),e.port||(e.port="https"==e.scheme?443:80);var n=new i(new o,e);return t&&n.on("response",t),n},n.get=function(e,t){e.method="GET";var i=n.request(e,t);return i.end(),i},n.Agent=function(){},n.Agent.defaultMaxSockets=4;var o=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{var n=new window.ActiveXObject(e[t]);return function(){if(n){var i=n;return n=null,i}return new window.ActiveXObject(e[t])}}catch(i){}throw new Error("ajax not supported in this browser")}throw new Error("ajax not supported in this browser")}();n.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{"./lib/request":7,events:5,url:30}],7:[function(e,t){var n=e("stream"),i=e("./response"),r=e("Base64"),o=e("inherits"),s=t.exports=function(e,t){var n=this;n.writable=!0,n.xhr=e,n.body=[],n.uri=(t.scheme||"http")+"://"+t.host+(t.port?":"+t.port:"")+(t.path||"/"),"undefined"==typeof t.withCredentials&&(t.withCredentials=!0);try{e.withCredentials=t.withCredentials}catch(o){}if(t.responseType)try{e.responseType=t.responseType}catch(o){}if(e.open(t.method||"GET",n.uri,!0),e.onerror=function(){n.emit("error",new Error("Network error"))},n._headers={},t.headers)for(var s=a(t.headers),u=0;u<s.length;u++){var c=s[u];if(n.isSafeRequestHeader(c)){var l=t.headers[c];n.setHeader(c,l)}}t.auth&&this.setHeader("Authorization","Basic "+r.btoa(t.auth));var f=new i;f.on("close",function(){n.emit("close")}),f.on("ready",function(){n.emit("response",f)}),f.on("error",function(e){n.emit("error",e)}),e.onreadystatechange=function(){e.__aborted||f.handle(e)}};o(s,n),s.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t},s.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]},s.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},s.prototype.write=function(e){this.body.push(e)},s.prototype.destroy=function(){this.xhr.__aborted=!0,this.xhr.abort(),this.emit("close")},s.prototype.end=function(e){void 0!==e&&this.body.push(e);for(var t=a(this._headers),n=0;n<t.length;n++){var i=t[n],r=this._headers[i];if(u(r))for(var o=0;o<r.length;o++)this.xhr.setRequestHeader(i,r[o]);else this.xhr.setRequestHeader(i,r)}if(0===this.body.length)this.xhr.send("");else if("string"==typeof this.body[0])this.xhr.send(this.body.join(""));else if(u(this.body[0])){for(var s=[],n=0;n<this.body.length;n++)s.push.apply(s,this.body[n]);this.xhr.send(s)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){for(var c=0,n=0;n<this.body.length;n++)c+=this.body[n].length;for(var s=new this.body[0].constructor(c),l=0,n=0;n<this.body.length;n++)for(var f=this.body[n],o=0;o<f.length;o++)s[l++]=f[o];this.xhr.send(s)}else{for(var s="",n=0;n<this.body.length;n++)s+=this.body[n].toString();this.xhr.send(s)}},s.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],s.prototype.isSafeRequestHeader=function(e){return e?-1===c(s.unsafeHeaders,e.toLowerCase()):!1};var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},u=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}},{"./response":8,Base64:9,inherits:10,stream:29}],8:[function(e,t){function n(e){for(var t=e.getAllResponseHeaders().split(/\r?\n/),n={},i=0;i<t.length;i++){var r=t[i];if(""!==r){var o=r.match(/^([^:]+):\s*(.*)/);if(o){var s=o[1].toLowerCase(),u=o[2];void 0!==n[s]?a(n[s])?n[s].push(u):n[s]=[n[s],u]:n[s]=u}else n[r]=!0}}return n}var i=e("stream"),r=e("util"),o=t.exports=function(){this.offset=0,this.readable=!0};r.inherits(o,i);var s={streaming:!0,status2:!0};o.prototype.getResponse=function(e){var t=String(e.responseType).toLowerCase();return"blob"===t?e.responseBlob||e.response:"arraybuffer"===t?e.response:e.responseText},o.prototype.getHeader=function(e){return this.headers[e.toLowerCase()]},o.prototype.handle=function(e){if(2===e.readyState&&s.status2){try{this.statusCode=e.status,this.headers=n(e)}catch(t){s.status2=!1}s.status2&&this.emit("ready")}else if(s.streaming&&3===e.readyState){try{this.statusCode||(this.statusCode=e.status,this.headers=n(e),this.emit("ready"))}catch(t){}try{this._emitData(e)}catch(t){s.streaming=!1}}else 4===e.readyState&&(this.statusCode||(this.statusCode=e.status,this.emit("ready")),this._emitData(e),e.error?this.emit("error",this.getResponse(e)):this.emit("end"),this.emit("close"))},o.prototype._emitData=function(e){var t=this.getResponse(e);return t.toString().match(/ArrayBuffer/)?(this.emit("data",new Uint8Array(t,this.offset)),void(this.offset=t.byteLength)):void(t.length>this.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{stream:29,util:32}],9:[function(e,t,n){!function(){function e(e){this.message=e}var t="undefined"!=typeof n?n:this,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var n,r,o=0,s=i,a="";t.charAt(0|o)||(s="=",o%1);a+=s.charAt(63&n>>8-o%1*8)){if(r=t.charCodeAt(o+=.75),r>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|r}return a}),t.atob||(t.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,s=0,a="";r=t.charAt(s++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r=i.indexOf(r);return a})}()},{}],10:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],11:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],12:[function(e,t){function n(){}var i=t.exports={};i.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var i=n.shift();i()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=n,i.addListener=n,i.once=n,i.off=n,i.removeListener=n,i.removeAllListeners=n,i.emit=n,i.binding=function(){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(){throw new Error("process.chdir is not supported")}},{}],13:[function(e,t,n){(function(e){!function(i){function r(e){throw RangeError(R[e])}function o(e,t){for(var n=e.length;n--;)e[n]=t(e[n]);return e}function s(e,t){return o(e.split(O),t).join(".")}function a(e){for(var t,n,i=[],r=0,o=e.length;o>r;)t=e.charCodeAt(r++),t>=55296&&56319>=t&&o>r?(n=e.charCodeAt(r++),56320==(64512&n)?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--)):i.push(t);return i}function u(e){return o(e,function(e){var t="";return e>65535&&(e-=65536,t+=N(e>>>10&1023|55296),e=56320|1023&e),t+=N(e)}).join("")}function c(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:w}function l(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function f(e,t,n){var i=0;for(e=n?I(e/A):e>>1,e+=I(e/t);e>L*G>>1;i+=w)e=I(e/L);return I(i+(L+1)*e/(e+j))}function h(e){var t,n,i,o,s,a,l,h,p,d,b=[],m=e.length,g=0,y=q,v=S;for(n=e.lastIndexOf(P),0>n&&(n=0),i=0;n>i;++i)e.charCodeAt(i)>=128&&r("not-basic"),b.push(e.charCodeAt(i));for(o=n>0?n+1:0;m>o;){for(s=g,a=1,l=w;o>=m&&r("invalid-input"),h=c(e.charCodeAt(o++)),(h>=w||h>I((k-g)/a))&&r("overflow"),g+=h*a,p=v>=l?_:l>=v+G?G:l-v,!(p>h);l+=w)d=w-p,a>I(k/d)&&r("overflow"),a*=d;t=b.length+1,v=f(g-s,t,0==s),I(g/t)>k-y&&r("overflow"),y+=I(g/t),g%=t,b.splice(g++,0,y)
}return u(b)}function p(e){var t,n,i,o,s,u,c,h,p,d,b,m,g,y,v,x=[];for(e=a(e),m=e.length,t=q,n=0,s=S,u=0;m>u;++u)b=e[u],128>b&&x.push(N(b));for(i=o=x.length,o&&x.push(P);m>i;){for(c=k,u=0;m>u;++u)b=e[u],b>=t&&c>b&&(c=b);for(g=i+1,c-t>I((k-n)/g)&&r("overflow"),n+=(c-t)*g,t=c,u=0;m>u;++u)if(b=e[u],t>b&&++n>k&&r("overflow"),b==t){for(h=n,p=w;d=s>=p?_:p>=s+G?G:p-s,!(d>h);p+=w)v=h-d,y=w-d,x.push(N(l(d+v%y,0))),h=I(v/y);x.push(N(l(h,0))),s=f(n,g,i==o),n=0,++i}++n,++t}return x.join("")}function d(e){return s(e,function(e){return C.test(e)?h(e.slice(4).toLowerCase()):e})}function b(e){return s(e,function(e){return M.test(e)?"xn--"+p(e):e})}var m="object"==typeof n&&n,g="object"==typeof t&&t&&t.exports==m&&t,y="object"==typeof e&&e;(y.global===y||y.window===y)&&(i=y);var v,x,k=2147483647,w=36,_=1,G=26,j=38,A=700,S=72,q=128,P="-",C=/^xn--/,M=/[^ -~]/,O=/\x2E|\u3002|\uFF0E|\uFF61/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=w-_,I=Math.floor,N=String.fromCharCode;if(v={version:"1.2.4",ucs2:{decode:a,encode:u},decode:h,encode:p,toASCII:b,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return v});else if(m&&!m.nodeType)if(g)g.exports=v;else for(x in v)v.hasOwnProperty(x)&&(m[x]=v[x]);else i.punycode=v}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(e,t){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;c>l;++l){var f,h,p,d,b=e[l].replace(a,"%20"),m=b.indexOf(r);m>=0?(f=b.substr(0,m),h=b.substr(m+1)):(f=b,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],15:[function(e,t){"use strict";function n(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i<e.length;i++)n.push(t(e[i],i));return n}var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,s,a){return t=t||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e?n(o(e),function(o){var a=encodeURIComponent(i(o))+s;return r(e[o])?n(e[o],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[o]))}).join(t):a?encodeURIComponent(i(a))+s+encodeURIComponent(i(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],16:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":14,"./encode":15}],17:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":18}],18:[function(e,t){(function(n){function i(e){return this instanceof i?(u.call(this,e),c.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",r)):new i(e)}function r(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function o(e,t){for(var n=0,i=e.length;i>n;n++)t(e[n],n)}t.exports=i;var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},a=e("core-util-is");a.inherits=e("inherits");var u=e("./_stream_readable"),c=e("./_stream_writable");a.inherits(i,u),o(s(c.prototype),function(e){i.prototype[e]||(i.prototype[e]=c.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":20,"./_stream_writable":22,_process:12,"core-util-is":23,inherits:10}],19:[function(e,t){function n(e){return this instanceof n?void i.call(this,e):new n(e)}t.exports=n;var i=e("./_stream_transform"),r=e("core-util-is");r.inherits=e("inherits"),r.inherits(n,i),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":21,"core-util-is":23,inherits:10}],20:[function(e,t){(function(n){function i(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(q||(q=e("string_decoder/").StringDecoder),this.decoder=new q(t.encoding),this.encoding=t.encoding)}function r(e){return this instanceof r?(this._readableState=new i(e,this),this.readable=!0,void A.call(this)):new r(e)}function o(e,t,n,i,r){var o=c(t,n);if(o)e.emit("error",o);else if(null===n||void 0===n)t.reading=!1,t.ended||l(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!r){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&r){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||r||i||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&f(e),p(e,t);else r||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=P)e=P;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var n=null;return G.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?f(e):x(e)}function f(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function p(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){d(e,t)}))}function d(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function b(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&m(e)}}function m(e){function t(e){var t=e.write(n);!1===t&&i.awaitDrain++}var n,i=e._readableState;for(i.awaitDrain=0;i.pipesCount&&null!==(n=e.read());)if(1===i.pipesCount?t(i.pipes,0,null):k(i.pipes,t),e.emit("data",n),i.awaitDrain>0)return;return 0===i.pipesCount?(i.flowing=!1,void(j.listenerCount(e,"data")>0&&y(e))):void(i.ranOut=!0)}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,m(this))}function y(e,t){var i=e._readableState;if(i.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,o=!1;e.readable=!0,e.pipe=A.prototype.pipe,e.on=e.addListener=A.prototype.on,e.on("readable",function(){o=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(o=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,o?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function v(e,t){var n,i=t.buffer,r=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===i.length)return null;if(0===r)n=null;else if(s)n=i.shift();else if(!e||e>=r)n=o?i.join(""):G.concat(i,r),i.length=0;else if(e<i[0].length){var a=i[0];n=a.slice(0,e),i[0]=a.slice(e)}else if(e===i[0].length)n=i.shift();else{n=o?"":new G(e);for(var u=0,c=0,l=i.length;l>c&&e>u;c++){var a=i[0],f=Math.min(e-u,a.length);o?n+=a.slice(0,f):a.copy(n,u,0,f),f<a.length?i[0]=a.slice(f):i.shift(),u+=f}}return n}function x(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function k(e,t){for(var n=0,i=e.length;i>n;n++)t(e[n],n)}function w(e,t){for(var n=0,i=e.length;i>n;n++)if(e[n]===t)return n;return-1}t.exports=r;var _=e("isarray"),G=e("buffer").Buffer;r.ReadableState=i;var j=e("events").EventEmitter;j.listenerCount||(j.listenerCount=function(e,t){return e.listeners(t).length});var A=e("stream"),S=e("core-util-is");S.inherits=e("inherits");var q;S.inherits(r,A),r.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new G(e,t),t="")),o(this,n,e,t,!1)},r.prototype.unshift=function(e){var t=this._readableState;return o(this,t,e,"",!0)},r.prototype.setEncoding=function(t){q||(q=e("string_decoder/").StringDecoder),this._readableState.decoder=new q(t),this._readableState.encoding=t};var P=8388608;r.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n,i=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return f(this),null;if(e=u(e,t),0===e&&t.ended)return n=null,t.length>0&&t.decoder&&(n=v(e,t),t.length-=n.length),0===t.length&&x(this),n;var r=t.needReadable;return t.length-e<=t.highWaterMark&&(r=!0),(t.ended||t.reading)&&(r=!1),r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=u(i,t)),n=e>0?v(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&x(this),n},r.prototype._read=function(){this.emit("error",new Error("not implemented"))},r.prototype.pipe=function(e,t){function i(e){e===l&&o()}function r(){e.end()}function o(){e.removeListener("close",a),e.removeListener("finish",u),e.removeListener("drain",d),e.removeListener("error",s),e.removeListener("unpipe",i),l.removeListener("end",r),l.removeListener("end",o),(!e._writableState||e._writableState.needDrain)&&d()}function s(t){c(),e.removeListener("error",s),0===j.listenerCount(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",u),c()}function u(){e.removeListener("close",a),c()}function c(){l.unpipe(e)}var l=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=h?r:o;f.endEmitted?n.nextTick(p):l.once("end",p),e.on("unpipe",i);var d=b(l);return e.on("drain",d),e._events&&e._events.error?_(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",a),e.once("finish",u),e.emit("pipe",l),f.flowing||(this.on("readable",g),f.flowing=!0,n.nextTick(function(){m(l)})),e},r.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1;for(var r=0;i>r;r++)n[r].emit("unpipe",this);return this}var r=w(t.pipes,e);return-1===r?this:(t.pipes.splice(r,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},r.prototype.on=function(e,t){var n=A.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||y(this),"readable"===e&&this.readable){var i=this._readableState;i.readableListening||(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading?i.length&&f(this,i):this.read(0))}return n},r.prototype.addListener=r.prototype.on,r.prototype.resume=function(){y(this),this.read(0),this.emit("resume")},r.prototype.pause=function(){y(this,!0),this.emit("pause")},r.prototype.wrap=function(e){var t=this._readableState,n=!1,i=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&i.push(e)}i.push(null)}),e.on("data",function(r){if(t.decoder&&(r=t.decoder.write(r)),(!t.objectMode||null!==r&&void 0!==r)&&(t.objectMode||r&&r.length)){var o=i.push(r);o||(n=!0,e.pause())}});for(var r in e)"function"==typeof e[r]&&"undefined"==typeof this[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));var o=["error","close","destroy","pause","resume"];return k(o,function(t){e.on(t,i.emit.bind(i,t))}),i._read=function(){n&&(n=!1,e.resume())},i},r._fromList=v}).call(this,e("_process"))},{_process:12,buffer:2,"core-util-is":23,events:5,inherits:10,isarray:11,stream:29,"string_decoder/":24}],21:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return i(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(e,t,n){var i=e._transformState;i.transforming=!1;var r=i.writecb;if(!r)return e.emit("error",new Error("no writecb in Transform class"));i.writechunk=null,i.writecb=null,null!==n&&void 0!==n&&e.push(n),r&&r(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}function r(e){if(!(this instanceof r))return new r(e);s.call(this,e);var t=(this._transformState=new n(e,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){o(t,e)}):o(t)})}function o(e,t){if(t)return e.emit("error",t);var n=e._writableState,i=(e._readableState,e._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(i.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=r;var s=e("./_stream_duplex"),a=e("core-util-is");a.inherits=e("inherits"),a.inherits(r,s),r.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},r.prototype._transform=function(){throw new Error("not implemented")},r.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":18,"core-util-is":23,inherits:10}],22:[function(e,t){(function(n){function i(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function r(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){p(t,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.errorEmitted=!1}function o(t){var n=e("./_stream_duplex");return this instanceof o||this instanceof n?(this._writableState=new r(t,this),this.writable=!0,void w.call(this)):new o(t)}function s(e,t,i){var r=new Error("write after end");e.emit("error",r),n.nextTick(function(){i(r)})}function a(e,t,i,r){var o=!0;if(!x.isBuffer(i)&&"string"!=typeof i&&null!==i&&void 0!==i&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),n.nextTick(function(){r(s)}),o=!1}return o}function u(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new x(t,n)),t}function c(e,t,n,r,o){n=u(t,n,r),x.isBuffer(n)&&(r="buffer");var s=t.objectMode?1:n.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing?t.buffer.push(new i(n,r,o)):l(e,t,s,n,r,o),a}function l(e,t,n,i,r,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,e._write(i,r,t.onwrite),t.sync=!1}function f(e,t,i,r,o){i?n.nextTick(function(){o(r)}):o(r),e._writableState.errorEmitted=!0,e.emit("error",r)}function h(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function p(e,t){var i=e._writableState,r=i.sync,o=i.writecb;if(h(i),t)f(e,i,r,t,o);else{var s=g(e,i);s||i.bufferProcessing||!i.buffer.length||m(e,i),r?n.nextTick(function(){d(e,i,s,o)}):d(e,i,s,o)}}function d(e,t,n,i){n||b(e,t),i(),n&&y(e,t)}function b(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function m(e,t){t.bufferProcessing=!0;for(var n=0;n<t.buffer.length;n++){var i=t.buffer[n],r=i.chunk,o=i.encoding,s=i.callback,a=t.objectMode?1:r.length;if(l(e,t,a,r,o,s),t.writing){n++;break}}t.bufferProcessing=!1,n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}function g(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function y(e,t){var n=g(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function v(e,t,i){t.ending=!0,y(e,t),i&&(t.finished?n.nextTick(i):e.once("finish",i)),t.ended=!0}t.exports=o;var x=e("buffer").Buffer;o.WritableState=r;var k=e("core-util-is");k.inherits=e("inherits");var w=e("stream");k.inherits(o,w),o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,n){var i=this._writableState,r=!1;return"function"==typeof t&&(n=t,t=null),x.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=function(){}),i.ended?s(this,i,n):a(this,i,e,n)&&(r=c(this,i,e,t,n)),r},o.prototype._write=function(e,t,n){n(new Error("not implemented"))},o.prototype.end=function(e,t,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),i.ending||i.finished||v(this,i,n)}}).call(this,e("_process"))},{"./_stream_duplex":18,_process:12,buffer:2,"core-util-is":23,inherits:10,stream:29}],23:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function i(e){return"boolean"==typeof e}function r(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function l(e){return f(e)&&"[object RegExp]"===g(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return f(e)&&"[object Date]"===g(e)}function p(e){return f(e)&&("[object Error]"===g(e)||e instanceof Error)}function d(e){return"function"==typeof e}function b(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function m(t){return e.isBuffer(t)}function g(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=i,n.isNull=r,n.isNullOrUndefined=o,n.isNumber=s,n.isString=a,n.isSymbol=u,n.isUndefined=c,n.isRegExp=l,n.isObject=f,n.isDate=h,n.isError=p,n.isFunction=d,n.isPrimitive=b,n.isBuffer=m}).call(this,e("buffer").Buffer)},{buffer:2}],24:[function(e,t,n){function i(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function r(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=e("buffer").Buffer,u=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),i(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=r)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived),t+=e.toString(this.encoding,0,r);var r=t.length-1,i=t.charCodeAt(r);if(i>=55296&&56319>=i){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,i=this.charBuffer,r=this.encoding;t+=i.slice(0,n).toString(r)}return t}},{buffer:2}],25:[function(e,t){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":19}],26:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":18,"./lib/_stream_passthrough.js":19,"./lib/_stream_readable.js":20,"./lib/_stream_transform.js":21,"./lib/_stream_writable.js":22}],27:[function(e,t){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":21}],28:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":22}],29:[function(e,t){function n(){i.call(this)}t.exports=n;var i=e("events").EventEmitter,r=e("inherits");r(n,i),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function r(){c.readable&&c.resume&&c.resume()}function o(){l||(l=!0,e.end())}function s(){l||(l=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){c.removeListener("data",n),e.removeListener("drain",r),c.removeListener("end",o),c.removeListener("close",s),c.removeListener("error",a),e.removeListener("error",a),c.removeListener("end",u),c.removeListener("close",u),e.removeListener("close",u)}var c=this;c.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(c.on("end",o),c.on("close",s));var l=!1;return c.on("error",a),e.on("error",a),c.on("end",u),c.on("close",u),e.on("close",u),e.emit("pipe",c),e}},{events:5,inherits:10,"readable-stream/duplex.js":17,"readable-stream/passthrough.js":25,"readable-stream/readable.js":26,"readable-stream/transform.js":27,"readable-stream/writable.js":28}],30:[function(e,t,n){function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(e,t,n){if(e&&c(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}function o(e){return u(e)&&(e=r(e)),e instanceof i?e.format():i.prototype.format.call(e)}function s(e,t){return r(e,!1,!0).resolve(t)}function a(e,t){return e?r(e,!1,!0).resolveObject(t):t}function u(e){return"string"==typeof e}function c(e){return"object"==typeof e&&null!==e}function l(e){return null===e}function f(e){return null==e}var h=e("punycode");n.parse=r,n.resolve=s,n.resolveObject=a,n.format=o,n.Url=i;var p=/^([a-z0-9.+-]+:)/i,d=/:[0-9]*$/,b=["<",">",'"',"`"," ","\r","\n","	"],m=["{","}","|","\\","^","`"].concat(b),g=["'"].concat(m),y=["%","/","?",";","#"].concat(g),v=["/","?","#"],x=255,k=/^[a-z0-9A-Z_-]{0,63}$/,w=/^([a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},G={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=e("querystring");i.prototype.parse=function(e,t,n){if(!u(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e;i=i.trim();var r=p.exec(i);if(r){r=r[0];var o=r.toLowerCase();this.protocol=o,i=i.substr(r.length)}if(n||r||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===i.substr(0,2);!s||r&&G[r]||(i=i.substr(2),this.slashes=!0)}if(!G[r]&&(s||r&&!j[r])){for(var a=-1,c=0;c<v.length;c++){var l=i.indexOf(v[c]);-1!==l&&(-1===a||a>l)&&(a=l)}var f,d;d=-1===a?i.lastIndexOf("@"):i.lastIndexOf("@",a),-1!==d&&(f=i.slice(0,d),i=i.slice(d+1),this.auth=decodeURIComponent(f)),a=-1;for(var c=0;c<y.length;c++){var l=i.indexOf(y[c]);-1!==l&&(-1===a||a>l)&&(a=l)}-1===a&&(a=i.length),this.host=i.slice(0,a),i=i.slice(a),this.parseHost(),this.hostname=this.hostname||"";var b="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!b)for(var m=this.hostname.split(/\./),c=0,S=m.length;S>c;c++){var q=m[c];if(q&&!q.match(k)){for(var P="",C=0,M=q.length;M>C;C++)P+=q.charCodeAt(C)>127?"x":q[C];if(!P.match(k)){var O=m.slice(0,c),R=m.slice(c+1),L=q.match(w);L&&(O.push(L[1]),R.unshift(L[2])),R.length&&(i="/"+R.join(".")+i),this.hostname=O.join(".");break}}}if(this.hostname=this.hostname.length>x?"":this.hostname.toLowerCase(),!b){for(var I=this.hostname.split("."),N=[],c=0;c<I.length;++c){var E=I[c];N.push(E.match(/[^A-Za-z0-9_-]/)?"xn--"+h.encode(E):E)}this.hostname=N.join(".")}var T=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+T,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!_[o])for(var c=0,S=g.length;S>c;c++){var B=g[c],U=encodeURIComponent(B);U===B&&(U=escape(B)),i=i.split(B).join(U)}var D=i.indexOf("#");-1!==D&&(this.hash=i.substr(D),i=i.slice(0,D));var V=i.indexOf("?");if(-1!==V?(this.search=i.substr(V),this.query=i.substr(V+1),t&&(this.query=A.parse(this.query)),i=i.slice(0,V)):t&&(this.search="",this.query={}),i&&(this.pathname=i),j[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var T=this.pathname||"",E=this.search||"";this.path=T+E}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",i=this.hash||"",r=!1,o="";this.host?r=e+this.host:this.hostname&&(r=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&c(this.query)&&Object.keys(this.query).length&&(o=A.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||j[t])&&r!==!1?(r="//"+(r||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):r||(r=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace("#","%23"),t+r+n+s+i},i.prototype.resolve=function(e){return this.resolveObject(r(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if(u(e)){var t=new i;t.parse(e,!1,!0),e=t}var n=new i;if(Object.keys(this).forEach(function(e){n[e]=this[e]},this),n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol)return Object.keys(e).forEach(function(t){"protocol"!==t&&(n[t]=e[t])}),j[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(e.protocol&&e.protocol!==n.protocol){if(!j[e.protocol])return Object.keys(e).forEach(function(t){n[t]=e[t]}),n.href=n.format(),n;if(n.protocol=e.protocol,e.host||G[e.protocol])n.pathname=e.pathname;else{for(var r=(e.pathname||"").split("/");r.length&&!(e.host=r.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==r[0]&&r.unshift(""),r.length<2&&r.unshift(""),n.pathname=r.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var o=n.pathname||"",s=n.search||"";n.path=o+s}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var a=n.pathname&&"/"===n.pathname.charAt(0),c=e.host||e.pathname&&"/"===e.pathname.charAt(0),h=c||a||n.host&&e.pathname,p=h,d=n.pathname&&n.pathname.split("/")||[],r=e.pathname&&e.pathname.split("/")||[],b=n.protocol&&!j[n.protocol];if(b&&(n.hostname="",n.port=null,n.host&&(""===d[0]?d[0]=n.host:d.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===r[0]?r[0]=e.host:r.unshift(e.host)),e.host=null),h=h&&(""===r[0]||""===d[0])),c)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,d=r;else if(r.length)d||(d=[]),d.pop(),d=d.concat(r),n.search=e.search,n.query=e.query;else if(!f(e.search)){if(b){n.hostname=n.host=d.shift();var m=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;m&&(n.auth=m.shift(),n.host=n.hostname=m.shift())}return n.search=e.search,n.query=e.query,l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!d.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var g=d.slice(-1)[0],y=(n.host||e.host)&&("."===g||".."===g)||""===g,v=0,x=d.length;x>=0;x--)g=d[x],"."==g?d.splice(x,1):".."===g?(d.splice(x,1),v++):v&&(d.splice(x,1),v--);if(!h&&!p)for(;v--;v)d.unshift("..");!h||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),y&&"/"!==d.join("/").substr(-1)&&d.push("");var k=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(b){n.hostname=n.host=k?"":d.length?d.shift():"";var m=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;m&&(n.auth=m.shift(),n.host=n.hostname=m.shift())}return h=h||n.host&&d.length,h&&!k&&d.unshift(""),d.length?n.pathname=d.join("/"):(n.pathname=null,n.path=null),l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=d.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{punycode:13,querystring:16}],31:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],32:[function(e,t,n){(function(t,i){function r(e,t){var i={seen:[],stylize:s};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),b(t)?i.showHidden=t:t&&n._extend(i,t),k(i.showHidden)&&(i.showHidden=!1),k(i.depth)&&(i.depth=2),k(i.colors)&&(i.colors=!1),k(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=o),u(i,e,i.depth)}function o(e,t){var n=r.styles[t];return n?"["+r.colors[n][0]+"m"+e+"["+r.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function u(e,t,i){if(e.customInspect&&t&&A(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(i,e);return v(r)||(r=u(e,r,i)),r}var o=c(e,t);if(o)return o;var s=Object.keys(t),b=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),j(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(A(t)){var m=t.name?": "+t.name:"";return e.stylize("[Function"+m+"]","special")
}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(G(t))return e.stylize(Date.prototype.toString.call(t),"date");if(j(t))return l(t)}var g="",y=!1,x=["{","}"];if(d(t)&&(y=!0,x=["[","]"]),A(t)){var k=t.name?": "+t.name:"";g=" [Function"+k+"]"}if(w(t)&&(g=" "+RegExp.prototype.toString.call(t)),G(t)&&(g=" "+Date.prototype.toUTCString.call(t)),j(t)&&(g=" "+l(t)),0===s.length&&(!y||0==t.length))return x[0]+g+x[1];if(0>i)return w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var _;return _=y?f(e,t,i,b,s):s.map(function(n){return h(e,t,i,b,n,y)}),e.seen.pop(),p(_,g,x)}function c(e,t){if(k(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,i,r){for(var o=[],s=0,a=t.length;a>s;++s)o.push(M(t,String(s))?h(e,t,n,i,String(s),!0):"");return r.forEach(function(r){r.match(/^\d+$/)||o.push(h(e,t,n,i,r,!0))}),o}function h(e,t,n,i,r,o){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]},c.get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),M(i,r)||(s="["+r+"]"),a||(e.seen.indexOf(c.value)<0?(a=m(n)?u(e,c.value,null):u(e,c.value,n-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return"   "+e}).join("\n"))):a=e.stylize("[Circular]","special")),k(s)){if(o&&r.match(/^\d+$/))return a;s=JSON.stringify(""+r),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e,t,n){var i=0,r=e.reduce(function(e,t){return i++,t.indexOf("\n")>=0&&i++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return null==e}function y(e){return"number"==typeof e}function v(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function k(e){return void 0===e}function w(e){return _(e)&&"[object RegExp]"===q(e)}function _(e){return"object"==typeof e&&null!==e}function G(e){return _(e)&&"[object Date]"===q(e)}function j(e){return _(e)&&("[object Error]"===q(e)||e instanceof Error)}function A(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function q(e){return Object.prototype.toString.call(e)}function P(e){return 10>e?"0"+e.toString(10):e.toString(10)}function C(){var e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var O=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(r(arguments[n]));return t.join(" ")}for(var n=1,i=arguments,o=i.length,s=String(e).replace(O,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(t){return"[Circular]"}default:return e}}),a=i[n];o>n;a=i[++n])s+=m(a)||!_(a)?" "+a:" "+r(a);return s},n.deprecate=function(e,r){function o(){if(!s){if(t.throwDeprecation)throw new Error(r);t.traceDeprecation?console.trace(r):console.error(r),s=!0}return e.apply(this,arguments)}if(k(i.process))return function(){return n.deprecate(e,r).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return o};var R,L={};n.debuglog=function(e){if(k(R)&&(R=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!L[e])if(new RegExp("\\b"+e+"\\b","i").test(R)){var i=t.pid;L[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,i,t)}}else L[e]=function(){};return L[e]},n.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=d,n.isBoolean=b,n.isNull=m,n.isNullOrUndefined=g,n.isNumber=y,n.isString=v,n.isSymbol=x,n.isUndefined=k,n.isRegExp=w,n.isObject=_,n.isDate=G,n.isError=j,n.isFunction=A,n.isPrimitive=S,n.isBuffer=e("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",C(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!_(t))return e;for(var n=Object.keys(t),i=n.length;i--;)e[n[i]]=t[n[i]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":31,_process:12,inherits:10}],33:[function(require,module,exports){(function(global){!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.Gibberish=t()}(this,function(){function createInput(){console.log("connecting audio input..."),navigator.getUserMedia({audio:!0},function(e){console.log("audio input connected"),Gibberish.mediaStreamSource=Gibberish.context.createMediaStreamSource(e),Gibberish.mediaStreamSource.connect(Gibberish.node),_hasInput=!0},function(e){console.log(e),console.log("error opening audio input")})}var Gibberish={memo:{},codeblock:[],analysisCodeblock:[],analysisUgens:[],dirtied:[],id:0,isDirty:!1,out:null,debug:!1,callback:"",audioFiles:{},sequencers:[],callbackArgs:["input"],callbackObjects:[],analysisCallbackArgs:[],analysisCallbackObjects:[],onBlock:null,createCallback:function(){this.memo={},this.codeblock.length=0,this.callbackArgs.length=0,this.callbackObjects.length=0,this.analysisCallbackArgs.length=0,this.dirtied.length=0,this.codestring="	",this.args=["input"],this.memo={},this.out.codegen();var e=this.codeblock.slice(0);if(this.analysisUgens.length>0){this.analysisCodeblock.length=0;for(var t=0;t<this.analysisUgens.length;t++)this.analysisCallbackArgs.push(this.analysisUgens[t].analysisSymbol)}if(this.args=this.args.concat(this.callbackArgs),this.args=this.args.concat(this.analysisCallbackArgs),this.codestring+=e.join("	"),this.codestring+="\n	",this.analysisUgens.length>0){this.analysisCodeblock.length=0;for(var t=0;t<this.analysisUgens.length;t++)this.codeblock.length=0,this.analysisUgens[t].analysisCodegen();this.codestring+=this.analysisCodeblock.join("\n	"),this.codestring+="\n	"}return this.codestring+="return "+this.out.variable+";\n",this.callbackString=this.codestring,this.debug&&console.log(this.callbackString),[this.args,this.codestring]},audioProcess:function(e){var t,n,i=e.outputBuffer.getChannelData(0),r=e.outputBuffer.getChannelData(1),o=e.inputBuffer.getChannelData(0),s=Gibberish,a=s.callback,u=s.sequencers,c=(Gibberish.out.callback,s.callbackObjects.slice(0));null!==s.onBlock&&s.onBlock(s.context),c.unshift(0);for(var l=0,f=e.outputBuffer.length;f>l;l++){for(var h=0;h<u.length;h++)u[h].tick();if(s.isDirty){t=s.createCallback();try{a=s.callback=new Function(t[0],t[1])}catch(e){console.error("ERROR WITH CALLBACK : \n\n",t)}s.isDirty=!1,c=s.callbackObjects.slice(0),c.unshift(0)}c[0]=o[l],n=a.apply(null,c),i[l]=n[0],r[l]=n[1]}},audioProcessFirefox:function(e){var t,n=Gibberish,i=n.callback,r=n.sequencers,o=n.callbackObjects.slice(0);o.unshift(0);for(var s=0,a=e.length;a>s;s+=2){for(var u=0;u<r.length;u++)r[u].tick();if(n.isDirty){t=n.createCallback();try{i=n.callback=new Function(t[0],t[1])}catch(c){console.error("ERROR WITH CALLBACK : \n\n",i)}n.isDirty=!1,o=n.callbackObjects.slice(0),o.unshift(0)}var l=i.apply(null,o);e[s]=l[0],e[s+1]=l[1]}},clear:function(){this.out.inputs.length=0,this.analysisUgens.length=0,this.sequencers.length=0,this.callbackArgs.length=2,this.callbackObjects.length=1,Gibberish.dirty(this.out)},dirty:function(e){if("undefined"!=typeof e){for(var t=!1,n=0;n<this.dirtied.length;n++)this.dirtied[n].variable===e.variable&&(t=!0);t||(this.isDirty=!0,this.dirtied.push(e))}else this.isDirty=!0},generateSymbol:function(e){return e+"_"+this.id++},AudioDataDestination:function(e,t){var n=new Audio;n.mozSetup(2,e);var i,r=0,o=e/2,s=null;setInterval(function(){var e;if(s){if(e=n.mozWriteAudio(s.subarray(i)),r+=e,i+=e,i<s.length)return;s=null}var a=n.mozCurrentSampleOffset(),u=a+o-r;if(u>0){var c=new Float32Array(u);t(c),e=n.mozWriteAudio(c),a=n.mozCurrentSampleOffset(),e<c.length&&(s=c,i=e),r+=e}},100)},init:function(){var e,t,n="undefined"==typeof arguments[0]?1024:arguments[0];return"undefined"!=typeof webkitAudioContext?e=webkitAudioContext:"undefined"!=typeof AudioContext&&(e=AudioContext),t=function(){if("undefined"!=typeof e){if(document&&document.documentElement&&"ontouchstart"in document.documentElement&&(window.removeEventListener("touchstart",t),"ontouchstart"in document.documentElement)){var n=Gibberish.context.createBufferSource();n.connect(Gibberish.context.destination),n.noteOn(0)}}else alert("Your browser does not support javascript audio synthesis. Please download a modern web browser that is not Internet Explorer.");Gibberish.onstart&&Gibberish.onstart()},Gibberish.context=new e,Gibberish.node=Gibberish.context.createScriptProcessor(n,2,2,Gibberish.context.sampleRate),Gibberish.node.onaudioprocess=Gibberish.audioProcess,Gibberish.node.connect(Gibberish.context.destination),Gibberish.out=new Gibberish.Bus2,Gibberish.out.codegen(),Gibberish.dirty(Gibberish.out),document&&document.documentElement&&"ontouchstart"in document.documentElement?window.addEventListener("touchstart",t):t(),this},makePanner:function(){for(var e=[],t=[],n=Math.sqrt(2)/2,i=0;1024>i;i++){var r=-1+i/1024*2;e[i]=n*(Math.cos(r)-Math.sin(r)),t[i]=n*(Math.cos(r)+Math.sin(r))}return function(n,i,r){var o,s,a,u,c,l,f="object"==typeof n,h=f?n[0]:n,p=f?n[1]:n;return o=1023*(i+1)/2,s=0|o,a=o-s,s=1023&s,u=1023===s?0:s+1,c=e[s],l=e[u],r[0]=(c+a*(l-c))*h,c=t[s],l=t[u],r[1]=(c+a*(l-c))*p,r}},defineUgenProperty:function(e,t,n){var i=n.properties[e]={value:t,binops:[],parent:n,name:e};Object.defineProperty(n,e,{configurable:!0,get:function(){return i.value},set:function(e){i.value=e,Gibberish.dirty(n)}})},polyInit:function(e){e.mod=e.polyMod,e.removeMod=e.removePolyMod,e.voicesClear=function(){if(e.children.length>0){for(var t=0;t<e.children.length;t++)e.children[t].disconnect();e.children.length=0,e.voiceCount=0}};for(var t in e.polyProperties)!function(t){var n=e.polyProperties[t];Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(i){n=i;for(var r=0;r<e.children.length;r++)e.children[r][t]=n}})}(t);var n=e.maxVoices;Object.defineProperty(e,"maxVoices",{get:function(){return n},set:function(e){n=e,this.voicesClear(),this.initVoices()}})},interpolate:function(e,t){var n=0|t,i=n+1>e.length-1?0:n+1;return frac=t-n,e[n]+frac*(e[i]-e[n])},pushUnique:function(e,t){for(var n=e,i=!0,r=0;r<t.length;r++)if(n===t[r]){i=!1;break}i&&t.push(n)},"export":function(e,t){for(var n in Gibberish[e])t[n]=Gibberish[e][n]},ugen:function(){Gibberish.extend(this,{processProperties:function(){if("object"!=typeof arguments[0][0]||"undefined"!=typeof arguments[0][0].type||Array.isArray(arguments[0][0])||"op"===arguments[0][0].name){var e=0;for(var t in this.properties)"object"==typeof this.properties[t]&&"undefined"!=typeof this.properties[t].binops?"undefined"!=typeof arguments[0][e]&&(this.properties[t].value=arguments[0][e++]):"undefined"!=typeof arguments[0][e]&&(this.properties[t]=arguments[0][e++])}else{var n=arguments[0][0];for(var t in n)"undefined"!=typeof n[t]&&("object"==typeof this.properties[t]&&"undefined"!=typeof this.properties[t].binops?this.properties[t].value=n[t]:this[t]=n[t])}return this},valueOf:function(){return this.codegen(),this.variable},codegen:function(){var e="",t=null;if(Gibberish.memo[this.symbol])return Gibberish.memo[this.symbol];t=this.variable?this.variable:Gibberish.generateSymbol("v"),Gibberish.memo[this.symbol]=t,this.variable=t,e+="var "+t+" = "+this.symbol+"(";for(var n in this.properties){var i=this.properties[n],r="";if(Array.isArray(i.value)){0===i.value.length&&(r=0);for(var o=0;o<i.value.length;o++){var s=i.value[o];r+="object"==typeof s?null!==s?s.valueOf():"null":"function"==typeof i.value?i.value():i.value,r+=o<i.value.length-1?", ":""}}else"object"==typeof i.value?null!==i.value&&(r=i.value.codegen?i.value.valueOf():i.value):"undefined"!==i.name&&(r="function"==typeof i.value?i.value():i.value);if(0!=i.binops.length){for(var a=0;a<i.binops.length;a++)e+="(";for(var u=0;u<i.binops.length;u++){var c,l=i.binops[u];c="number"==typeof l.ugen?l.ugen:null!==l.ugen?l.ugen.valueOf():"null","="===l.binop?(e=e.replace(r,""),e+=c):"++"===l.binop?e+=" + Math.abs("+c+")":(0===u&&(e+=r),e+=" "+l.binop+" "+c+")")}}else e+=r;e+=", "}return" "===e.charAt(e.length-1)&&(e=e.slice(0,-2)),e+=");\n",this.codeblock=e,-1===Gibberish.codeblock.indexOf(this.codeblock)&&Gibberish.codeblock.push(this.codeblock),-1===Gibberish.callbackArgs.indexOf(this.symbol)&&"op"!==this.name&&Gibberish.callbackArgs.push(this.symbol),-1===Gibberish.callbackObjects.indexOf(this.callback)&&"op"!==this.name&&Gibberish.callbackObjects.push(this.callback),this.dirty=!1,t},init:function(){if(this.initalized||(this.symbol=Gibberish.generateSymbol(this.name),this.codeblock=null,this.variable=null),"undefined"==typeof this.properties&&(this.properties={}),!this.initialized){this.destinations=[];for(var e in this.properties)Gibberish.defineUgenProperty(e,this.properties[e],this)}if(arguments.length>0&&"object"==typeof arguments[0][0]&&"undefined"===arguments[0][0].type){var t=arguments[0][0];for(var e in t)this[e]=t[e]}return this.initialized=!0,this},mod:function(e,t,n){var i=this.properties[e],r={ugen:t,binop:n};i.binops.push(r),Gibberish.dirty(this)},removeMod:function(e,t){if("undefined"==typeof t)this.properties[e].binops.length=0;else if("number"==typeof t)this.properties[e].binops.splice(t,1);else if("object"==typeof t)for(var n=0,i=this.properties[e].binops.length;i>n;n++)this.properties[e].binops[n].ugen===t&&this.properties[e].binops.splice(n,1);Gibberish.dirty(this)},polyMod:function(e,t,n){for(var i=0;i<this.children.length;i++)this.children[i].mod(e,t,n);Gibberish.dirty(this)},removePolyMod:function(){var e=Array.prototype.slice.call(arguments,0);if("amp"!==arguments[0]&&"pan"!==arguments[0])for(var t=0;t<this.children.length;t++)this.children[t].removeMod.apply(this.children[t],e);else this.removeMod.apply(this,e);Gibberish.dirty(this)},smooth:function(e){var t=new Gibberish.OnePole;this.mod(e,t,"=")},connect:function(e,t){return"undefined"==typeof e&&(e=Gibberish.out),-1===this.destinations.indexOf(e)&&(e.addConnection(this,1,t),this.destinations.push(e)),this},send:function(e,t){return-1===this.destinations.indexOf(e)?(e.addConnection(this,t),this.destinations.push(e)):e.adjustSendAmount(this,t),this},disconnect:function(e,t){var n;if(e)n=this.destinations.indexOf(e),n>-1&&this.destinations.splice(n,1),e.removeConnection(this);else{for(var i=0;i<this.destinations.length;i++)this.destinations[i].removeConnection(this);this.destinations=[]}return Gibberish.dirty(this),this}})}};Array2=function(){this.length=0},Array2.prototype=[],Array2.prototype.remove=function(e,t){if(t="undefined"==typeof t?!0:t,"undefined"==typeof e){for(var n=0;n<this.length;n++)delete this[n];this.length=0}else if("number"==typeof e)this.splice(e,1);else if("string"==typeof e){for(var i=[],n=0;n<this.length;n++){var r=this[n];if(r.type===e||r.name===e){if(!t)return void this.splice(n,1);i.push(n)}}for(var n=0;n<i.length;n++)this.splice(i[n],1)}else if("object"==typeof e)for(var o=this.indexOf(e);o>-1;)this.splice(o,1),o=this.indexOf(e);this.parent&&Gibberish.dirty(this.parent)},Array2.prototype.get=function(e){if("number"==typeof e)return this[e];if("string"==typeof e)for(var t=0;t<this.length;t++){var n=this[t];if(n.name===e)return n}else if("object"==typeof e){var i=this.indexOf(e);if(i>-1)return this[i]}return null},Array2.prototype.replace=function(e,t){if(t.parent=this,t.input=e.input,"number"!=typeof e){var n=this.indexOf(e);n>-1&&this.splice(n,1,t)}else this.splice(e,1,t);this.parent&&Gibberish.dirty(this.parent)},Array2.prototype.insert=function(e,t){if(e.parent=this,this.input=this.parent,Array.isArray(e))for(var n=0;n<e.length;n++)this.splice(t+n,0,e[n]);else this.splice(t,0,e);this.parent&&Gibberish.dirty(this.parent)},Array2.prototype.add=function(){for(var e=0;e<arguments.length;e++)arguments[e].parent=this,arguments[e].input=this.parent,this.push(arguments[e]);this.parent&&(console.log("DIRTYING"),Gibberish.dirty(this.parent))};var rnd=Math.random;Gibberish.rndf=function(e,t,n,i){if(i="undefined"==typeof i?!0:i,"undefined"==typeof n&&"object"!=typeof e){1==arguments.length?(t=arguments[0],e=0):2==arguments.length?(e=arguments[0],t=arguments[1]):(e=0,t=1);var r=t-e,o=Math.random(),s=r*o;return e+s}var a=[],u=[];"undefined"==typeof n&&(n=t||e.length);for(var c=0;n>c;c++){var l;if("object"==typeof arguments[0])l=arguments[0][rndi(0,arguments[0].length-1)];else if(i)l=Gibberish.rndf(e,t);else{for(l=Gibberish.rndf(e,t);u.indexOf(l)>-1;)l=Gibberish.rndf(e,t);u.push(l)}a.push(l)}return a},Gibberish.Rndf=function(){{var e,t,n,i;Math.random}return 0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2]):(e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3]),function(){var r,o,s;return o="function"==typeof e?e():e,s="function"==typeof t?t():t,r="undefined"==typeof n?Gibberish.rndf(o,s):Gibberish.rndf(o,s,n,i)}},Gibberish.rndi=function(e,t,n,i){var r;if(0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):(e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3]),r=t-e,n>r&&(i=!0),"undefined"==typeof n)return r=t-e,Math.round(e+Math.random()*r);for(var o=[],s=[],a=0;n>a;a++){var u;if(i)u=Gibberish.rndi(e,t);else{for(u=Gibberish.rndi(e,t);s.indexOf(u)>-1;)u=Gibberish.rndi(e,t);s.push(u)}o.push(u)}return o},Gibberish.Rndi=function(){{var e,t,n,i,r;Math.random,Math.round}return 0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2]):(e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3]),r=t-e,"number"==typeof n&&n>r&&(i=!0),function(){var r,o,s;return o="function"==typeof e?e():e,s="function"==typeof t?t():t,r="undefined"==typeof n?Gibberish.rndi(o,s):Gibberish.rndi(o,s,n,i)}},Gibberish.extend=function(e,t){for(var n in t){{n.split(".")}t[n]instanceof Array&&t[n].length<100?(e[n]=t[n].slice(0),"fx"===n&&(e[n].parent=t[n].parent)):"object"!=typeof t[n]||null===t[n]||t[n]instanceof Float32Array?e[n]=t[n]:(e[n]=e[n]||{},arguments.callee(e[n],t[n]))}return e},Function.prototype.clone=function(){return eval("["+this.toString()+"]")[0]},String.prototype.format=function(e,t,n){function i(){var i=this,r=arguments.length+1;for(e=0;r>e;n=arguments[e++])t=n,i=i.replace(RegExp("\\{"+(e-1)+"\\}","g"),t);return i}return i.native=String.prototype.format,i}(),Gibberish.future=function(e,t){var n=new Gibberish.Sequencer({values:[function(){},function(){e(),n.stop(),n.disconnect()}],durations:[t]}).start();return n.cancel=function(){n.stop(),n.disconnect()},n},Gibberish.Proxy=function(){var e=0;Gibberish.extend(this,{name:"proxy",type:"effect",properties:{},callback:function(){return e}}).init(),this.input=arguments[0],e=this.input.parent[this.input.name],delete this.input.parent[this.input.name],this.input.parent.properties[this.input.name].value=this,Object.defineProperty(this.input.parent,this.input.name,{get:function(){return e},set:function(t){e=t}}),Gibberish.dirty(this.input.parent)},Gibberish.Proxy.prototype=new Gibberish.ugen,Gibberish.Proxy2=function(){var e=arguments[0],t=arguments[1];Gibberish.extend(this,{name:"proxy2",type:"effect",properties:{},callback:function(){var n=e[t];return Array.isArray(n)?(n[0]+n[1]+n[2])/3:n}}).init(),this.getInput=function(){return e},this.setInput=function(t){e=t},this.getName=function(){return t},this.setName=function(e){t=e}},Gibberish.Proxy2.prototype=new Gibberish.ugen,Gibberish.Proxy3=function(){var e=arguments[0],t=arguments[1];Gibberish.extend(this,{name:"proxy3",type:"effect",properties:{},callback:function(){var n=e[t];return n||0}}),this.init(),this.codegen=function(){console.log(" CALLED "),this.variable||(this.variable=Gibberish.generateSymbol("v")),Gibberish.callbackArgs.push(this.symbol),Gibberish.callbackObjects.push(this.callback),this.codeblock="var "+this.variable+" = "+this.symbol+"("+e.properties[t].codegen()+");\n"}},Gibberish.Proxy3.prototype=new Gibberish.ugen,Gibberish.oscillator=function(){this.type="oscillator",this.oscillatorInit=function(){return this.fx=new Array2,this.fx.parent=this,this}},Gibberish.oscillator.prototype=new Gibberish.ugen,Gibberish._oscillator=new Gibberish.oscillator,Gibberish.Wavetable=function(){var e=0,t=null,n=Gibberish.context.sampleRate/1024;this.properties={frequency:440,amp:.25,sync:0},this.getTable=function(){return t},this.setTable=function(e){t=e,n=Gibberish.context.sampleRate/t.length},this.getTableFreq=function(){return n},this.setTableFreq=function(e){n=e},this.getPhase=function(){return e},this.setPhase=function(t){e=t},this.callback=function(i,r){var o,s,a,u,c;for(e+=i/n;e>=1024;)e-=1024;return o=0|e,s=e-o,o=1023&o,a=1023===o?0:o+1,u=t[o],c=t[a],(u+s*(c-u))*r}},Gibberish.Wavetable.prototype=Gibberish._oscillator,Gibberish.Table=function(e){this.__proto__=new Gibberish.Wavetable,this.name="table";var t=2*Math.PI;if("undefined"==typeof e){e=new Float32Array(1024);for(var n=1024;n--;)e[n]=Math.sin(n/1024*t)}this.setTable(e),this.init(),this.oscillatorInit()},Gibberish.asmSine=function(e,t,n){"use asm";function i(){for(var e=1024,t=1024;e=e-1|0;)t-=1,u[e>>2]=+s(+(t/1024)*6.2848);l=44100/1024}function r(e,t,n){e=+e,t=+t,n=+n;var i=0,r=0,o=0,s=0,f=0,h=0;return a=+(a+e/l),a>=1024&&(a=+(a-1024)),i=+c(a),s=a-i,r=~~i,o=(r|0)==1024?0:r+1|0,f=+u[r>>2],h=+u[o>>2],+((f+s*(h-f))*t)}function o(e){return e|=0,+u[e>>2]}var s=e.Math.sin,a=0,u=new e.Float32Array(n),c=e.Math.floor,l=0;return{init:i,gen:r,get:o}},Gibberish.asmSine2=function(){this.properties={frequency:440,amp:.5,sr:Gibberish.context.sampleRate},this.name="sine";var e=new ArrayBuffer(4096),t=Gibberish.asmSine(window,null,e);return t.init(),this.getTable=function(){return e},this.get=t.get,this.callback=t.gen,this.init(),this.oscillatorInit(),this.processProperties(arguments),this},Gibberish.asmSine2.prototype=Gibberish._oscillator,Gibberish.Sine=function(){this.__proto__=new Gibberish.Wavetable,this.name="sine";for(var e=2*Math.PI,t=new Float32Array(1024),n=1024;n--;)t[n]=Math.sin(n/1024*e);this.setTable(t),this.init(arguments),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Sine2=function(){this.__proto__=new Gibberish.Sine,this.name="sine2";var e=this.__proto__.callback,t=Gibberish.makePanner(),n=[0,0];this.callback=function(i,r,o){var s=e(i,r);return n=t(s,o,n)},this.init(),this.oscillatorInit(),Gibberish.defineUgenProperty("pan",0,this),this.processProperties(arguments)},Gibberish.Square=function(){this.__proto__=new Gibberish.Wavetable,this.name="square";for(var e=(2*Math.PI,new Float32Array(1024)),t=1024;t--;)e[t]=t/1024>.5?1:-1;this.setTable(e),this.init(arguments),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Saw=function(){this.__proto__=new Gibberish.Wavetable,this.name="saw";for(var e=new Float32Array(1024),t=1024;t--;)e[t]=4*((t/1024/2+.25)%.5-.25);this.setTable(e),this.init(arguments),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Saw2=function(){this.__proto__=new Gibberish.Saw,this.name="saw2";var e=this.__proto__.callback,t=Gibberish.makePanner(),n=[0,0];this.callback=function(i,r,o){var s=e(i,r);return n=t(s,o,n)},this.init(),Gibberish.defineUgenProperty("pan",0,this)},Gibberish.Triangle=function(){this.__proto__=new Gibberish.Wavetable,this.name="triangle";for(var e=new Float32Array(1024),t=Math.abs,n=1024;n--;)e[n]=1-4*t((n/1024+.25)%1-.5);this.setTable(e),this.init(arguments),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Triangle2=function(){this.__proto__=new Gibberish.Triangle,this.name="triangle2";var e=this.__proto__.callback,t=Gibberish.makePanner(),n=[0,0];this.callback=function(i,r,o){var s=e(i,r);return t(s,o,n)},this.init(),this.oscillatorInit(),Gibberish.defineUgenProperty("pan",0,this),this.processProperties(arguments)},Gibberish.Saw3=function(){var e=0,t=0,n=2.5,i=-1.5,r=0,o=Math.sin,s=11;pi_2=2*Math.PI,flip=0,signHistory=0,ignore=!1,sr=Gibberish.context.sampleRate,Gibberish.extend(this,{name:"saw",properties:{frequency:440,amp:.15,sync:0,sr:Gibberish.context.sampleRate},callback:function(a,u){var c=a/sr,l=.5-c,f=s*l*l*l*l,h=.376-.752*c,p=1-2*c,d=0;return t+=c,t-=t>1?2:0,e=.5*(e+o(pi_2*(t+e*f))),d=n*e+i*r,r=e,d+=h,d*=p,d*u}}),Object.defineProperty(this,"scale",{get:function(){return s},set:function(e){s=e}}),this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Saw3.prototype=Gibberish._oscillator,Gibberish.PWM=function(){var e=0,t=0,n=0,i=0,r=0,o=2.5,s=-1.5,a=Math.sin,u=11;pi_2=2*Math.PI,test=0,sr=Gibberish.context.sampleRate,Gibberish.extend(this,{name:"pwm",properties:{frequency:440,amp:.15,pulsewidth:.05,sr:Gibberish.context.sampleRate},callback:function(c,l,f){var h=c/sr,p=.5-h,d=u*p*p*p*p,b=1-2*h,m=0;return r+=h,r-=r>1?2:0,e=.5*(e+a(pi_2*(r+e*d))),t=.5*(t+a(pi_2*(r+t*d+f))),m=t-e,m=o*m+s*(n-i),n=e,i=t,m*b*l}}),Object.defineProperty(this,"scale",{get:function(){return u},set:function(e){u=e}}),this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.PWM.prototype=Gibberish._oscillator,Gibberish.Noise=function(){var e=Math.random;Gibberish.extend(this,{name:"noise",properties:{amp:1},callback:function(t){return(2*e()-1)*t}}),this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Noise.prototype=Gibberish._oscillator,Gibberish.KarplusStrong=function(){var e=[0],t=0,n=Math.random,i=Gibberish.makePanner(),r=Gibberish.context.sampleRate,o=[0,0];Gibberish.extend(this,{name:"karplus_strong",frequency:0,properties:{blend:1,damping:0,amp:1,channels:2,pan:0,velocity:1},note:function(t,i){if("undefined"!=typeof t){var o=Math.floor(r/t);e.length=0;for(var s=0;o>s;s++)e[s]=2*n()-1;i&&(this.velocity=i),this.frequency=t}},callback:function(r,s,a,u,c,l){var f=e.shift(),h=n()>r?-1:1;s=s>0?s:0;var p=h*(f+t)*(.5-s/100);return t=p,e.push(p),p*=a*l,1===u?p:i(p,c,o)}}).init().oscillatorInit().processProperties(arguments)},Gibberish.KarplusStrong.prototype=Gibberish._oscillator,Gibberish.PolyKarplusStrong=function(){this.__proto__=new Gibberish.Bus2,Gibberish.extend(this,{name:"poly_karplus_strong",maxVoices:5,voiceCount:0,_frequency:0,polyProperties:{blend:1,damping:0,velocity:1},note:function(e,t){var n=this.children[this.voiceCount++];this.voiceCount>=this.maxVoices&&(this.voiceCount=0),n.note(e,t),this._frequency=e},initVoices:function(){for(var e=0;e<this.maxVoices;e++){var t={blend:this.blend,damping:this.damping,channels:2,amp:1},n=new Gibberish.KarplusStrong(t).connect(this);this.children.push(n)}}}),this.amp=1/this.maxVoices,this.children=[],"object"==typeof arguments[0]&&(this.maxVoices=arguments[0].maxVoices?arguments[0].maxVoices:this.maxVoices),Gibberish.polyInit(this),this.initVoices(),this.processProperties(arguments),this.initialized=!1,Gibberish._synth.oscillatorInit.call(this),Gibberish.dirty(this)},Gibberish.bus=function(){this.type="bus",this.inputCodegen=function(){var e,t=this.value.valueOf();return e=t+", "+this.amp,this.codeblock=e,e},this.addConnection=function(){var e=arguments[2],t={value:arguments[0],amp:arguments[1],codegen:this.inputCodegen,valueOf:function(){return this.codegen()}};"undefined"!=typeof e?this.inputs.splice(e,0,t):this.inputs.push(t),Gibberish.dirty(this)},this.removeConnection=function(e){for(var t=0;t<this.inputs.length;t++)if(this.inputs[t].value===e){this.inputs.splice(t,1),Gibberish.dirty(this);break}},this.adjustSendAmount=function(e,t){for(var n=0;n<this.inputs.length;n++)if(this.inputs[n].value===e){this.inputs[n].amp=t,Gibberish.dirty(this);break}},this.callback=function(){var e=arguments[arguments.length-2],t=arguments[arguments.length-1];output[0]=output[1]=0;for(var n=0;n<arguments.length-2;n+=2){var i="object"==typeof arguments[n],r=arguments[n+1];output[0]+=i?arguments[n][0]*r:arguments[n]*r,output[1]+=i?arguments[n][1]*r:arguments[n]*r}return output[0]*=e,output[1]*=e,panner(output,t,output)}},Gibberish.bus.prototype=new Gibberish.ugen,Gibberish._bus=new Gibberish.bus,Gibberish.Bus=function(){return Gibberish.extend(this,{name:"bus",properties:{inputs:[],amp:1},callback:function(){for(var e=0,t=arguments.length-1,n=arguments[t],i=0;t>i;i++)e+=arguments[i];return e*=n}}),this.init(),this.processProperties(arguments),this},Gibberish.Bus.prototype=Gibberish._bus,Gibberish.Bus2=function(){this.name="bus2",this.type="bus",this.properties={inputs:[],amp:1,pan:0};var e=[0,0],t=Gibberish.makePanner();this.callback=function(){var n=arguments,i=n.length,r=n[i-2],o=n[i-1];e[0]=e[1]=0;for(var s=0,a=i-2;a>s;s+=2){var u="object"==typeof n[s],c=n[s+1];e[0]+=u?n[s][0]*c||0:n[s]*c||0,e[1]+=u?n[s][1]*c||0:n[s]*c||0}return e[0]*=r,e[1]*=r,t(e,o,e)},this.show=function(){console.log(e,args)},this.getOutput=function(){return e},this.getArgs=function(){return args},this.init(arguments),this.processProperties(arguments)},Gibberish.Bus2.prototype=Gibberish._bus,Gibberish.envelope=function(){this.type="envelope"},Gibberish.envelope.prototype=new Gibberish.ugen,Gibberish._envelope=new Gibberish.envelope,Gibberish.ExponentialDecay=function(){var e=Math.pow,t=0,n=0;Gibberish.extend(this,{name:"ExponentialDecay",properties:{decay:.5,length:11050},callback:function(i,r){return t=e(i,n),n+=1/r,t},trigger:function(){n="number"==typeof arguments[0]?arguments[0]:0}}).init()},Gibberish.ExponentialDecay.prototype=Gibberish._envelope,Gibberish.Line=function(e,t,n,i){var r,o={name:"line",properties:{start:e||0,end:isNaN(t)?1:t,time:n||Gibberish.context.sampleRate,loops:i||!1},retrigger:function(e,t){s=0,this.start=r,this.end=e,this.time=t,a=(e-r)/t},getPhase:function(){return s},getIncr:function(){return a},getOut:function(){return r}},s=0,a=(t-e)/n;return this.callback=function(e,t,n,i){var o=(t-e)/n;return r=n>s?e+s++*o:t,s=r>=t&&i?0:s,r},this.setPhase=function(e){s=e},Gibberish.extend(this,o),this.init(),this},Gibberish.Line.prototype=Gibberish._envelope,Gibberish.Ease=function(e,t,n,i,r){var o=Math.sqrt,s=0,a=0;e=e||0,t=t||1,n=n||Gibberish.context.sampleRate,r=r||!1,i="undefined"==typeof i?1:i;var u={name:"ease",properties:{},retrigger:function(e,t){a=0,this.start=s,this.end=e,this.time=t},getPhase:function(){return a},getOut:function(){return s}};return this.callback=function(){var u=a++/n,c=i?1-o(1-u*u):o(1-(1-u)*(1-u));return s=n>a?e+c*(t-e):t,a=s>=t&&r?0:a,s},this.setPhase=function(e){a=e},this.setEase=function(e){i=e},Gibberish.extend(this,u),this.init(),this},Gibberish.Ease.prototype=Gibberish._envelope,Gibberish.Curve=function(e,t,n,i,r,o,s){var a=Math.sqrt,u=0,c=0;e=e||0,t=t||1,n=n||Gibberish.context.sampleRate,i=i||.94,r=r||.26,s=s||!1,o="undefined"==typeof o?1:o;var l={name:"curve",properties:{},retrigger:function(e,t){c=0,this.start=u,this.end=e,this.time=t,incr=(e-u)/t},getPhase:function(){return c
},getOut:function(){return u}};return this.callback=function(){var l=c++/n,f=1-2*i,h=(a(i*i+f*l)-i)/f,p=(1-2*r)*h*h+2*r*h;return u=n>c?e+p*(t-e):t,o||(u=1-u),c=u>=t&&s?0:c,u},this.setPhase=function(e){c=e},Gibberish.extend(this,l),this.init(),this},Gibberish.Curve.prototype=Gibberish._envelope,Gibberish.Lines=function(e,t,n){var i,r=e[0],o=0,s=1,a=0,u=0,c=0,l=!1;"undefined"==typeof e&&(e=[0,1]),"undefined"==typeof t&&(t=[44100]),u=e[s],c=t[0],i=(u-e[0])/c,n=n||!1;var f={name:"lines",properties:{},retrigger:function(){o=0,r=e[0],c=t[0],u=e[1],s=1,a=0,i=(u-r)/c,l=!1},getPhase:function(){return o},getOut:function(){return r}};return f.run=f.retrigger,this.callback=function(){if(o>=c&&!l)if(s<e.length-1){var f=t[++a%t.length];c=o+f,u=e[++s%e.length],i=(u-r)/f}else n?(o=0,r=e[0],c=t[0],u=e[1],s=1,a=0,i=(u-r)/c):(l=!0,r=e[e.length-1]);else l||(r+=i,o++);return r},this.setPhase=function(e){o=e},Gibberish.extend(this,f),this.init(),this},Gibberish.Lines.prototype=Gibberish._envelope,Gibberish.AD=function(e,t){var n=0,i=0;Gibberish.extend(this,{name:"AD",properties:{attack:e||1e4,decay:t||1e4},run:function(){return i=0,n=0,this},callback:function(e,t){if(e=0>e?22050:e,t=0>t?22050:t,0===i){var r=1/e;n+=r,n>=1&&i++}else if(1===i){var r=1/t;n-=r,0>=n&&(n=0,i++)}return n},getState:function(){return i}}).init().processProperties(arguments)},Gibberish.AD.prototype=Gibberish._envelope,Gibberish.ADSR=function(e,t,n,i,r,o,s){var a={name:"adsr",type:"envelope",requireReleaseTrigger:"undefined"!=typeof s?s:!1,properties:{attack:isNaN(e)?1e4:e,decay:isNaN(t)?1e4:t,sustain:isNaN(n)?22050:n,release:isNaN(i)?1e4:i,attackLevel:r||1,sustainLevel:o||.5,releaseTrigger:0},run:function(){this.setPhase(0),this.setState(0)},stop:function(){this.releaseTrigger=1}};Gibberish.extend(this,a);var u=0,c=0,l=0,f=this;return this.callback=function(e,t,n,i,r,o,s){var a=0;return l=1===l?1:s,0===c?(a=u/e*r,++u/e>=1&&(c++,u=t)):1===c?(a=u/t*(r-o)+o,--u<=0&&(null!==n?(c+=1,u=n):(c+=2,u=i))):2===c?(a=o,f.requireReleaseTrigger&&l?(c++,u=i,f.releaseTrigger=0,l=0):u--<=0&&!f.requireReleaseTrigger&&(c++,u=i)):3===c&&(u--,a=u/i*o,0>=u&&c++),a},this.call=function(){return this.callback(this.attack,this.decay,this.sustain,this.release,this.attackLevel,this.sustainLevel,this.releaseTrigger)},this.getPhase=function(){return u},this.setPhase=function(e){u=e},this.setState=function(e){c=e,u=0},this.getState=function(){return c},this.init(),this},Gibberish.ADSR.prototype=Gibberish._envelope,Gibberish.ADR=function(e,t,n,i,r){var o={name:"adr",type:"envelope",properties:{attack:isNaN(e)?11025:e,decay:isNaN(t)?11025:t,release:isNaN(n)?22050:n,attackLevel:i||1,releaseLevel:r||.2},run:function(){this.setPhase(0),this.setState(0)}};Gibberish.extend(this,o);var s=0,a=0;return this.callback=function(e,t,n,i,r){var o=0;return 0===a?(o=s/e*i,++s/e===1&&(a++,s=t)):1===a?(o=s/t*(i-r)+r,--s<=0&&(a+=1,s=n)):2===a&&(s--,o=s/n*r,0>=s&&a++),o},this.setPhase=function(e){s=e},this.setState=function(e){a=e,s=0},this.getState=function(){return a},this.init(),this},Gibberish.ADR.prototype=Gibberish._envelope,Gibberish.analysis=function(){this.type="analysis",this.codegen=function(){if(Gibberish.memo[this.symbol])return Gibberish.memo[this.symbol];var e=this.variable?this.variable:Gibberish.generateSymbol("v");return Gibberish.memo[this.symbol]=e,this.variable=e,Gibberish.callbackArgs.push(this.symbol),Gibberish.callbackObjects.push(this.callback),this.codeblock="var "+this.variable+" = "+this.symbol+"();\n",-1===Gibberish.codeblock.indexOf(this.codeblock)&&Gibberish.codeblock.push(this.codeblock),this.variable},this.analysisCodegen=function(){var e=0;this.input.codegen?(e=this.input.codegen(),e.indexOf("op")>-1&&console.log("ANALYSIS BUG")):e=this.input.value?"undefined"!=typeof this.input.value.codegen?this.input.value.codegen():this.input.value:"null";var t=this.analysisSymbol+"("+e+",";for(var n in this.properties)"input"!==n&&(t+=this[n]+",");return t=t.slice(0,-1),t+=");",this.analysisCodeblock=t,-1===Gibberish.analysisCodeblock.indexOf(this.analysisCodeblock)&&Gibberish.analysisCodeblock.push(this.analysisCodeblock),-1===Gibberish.callbackObjects.indexOf(this.analysisCallback)&&Gibberish.callbackObjects.push(this.analysisCallback),t},this.remove=function(){Gibberish.analysisUgens.splice(Gibberish.analysisUgens.indexOf(this),1)},this.analysisInit=function(){this.analysisSymbol=Gibberish.generateSymbol(this.name),Gibberish.analysisUgens.push(this),Gibberish.dirty()}},Gibberish.analysis.prototype=new Gibberish.ugen,Gibberish._analysis=new Gibberish.analysis,Gibberish.Follow=function(){this.name="follow",this.properties={input:0,bufferSize:4410,mult:1,useAbsoluteValue:!0},this.storage=[];var e=Math.abs,t=[0],n=0,i=0,r=0;this.analysisCallback=function(o,s,a,u){"object"==typeof o&&(o=o[0]+o[1]),n+=u?e(o):o,n-=t[i],t[i]=u?e(o):o,i=(i+1)%s,t[i]=t[i]?t[i]:0,r=n/s*a},this.callback=this.getValue=function(){return r},this.init(),this.analysisInit(),this.processProperties(arguments);var o=(this.__lookupSetter__("bufferSize"),this.bufferSize);Object.defineProperty(this,"bufferSize",{get:function(){return o},set:function(e){o=e,n=0,t=[0],i=0}}),this.getStorage=function(){return this.storage}},Gibberish.Follow.prototype=Gibberish._analysis,Gibberish.SingleSampleDelay=function(){this.name="single_sample_delay",this.properties={input:arguments[0]||0,amp:arguments[1]||1};var e=0;this.analysisCallback=function(t){e=t},this.callback=function(){return e},this.getValue=function(){return e},this.init(),this.analysisInit(),this.processProperties(arguments)},Gibberish.SingleSampleDelay.prototype=Gibberish._analysis,Gibberish.Record=function(e,t,n){var i=new Float32Array(t),r=0,o=!1,s=this;Gibberish.extend(this,{name:"record",oncomplete:n,properties:{input:0,size:t||0},analysisCallback:function(e,t){o&&(i[r++]="object"==typeof e?e[0]+e[1]:e,r>=t&&(o=!1,s.remove()))},record:function(){return r=0,o=!0,this},getBuffer:function(){return i},getPhase:function(){return r},remove:function(){"undefined"!=typeof this.oncomplete&&this.oncomplete();for(var e=0;e<Gibberish.analysisUgens.length;e++){var t=Gibberish.analysisUgens[e];if(t===this)return Gibberish.callbackArgs.indexOf(this.analysisSymbol)>-1&&Gibberish.callbackArgs.splice(Gibberish.callbackArgs.indexOf(this.analysisSymbol),1),Gibberish.callbackObjects.indexOf(this.analysisCallback)>-1&&Gibberish.callbackObjects.splice(Gibberish.callbackObjects.indexOf(this.analysisCallback),1),void Gibberish.analysisUgens.splice(e,1)}}}),this.properties.input=e,this.init(),this.analysisInit(),Gibberish.dirty()},Gibberish.Record.prototype=Gibberish._analysis,Gibberish.effect=function(){this.type="effect"},Gibberish.effect.prototype=new Gibberish.ugen,Gibberish._effect=new Gibberish.effect,Gibberish.Distortion=function(){var e=Math.abs,t=Math.log,n=Math.LN2;Gibberish.extend(this,{name:"distortion",properties:{input:0,amount:50},callback:function(i,r){var o;return r=r>2?r:2,"number"==typeof i?(o=i*r,i=o/(1+e(o))/(t(r)/n)):(o=i[0]*r,i[0]=o/(1+e(o))/(t(r)/n),o=i[1]*r,i[1]=o/(1+e(o))/(t(r)/n)),i}}).init().processProperties(arguments)},Gibberish.Distortion.prototype=Gibberish._effect,Gibberish.Gain=function(){Gibberish.extend(this,{name:"gain",properties:{input:0,amount:1},callback:function(e,t){return"number"==typeof e?e*=t:(e[0]*=t,e[1]*=t),e}}).init().processProperties(arguments)},Gibberish.Gain.prototype=Gibberish._effect,Gibberish.Delay=function(){var e=[],t=0;e.push(new Float32Array(2*Gibberish.context.sampleRate)),e.push(new Float32Array(2*Gibberish.context.sampleRate)),Gibberish.extend(this,{name:"delay",properties:{input:0,time:22050,feedback:.5,wet:1,dry:1,rate:1},callback:function(n,i,r,o,s,a){var u="number"==typeof n?1:2,c=t++%88200;i/=a;var l=(c+(0|i))%88200;return 1===u?(e[0][l]=n+e[0][c]*r,n=n*s+e[0][c]*o):(e[0][l]=n[0]+e[0][c]*r,n[0]=n[0]*s+e[0][c]*o,e[1][l]=n[1]+e[1][c]*r,n[1]=n[1]*s+e[1][c]*o),n}});var n=Math.round(this.properties.time);Object.defineProperty(this,"time",{configurable:!0,get:function(){return n},set:function(e){n=Math.round(e),Gibberish.dirty(this)}}),this.init(),this.processProperties(arguments)},Gibberish.Delay.prototype=Gibberish._effect,Gibberish.Decimator=function(){var e=0,t=[],n=Math.pow,i=Math.floor;Gibberish.extend(this,{name:"decimator",properties:{input:0,bitDepth:16,sampleRate:1},callback:function(r,o,s){e+=s;var a="number"==typeof r?1:2;if(1===a){if(e>=1){var u=n(o,2);t[0]=i(r*u)/u,e-=1}r=t[0]}else{if(e>=1){var u=n(o,2);t[0]=i(r[0]*u)/u,t[1]=i(r[1]*u)/u,e-=1}r=t}return r}}).init().processProperties(arguments)},Gibberish.Decimator.prototype=Gibberish._effect,Gibberish.RingModulation=function(){var e=(new Gibberish.Sine).callback,t=[0,0];Gibberish.extend(this,{name:"ringmod",properties:{input:0,frequency:440,amp:.5,mix:.5},callback:function(n,i,r,o){var s="number"==typeof n?1:2,a=1===s?n:n[0],u=e(i,r);if(a=a*(1-o)+a*u*o,2===s){var c=n[1];return c=c*(1-o)+c*u*o,t[0]=a,t[1]=c,t}return a}}).init().processProperties(arguments)},Gibberish.RingModulation.prototype=Gibberish._effect,Gibberish.DCBlock=function(){var e=0,t=0;Gibberish.extend(this,{name:"dcblock",type:"effect",properties:{input:0},reset:function(){e=0,t=0},callback:function(n){var i=n-e+.9997*t;return e=n,t=i,i}}).init().processProperties(arguments)},Gibberish.DCBlock.prototype=Gibberish._effect,Gibberish.Tremolo=function(){var e=(new Gibberish.Sine).callback;Gibberish.extend(this,{name:"tremolo",type:"effect",properties:{input:0,frequency:2.5,amp:.5},callback:function(t,n,i){var r="number"==typeof t?1:2,o=e(n,i);return 1===r?t*=o:(t[0]*=o,t[1]*=o),t}}).init().processProperties(arguments)},Gibberish.Tremolo.prototype=Gibberish._effect,Gibberish.OnePole=function(){var e=0;Gibberish.extend(this,{name:"onepole",type:"effect",properties:{input:0,a0:.15,b1:.85},callback:function(t,n,i){var r=t*n+e*i;return e=r,r},smooth:function(t,n){this.input=n[t],e=this.input,n[t]=this,this.obj=n,this.property=t,this.oldSetter=n.__lookupSetter__(t),this.oldGetter=n.__lookupGetter__(t);var i=this;Object.defineProperty(n,t,{get:function(){return i.input},set:function(e){i.input=e}})},remove:function(){Object.defineProperty(this.obj,this.property,{get:this.oldGetter,set:this.oldSetter}),this.obj[this.property]=this.input}}).init().processProperties(arguments)},Gibberish.OnePole.prototype=Gibberish._effect,Gibberish.Filter24=function(){var e=[0,0,0,0],t=[0,0,0,0],n=[0,0],i=isNaN(arguments[0])?.1:arguments[0],r=isNaN(arguments[1])?3:arguments[1];_isLowPass="undefined"!=typeof arguments[2]?arguments[2]:!0,Gibberish.extend(this,{name:"filter24",properties:{input:0,cutoff:i,resonance:r,isLowPass:_isLowPass},callback:function(i,r,o,s){var a="number"==typeof i?1:2,u=1===a?i:i[0],c=e[3]*o;if(c=c>1?1:c,r=0>r?0:r,r=r>1?1:r,u-=c,e[0]=e[0]+(-e[0]+u)*r,e[1]=e[1]+(-e[1]+e[0])*r,e[2]=e[2]+(-e[2]+e[1])*r,e[3]=e[3]+(-e[3]+e[2])*r,u=s?e[3]:u-e[3],2===a){var l=i[1];return c=t[3]*o,c=c>1?1:c,l-=c,t[0]=t[0]+(-t[0]+l)*r,t[1]=t[1]+(-t[1]+t[0])*r,t[2]=t[2]+(-t[2]+t[1])*r,t[3]=t[3]+(-t[3]+t[2])*r,l=s?t[3]:l-t[3],n[0]=u,n[1]=l,n}return u}}).init().processProperties(arguments)},Gibberish.Filter24.prototype=Gibberish._effect,Gibberish.SVF=function(){var e=[0,0],t=[0,0],n=Math.PI,i=[0,0];Gibberish.extend(this,{name:"SVF",properties:{input:0,cutoff:440,Q:2,mode:0,sr:Gibberish.context.sampleRate},callback:function(r,o,s,a,u){var c="number"==typeof r?1:2,l=1===c?r:r[0],f=2*n*o/u;s=1/s;var h=t[0]+f*e[0],p=l-h-s*e[0],d=f*p+e[0],b=p+h;if(e[0]=d,t[0]=h,l=0===a?h:1===a?p:2===a?d:b,2===c){var m=r[1],h=t[1]+f*e[1],p=m-h-s*e[1],d=f*p+e[1],b=p+h;e[1]=d,t[1]=h,m=0===a?h:1===a?p:2===a?d:b,i[0]=l,i[1]=m}else i=l;return i}}).init().processProperties(arguments)},Gibberish.SVF.prototype=Gibberish._effect,Gibberish.Biquad=function(){var e=0,t=0,n=0,i=0,r=0,o=0,s=0,a=0,u=[0,0],c=.001639,l=.003278,f=.001639,h=-1.955777,p=.960601,d="LP",b=2e3,m=.5,g=Gibberish.context.sampleRate;Gibberish.extend(this,{name:"biquad",properties:{input:null},calculateCoefficients:function(){switch(d){case"LP":var e=2*Math.PI*b/g,t=Math.sin(e),n=Math.cos(e),i=t/(2*m);c=(1-n)/2,l=1-n,f=c,a0=1+i,h=-2*n,p=1-i;break;case"HP":var e=2*Math.PI*b/g,t=Math.sin(e),n=Math.cos(e),i=t/(2*m);c=(1+n)/2,l=-(1+n),f=c,a0=1+i,h=-2*n,p=1-i;break;case"BP":var e=2*Math.PI*b/g,t=Math.sin(e),n=Math.cos(e),r=Math.log(2)/2*m*e/t,i=t*(Math.exp(r)-Math.exp(-r))/2;c=i,l=0,f=-i,a0=1+i,h=-2*n,p=1-i;break;default:return}c/=a0,l/=a0,f/=a0,h/=a0,p/=a0},callback:function(d){var b=isNaN(d)?2:1,m=0,g=0,y=1===b?d:d[0];return m=c*y+l*e+f*t-h*n-p*i,t=e,e=y,i=n,n=m,2===b&&(inR=d[1],g=c*inR+l*r+f*o-h*s-p*a,o=r,r=inR,a=s,s=g,u[0]=m,u[1]=g),1===b?m:u}}).init(),Object.defineProperties(this,{mode:{get:function(){return d},set:function(e){d=e,this.calculateCoefficients()}},cutoff:{get:function(){return b},set:function(e){b=e,this.calculateCoefficients()}},Q:{get:function(){return m},set:function(e){m=e,this.calculateCoefficients()}}}),this.processProperties(arguments),this.calculateCoefficients()},Gibberish.Biquad.prototype=Gibberish._effect,Gibberish.Flanger=function(){var e=[new Float32Array(88200),new Float32Array(88200)],t=88200,n=(new Gibberish.Sine).callback,i=Gibberish.interpolate,r=-100,o=0;Gibberish.extend(this,{name:"flanger",properties:{input:0,rate:.25,feedback:0,amount:125,offset:125},callback:function(s,a,u,c){var l="number"==typeof s?1:2,f=r+n(a,.95*c);f>t?f-=t:0>f&&(f+=t);var h=i(e[0],f);return e[0][o]=1===l?s+h*u:s[0]+h*u,2===l?(s[0]+=h,h=i(e[1],f),e[1][o]=s[1]+h*u,s[1]+=h):s+=h,++o>=t&&(o=0),++r>=t&&(r=0),s}}).init().processProperties(arguments),r=-1*this.offset},Gibberish.Flanger.prototype=Gibberish._effect,Gibberish.Vibrato=function(){var e=[new Float32Array(88200),new Float32Array(88200)],t=88200,n=(new Gibberish.Sine).callback,i=Gibberish.interpolate,r=-100,o=0;Gibberish.extend(this,{name:"vibrato",properties:{input:0,rate:5,amount:.5,offset:125},callback:function(s,a,u,c){var l="number"==typeof s?1:2,f=r+n(a,u*c-1);f>t?f-=t:0>f&&(f+=t);var h=i(e[0],f);return e[0][o]=1===l?s:s[0],2===l?(s[0]=h,h=i(e[1],f),e[1][o]=s[1],s[1]=h):s=h,++o>=t&&(o=0),++r>=t&&(r=0),s}}).init().processProperties(arguments),r=-1*this.offset},Gibberish.Vibrato.prototype=Gibberish._effect,Gibberish.BufferShuffler=function(){var e=[new Float32Array(88200),new Float32Array(88200)],t=88200,n=0,i=0,r=0,o=0,s=0,a=Math.random,u=1,c=!1,l=!1,f=!1,h=Gibberish.interpolate,p=!1,d=1,b=!1,m=Gibberish.rndf,g=[0,0];Gibberish.extend(this,{name:"buffer_shuffler",properties:{input:0,chance:.25,rate:11025,length:22050,reverseChange:.5,pitchChance:.5,pitchMin:.25,pitchMax:2,wet:1,dry:0},callback:function(y,v,x,k,w,_,G,j,A,S){var q="number"==typeof y?1:2;s?++o%(k-400)===0&&(c=!1,l=!0,u=1,o=0):(e[0][i]=1===q?y:y[0],e[1][i]=1===q?y:y[1],i++,i%=t,b=0===i?1:b,r++,r%x==0&&a()<v&&(f=a()<w,s=!0,f||(n=i-k,0>n&&(n=t+n)),p=a()<_,p&&(d=m(G,j)),u=1,c=!0,l=!1)),n+=f?-1*d:d,0>n?n+=t:n>=t&&(n-=t);var P,C,M,O,R=h(e[0],n);return c?(u-=.0025,M=R*(1-u),P=1===q?M+y*u:M+y[0]*u,2===q&&(O=h(e[1],n),M=O*(1-u),C=1===q?P:M+y[1]*u),.0025>=u&&(c=!1)):l?(u-=.0025,M=R*u,P=1===q?M+y*u:M+y[0]*(1-u),2===q&&(O=h(e[1],n),M=O*u,C=M+y[1]*(1-u)),.0025>=u&&(l=!1,s=!1,f=!1,d=1,p=0)):1===q?P=s&&b?R*A+y*S:y:(O=h(e[1],n),P=s&&b?R*A+y[0]*S:y[0],C=s&&b?O*A+y[1]*S:y[1]),g=[P,C],1===q?P:g}}).init().processProperties(arguments)},Gibberish.BufferShuffler.prototype=Gibberish._effect,Gibberish.AllPass=function(e){var t=-1,n=new Float32Array(e||500),i=n.length;Gibberish.extend(this,{name:"allpass",properties:{input:0},callback:function(e){t=++t%i;var r=n[t],o=-1*e+r;return n[t]=e+.5*r,o}})},Gibberish.Comb=function(e){var t=new Float32Array(e||1200),n=t.length,i=0,r=0;Gibberish.extend(this,{name:"comb",properties:{input:0,feedback:.84,damping:.2},callback:function(e,o,s){var a=++i%n,u=t[a];return r=u*(1-s)+r*s,t[a]=e+r*o,u}})},Gibberish.Reverb=function(){var e={combCount:8,combTuning:[1116,1188,1277,1356,1422,1491,1557,1617],allPassCount:4,allPassTuning:[556,441,341,225],allPassFeedback:.5,fixedGain:.015,scaleDamping:.4,scaleRoom:.28,offsetRoom:.7,stereoSpread:23},t=.84,n=[],i=[],r=[0,0];Gibberish.extend(this,{name:"reverb",roomSize:.5,properties:{input:0,wet:.5,dry:.55,roomSize:.84,damping:.5},callback:function(e,t,o,s,a){for(var u="object"==typeof e?2:1,c=1===u?e:e[0]+e[1],l=.015*c,f=l,h=0;8>h;h++){var p=n[h](l,.98*s,.4*a);f+=p}for(var h=0;4>h;h++)f=i[h](f);return r[0]=r[1]=c*o+f*t,r}}).init().processProperties(arguments),this.setFeedback=function(e){t=e};for(var o=0;8>o;o++)n.push(new Gibberish.Comb(e.combTuning[o]).callback);for(var o=0;4>o;o++)i.push(new Gibberish.AllPass(e.allPassTuning[o],e.allPassFeedback).callback)},Gibberish.Reverb.prototype=Gibberish._effect,Gibberish.StereoReverb=function(){var e={combCount:8,combTuning:[1116,1188,1277,1356,1422,1491,1557,1617],allPassCount:4,allPassTuning:[556,441,341,225],allPassFeedback:.5,fixedGain:.015,scaleDamping:.4,scaleRoom:.28,offsetRoom:.7,stereoSpread:23},t=.84,n=[],i=[],r=[],o=[],s=[0,0];Gibberish.extend(this,{name:"reverb",roomSize:.5,properties:{input:0,wet:.5,dry:.55,roomSize:.84,damping:.5},callback:function(e,t,a,u,c){for(var l="object"==typeof e?2:1,f=e[0],h=1===l?f:e[1],p=outL=.015*f,d=outR=.015*h,b=0;8>b;b++)outL+=n[b](p,.98*u,.4*c),outR+=i[b](d,.98*u,.4*c);for(var b=0;4>b;b++)outL=r[b](outL),outR=o[b](outR);return s[0]=f*a+outL*t,s[1]=h*a+outR*t,s}}).init().processProperties(arguments),this.setFeedback=function(e){t=e};for(var a=0;8>a;a++)n.push(new Gibberish.Comb(e.combTuning[a]).callback),i.push(new Gibberish.Comb(e.combTuning[a]).callback);for(var a=0;4>a;a++)r.push(new Gibberish.AllPass(e.allPassTuning[a],e.allPassFeedback).callback),o.push(new Gibberish.AllPass(e.allPassTuning[a],e.allPassFeedback).callback)},Gibberish.StereoReverb.prototype=Gibberish._effect,Gibberish.Granulator=function(e){var t=[];buffer=null,interpolate=Gibberish.interpolate,panner=Gibberish.makePanner(),bufferLength=0,debug=0,write=0,self=this,out=[0,0],_out=[0,0],rndf=Gibberish.rndf,numberOfGrains=e.numberOfGrains||20,console.log("NUMBER OF GRAINS",numberOfGrains),Gibberish.extend(this,{name:"granulator",bufferLength:88200,reverse:!0,spread:.5,properties:{speed:1,speedMin:-0,speedMax:0,grainSize:1e3,position:.5,positionMin:0,positionMax:0,amp:.2,fade:.1,pan:0,shouldWrite:!1},setBuffer:function(e){buffer=e,bufferLength=e.length},callback:function(e,n,i,r,o,s,a,u,c,l){for(var f=0;numberOfGrains>f;f++){var h=t[f];if(h._speed>0){h.pos>h.end&&(h.pos=(a+rndf(o,s))*buffer.length,h.start=h.pos,h.end=h.start+r,h._speed=e+rndf(n,i),h._speed=h._speed<.1?.1:h._speed,h._speed=h._speed<.1&&h._speed>0?.1:h._speed,h._speed=h._speed>-.1&&h._speed<0?-.1:h._speed,h.fadeAmount=h._speed*c*r,h.pan=rndf(-1*self.spread,self.spread));for(var p=h.pos;p>buffer.length;)p-=buffer.length;for(;0>p;)p+=buffer.length;var d=interpolate(buffer,p);d*=h.pos<h.fadeAmount+h.start?(h.pos-h.start)/h.fadeAmount:1,d*=h.pos>h.end-h.fadeAmount?(h.end-h.pos)/h.fadeAmount:1}else{h.pos<h.end&&(h.pos=(a+rndf(o,s))*buffer.length,h.start=h.pos,h.end=h.start-r,h._speed=e+rndf(n,i),h._speed=h._speed<.1&&h._speed>0?.1:h._speed,h._speed=h._speed>-.1&&h._speed<0?-.1:h._speed,h.fadeAmount=h._speed*c*r);for(var p=h.pos;p>buffer.length;)p-=buffer.length;for(;0>p;)p+=buffer.length;var d=interpolate(buffer,p);d*=h.pos>h.start-h.fadeAmount?(h.start-h.pos)/h.fadeAmount:1,d*=h.pos<h.end+h.fadeAmount?(h.end-h.pos)/h.fadeAmount:1}_out=panner(d*u,h.pan,_out),out[0]+=_out[0],out[1]+=_out[1],h.pos+=h._speed}return panner(out,l,out)}}).init().processProperties(arguments);for(var n=0;numberOfGrains>n;n++)t[n]={pos:self.position+Gibberish.rndf(self.positionMin,self.positionMax),_speed:self.speed+Gibberish.rndf(self.speedMin,self.speedMax)},t[n].start=t[n].pos,t[n].end=t[n].pos+self.grainSize,t[n].fadeAmount=t[n]._speed*self.fade*self.grainSize,t[n].pan=Gibberish.rndf(-1*self.spread,self.spread),console.log("GRAIN",n,"POS",t[n].pos,"SPEED",t[n]._speed);this.grains=t,"undefined"!=typeof e.buffer&&(buffer=e.buffer,bufferLength=buffer.length)},Gibberish.Granulator.prototype=Gibberish._effect,Gibberish.synth=function(){this.type="oscillator",this.oscillatorInit=function(){this.fx=new Array2,this.fx.parent=this}},Gibberish.synth.prototype=new Gibberish.ugen,Gibberish._synth=new Gibberish.synth,Gibberish.Synth=function(e){this.name="synth",this.properties={frequency:0,pulsewidth:.5,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,releaseTrigger:0,glide:.15,amp:.25,channels:2,pan:0,velocity:1,sr:Gibberish.context.sampleRate},this.note=function(i,r){if("undefined"!=typeof i){if(Array.isArray(arguments[0])){var o=arguments[0][0];r=arguments[0][1],i=o}if(0!==r){if("object"!=typeof this.frequency){if(t&&i===l&&e.requireReleaseTrigger)return this.releaseTrigger=1,void(l=null);this.frequency=l=i,this.releaseTrigger=0,"object"==typeof i&&Gibberish.dirty(this)}else this.frequency[0]=l=i,this.releaseTrigger=0,Gibberish.dirty(this);"undefined"!=typeof r&&(this.velocity=r),n.run()}else this.releaseTrigger=1}},e=e||{};var t="undefined"==typeof e.useADSR?!1:e.useADSR,n=t?new Gibberish.ADSR:new Gibberish.AD,i=n.getState,r=n.callback,o=new Gibberish.PWM,s=o.callback,a=(new Gibberish.OnePole).callback,u=Gibberish.makePanner(),c=this,l=0,f=[0,0];n.requireReleaseTrigger=e.requireReleaseTrigger||!1,this.callback=function(e,n,o,l,h,p,d,b,m,g,y,v,x,k,w){g=g>=1?.99999:g,e=a(e,1-g,g);var _,G;return t?(_=r(o,l,h,p,d,b,m),m&&(c.releaseTrigger=0),i()<4?(G=s(e,1,n,w)*_*k*y,1===v?G:u(G,x,f)):(G=f[0]=f[1]=0,1===v?G:f)):i()<2?(_=r(o,l),G=s(e,1,n,w)*_*k*y,1===v?G:u(G,x,f)):(G=f[0]=f[1]=0,1===v?G:f)},this.getEnv=function(){return n},this.getOsc=function(){return o},this.setOsc=function(e){o=e,s=o.callback};var h="PWM";Object.defineProperty(this,"waveform",{get:function(){return h},set:function(e){this.setOsc(new Gibberish[e])}}),this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Synth.prototype=Gibberish._synth,Gibberish.PolySynth=function(){this.__proto__=new Gibberish.Bus2,Gibberish.extend(this,{name:"polysynth",maxVoices:5,voiceCount:0,frequencies:[],_frequency:0,polyProperties:{frequency:0,glide:0,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,pulsewidth:.5,velocity:1,waveform:"PWM"},note:function(e,t){if("undefined"!=typeof e){var n=this.frequencies.indexOf(e),i=n>-1?n:this.voiceCount++,r=this.children[i];r.note(e,t),-1===n?(this.frequencies[i]=e,this._frequency=e,this.voiceCount>=this.maxVoices&&(this.voiceCount=0)):delete this.frequencies[i],this.lastChild=i}},initVoices:function(){for(var e=0;e<this.maxVoices;e++){var t={waveform:this.waveform,attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release,attackLevel:this.attackLevel,sustainLevel:this.sustainLevel,pulsewidth:this.pulsewidth,channels:2,amp:1,useADSR:this.useADSR||!1,requireReleaseTrigger:this.requireReleaseTrigger||!1},n=new Gibberish.Synth(t).connect(this);this.children.push(n)}}}),this.amp=1/this.maxVoices,this.children=[],"object"==typeof arguments[0]&&(this.maxVoices=arguments[0].maxVoices?arguments[0].maxVoices:this.maxVoices,this.useADSR="undefined"!=typeof arguments[0].useADSR?arguments[0].useADSR:!1,this.requireReleaseTrigger="undefined"!=typeof arguments[0].requireReleaseTrigger?arguments[0].requireReleaseTrigger:!1),Gibberish.polyInit(this),this.initVoices(),this.processProperties(arguments),Gibberish._synth.oscillatorInit.call(this)},Gibberish.Synth2=function(e){this.name="synth2",this.properties={frequency:0,pulsewidth:.5,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,releaseTrigger:0,cutoff:.25,resonance:3.5,useLowPassFilter:!0,glide:.15,amp:.25,channels:1,pan:0,velocity:1,sr:Gibberish.context.sampleRate},this.note=function(i,r){if("undefined"!=typeof i)if(0!==r){if("object"!=typeof this.frequency){if(t&&i===f&&e.requireReleaseTrigger)return this.releaseTrigger=1,void(f=null);this.frequency=f=i,this.releaseTrigger=0,"object"==typeof i&&Gibberish.dirty(this)}else this.frequency[0]=f=i,this.releaseTrigger=0,Gibberish.dirty(this);"undefined"!=typeof r&&(this.velocity=r),n.run()}else this.releaseTrigger=1},e=e||{};var t="undefined"==typeof e.useADSR?!1:e.useADSR,n=t?new Gibberish.ADSR:new Gibberish.AD,i=n.getState,r=n.callback,o=new Gibberish.PWM,s=o.callback,a=new Gibberish.Filter24,u=a.callback,c=(new Gibberish.OnePole).callback,l=Gibberish.makePanner(),f=0,h=this,p=[0,0];n.requireReleaseTrigger=e.requireReleaseTrigger||!1,this.callback=function(e,n,o,a,f,d,b,m,g,y,v,x,k,w,_,G,j,A){k=k>=1?.99999:k,e=c(e,1-k,k);var S,q;return t?(S=r(o,a,f,d,b,m,g),g&&(h.releaseTrigger=0),i()<4?(q=u(s(e,.15,n,A),y*S,v,x)*S*j*w,1===_?q:l(q,G,p)):(q=p[0]=p[1]=0,1===_?q:p)):i()<2?(S=r(o,a),q=u(s(e,.15,n,A),y*S,v,x)*S*j*w,1===_?q:l(q,G,p)):(q=p[0]=p[1]=0,1===_?q:p)},this.getUseADSR=function(){return t},this.getEnv=function(){return n},this.getOsc=function(){return o},this.setOsc=function(e){o=e,s=o.callback};var d="PWM";Object.defineProperty(this,"waveform",{get:function(){return d},set:function(e){this.setOsc(new Gibberish[e])}}),this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.Synth2.prototype=Gibberish._synth,Gibberish.PolySynth2=function(){this.__proto__=new Gibberish.Bus2,Gibberish.extend(this,{name:"polysynth2",maxVoices:5,voiceCount:0,frequencies:[],_frequency:0,polyProperties:{frequency:0,glide:0,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,pulsewidth:.5,resonance:3.5,cutoff:.25,velocity:1,useLowPassFilter:!0,waveform:"PWM"},note:function(e,t){if("undefined"!=typeof e){var n=this.frequencies.indexOf(e),i=n>-1?n:this.voiceCount++,r=this.children[i];r.note(e,t),-1===n?(this.frequencies[i]=e,this._frequency=e,this.voiceCount>=this.maxVoices&&(this.voiceCount=0)):delete this.frequencies[i],this.lastChild=i}},initVoices:function(){this.dirty=!0;for(var e=0;e<this.maxVoices;e++){var t={attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release,attackLevel:this.attackLevel,sustainLevel:this.sustainLevel,pulsewidth:this.pulsewidth,channels:2,amp:1,useADSR:this.useADSR||!1,requireReleaseTrigger:this.requireReleaseTrigger||!1},n=new Gibberish.Synth2(t).connect(this);this.children.push(n)}}}),this.amp=1/this.maxVoices,this.children=[],"object"==typeof arguments[0]&&(this.maxVoices=arguments[0].maxVoices?arguments[0].maxVoices:this.maxVoices,this.useADSR="undefined"!=typeof arguments[0].useADSR?arguments[0].useADSR:!1,this.requireReleaseTrigger="undefined"!=typeof arguments[0].requireReleaseTrigger?arguments[0].requireReleaseTrigger:!1),Gibberish.polyInit(this),this.initVoices(),this.processProperties(arguments),Gibberish._synth.oscillatorInit.call(this)},Gibberish.FMSynth=function(e){this.name="fmSynth",this.properties={frequency:0,cmRatio:2,index:5,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,releaseTrigger:0,glide:.15,amp:.25,channels:2,velocity:1,pan:0},this.note=function(i,r){if("undefined"!=typeof i)if(console.log("VELOCITY",r),0!==r){if("object"!=typeof this.frequency){if(t&&i===f&&e.requireReleaseTrigger)return this.releaseTrigger=1,void(f=null);this.frequency=f=i,this.releaseTrigger=0,"object"==typeof i&&Gibberish.dirty(this)}else this.frequency[0]=f=i,this.releaseTrigger=0,Gibberish.dirty(this);"undefined"!=typeof r&&(this.velocity=r),n.run()}else this.releaseTrigger=1},e=e||{};var t="undefined"==typeof e.useADSR?!1:e.useADSR,n=t?new Gibberish.ADSR:new Gibberish.AD,i=n.getState,r=n.callback,o=(new Gibberish.Sine).callback,s=(new Gibberish.Sine).callback,a=(new Gibberish.OnePole).callback,u=Gibberish.makePanner(),c=[0,0],l=this,f=0;n.requireReleaseTrigger=e.requireReleaseTrigger||!1,this.callback=function(e,n,f,h,p,d,b,m,g,y,v,x,k,w,_){var G,j,A;return v>=1&&(v=.9999),e=a(e,1-v,v),t?(G=r(h,p,d,b,m,g,y)*w,y&&(l.releaseTrigger=0),i()<4?(A=s(e*n,e*f)*G,j=o(e+A,1)*G*x,1===k?j:u(j,_,c)):(j=c[0]=c[1]=0,1===k?j:c)):i()<2?(G=r(h,p)*w,A=s(e*n,e*f)*G,j=o(e+A,1)*G*x,1===k?j:u(j,_,c)):(j=c[0]=c[1]=0,1===k?j:c)},this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.FMSynth.prototype=Gibberish._synth,Gibberish.PolyFM=function(){this.__proto__=new Gibberish.Bus2,Gibberish.extend(this,{name:"polyfm",maxVoices:5,voiceCount:0,children:[],frequencies:[],_frequency:0,velocity:1,polyProperties:{glide:0,attack:22050,decay:22050,sustain:22050,release:22050,attackLevel:1,sustainLevel:.5,index:5,cmRatio:2},note:function(e,t){if("undefined"!=typeof e){var n=this.frequencies.indexOf(e),i=n>-1?n:this.voiceCount++,r=this.children[i];"undefined"==typeof t&&(t=this.velocity),r.note(e,t),-1===n?(this.frequencies[i]=e,this._frequency=e,this.voiceCount>=this.maxVoices&&(this.voiceCount=0)):delete this.frequencies[i]}},initVoices:function(){for(var e=0;e<this.maxVoices;e++){var t={attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release,attackLevel:this.attackLevel,sustainLevel:this.sustainLevel,cmRatio:this.cmRatio,index:this.index,channels:2,useADSR:this.useADSR||!1,requireReleaseTrigger:this.requireReleaseTrigger||!1,amp:1},n=new Gibberish.FMSynth(t);n.connect(this),this.children.push(n)}}}),this.amp=1/this.maxVoices,this.children=[],"object"==typeof arguments[0]&&(this.maxVoices=arguments[0].maxVoices?arguments[0].maxVoices:this.maxVoices,this.useADSR="undefined"!=typeof arguments[0].useADSR?arguments[0].useADSR:!1,this.requireReleaseTrigger="undefined"!=typeof arguments[0].requireReleaseTrigger?arguments[0].requireReleaseTrigger:!1),Gibberish.polyInit(this),this.initVoices(),this.processProperties(arguments),Gibberish._synth.oscillatorInit.call(this)},Gibberish.Sampler=function(){var e=1,t=Gibberish.interpolate,n=Gibberish.makePanner(),i=[0,0],r=null,o=1,s=this;if(Gibberish.extend(this,{name:"sampler",file:null,isLoaded:!1,playOnLoad:0,buffers:{},properties:{pitch:1,amp:1,isRecording:!1,isPlaying:!0,input:0,length:0,start:0,end:1,loops:0,pan:0},_onload:function(t){r=t.channels[0],o=t.length,s.length=o,s.length=e=o,s.isPlaying=!0,Gibberish.audioFiles[s.file]=r,s.buffers[s.file]=r,s.onload&&s.onload(),0!==s.playOnLoad&&s.note(s.playOnLoad),s.isLoaded=!0},switchBuffer:function(e){if("string"==typeof e)"undefined"!=typeof this.buffers[e]&&(r=this.buffers[e],o=this.length=r.length);else if("number"==typeof e){var t=Object.keys(this.buffers);if(0===t.length)return;r=this.buffers[t[e]],o=this.length=r.length,this.setPhase(0)}},floatTo16BitPCM:function(e,t,n){for(var i=0;i<n.length-1;i++,t+=2){var r=Math.max(-1,Math.min(1,n[i]));e.setInt16(t,0>r?32768*r:32767*r,!0)}},encodeWAV:function(){function e(e,t,n){for(var i=0;i<n.length;i++)e.setUint8(t+i,n.charCodeAt(i))}var t=this.getBuffer(),n=new ArrayBuffer(44+2*t.length),i=new DataView(n),r=Gibberish.context.sampleRate;return e(i,0,"RIFF"),i.setUint32(4,32+2*t.length,!0),e(i,8,"WAVE"),e(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,r,!0),i.setUint32(28,4*r,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),e(i,36,"data"),i.setUint32(40,2*t.length,!0),this.floatTo16BitPCM(i,44,t),i},download:function(){var e=this.encodeWAV(),t=new Blob([e]),n=window.webkitURL.createObjectURL(t),i=window.document.createElement("a");i.href=n,i.download="output.wav";var r=document.createEvent("Event");r.initEvent("click",!0,!0),i.dispatchEvent(r)},range:function(e,t){if(Array.isArray(e)&&(t=e[1],e=e[0]),e>t){var n=e;e=t,t=n}this.start=e,this.end=t},note:function(t,n){if("undefined"!=typeof t){switch(typeof t){case"number":this.pitch=t;break;case"function":this.pitch=t();break;case"object":this.pitch=Array.isArray(t)?t[0]:t}if("number"==typeof n&&(this.amp=n),null!==this.function){this.isPlaying=!0;var i;switch(typeof this.pitch){case"number":i=this.pitch;break;case"function":i=this.pitch.getValue?this.pitch.getValue():this.pitch();break;case"object":i=Array.isArray(this.pitch)?this.pitch[0]:this.pitch.getValue?this.pitch.getValue():this.pitch.input.getValue(),"function"==typeof i&&(i=i())}e=0,Gibberish.dirty(this)}}},getBuffer:function(){return r},setBuffer:function(e){r=e},getPhase:function(){return e},setPhase:function(t){e=t
},getNumberOfBuffers:function(){return Object.keys(s.buffers).length-1},callback:function(o,s,a,u,c,l,f,h,p,d){var b=0,m=f*l,g=h*l;return e+=o,null!==r&&u?(o>0?g>m+e?b=t(r,m+e):p&&(e=0):g+e>m?b=t(r,g+e):p&&(e=0),n(b*s,d,i)):(i[0]=i[1]=b,i)}}).init().oscillatorInit().processProperties(arguments),"undefined"!=typeof arguments[0]&&("string"==typeof arguments[0]?(this.file=arguments[0],this.pitch=0):"object"==typeof arguments[0]&&arguments[0].file&&(this.file=arguments[0].file)),"undefined"!=typeof Gibberish.audioFiles[this.file])r=Gibberish.audioFiles[this.file],this.end=1,this.buffers[this.file]=r,this.length=e=this.bufferLength=r.length,Gibberish.dirty(this),this.onload&&this.onload();else if(null!==this.file){var a,u=new XMLHttpRequest;u.open("GET",this.file,!0),u.responseType="arraybuffer",u.onload=function(){a(this.response)},u.send(),u.onerror=function(e){console.error("Sampler file loading error",e)},a=function(t){Gibberish.context.decodeAudioData(t,function(t){r=t.getChannelData(0),s.length=e=o=r.length,s.isPlaying=!0,s.buffers[s.file]=r,Gibberish.audioFiles[s.file]=r,s.onload&&s.onload(),0!==s.playOnLoad&&s.note(s.playOnLoad),s.isLoaded=!0},function(e){console.log("Error decoding file",e)})}}else"undefined"!=typeof this.buffer&&(this.isLoaded=!0,r=this.buffer,this.bufferLength=r.length||88200,e=this.bufferLength,arguments[0]&&arguments[0].loops&&(this.loops=1),Gibberish.dirty(this),this.onload&&this.onload())},Gibberish.Sampler.prototype=Gibberish._oscillator,Gibberish.Sampler.prototype.record=function(e,t){this.isRecording=!0;var n=this;return this.recorder=new Gibberish.Record(e,t,function(){n.setBuffer(this.getBuffer()),bufferLength=n.getBuffer().length,n.setPhase(n.end),n.isRecording=!1}).record(),this},Gibberish.MonoSynth=function(){Gibberish.extend(this,{name:"monosynth",properties:{attack:1e4,decay:1e4,cutoff:.2,resonance:2.5,amp1:1,amp2:1,amp3:1,filterMult:.3,isLowPass:!0,pulsewidth:.5,amp:.6,detune2:.01,detune3:-.01,octave2:1,octave3:-1,glide:0,pan:0,velocity:1,frequency:0,channels:2},waveform:"Saw3",note:function(e,i){"undefined"!=typeof e&&("undefined"!=typeof i&&0!==i&&(this.velocity=i),0!==i&&("object"!=typeof this.frequency?this.frequency=e:(this.frequency[0]=e,Gibberish.dirty(this)),n()>0&&t.run()))}});var e=waveform1=waveform2=waveform3=this.waveform;Object.defineProperty(this,"waveform",{get:function(){return e},set:function(t){e!==t&&(e=t,o=(new Gibberish[t]).callback,s=(new Gibberish[t]).callback,a=(new Gibberish[t]).callback)}}),Object.defineProperties(this,{waveform1:{get:function(){return waveform1},set:function(e){waveform1=e,o=(new Gibberish[e]).callback}},waveform2:{get:function(){return waveform2},set:function(e){waveform2=e,s=(new Gibberish[e]).callback}},waveform3:{get:function(){return waveform3},set:function(e){waveform3=e,a=(new Gibberish[e]).callback}}});var t=new Gibberish.AD(this.attack,this.decay),n=t.getState,i=t.callback,r=(new Gibberish.Filter24).callback,o=new Gibberish[this.waveform](this.frequency,this.amp1).callback,s=new Gibberish[this.waveform](this.frequency2,this.amp2).callback,a=new Gibberish[this.waveform](this.frequency3,this.amp3).callback,u=(new Gibberish.OnePole).callback,c=Gibberish.makePanner(),l=[0,0];this.envelope=t,this.callback=function(e,t,f,h,p,d,b,m,g,y,v,x,k,w,_,G,j,A,S,q){if(n()<2){G>=1&&(G=.9999),S=u(S,1-G,G);var P=S;if(w>0)for(var C=0;w>C;C++)P*=2;else if(0>w)for(var C=0;C>w;C--)P/=2;var M=S;if(_>0)for(var C=0;_>C;C++)M*=2;else if(0>_)for(var C=0;C>_;C--)M/=2;P+=x>0?(2*S-S)*x:(S-S/2)*x,M+=k>0?(2*S-S)*k:(S-S/2)*k;var O=o(S,p,y)+s(P,d,y)+a(M,b,y),R=i(e,t)*A,L=r(O,f+m*R,h,g,1)*R;return L*=v,l[0]=l[1]=L,1===q?l:c(L,j,l)}return l[0]=l[1]=0,l},this.init(),this.oscillatorInit(),this.processProperties(arguments)},Gibberish.MonoSynth.prototype=Gibberish._synth,Gibberish.Binops={"export":function(e){Gibberish.export("Binops",e||window)},operator:function(){var e=new Gibberish.ugen,t=arguments[0],n=Array.prototype.slice.call(arguments,1);e.name="op",e.properties={};for(var i=0;i<n.length;i++)e.properties[i]=n[i];return e.init.apply(e,n),e.codegen=function(){var e,n="( ";if("undefined"!=typeof Gibberish.memo[this.symbol])return Gibberish.memo[this.symbol];e=Object.keys(this.properties);for(var i=!1,r=0;r<e.length;r++)if(i)i=!1;else{var o="object"==typeof this[r];n+=o?this[r].codegen():this[r],"*"!==t&&"/"!==t||1!==this[r+1]?r<e.length-1&&(n+=" "+t+" "):i=!0}return n+=" )",this.codeblock=n,n},e.valueOf=function(){return e.codegen()},e},Add:function(){var e=Array.prototype.slice.call(arguments,0);return e.unshift("+"),Gibberish.Binops.operator.apply(null,e)},Sub:function(){var e=Array.prototype.slice.call(arguments,0);return e.unshift("-"),Gibberish.Binops.operator.apply(null,e)},Mul:function(){var e=Array.prototype.slice.call(arguments,0);return e.unshift("*"),Gibberish.Binops.operator.apply(null,e)},Div:function(){var e=Array.prototype.slice.call(arguments,0);return e.unshift("/"),Gibberish.Binops.operator.apply(null,e)},Mod:function(){var e=Array.prototype.slice.call(arguments,0);return e.unshift("%"),Gibberish.Binops.operator.apply(null,e)},Abs:function(){var e=Array.prototype.slice.call(arguments,0),t={name:"abs",properties:{},callback:Math.abs.bind(t)};return t.__proto__=new Gibberish.ugen,t.properties[0]=e[0],t.init(),t},Sqrt:function(){var e=(Array.prototype.slice.call(arguments,0),{name:"sqrt",properties:{},callback:Math.sqrt.bind(e)});return e.__proto__=new Gibberish.ugen,e.properties[i]=arguments[0],e.init(),e},Pow:function(){var e=Array.prototype.slice.call(arguments,0),t={name:"pow",properties:{},callback:Math.pow.bind(t)};t.__proto__=new Gibberish.ugen;for(var n=0;n<e.length;n++)t.properties[n]=e[n];return t.init(),console.log(t.callback),t},Clamp:function(){var e=Array.prototype.slice.call(arguments,0),t={name:"clamp",properties:{input:0,min:0,max:1},callback:function(e,t,n){return t>e?e=t:e>n&&(e=n),e}};return t.__proto__=new Gibberish.ugen,t.init(),t.processProperties(e),t},Merge:function(){var e=Array.prototype.slice.call(arguments,0),t={name:"merge",properties:{},callback:function(e){return e[0]+e[1]}};t.__proto__=new Gibberish.ugen;for(var n=0;n<e.length;n++)t.properties[n]=e[n];return t.init(),t},Map:function(e,t,n,i,r,o,s){var a=Math.pow,u=0,c=0,l={name:"map",properties:{input:e,outputMin:t,outputMax:n,inputMin:i,inputMax:r,curve:o||u,wrap:s||!1},callback:function(e,t,n,i,r,o,s){var u,l=n-t,f=r-i,h=(e-i)/f;return h>1?h=s?h%1:1:0>h&&(h=s?1+h%1:0),u=0===o?t+h*l:t+a(h,1.5)*l,c=u,u},getValue:function(){return c},invert:function(){var e=l.outputMin;l.outputMin=l.outputMax,l.outputMax=e}};return l.__proto__=new Gibberish.ugen,l.init(),l}},Gibberish.Time={bpm:120,"export":function(e){Gibberish.export("Time",e||window)},ms:function(e){return e*Gibberish.context.sampleRate/1e3},seconds:function(e){return e*Gibberish.context.sampleRate},beats:function(e){return function(){var t=Gibberish.context.sampleRate/(Gibberish.Time.bpm/60);return t*e}}},Gibberish.Sequencer2=function(){var e=this,t=0;Gibberish.extend(this,{target:null,key:null,values:null,valuesIndex:0,durations:null,durationsIndex:0,nextTime:0,playOnce:!1,repeatCount:0,repeatTarget:null,isConnected:!0,keysAndValues:null,counts:{},properties:{rate:1,isRunning:!1,nextTime:0},offset:0,name:"seq",callback:function(n,i,r){if(i){if(t>=r){if(null!==e.values){if(e.target){var o=e.values[e.valuesIndex++];"function"==typeof o&&(o=o()),"function"==typeof e.target[e.key]?e.target[e.key](o):e.target[e.key]=o}else"function"==typeof e.values[e.valuesIndex]&&e.values[e.valuesIndex++]();e.valuesIndex>=e.values.length&&(e.valuesIndex=0)}else if(null!==e.keysAndValues)for(var s in e.keysAndValues){var a=e.counts[s]++,o=e.keysAndValues[s][a];"function"==typeof o&&(o=o()),"function"==typeof e.target[s]?e.target[s](o):e.target[s]=o,e.counts[s]>=e.keysAndValues[s].length&&(e.counts[s]=0),e.chose&&e.chose(s,a)}else"function"==typeof e.target[e.key]&&e.target[e.key]();if(t-=r,Array.isArray(e.durations)){var u=e.durations[e.durationsIndex++];e.nextTime="function"==typeof u?u():u,e.chose&&e.chose("durations",e.durationsIndex-1),e.durationsIndex>=e.durations.length&&(e.durationsIndex=0)}else{var u=e.durations;e.nextTime="function"==typeof u?u():u}return e.repeatTarget&&(e.repeatCount++,e.repeatCount===e.repeatTarget&&(e.isRunning=!1,e.repeatCount=0)),0}t+=n}return 0},start:function(e){return e||(t=0),this.isRunning=!0,this},stop:function(){return this.isRunning=!1,this},repeat:function(e){return this.repeatTarget=e,this},shuffle:function(){for(n in this.keysAndValues)this.shuffleArray(this.keysAndValues[n])},shuffleArray:function(e){for(var t,n,i=e.length;i;t=parseInt(Math.random()*i),n=e[--i],e[i]=e[t],e[t]=n);}}),this.init(arguments),this.processProperties(arguments);for(var n in this.keysAndValues)this.counts[n]=0;this.oscillatorInit(),t+=this.offset,this.connect()},Gibberish.Sequencer2.prototype=Gibberish._oscillator,Gibberish.Sequencer=function(){Gibberish.extend(this,{target:null,key:null,values:null,valuesIndex:0,durations:null,durationsIndex:0,nextTime:0,phase:0,isRunning:!1,playOnce:!1,repeatCount:0,repeatTarget:null,isConnected:!0,keysAndValues:null,counts:{},offset:0,name:"seq",tick:function(){if(this.isRunning){if(this.phase>=this.nextTime){if(null!==this.values){if(this.target){var e=this.values[this.valuesIndex++];if("function"==typeof e)try{e=e()}catch(t){console.error("ERROR: Can't execute function triggered by Sequencer:\n"+e.toString()),this.values.splice(this.valuesIndex-1,1),this.valuesIndex--}"function"==typeof this.target[this.key]?this.target[this.key](e):this.target[this.key]=e}else if("function"==typeof this.values[this.valuesIndex])try{this.values[this.valuesIndex++]()}catch(t){console.error("ERROR: Can't execute function triggered by Sequencer:\n"+this.values[this.valuesIndex-1].toString()),this.values.splice(this.valuesIndex-1,1),this.valuesIndex--}this.valuesIndex>=this.values.length&&(this.valuesIndex=0)}else if(null!==this.keysAndValues)for(var n in this.keysAndValues){var i="function"==typeof this.keysAndValues[n].pick?this.keysAndValues[n].pick():this.counts[n]++,e=this.keysAndValues[n][i];if("function"==typeof e)try{e=e()}catch(t){console.error("ERROR: Can't execute function triggered by Sequencer:\n"+e.toString()),this.keysAndValues[n].splice(i,1),"function"!=typeof this.keysAndValues[n].pick&&this.counts[n]--}"function"==typeof this.target[n]?this.target[n](e):this.target[n]=e,this.counts[n]>=this.keysAndValues[n].length&&(this.counts[n]=0)}else"function"==typeof this.target[this.key]&&this.target[this.key]();if(this.phase-=this.nextTime,Array.isArray(this.durations)){var r="function"==typeof this.durations.pick?this.durations[this.durations.pick()]:this.durations[this.durationsIndex++];this.nextTime="function"==typeof r?r():r,this.durationsIndex>=this.durations.length&&(this.durationsIndex=0)}else{var r=this.durations;this.nextTime="function"==typeof r?r():r}return void(this.repeatTarget&&(this.repeatCount++,this.repeatCount===this.repeatTarget&&(this.isRunning=!1,this.repeatCount=0)))}this.phase++}},start:function(e){return e||(this.phase=this.offset),this.isRunning=!0,this},stop:function(){return this.isRunning=!1,this},repeat:function(e){return this.repeatTarget=e,this},shuffle:function(){for(e in this.keysAndValues)this.shuffleArray(this.keysAndValues[e])},shuffleArray:function(e){for(var t,n,i=e.length;i;t=parseInt(Math.random()*i),n=e[--i],e[i]=e[t],e[t]=n);},disconnect:function(){var e=Gibberish.sequencers.indexOf(this);Gibberish.sequencers.splice(e,1),this.isConnected=!1},connect:function(){return-1===Gibberish.sequencers.indexOf(this)&&Gibberish.sequencers.push(this),this.isConnected=!0,this}});for(var e in arguments[0])this[e]=arguments[0][e];for(var e in this.keysAndValues)this.counts[e]=0;this.connect(),this.phase+=this.offset},Gibberish.Sequencer.prototype=Gibberish._oscillator,Gibberish.PolySeq=function(){var e=this,t=0,n=function(e,t){return t>e?-1:e>t?1:0};Gibberish.extend(this,{seqs:[],autofire:[],timeline:{},playOnce:!1,repeatCount:0,repeatTarget:null,isConnected:!1,properties:{rate:1,isRunning:!1,nextTime:0},offset:0,name:"polyseq",getPhase:function(){return t},setPhase:function(e){t=e},adjustPhase:function(e){t+=e},timeModifier:null,add:function(n,i){n.valuesIndex=n.durationsIndex=0,null===n.durations?(n.autofire=!0,e.autofire.push(n)):("undefined"==typeof i?e.seqs.push(n):e.seqs.splice(i,0,n),"undefined"!=typeof e.timeline[t]?n.priority?e.timeline[t].unshift(n):e.timeline[t].push(n):e.timeline[t]=[n],e.nextTime=t),!e.scale||"frequency"!==n.key&&"note"!==n.key||e.applyScale&&e.applyScale(),n.shouldStop=!1},callback:function(i,r,o){var s;if(r){if(t>=o){var a=e.timeline[o],u=t-o;if("undefined"==typeof a)return;for(var c=0;c<a.length;c++){var l=a[c];if(!l.shouldStop){var f=l.values.pick?l.values.pick():l.valuesIndex++%l.values.length,h="function"==typeof l.values?l.values():l.values[f];if("function"==typeof h&&(h=h()),l.target&&("function"==typeof l.target[l.key]?l.target[l.key](h):l.target[l.key]=h),e.chose&&e.chose(l.key,f),Array.isArray(l.durations)){var f=l.durations.pick?l.durations.pick():l.durationsIndex++,p="function"==typeof l.durations?l.durations():l.durations[f];s="function"==typeof p?p():p,"function"!=typeof l.durations&&l.durationsIndex>=l.durations.length&&(l.durationsIndex=0),e.chose&&e.chose("durations",f)}else{var p="function"==typeof l.durations?l.durations():l.durations;s="function"==typeof p?p():p}var d;d=null!==e.timeModifier?e.timeModifier(s)+t:s+t,d-=u,s-=u,"undefined"==typeof e.timeline[d]?e.timeline[d]=[l]:l.priority?e.timeline[d].unshift(l):e.timeline[d].push(l)}}for(var c=0,b=e.autofire.length;b>c;c++){var l=e.autofire[c];if(!l.shouldStop){var f=l.values.pick?l.values.pick():l.valuesIndex++%l.values.length,h=l.values[f];"function"==typeof h&&(h=h()),l.target&&("function"==typeof l.target[l.key]?l.target[l.key](h):l.target[l.key]=h),e.chose&&e.chose(l.key,f)}}delete e.timeline[o];var m=Object.keys(e.timeline),g=m.length;if(g>1){for(var y=0;g>y;y++)m[y]=parseFloat(m[y]);m=m.sort(n),e.nextTime=m[0]}else e.nextTime=parseFloat(m[0])}t+=i}return 0},start:function(e,n){if(e&&this.offset){t=0,this.nextTime=this.offset;var i=""+this.offset;this.timeline={},this.timeline[i]=[];for(var r=0;r<this.seqs.length;r++){var o=this.seqs[r];o.valuesIndex=o.durationsIndex=o.shouldStop=0,this.timeline[i].push(o)}}else{t=0,this.nextTime=0,this.timeline={0:[]};for(var r=0;r<this.seqs.length;r++){var o=this.seqs[r];o.valuesIndex=o.durationsIndex=o.shouldStop=0,this.timeline[0].push(o)}}return this.isConnected||(this.connect(Gibberish.Master,n),this.isConnected=!0),this.isRunning=!0,this},stop:function(){return this.isRunning=!1,this.isConnected&&(this.disconnect(),this.isConnected=!1),this},repeat:function(e){return this.repeatTarget=e,this},shuffle:function(e){if("undefined"!=typeof e)for(var t=0;t<this.seqs.length;t++)this.seqs[t].key===e&&this.shuffleArray(this.seqs[t].values);else for(var t=0;t<this.seqs.length;t++)this.shuffleArray(this.seqs[t].values)},shuffleArray:function(e){for(var t,n,i=e.length;i;t=parseInt(Math.random()*i),n=e[--i],e[i]=e[t],e[t]=n);}}),this.init(arguments),this.processProperties(arguments),this.oscillatorInit()},Gibberish.PolySeq.prototype=Gibberish._oscillator;var _hasInput=!1;return"object"==typeof navigator&&(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia),Gibberish.Input=function(){var e=[];_hasInput||createInput(),this.type=this.name="input",this.fx=new Array2,this.fx.parent=this,this.properties={input:"input",amp:.5,channels:1},this.callback=function(t,n,i){return 1===i?e=t*n:(e[0]=t[0]*n,e[1]=t[1]*n),e},this.init(arguments),this.processProperties(arguments)},Gibberish.Input.prototype=new Gibberish.ugen,Gibberish.Kick=function(){var e=!1,t=(new Gibberish.SVF).callback,n=(new Gibberish.SVF).callback,i=.2,r=.8;Gibberish.extend(this,{name:"kick",properties:{pitch:50,__decay:20,__tone:1e3,amp:2,sr:Gibberish.context.sampleRate},callback:function(i,r,o,s,a){var u=e?60:0;return u=t(u,i,r,2,a),u=n(u,o,.5,0,a),u*=s,e=!1,u},note:function(t,n,i,r){"number"==typeof t&&(this.pitch=t),"number"==typeof n&&(this.decay=n),"number"==typeof i&&(this.tone=i),"number"==typeof r&&(this.amp=r),e=!0}}).init().oscillatorInit(),Object.defineProperties(this,{decay:{get:function(){return i},set:function(e){i=e>1?1:e,this.__decay=100*i}},tone:{get:function(){return r},set:function(e){r=e>1?1:e,this.__tone=220+1400*e}}}),this.processProperties(arguments)},Gibberish.Kick.prototype=Gibberish._oscillator,Gibberish.Conga=function(){var e=!1,t=(new Gibberish.SVF).callback;Gibberish.extend(this,{name:"conga",properties:{pitch:190,amp:2,sr:Gibberish.context.sampleRate},callback:function(n,i,r){var o=e?60:0;return o=t(o,n,50,2,r),o*=i,e=!1,o},note:function(t,n){"number"==typeof t&&(this.pitch=t),"number"==typeof n&&(this.amp=n),e=!0}}).init().oscillatorInit(),this.processProperties(arguments)},Gibberish.Conga.prototype=Gibberish._oscillator,Gibberish.Clave=function(){var e=!1,t=new Gibberish.SVF,n=t.callback;Gibberish.extend(this,{name:"clave",properties:{pitch:2500,amp:1,sr:Gibberish.context.sampleRate},callback:function(t,i,r){var o=e?2:0;return o=n(o,t,5,2,r),o*=i,e=!1,o},note:function(t,n){"number"==typeof t&&(this.pitch=t),"number"==typeof n&&(this.amp=n),e=!0}}).init().oscillatorInit(),this.bpf=t,this.processProperties(arguments)},Gibberish.Clave.prototype=Gibberish._oscillator,Gibberish.Tom=function(){var e=!1,t=(new Gibberish.SVF).callback,n=(new Gibberish.SVF).callback,i=new Gibberish.ExponentialDecay,r=i.callback,o=Math.random;Gibberish.extend(this,{name:"tom",properties:{pitch:80,amp:.5,sr:Gibberish.context.sampleRate},callback:function(i,s,a){var u,c=e?60:0;return c=t(c,i,30,2,a),u=16*o()-8,u=u>0?u:0,u*=r(.05,11025),u=n(u,120,.5,0,a),c+=u,c*=s,e=!1,c},note:function(t,n){"number"==typeof t&&(this.pitch=t),"number"==typeof n&&(this.amp=n),i.trigger(),e=!0}}).init().oscillatorInit(),i.trigger(1),this.processProperties(arguments)},Gibberish.Tom.prototype=Gibberish._oscillator,Gibberish.Clap=function(){var e=new Gibberish.Biquad,t=e.callback,n=new Gibberish.Biquad,i=n.callback,r=new Gibberish.Biquad,o=r.callback,s=new Gibberish.ExponentialDecay,a=s.callback,u=new Gibberish.ExponentialDecay,c=u.callback,l=new Gibberish.Line,f=(l.callback,new Gibberish.Saw),h=f.callback,p=Math.random,d=1e3,b=2.5,m=.025,g=.9,y=1323,v=660,x=100;e.mode=n.mode="BP",r.mode="BP",r.cutoff=2400,e.cutoff=n.cutoff=1e3,e.Q=2,n.Q=1,Gibberish.extend(this,{name:"clap",properties:{amp:.5,sr:Gibberish.context.sampleRate},callback:function(e){var n,r,s=0;return n=4*p()-2,n=n>0?n:0,r=4*p()-2,r=r>0?r:0,s=i(t(n)),s*=c(g,v),r=o(h(x,r)*a(m,y)),s+=r,s*=e},note:function(e){"number"==typeof e&&(this.amp=e),u.trigger(),s.trigger(),l.setPhase(0),f.setPhase(0)}}).init().oscillatorInit(),this.getBPF=function(){return e},this.getBPF2=function(){return n},this.getBPF3=function(){return r},this.getLine=function(){return l},this.setEnvK=function(e,t,n,i){m=e,t&&(g=t),n&&(y=n),i&&(v=i)},this.setFreq=function(e){x=e},this.setRez=function(e){b=e},this.setCutoff=function(e){d=e},this.processProperties(arguments)},Gibberish.Clap.prototype=Gibberish._oscillator,Gibberish.Cowbell=function(){var e=new Gibberish.Square,t=new Gibberish.Square,n=e.callback,i=t.callback,r=new Gibberish.SVF({mode:2}),o=r.callback,s=new Gibberish.ExponentialDecay(.0025,10500),a=s.callback;Gibberish.extend(this,{name:"cowbell",properties:{amp:1,pitch:560,bpfFreq:1e3,bpfRez:3,decay:22050,decayCoeff:1e-4,sr:Gibberish.context.sampleRate},callback:function(e,t,r,s,u,c,l){var f;return f=n(t,1,1,0),f+=i(845,1,1,0),f=o(f,r,s,2,l),f*=a(c,u),f*=e},note:function(e){s.trigger(),e&&(this.decay=e)}}).init().oscillatorInit().processProperties(arguments),this.bpf=r,this.eg=s,s.trigger(1)},Gibberish.Cowbell.prototype=Gibberish._oscillator,Gibberish.Snare=function(){var e=(new Gibberish.SVF).callback,t=(new Gibberish.SVF).callback,n=(new Gibberish.SVF).callback,i=new Gibberish.ExponentialDecay(.0025,11025),r=i.callback,o=Math.random,s=0;Gibberish.extend(this,{name:"snare",properties:{cutoff:1e3,decay:11025,tune:0,snappy:.5,amp:1,sr:Gibberish.context.sampleRate},callback:function(i,a,u,c,l,f){var h,p,d=0,b=0;return d=r(.0025,a),d>.005&&(b=(2*o()-1)*d,b=n(b,i+1e3*u,.5,1,f),b*=c,b=b>0?b:0,s=d,h=e(s,180*(u+1),15,2,f),p=t(s,330*(u+1),15,2,f),b+=h,b+=.8*p,b*=l),b},note:function(e,t,n,r){"number"==typeof e&&(this.tune=e),"number"==typeof r&&(this.cutoff=r),"number"==typeof n&&(this.snappy=n),"number"==typeof t&&(this.amp=t),i.trigger()}}).init().oscillatorInit().processProperties(arguments),i.trigger(1)},Gibberish.Snare.prototype=Gibberish._oscillator,Gibberish.Hat=function(){{var e=new Gibberish.Square,t=new Gibberish.Square,n=new Gibberish.Square,i=new Gibberish.Square,r=new Gibberish.Square,o=new Gibberish.Square,s=e.callback,a=t.callback,u=n.callback,c=i.callback,l=r.callback,f=o.callback,h=new Gibberish.SVF({mode:2}),p=h.callback,d=new Gibberish.Filter24,b=d.callback,m=new Gibberish.ExponentialDecay(.0025,10500),g=m.callback,y=new Gibberish.ExponentialDecay(.1,7500);y.callback}Gibberish.extend(this,{name:"hat",properties:{amp:1,pitch:325,bpfFreq:7e3,bpfRez:2,hpfFreq:.975,hpfRez:0,decay:3500,decay2:3e3,sr:Gibberish.context.sampleRate},callback:function(e,t,n,i,r,o,h,d,m){var y;return y=s(t,1,.5,0),y+=a(1.4471*t,.75,1,0),y+=u(1.617*t,1,1,0),y+=c(1.9265*t,1,1,0),y+=l(2.5028*t,1,1,0),y+=f(2.6637*t,.75,1,0),y=p(y,n,i,2,m),y*=g(.001,h),y=b(y,r,o,0,1),y*=e},note:function(e,t){m.trigger(),y.trigger(),e&&(this.decay=e),t&&(this.decay2=t)}}).init().oscillatorInit().processProperties(arguments),this.bpf=h,this.hpf=d,m.trigger(1),y.trigger(1)},Gibberish.Hat.prototype=Gibberish._oscillator,function(){var e={Soundfont:{instruments:{}}},t=e.Soundfont;"object"==typeof window?window.GenMIDI=e:global.GenMIDI=e;var n=function(e,t){function n(n){console.log("COMPLETE",e);var i=document.createElement("script");i.innerHTML=n.srcElement?n.srcElement.responseText:n.target.responseText,document.querySelector("head").appendChild(i),t(i)}var i=new XMLHttpRequest;i.addEventListener("load",n,!1),i.addEventListener("error",function(e){console.log("SF load error",e)},!1),i.open("GET",e,!0),i.send()},i={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeArrayBuffer:function(e){var t=e.length/4*3,n=new ArrayBuffer(t);return this.decode(e,n),n},decode:function(e,t){var n=this._keyStr.indexOf(e.charAt(e.length-1)),i=this._keyStr.indexOf(e.charAt(e.length-2)),r=e.length/4*3;64==n&&r--,64==i&&r--;var o,s,a,u,c,l,f,h,p=0,d=0;for(o=new Uint8Array(t?t:r),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),p=0;r>p;p+=3)c=this._keyStr.indexOf(e.charAt(d++)),l=this._keyStr.indexOf(e.charAt(d++)),f=this._keyStr.indexOf(e.charAt(d++)),h=this._keyStr.indexOf(e.charAt(d++)),s=c<<2|l>>4,a=(15&l)<<4|f>>2,u=(3&f)<<6|h,o[p]=s,64!=f&&(o[p+1]=a),64!=h&&(o[p+2]=u);return o}},r=function(e){var n=0,r=t[e.instrumentFileName];"undefined"==typeof t.instruments[e.instrumentFileName]&&(t.instruments[e.instrumentFileName]={}),e.buffers=t.instruments[e.instrumentFileName];for(var o in r)n++,!function(){var s=o,a=r[s].split(",")[1],u=i.decodeArrayBuffer(a);Gibberish.context.decodeAudioData(u,function(i){t.instruments[e.instrumentFileName][s]=i.getChannelData(0),n--,0>=n&&(console.log("Soundfont "+e.instrumentFileName+" is loaded."),e.isLoaded=!0,e.onload&&e.onload())},function(e){console.log("ERROR",e.err,arguments,s)})}()};Gibberish.SoundFont=function(e,i){return Gibberish.extend(this,{instrumentFileName:e,name:"soundfont",properties:{amp:1,pan:0},playing:[],buffers:{},onload:null,out:[0,0],isLoaded:!1,resourcePath:i||"./resources/soundfonts/",callback:function(e,t){for(var n=0,i=this.playing.length-1;i>=0;i--){var r=this.playing[i];n+=this.interpolate(r.buffer,r.phase)*r.velocity,r.phase+=r.increment,r.phase>r.length&&this.playing.splice(this.playing.indexOf(r),1)}return this.panner(n*e,t,this.out)}.bind(this),note:function(e,t,n){this.isLoaded&&this.playing.push({buffer:this.buffers[e],phase:0,increment:isNaN(n)?1:1+n,length:this.buffers[e].length,velocity:isNaN(t)?1:t})},interpolate:Gibberish.interpolate.bind(this),panner:Gibberish.makePanner()}).init().oscillatorInit(),"object"==typeof arguments[0]&&arguments[0].instrumentFileName&&(this.instrumentFileName=arguments[0].instrumentFileName),t.instruments[this.instrumentFileName]||"object"==typeof i?"object"==typeof i?(t[this.instrumentFileName]=i,r(this)):(this.buffers=t.instruments[this.instrumentFileName],this.isLoaded=!0,setTimeout(function(){this.onload&&this.onload()}.bind(this),0)):(console.log("DOWNLOADING SOUNDFONT"),n(i+this.instrumentFileName+"-mp3.js",r.bind(null,this))),this},Gibberish.SoundFont.storage=t,Gibberish.SoundFont.prototype=Gibberish._oscillator}(),Gibberish.Vocoder=function(){var e=[],t=[],n=Math.abs,i=(Math.sqrt,[0,0]),r=[],o=[],s=128,a=[],u=[],c=[],l=0,f=arguments[3]||330,h=arguments[4]||3200,p=arguments[2]||16,d=arguments[5]||.15;this.name="vocoder",this.properties={carrier:arguments[0]||null,modulator:arguments[1]||null,amp:1,pan:0};for(var b=1200*Math.log(h/f)/Math.LN2,m=b/p,g=Math.pow(2,m/1200),y=f,v=0;p>v;v++)r[v]=new Gibberish.Biquad({mode:"BP",Q:d,cutoff:y}),e[v]=r[v].callback,o[v]=new Gibberish.Biquad({mode:"BP",Q:d,cutoff:y}),t[v]=o[v].callback,a[v]=[0],u[v]=0,c[v]=0,y*=g;this.callback=function(r,o,f){for(var h,d=(l+1)%s,b="number"!=typeof o?o[0]+o[1]:o,m="number"!=typeof r?r[0]+r[1]:r,g=0,y=0;p>y;y++)h=n(e[y](b)),u[y]+=h,u[y]-=a[y][l],a[y][l]=h,a[y][d]=a[y][d]?a[y][d]:0,c[y]=u[y]/s,g+=t[y](m)*c[y];return l=d,i[0]=i[1]=g*f*16,i},this.getEncoders=function(){return r},this.getDecoders=function(){return o},this.init(),this.oscillatorInit()},Gibberish.Vocoder.prototype=Gibberish._synth,Gibberish})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],34:[function(require,module,exports){!function(){var freesound=module.exports={BASE_URI:"http://www.freesound.org/api",apiKey:"",debug:!1,_URI_SOUND:"/sounds/<sound_id>/",_URI_SOUND_ANALYSIS:"/sounds/<sound_id>/analysis/",_URI_SOUND_ANALYSIS_FILTER:"/sounds/<sound_id>/analysis/<filter>",_URI_SIMILAR_SOUNDS:"/sounds/<sound_id>/similar/",_URI_SEARCH:"/sounds/search/",_URI_CONTENT_SEARCH:"/sounds/content_search/",_URI_GEOTAG:"/sounds/geotag",_URI_USER:"/people/<user_name>/",_URI_USER_SOUNDS:"/people/<user_name>/sounds/",_URI_USER_PACKS:"/people/<user_name>/packs/",_URI_USER_BOOKMARKS:"/people/<username>/bookmark_categories",_URI_BOOKMARK_CATEGORY_SOUNDS:"/people/<username>/bookmark_categories/<category_id>/sounds",_URI_PACK:"/packs/<pack_id>/",_URI_PACK_SOUNDS:"/packs/<pack_id>/sounds/",_make_uri:function(e,t){for(var n in t)e=e.replace(/<[\w_]+>/,t[n]);return this.BASE_URI+e},_make_request:function(uri,success,error,params,wrapper){var fs=this;-1==uri.indexOf("?")&&(uri+="?"),uri=uri+"&api_key="+this.apiKey;for(var p in params)uri=uri+"&"+p+"="+params[p];var xhr;try{xhr=new XMLHttpRequest}catch(e){xhr=new ActiveXObject("Microsoft.XMLHTTP")}xhr.onreadystatechange=function(){if(4==xhr.readyState&&200==xhr.status){var data=eval("("+xhr.responseText+")");success(wrapper?wrapper(data):data)}else 4==xhr.readyState&&200!=xhr.status&&error()},freesound.debug&&console.log(uri),xhr.open("GET",uri),xhr.send(null)},_make_sound_object:function(e){return e.get_analysis=function(t,n,i,r){var o=n?freesound._URI_SOUND_ANALYSIS_FILTER:freesound._URI_SOUND_ANALYSIS;freesound._make_request(freesound._make_uri(o,[e.id,n?n:""]),i,r)},e.get_similar_sounds=function(t,n){freesound._make_request(freesound._make_uri(freesound._URI_SIMILAR_SOUNDS,[e.id]),t,n,{},this._make_sound_collection_object)},e},_make_sound_collection_object:function(e){var t=function(e,t,n){freesound._make_request(e,t,n,{},this._make_sound_collection_object)};return e.next_page=function(e,n){t(this.next,e,n)},e.previous_page=function(e,n){t(this.previous,e,n)},e},_make_user_object:function(e){return e.get_sounds=function(t,n){freesound._make_request(freesound._make_uri(freesound._URI_USER_SOUNDS,[e.username]),t,n,{},this._make_sound_collection_object)},e.get_packs=function(t,n){freesound._make_request(freesound._make_uri(freesound._URI_USER_PACKS,[e.username]),t,n,{},this._make_pack_collection_object)},e.get_bookmark_categories=function(t,n){freesound._make_request(freesound._make_uri(freesound._URI_USER_BOOKMARKS,[e.username]),t,n)},e.get_bookmark_category_sounds=function(e,t,n){freesound._make_request(e,t,n)},e},_make_pack_object:function(e){return e.get_sounds=function(t,n){freesound._make_request(freesound._make_uri(freesound._URI_PACK_SOUNDS,[e.id]),t,n,{},this._make_sound_collection_object)},e},_make_pack_collection_object:function(e){var t=function(e,t,n){freesound._make_request(e,t,n,{},this._make_pack_collection_object)};return e.next_page=function(e,n){t(this.next,e,n)},e.previous_page=function(e,n){t(this.previous,e,n)},e},get_from_ref:function(e,t,n){this._make_request(e,t,n,{})},get_sound:function(e,t,n){this._make_request(this._make_uri(this._URI_SOUND,[e]),t,n,{},this._make_sound_object)},get_user:function(e,t,n){this._make_request(this._make_uri(this._URI_USER,[e]),t,n,{},this._make_user_object)},get_pack:function(e,t,n){this._make_request(this._make_uri(this._URI_PACK,[e]),t,n,{},this._make_pack_object)},quick_search:function(e,t,n){this.search(e,0,null,null,t,n)},search:function(e,t,n,i,r,o,s,a,u){var c={q:e?e:" "};t&&(c.p=t),n&&(c.f=n),i&&(c.s=i),r&&(c.num_results=r),s&&(c.sounds_per_page=s),o&&(c.fields=o),this._make_request(this._make_uri(this._URI_SEARCH),a,u,c,this._make_sound_collection_object)},content_based_search:function(e,t,n,i,r,o,s,a){var u={};r&&(u.p=r),t&&(u.f=t),e&&(u.t=e),n&&(u.max_results=n),o&&(u.sounds_per_page=o),i&&(u.fields=i),this._make_request(this._make_uri(this._URI_CONTENT_SEARCH),s,a,u,this._make_sound_collection_object)},geotag:function(e,t,n,i,r,o,s,a,u){var c={};e&&(c.min_lat=e),t&&(c.max_lat=t),n&&(c.min_lon=n),i&&(c.max_lon=i),r&&(c.p=r),s&&(c.sounds_per_page=s),o&&(c.fields=o),this._make_request(this._make_uri(this._URI_GEOTAG),a,u,c,this._make_sound_collection_object)}}}()},{}],35:[function(require,module,exports){!function(){var freesound=function(){var authHeader="",clientId="",clientSecret="",host="freesound.org",uris={base:"https://"+host+"/apiv2",textSearch:"/search/text/",contentSearch:"/search/content/",combinedSearch:"/sounds/search/combined/",sound:"/sounds/<sound_id>/",soundAnalysis:"/sounds/<sound_id>/analysis/",similarSounds:"/sounds/<sound_id>/similar/",comments:"/sounds/<sound_id>/comments/",download:"/sounds/<sound_id>/download/",upload:"/sounds/upload/",describe:"/sounds/<sound_id>/describe/",pending:"/sounds/pending_uploads/",bookmark:"/sounds/<sound_id>/bookmark/",rate:"/sounds/<sound_id>/rate/",comment:"/sounds/<sound_id>/comment/",authorize:"/oauth2/authorize/",logout:"/api-auth/logout/",logoutAuthorize:"/oauth2/logout_and_authorize/",me:"/me/",user:"/users/<username>/",userSounds:"/users/<username>/sounds/",userPacks:"/users/<username>/packs/",userBookmarkCategories:"/users/<username>/bookmark_categories/",userBookmarkCategorySounds:"/users/<username>/bookmark_categories/<category_id>/sounds/",pack:"/packs/<pack_id>/",packSounds:"/packs/<pack_id>/sounds/",packDownload:"/packs/<pack_id>/download/"},makeUri=function(e,t){for(var n in t)e=e.replace(/<[\w_]+>/,t[n]);return uris.base+e},makeRequest=function(uri,success,error,params,wrapper,method,data,content_type){void 0===method&&(method="GET"),error||(error=function(e){console.log(e)}),params=params||{},params.format="json";var fs=this,parse_response=function(response){var data=eval("("+response+")");success(wrapper?wrapper(data):data)},paramStr="";for(var p in params)paramStr=paramStr+"&"+p+"="+params[p];if(paramStr&&(uri=uri+"?"+paramStr),"undefined"!=typeof module){var http=require("http"),options={host:host,path:uri.substring(uri.indexOf("/",8),uri.length),port:"80",method:method,headers:{Authorization:authHeader},withCredentials:!1},req=http.request(options,function(e){e.on("data",function(t){[200,201,202].indexOf(e.statusCode)>=0?success(wrapper?wrapper(t):t):error(t)
})});req.on("error",error).end()}else{var xhr;try{xhr=new XMLHttpRequest}catch(e){xhr=new ActiveXObject("Microsoft.XMLHTTP")}xhr.onreadystatechange=function(){if(4===xhr.readyState&&[200,201,202].indexOf(xhr.status)>=0){var data=eval("("+xhr.responseText+")");success&&success(wrapper?wrapper(data):data)}else 4===xhr.readyState&&200!==xhr.status&&error&&error(xhr.statusText)},xhr.open(method,uri),xhr.setRequestHeader("Authorization",authHeader),void 0!==content_type&&xhr.setRequestHeader("Content-Type",content_type),xhr.send(data)}},checkOauth=function(){if(-1==authHeader.indexOf("Bearer"))throw"Oauth authentication required"},makeFD=function(e,t){t||(t=new FormData);for(var n in e)t.append(n,e[n]);return t},search=function(e,t,n,i,r){e.analysis_file?makeRequest(makeUri(t),n,i,null,r,"POST",makeFD(e)):makeRequest(makeUri(t),n,i,e,r)},Collection=function(e){var t=function(e,t,n){makeRequest(e,t,n,{},Collection)};return e.nextPage=function(n,i){t(e.next,n,i)},e.previousPage=function(n,i){t(e.previous,n,i)},e.getItem=function(t){return e.results[t]},e},SoundCollection=function(e){var t=Collection(e);return t.getSound=function(e){return new SoundObject(t.results[e])},t},PackCollection=function(e){var t=Collection(e);return t.getPack=function(e){return new PackObject(t.results[e])},t},SoundObject=function(e){return e.getAnalysis=function(t,n,i,r){makeRequest(makeUri(uris.soundAnalysis,[e.id,t?t:""]),n,i)},e.getSimilar=function(t,n,i){makeRequest(makeUri(uris.similarSounds,[e.id]),t,n,i,SoundCollection)},e.getComments=function(t,n){makeRequest(makeUri(uris.comments,[e.id]),t,n,{},Collection)},e.download=function(t){checkOauth();var n=makeUri(uris.download,[e.id]);t.location=n},e.comment=function(t,n,i){checkOauth();var r=new FormData;r.append("comment",comment);var o=makeUri(uris.comment,[e.id]);makeRequest(o,n,i,{},null,"POST",r)},e.rate=function(t,n,i){checkOauth();var r=new FormData;r.append("rating",t);var o=makeUri(uris.rate,[e.id]);makeRequest(o,n,i,{},null,"POST",r)},e.bookmark=function(t,n,i,r){checkOauth();var o=new FormData;o.append("name",t),n&&o.append("category",n);var s=makeUri(uris.bookmark,[e.id]);makeRequest(s,i,r,{},null,"POST",o)},e.edit=function(t,n,i){checkOauth();var r=makeFD(t),o=makeUri(uris.edit,[e.id]);makeRequest(o,n,i,{},null,"POST",r)},e},UserObject=function(e){return e.sounds=function(t,n,i){var r=makeUri(uris.userSounds,[e.username]);makeRequest(r,t,n,i,SoundCollection)},e.packs=function(t,n){var i=makeUri(uris.userPacks,[e.username]);makeRequest(i,t,n,{},PackCollection)},e.bookmarkCategories=function(t,n){var i=makeUri(uris.userBookmarkCategories,[e.username]);makeRequest(i,t,n)},e.bookmarkCategorySounds=function(t,n,i){var r=makeUri(uris.userBookmarkCategorySounds,[e.username]);makeRequest(r,t,n,i)},e},PackObject=function(e){return e.sounds=function(t,n){var i=makeUri(uris.packSounds,[e.id]);makeRequest(i,t,n,{},SoundCollection)},e.download=function(t){checkOauth();var n=makeUri(uris.packDownload,[e.id]);t.location=n},e};return{setToken:function(e,t){authHeader=("oauth"===t?"Bearer ":"Token ")+e},setClientSecrets:function(e,t){clientId=e,clientSecret=t},postAccessCode:function(e,t,n){var i=uris.base+"/oauth2/access_token/",r=new FormData;r.append("client_id",clientId),r.append("client_secret",clientSecret),r.append("code",e),r.append("grant_type","authorization_code"),t||(t=function(e){setToken(e.access_token,"oauth")}),makeRequest(i,t,n,{},null,"POST",r)},textSearch:function(e,t,n,i){t=t||{},t.query=e?e:" ",search(t,uris.textSearch,n,i,SoundCollection)},contentSearch:function(e,t,n){if(!e.target&&!e.analysis_file)throw"Missing target or analysis_file";search(e,uris.contentSearch,t,n,SoundCollection)},combinedSearch:function(e,t,n){if(!(e.target||e.analysis_file||e.query))throw"Missing query, target or analysis_file";search(e,uris.contentSearch,t,n)},getSound:function(e,t,n){makeRequest(makeUri(uris.sound,[e]),t,n,{},SoundObject)},upload:function(e,t,n,i,r){checkOauth();var o=new FormData;o.append("audiofile",e,t),n&&(o=makeFD(n,o)),makeRequest(makeUri(uris.upload),i,r,{},null,"POST",o)},describe:function(e,t,n,i,r,o){checkOauth();var s=makeFD(t);makeRequest(makeUri(uris.upload),r,o,{},null,"POST",s)},getPendingSounds:function(e,t){checkOauth(),makeRequest(makeUri(uris.pending),e,t,{})},me:function(e,t){checkOauth(),makeRequest(makeUri(uris.me),e,t)},getLoginURL:function(){if(void 0===clientId)throw"client_id was not set";var e=makeUri(uris.authorize);return e+="?client_id="+clientId+"&response_type=code"},getLogoutURL:function(){var e=makeUri(uris.logoutAuthorize);return e+="?client_id="+clientId+"&response_type=code"},getUser:function(e,t,n){makeRequest(makeUri(uris.user,[e]),t,n,{},UserObject)},getPack:function(e,t,n){makeRequest(makeUri(uris.pack,[e]),t,n,{},PackObject)}}};"undefined"!=typeof module?module.exports=freesound():"function"==typeof define&&"object"==typeof define.amd?define("freesound",[],freesound):this.freesound=freesound()}()},{http:6}],36:[function(e,t){!function(){function e(e,t){return e=s[e],t=s[t],e.distance>t.distance?t.distance+12-e.distance:t.distance-e.distance}function n(e,t,n){for(;n>0;n--)e+=t;return e}function i(e,t){if("string"!=typeof e)return null;this.name=e,this.duration=t||4,this.accidental={value:0,sign:""};var n=e.match(/^([abcdefgh])(x|#|bb|b?)(-?\d*)/i);if(n&&e===n[0]&&0!==n[3].length)this.name=n[1].toLowerCase(),this.octave=parseFloat(n[3]),0!==n[2].length&&(this.accidental.sign=n[2].toLowerCase(),this.accidental.value=y[n[2]]);else{e=e.replace(/\u2032/g,"'").replace(/\u0375/g,",");var i=e.match(/^(,*)([abcdefgh])(x|#|bb|b?)([,\']*)$/i);if(!i||5!==i.length||e!==i[0])throw Error("Invalid note format");if(""===i[1]&&""===i[4])this.octave=i[2]===i[2].toLowerCase()?3:2;else if(""!==i[1]&&""===i[4]){if(i[2]===i[2].toLowerCase())throw Error("Invalid note format. Format must respect the Helmholtz notation.");this.octave=2-i[1].length}else{if(""!==i[1]||""===i[4])throw Error("Invalid note format");if(i[4].match(/^'+$/)){if(i[2]===i[2].toUpperCase())throw Error("Invalid note format. Format must respect the Helmholtz notation");this.octave=3+i[4].length}else{if(!i[4].match(/^,+$/))throw Error("Invalid characters after note name.");if(i[2]===i[2].toLowerCase())throw Error("Invalid note format. Format must respect the Helmholtz notation");this.octave=2-i[4].length}}this.name=i[2].toLowerCase(),0!==i[3].length&&(this.accidental.sign=i[3].toLowerCase(),this.accidental.value=y[i[3]])}}function r(e,t){if(!(e instanceof i))return null;t=t||"",this.name=e.name.toUpperCase()+e.accidental.sign+t,this.root=e,this.notes=[e],this.quality="major",this.type="major";var n,r,s,a,u,c=[],l=!1,h="quality",p=!1,d=!1,m=null;for(a=0,u=t.length;u>a;a++){for(n=t[a];" "===n||"("===n||")"===n;)n=t[++a];if(!n)break;if(r=n.charCodeAt(0),s=u>=a+3?t.substr(a,3):"","quality"===h)"M"===n||("maj"===s||916===r?(this.type="major",c.push("M7"),l=!0,(t[a+3]&&"7"===t[a+3]||916===r&&"7"===t[a+1])&&a++):"m"===n||"-"===n||"min"===s?this.quality=this.type="minor":111===r||176===r||"dim"===s?(this.quality="minor",this.type="diminished"):"+"===n||"aug"===s?(this.quality="major",this.type="augmented"):216===r||248===r?(this.quality="minor",this.type="diminished",c.push("m7"),l=!0):"sus"===s?(this.quality="sus",this.type=t[a+3]&&"2"===t[a+3]?"sus2":"sus4"):"5"===n?(this.quality="power",this.type="power"):a-=1),s in f&&(a+=2),h="";else if("#"===n)p=!0;else if("b"===n)d=!0;else if("5"===n)p?(m="A5","major"===this.quality&&(this.type="augmented")):d&&(m="d5","minor"===this.quality&&(this.type="diminished")),d=p=!1;else if("6"===n)c.push("M6"),d=p=!1;else if("7"===n)c.push("diminished"===this.type?"d7":"m7"),l=!0,d=p=!1;else if("9"===n)l||c.push("m7"),c.push(d?"m9":p?"A9":"M9"),d=p=!1;else{if("1"!==n)throw Error("Unexpected character: '"+n+"' in chord name");n=t[++a],"1"===n?c.push(d?"d11":p?"A11":"P11"):"3"===n&&c.push(d?"m13":p?"A13":"M13"),d=p=!1}}for(var g=0,y=b[this.type].length;y>g;g++)this.notes.push("5"===b[this.type][g][1]&&m?o.interval(this.root,m):o.interval(this.root,b[this.type][g]));for(g=0,y=c.length;y>g;g++)this.notes.push(o.interval(this.root,c[g]))}var o={},s={c:{name:"c",distance:0,index:0},d:{name:"d",distance:2,index:1},e:{name:"e",distance:4,index:2},f:{name:"f",distance:5,index:3},g:{name:"g",distance:7,index:4},a:{name:"a",distance:9,index:5},b:{name:"b",distance:11,index:6},h:{name:"h",distance:11,index:6}},a=["c","d","e","f","g","a","b"],u={.25:"longa",.5:"breve",1:"whole",2:"half",4:"quarter",8:"eighth",16:"sixteenth",32:"thirty-second",64:"sixty-fourth",128:"hundred-twenty-eighth"},c=[{name:"unison",quality:"perfect",size:0},{name:"second",quality:"minor",size:1},{name:"third",quality:"minor",size:3},{name:"fourth",quality:"perfect",size:5},{name:"fifth",quality:"perfect",size:7},{name:"sixth",quality:"minor",size:8},{name:"seventh",quality:"minor",size:10},{name:"octave",quality:"perfect",size:12},{name:"ninth",quality:"minor",size:13},{name:"tenth",quality:"minor",size:15},{name:"eleventh",quality:"perfect",size:17},{name:"twelfth",quality:"perfect",size:19},{name:"thirteenth",quality:"minor",size:20},{name:"fourteenth",quality:"minor",size:22},{name:"fifteenth",quality:"perfect",size:24}],l={unison:0,second:1,third:2,fourth:3,fifth:4,sixth:5,seventh:6,octave:7,ninth:8,tenth:9,eleventh:10,twelfth:11,thirteenth:12,fourteenth:13,fifteenth:14},f={P:"perfect",M:"major",m:"minor",A:"augmented",d:"diminished",perf:"perfect",maj:"major",min:"minor",aug:"augmented",dim:"diminished"},h={perfect:"P",major:"M",minor:"m",augmented:"A",diminished:"d"},p={P:"P",M:"m",m:"M",A:"d",d:"A"},d={perfect:["diminished","perfect","augmented"],minor:["diminished","minor","major","augmented"]},b={major:["M3","P5"],minor:["m3","P5"],augmented:["M3","A5"],diminished:["m3","d5"],sus2:["M2","P5"],sus4:["P4","P5"],power:["P5"]},m={major:"M",minor:"m",augmented:"aug",diminished:"dim",power:"5"},g={"-2":"bb","-1":"b",0:"",1:"#",2:"x"},y={bb:-2,b:-1,"#":1,x:2};i.prototype={key:function(e){return e?7*(this.octave-1)+3+Math.ceil(s[this.name].distance/2):12*(this.octave-1)+4+s[this.name].distance+this.accidental.value},fq:function(e){return e=e||440,e*Math.pow(2,(this.key()-49)/12)},scale:function(e,t){return o.scale.list(this,e,t)},interval:function(e,t){return o.interval(this,e,t)},chord:function(e){return e=e||"major",e in m&&(e=m[e]),new r(this,e)},helmholtz:function(){var e,t=3>this.octave?this.name.toUpperCase():this.name.toLowerCase();return 2>=this.octave?(e=n("",",",2-this.octave),e+t+this.accidental.sign):(e=n("","'",this.octave-3),t+this.accidental.sign+e)},scientific:function(){return this.name.toUpperCase()+this.accidental.sign+("number"==typeof this.octave?this.octave:"")},enharmonics:function(){var e=[],t=this.key(),n=this.interval("m2","up"),i=this.interval("m2","down"),r=n.key()-n.accidental.value,o=i.key()-i.accidental.value,s=t-r;return 3>s&&s>-3&&(n.accidental={value:s,sign:g[s]},e.push(n)),s=t-o,3>s&&s>-3&&(i.accidental={value:s,sign:g[s]},e.push(i)),e},valueName:function(){return u[this.duration]},toString:function(e){return e="boolean"==typeof e?e:"number"==typeof this.octave?!1:!0,this.name.toLowerCase()+this.accidental.sign+(e?"":this.octave)}},r.prototype.dominant=function(e){return e=e||"",new r(this.root.interval("P5"),e)},r.prototype.subdominant=function(e){return e=e||"",new r(this.root.interval("P4"),e)},r.prototype.parallel=function(e){if(e=e||"","triad"!==this.chordType()||"diminished"===this.quality||"augmented"===this.quality)throw Error("Only major/minor triads have parallel chords");return"major"===this.quality?new r(this.root.interval("m3","down"),"m"):new r(this.root.interval("m3","up"))},r.prototype.chordType=function(){var e,t,n;if(2===this.notes.length)return"dyad";if(3===this.notes.length){t={unison:!1,third:!1,fifth:!1};for(var i=0,r=this.notes.length;r>i;i++)e=this.root.interval(this.notes[i]),n=c[parseFloat(o.interval.invert(e.simple)[1])-1],e.name in t?t[e.name]=!0:n.name in t&&(t[n.name]=!0);return t.unison&&t.third&&t.fifth?"triad":"trichord"}if(4===this.notes.length){t={unison:!1,third:!1,fifth:!1,seventh:!1};for(var i=0,r=this.notes.length;r>i;i++)e=this.root.interval(this.notes[i]),n=c[parseFloat(o.interval.invert(e.simple)[1])-1],e.name in t?t[e.name]=!0:n.name in t&&(t[n.name]=!0);if(t.unison&&t.third&&t.fifth&&t.seventh)return"tetrad"}return"unknown"},r.prototype.toString=function(){return this.name},o.note=function(e,t){return new i(e,t)},o.note.fromKey=function(e){var t=440*Math.pow(2,(e-49)/12);return o.frequency.note(t).note},o.chord=function(e){var t;if(t=e.match(/^([abcdefgh])(x|#|bb|b?)/i),t&&t[0])return new r(new i(t[0].toLowerCase()),e.substr(t[0].length));throw Error("Invalid Chord. Couldn't find note name")},o.frequency={note:function(e,t){t=t||440;var n,r,o,u,c,l,f;return n=Math.round(49+12*((Math.log(e)-Math.log(t))/Math.log(2))),f=t*Math.pow(2,(n-49)/12),l=1200*(Math.log(e/f)/Math.log(2)),r=Math.floor((n-4)/12),o=n-12*r-4,u=s[a[Math.round(o/2)]],c=u.name,o>u.distance?c+="#":u.distance>o&&(c+="b"),{note:new i(c+(r+1)),cents:l}}},o.interval=function(e,t,n){if("string"==typeof t){"down"===n&&(t=o.interval.invert(t));var r=f[t[0]],s=parseFloat(t.substr(1));if(!r||isNaN(s)||1>s)throw Error("Invalid string-interval format");return o.interval.from(e,{quality:r,interval:c[s-1].name},n)}if(t instanceof i&&e instanceof i)return o.interval.between(e,t);throw Error("Invalid parameters")},o.interval.from=function(t,n,r){n.direction=r||n.direction||"up";var o,u,f,h,p,b;if(p=l[n.interval],b=c[p],p>7&&(p-=7),p=s[t.name].index+p,p>a.length-1&&(p-=a.length),o=a[p],-1===d[b.quality].indexOf(n.quality)||-1===d[b.quality].indexOf(b.quality))throw Error("Invalid interval quality");return u=d[b.quality].indexOf(n.quality)-d[b.quality].indexOf(b.quality),f=b.size+u-e(t.name,o),t.octave&&(h=Math.floor((t.key()-t.accidental.value+e(t.name,o)-4)/12)+1+Math.floor(l[n.interval]/7)),f+=t.accidental.value,f>=11&&(f-=12),f>-3&&3>f&&(o+=g[f]),"down"===r&&h--,new i(o+(h||""))},o.interval.between=function(e,t){var n,i,r,o,a,u,l=e.key(),f=t.key();if(n=f-l,n>24||-25>n)throw Error("Too big interval. Highest interval is a augmented fifteenth (25 semitones)");return 0>n&&(o=e,e=t,t=o),r=s[t.name].index-s[e.name].index+7*(t.octave-e.octave),i=c[r],u=d[i.quality][Math.abs(n)-i.size+1],a=h[u]+(""+Number(r+1)),{name:i.name,quality:u,direction:n>0?"up":"down",simple:a}},o.interval.invert=function(e){if(2!==e.length&&3!==e.length)return!1;var t=p[e[0]],n=parseFloat(2===e.length?e[1]:e.substr(1));return n>8&&(n-=7),8!==n&&1!==n&&(n=9-n),t+(""+n)},o.scale={list:function(e,t,n){var r,s,a=[],u=[];if(!(e instanceof i))return!1;if("string"==typeof t&&(t=o.scale.scales[t],!t))return!1;for(a.push(e),n&&u.push(e.name+(e.accidental.sign||"")),r=0,s=t.length;s>r;r++)a.push(o.interval(e,t[r])),n&&u.push(a[r+1].name+(a[r+1].accidental.sign||""));return n?u:a},scales:{major:["M2","M3","P4","P5","M6","M7"],ionian:["M2","M3","P4","P5","M6","M7"],dorian:["M2","m3","P4","P5","M6","m7"],phrygian:["m2","m3","P4","P5","m6","m7"],lydian:["M2","M3","A4","P5","M6","M7"],mixolydian:["M2","M3","P4","P5","M6","m7"],minor:["M2","m3","P4","P5","m6","m7"],aeolian:["M2","m3","P4","P5","m6","m7"],locrian:["m2","m3","P4","d5","m6","m7"],majorpentatonic:["M2","M3","P5","M6"],minorpentatonic:["m3","P4","P5","m7"],chromatic:["m2","M2","m3","M3","P4","A4","P5","m6","M6","m7","M7"],harmonicchromatic:["m2","M2","m3","M3","P4","A4","P5","m6","M6","m7","M7"]}},t.exports=o}()},{}],37:[function(e,t){t.exports=function(t){"use strict";{var n,i=t.dollar;e("gibberish-dsp")}return n={"export":function(e){i.extend(e,n.Busses),i.extend(e,n.Oscillators),i.extend(e,n.Synths),i.extend(e,n.Percussion),i.extend(e,n.Envelopes),i.extend(e,n.FX),i.extend(e,n.Seqs),i.extend(e,n.Samplers),i.extend(e,n.PostProcessing),i.extend(e,n.Vocoder),e.Theory=n.Theory,i.extend(e,n.Analysis),e.Score=n.Score,e.Clock=n.Clock,e.Seq=n.Seqs.Seq,e.Arp=n.Arp,e.ScaleSeq=n.Seqs.ScaleSeq,e.SoundFont=n.SoundFont,e.Speak=n.Speak,e.Additive=n.Additive,e.Ugen=n.Ugen,e.Rndi=n.Core.Rndi,e.Rndf=n.Core.Rndf,e.rndi=n.Core.rndi,e.rndf=n.Core.rndf,e.Input=n.Input,e.Freesound=n.Freesound2,e.Freesound2=n.Freesound2,e.Freesoundjs2=n.Freesoundjs2,e.Scale=n.Theory.Scale,e.Ensemble=n.Ensemble,e.module=t.import,n.Core.Time.export(e),n.Clock.export(e),n.Core.Binops.export(e),e.Master=n.Master},init:function(){var e=null;n.onstart&&(e=n.onstart),n.context||(n.context={sampleRate:44100}),n.Core.onstart=function(){n.Clock.start(!0),null!==e&&e()},n.Score=n.Score(t),n.Additive=n.Additive(t),t.Clock=n.Clock,t.Theory=n.Theory,t.Theory.scale=t.scale=t.Audio.Theory.Scale("c4","Minor"),n.Core._init(),i.extend(t.Binops,n.Binops),n.Master=n.Busses.Bus().connect(n.Core.out),n.Master.type="Bus",n.Master.name="Master",i.extend(!0,n.Master,n.ugenTemplate),n.Master.fx.ugen=n.Master,n.ugenTemplate.connect=n.Core._oscillator.connect=n.Core._synth.connect=n.Core._effect.connect=n.Core._bus.connect=n.connect,n.Core.defineUgenProperty=n.defineUgenProperty,i.extend(t.Presets,n.Synths.Presets),i.extend(t.Presets,n.Percussion.Presets),i.extend(t.Presets,n.FX.Presets)},Time:{ms:function(e){return{mode:"absolute",value:t.Audio.Core.context.sampleRate/1e3*e,valueOf:function(){return this.value}}},seconds:function(e){return{mode:"absolute",value:t.Audio.Core.context.sampleRate*e,valueOf:function(){return this.value}}},minutes:function(e){return{mode:"absolute",value:60*t.Audio.Core.context.sampleRate*e,valueOf:function(){return this.value}}}},defineUgenProperty:function(e,t,i){var r=n.Clock.timeProperties.indexOf(e)>-1,o=i.properties[e]={value:r?n.Clock.time(t):t,binops:[],parent:i,name:e},s=e.charAt(0).toUpperCase()+e.slice(1);Object.defineProperty(i,e,{configurable:!0,get:function(){return o.value},set:function(e){return i[s]&&i[s].mapping&&i[s].mapping.remove&&i[s].mapping.remove(!0),o.value=r?n.Clock.time(e):e,n.Core.dirty(i),o.value}}),i[e]=o.value},polyInit:function(e){e.mod=e.polyMod,e.removeMod=e.removePolyMod;for(var t in e.polyProperties)!function(t){var i=e.polyProperties[t],r=n.Clock.timeProperties.indexOf(t)>-1;Object.defineProperty(e,t,{get:function(){return i},set:function(i){for(var o=0;o<e.children.length;o++)e.children[o][t]=r?n.Clock.time(i):i}})}(t)},connect:function(e,t){return"undefined"==typeof e&&(e=n.Master),-1===this.destinations.indexOf(e)&&(e.addConnection(this,1,t),0!==t&&this.destinations.push(e)),this},clear:function(){for(var e=Array.prototype.slice.call(arguments,0),i=n.Theory.scale.seq.isConnected,r=0;r<n.Master.inputs.length;r++)-1===e.indexOf(n.Master.inputs[r].value)&&n.Master.inputs[r].value.disconnect();n.Master.inputs.length=arguments.length,n.Clock.shouldResetOnClear!==!1&&n.Clock.reset(),n.Master.fx.remove(),n.Master.amp=1,n.Core.clear(),n.Clock.seq.connect(),i&&(t.Theory.scale=t.scale=t.Audio.Theory.Scale("c4","Minor")),n.Core.out.addConnection(n.Master,1),n.Master.destinations.push(n.Core.out),console.log("Audio stopped.")},ugenTemplate:{sequencers:[],mappings:[],fx:i.extend([],{add:function(){var e=0===this.length?this.ugen:this[this.length-1];e.disconnect();for(var t=0;t<arguments.length;t++){var i=arguments[t];i.input=e,e=i,this.push(i)}return this.ugen!==n.Master?e.connect():e.connect(n.Core.out),this.ugen},remove:function(){if(arguments.length>0)for(var e=0;e<arguments.length;e++){var t=arguments[e];if("string"!=typeof t)if("object"!=typeof t){if("number"==typeof t){var i=this[t];if(i.disconnect(),this.splice(t,1),"undefined"!=typeof this[t]){var r=t-1;this[t].input=-1!==r?this[r]:this.ugen,"undefined"!=typeof this[t+1]?this[t+1].input=0===t?this.ugen:this[t]:this.ugen.connect(this.ugen!==n.Master?n.Master:n.Core.out)}else this.length>0?this[t-1].connect(n.Master):this.ugen.connect(this.ugen!==n.Master?n.Master:n.Core.out)}}else for(var o=0;o<this.length;o++)this[o]===t&&this.remove(o);else for(var o=0;o<this.length;o++)this[o].name===t&&this.remove(o)}else this.length>0?(this[this.length-1].disconnect(),this.ugen.connect(this.ugen!==n.Master?n.Master:n.Core.out),this.ugen.codegen(),this.length=0):console.log(this.ugen.name+" does not have any fx to remove. ")}}),replaceWith:function(e){if(e.connect){for(var t=0;t<this.destinations.length;t++)e.connect(this.destinations[t]);for(var t=0;t<this.sequencers.length;t++)this.sequencers[t].target=e,e.sequencers.push(this.sequencers[t]);for(var t=0;t<this.mappingObjects.length;t++){var n=this.mappingObjects[t];if(n.targets.length>0)for(var i=0;i<n.targets.length;i++){var r=n.targets[i];e.mappingProperties[n.name]?r[0].mapping.replace(e,n.name,n.Name):r[0].mapping.remove()}}}this.kill()},kill:function(){var e=0!==this.fx.length?this.fx[this.fx.length-1]:this;this.seq.isRunning&&this.seq.disconnect(),e.disconnect();for(var t=0;t<this.fx.length;t++){var n=this.fx[t];n.seq.isRunning&&n.seq.disconnect()}this.disconnect();for(var t=0;t<this.mappings.length;t++)this.mappings[t].remove();this.clearMarks&&this.clearMarks(),console.log(this.name+" has been terminated.")},play:function(e,t){return this.note?this.note.seq(e,t):this.frequency&&this.frequency.seq(e,t),this},fadeIn:function(e,t){isNaN(t)&&(t=1);var i=n.Clock.time(e),r=(new n.Core.ExponentialDecay({decayCoefficient:.05,length:i}),new n.Core.Line(0,t,i));return this.amp=r,future(function(){this.amp=t}.bind(this),i),this},fadeOut:function(e){var i=n.Clock.time(e),r=t.Audio.Envelopes.Curve(0,1,i,.05,.95,!1);return this.amp=n.Core.Binops.Mul(this.amp.oldGetter(),r),future(function(){this.amp=0}.bind(this),i),this},fadeOut2:function(e){var i=n.Clock.time(e),r=t.Audio.Envelopes.Curve(0,1,i,.05,.95,!1);return this.amp=n.Core.Binops.Mul(this.amp.oldGetter(),r),future(function(){this.amp=0,this.kill()}.bind(this),i),this}}},n.Core=e("gibberish-dsp"),n.Core._init=n.Core.init.bind(n.Core),delete n.Core.init,n.Clock=e("./audio/clock")(t),n.Freesoundjs=e("../external/freesound"),n.Freesound=e("./audio/gibber_freesound")(n.Freesoundjs),n.Freesoundjs2=e("../external/freesound2"),n.Freesound2=e("./audio/gibber_freesound2")(n.Freesoundjs2),n.Seqs=e("./audio/seq")(t),n.Theory=e("./audio/theory")(t),n.FX=e("./audio/fx")(t),n.Oscillators=e("./audio/oscillators")(t),n.Synths=e("./audio/synths")(t),n.Busses=e("./audio/bus")(t),n.Analysis=e("./audio/analysis")(t),n.Envelopes=e("./audio/envelopes")(t),n.Percussion=e("./audio/drums")(t),n.Input=e("./audio/audio_input")(t),n.Samplers=e("./audio/sampler")(t),n.Vocoder=e("./audio/vocoder")(t),n.PostProcessing=e("./audio/postprocessing")(t),n.Arp=e("./audio/arp")(t),n.SoundFont=e("./audio/soundfont")(t),n.Score=e("./audio/score"),n.Ensemble=e("./audio/ensemble")(t),n.Ugen=e("./audio/ugen")(t),n.Additive=e("./audio/additive"),n}},{"../external/freesound":34,"../external/freesound2":35,"./audio/additive":38,"./audio/analysis":39,"./audio/arp":40,"./audio/audio_input":41,"./audio/bus":42,"./audio/clock":43,"./audio/drums":44,"./audio/ensemble":45,"./audio/envelopes":46,"./audio/fx":47,"./audio/gibber_freesound":48,"./audio/gibber_freesound2":49,"./audio/oscillators":50,"./audio/postprocessing":51,"./audio/sampler":52,"./audio/score":53,"./audio/seq":54,"./audio/soundfont":55,"./audio/synths":56,"./audio/theory":57,"./audio/ugen":58,"./audio/vocoder":59,"gibberish-dsp":33}],38:[function(e,t){t.exports=function(e){var t=e.Audio.Ugen({name:"additive",inputs:{frequency:{min:50,max:3e3,"default":440},amp:{min:0,max:1,"default":.5}},callback:function(e,t){{var n,i=this.sines;this.harmonics}this.out=0;for(var r=0,o=i.length;o>r;r++)n=i[r],this.out+=n(e*n.harmonic,n.amp);return this.out*t},init:function(){this.sines=[];for(var t=0,n=0;t<this.harmonics.length/2;t++,n+=2){this.sines[t]=e.Audio.Oscillators.Sine(440,1)._.callback,this.sines[t].harmonic=this.harmonics[n],this.sines[t].amp=this.harmonics[n+1]}this.out=0,console.log(this.sines)}});return t}},{}],39:[function(e,t){t.exports=function(t){"use strict";var n,i={value:{min:0,max:255,output:a,wrap:!1,timescale:"graphics"}},r=e("gibberish-dsp"),o=t.dollar,s=t.outputCurves,a=(s.LINEAR,s.LOGARITHMIC),u={FFT:function(e,s){if("undefined"==typeof n){n=r.context.createAnalyser(),r.node.connect(n),n.fftSize=e||32,n.updateRate=s||40,n.values=new Uint8Array(n.frequencyBinCount),n.children=[];for(var a=0;a<n.frequencyBinCount;a++)!function(){var e=a,r={},s=0;Object.defineProperties(r,{value:{configurable:!0,get:function(){return s},set:function(e){s=e}}}),t.createProxyProperties(r,o.extend({},i),!1),n[e]=r,n.children.push(r),r.type="mapping",r.index=e,r.min=0,r.max=255,r.valueOf=function(){return this.value.value}}();n.low={_value:0},n.mid={_value:0},n.high={_value:0};var u=["low","mid","high"];u.forEach(function(e){n[e]._value=0,Object.defineProperty(n[e],"value",{configurable:!0,get:function(){return n[e]._value},set:function(t){n[e]._value=t}}),t.createProxyProperties(n[e],o.extend({},i),!1),n[e].type="mapping",n[e].min=0,n[e].max=255,n[e].valueOf=function(){return n[e].value}}),setInterval(function(){n.getByteFrequencyData(n.values);for(var e=0,t=0,i=0,r=0,o=0,s=0,a=0,u=n.values.length;u>a;a++)n[a].value=n.values[a],a>0&&(3>a?(e+=n.values[a],r++):6>a?(t+=n.values[a],o++):(i+=n.values[a],s++));n.low.value=e/r,n.mid.value=t/o,n.high.value=i/s},n.updateRate)}else e&&(n.fftSize=e),s&&(n.updateRate=s);return n},Follow:function(e,n){var i=new r.Follow(e,n),o={value:{min:0,max:1,output:a,timescale:"audio"}};return t.createProxyProperties(i,o),i}};return u}},{"gibberish-dsp":33}],40:[function(e,t){t.exports=function(t){var n,i=e("../../external/teoria.min"),r=t.dollar,o=(t.outputCurves,e("./seq")(t).Seq);return n=function(e,n,s,a,u){var c=o();r.extend(c,{name:"Arp",notes:[],pattern:s||"up",notation:e||"C4m7",mult:a||1,init:!1,speed:isNaN(n)?.25:n,scale:u||null,chord:function(e){var n=[];if(this.notation=e,"undefined"==typeof this.scale||null===this.scale&&"string"==typeof e)for(var r=0;r<this.mult;r++){var o,s,a=[],u=this.notation.slice(0,1);isNaN(this.notation.charAt(1))?(u+=this.notation.charAt(1),o=parseInt(this.notation.slice(2,3)),s=this.notation.slice(3)):(o=parseInt(this.notation.slice(1,2)),s=this.notation.slice(2)),o+=r;for(var e=i.note(u+o).chord(s),c=0;c<e.notes.length;c++){var l=e.notes[c].fq();a[c]=l}n=n.concat(a)}else for(var r=0;r<this.mult;r++){for(var a=[],c=0;c<this.notation.length;c++)a[c]=this.notation[c]+7*r;n=n.concat(a)}this.notes=t.construct(t.Pattern,this.patterns[this.pattern](n)),this.seqs[0]&&(this.seqs[0].values=[this.notes])},set:function(e,t,n,i,r){this.speed=t||this.speed,this.pattern=n||this.pattern,this.mult=i||this.mult,this.chord(e,r)},shuffle:function(){this.notes.shuffle()},reset:function(){this.notes.reset()},patterns:{up:function(e){return e},down:function(e){return e.reverse()},updown:function(e){var t=e.slice(0);return t.reverse(),e.concat(t)},updown2:function(e){var t=e.slice(0);return t.pop(),t.reverse(),t.pop(),e.concat(t)}}}),c.seq=c,t.createProxyMethods(c,["shuffle","reset","chord"]),c.chord(c.notation);var l=null;Object.defineProperty(c,"target",{get:function(){return l},set:function(e){l=e;var i={key:"note",target:l,values:c.notes,durations:t.Clock.time(n)};c.add(i),c.start()}});var f=n;return Object.defineProperty(c,"speed",{get:function(){return f},set:function(e){f=e;for(var n=0;n<c.seqs.length;n++)c.seqs[0].durations=t.Clock.time(f)}}),c}}},{"../../external/teoria.min":36,"./seq":54}],41:[function(e,t){t.exports=function(t){"use strict";var n={},i=e("gibberish-dsp"),r=t.outputCurves,o=r.LINEAR,s=r.LOGARITHMIC,a={amp:{min:0,max:1,hardMax:2,output:s,timescale:"audio",dimensions:1},out:{min:0,max:1,output:o,timescale:"audio",dimensions:1}},u="Input";return n=function(){var e=(new i.Input).connect(t.Master),n=Array.prototype.slice.call(arguments,0);return e.type="Gen",$.extend(!0,e,t.Audio.ugenTemplate),e.fx.ugen=e,Object.defineProperty(e,"_",{get:function(){return e.kill(),e},set:function(){}}),t.createProxyProperties(e,a),t.processArguments2(e,n,u),e.toString=function(){return"> "+u},e}}},{"gibberish-dsp":33}],42:[function(e,t){t.exports=function(t){"use strict";for(var n=t.dollar,i=e("gibberish-dsp"),r=t.outputCurves,o=r.LINEAR,s=(r.LOGARITHMIC,[["Bus2","Bus"]]),a={amp:{min:0,max:1,output:o,timescale:"audio"},pan:{min:-.75,max:.75,output:o,timescale:"audio"},out:{min:0,max:1,output:o,timescale:"audio",dimensions:1}},u=!1,c={mappingProperties:a,Presets:{}},l=0;l<s.length;l++)!function(){var e=Array.isArray(s[l])?s[l][0]:s[l],r=Array.isArray(s[l])?s[l][1]:s[l];c[r]=function(){var o=t.processArguments(arguments,r);return Array.isArray(o)?(o.unshift(0),o=t.construct(i[e],o)):o=new i[e](o),u?o.connect(Master):u=!0,o.type="Gen",Object.defineProperty(o,"_",{get:function(){return o.kill(),o},set:function(){}}),n.extend(!0,o,t.Audio.ugenTemplate),o.fx.ugen=o,t.createProxyProperties(o,a),o.presetInit&&o.presetInit(),o}}();return c.Group=function(){var e=t.processArguments(arguments,"Bus2");e=new i.Bus2,u?e.connect(Master):u=!0,e.type="FX",n.extend(!0,e,t.Audio.ugenTemplate),e.fx.ugen=e,t.createProxyProperties(e,a),n.extend(e,{add:function(){for(var t=0;t<arguments.length;t++)arguments[t].disconnect(),arguments[t].connect(e)},remove:function(){for(var t=0;t<arguments.length;t++)arguments[t].disconnect(e)},free:function(){for(var t=0;t<arguments.length;t++)arguments[t].disconnect(e),arguments[t].connect()}});for(var r=0;r<arguments.length;r++)e.add(arguments[r]);return e},c}},{"gibberish-dsp":33}],43:[function(require,module,exports){!function(){var times=[],$=null,curves=null,LINEAR=null,LOGARITHMIC=null,Gibberish=require("gibberish-dsp"),Gibber,Clock={seq:null,bpm:null,maxMeasures:44,baseBPM:120,metronome:null,currentBeat:0,beatsPerMeasure:4,codeToExecute:[],signature:{lower:4,upper:4},sequencers:[],shouldResetOnClear:!0,timeProperties:["attack","decay","sustain","release","offset","time"],phase:0,"export":function(e){e.beats=Clock.beats,e.Beats=Clock.Beats,e.measures=Clock.measures,e.Measures=Clock.Measures},processBeat:function(){if(Clock.currentBeat=Clock.currentBeat>=Clock.signature.upper?1:Clock.currentBeat+1,1===Clock.currentBeat&&Clock.codeToExecute.length>0){for(var i=0;i<Clock.codeToExecute.length;i++)try{"function"==typeof Clock.codeToExecute[i].function?Clock.codeToExecute[i].function():Gibber.Environment?Gibber.Environment.modes[Clock.codeToExecute[i].cm.doc.mode.name].run(Clock.codeToExecute[i].cm.column,Clock.codeToExecute[i].code,Clock.codeToExecute[i].pos,Clock.codeToExecute[i].cm,!1):eval(Clock.codeToExecute[i].code)}catch(e){console.error("FAILED TO EXECUTE CODE:",Clock.codeToExecute[i].code,e)}Clock.codeToExecute.length=0}null!==Clock.metronome&&Clock.metronome.draw(Clock.currentBeat,Clock.signature.upper),Clock.phase+=Clock.beats(1)},getTimeSinceStart:function(){return Clock.phase+Clock.seq.phase},reset:function(){this.phase=0,this.currentBeat=0,this.rate=1,this.start(!1)},tap:function(){var e=Gibber.Clock.getTimeSinceStart();for(times[2]&&e-times[2]>88200&&(times.length=0),times.unshift(e);times.length>3;)times.pop();if(3===times.length){var t=(times[0]+times[1]-2*times[2])/3,n=44100/t,i=60*n;Gibber.Clock.bpm=i}},start:function(e){var t=0;if(e){$.extend(this,{properties:{rate:1},name:"master_clock",callback:function(e){return t++,e}}),this.__proto__=new Gibberish.ugen,this.__proto__.init.call(this);var n=this.baseBPM;Object.defineProperty(Clock,"bpm",{get:function(){return n},set:function(e){n=e,Clock.rate=n/Clock.baseBPM}}),Object.defineProperty(this,"timeSignature",{configurable:!0,get:function(){return Clock.signature.upper+"/"+Clock.signature.lower},set:function(e){var t=e.split("/");2!==t.length||t[0]===Clock.signature.upper&&t[1]===Clock.signature.lower||(Clock.signature.upper=parseInt(t[0]),Clock.signature.lower=parseInt(t[1]),Clock.currentBeat=1!=Clock.currentBeat?0:1)}}),Gibber.createProxyProperties(this,{rate:{min:.1,max:2,output:LINEAR,timescale:"audio"},bpm:{min:20,max:200,output:LINEAR,timescale:"audio"}}),this.setPhase=function(e){t=e},this.getPhase=function(){return t},Clock.seq=new Gibberish.PolySeq({seqs:[{target:Clock,values:[Clock.processBeat.bind(Clock)],durations:[.25]}],rate:Clock}),Gibber.Audio.Seqs.Seq.children.push(Clock.seq),Clock.seq.connect().start(),Clock.seq.timeModifier=Clock.time.bind(Clock)
}else Clock.seq.setPhase(0),Clock.seq.connect().start()},addMetronome:function(e){this.metronome=e,this.metronome.init()},time:function(e){var t;return t=e<Clock.maxMeasures?Clock.beats(e*Clock.signature.lower):e},Time:function(e){var t;return t=Clock.Beats(e<this.maxMeasures?e*Clock.signature.lower:e)},beats:function(e){var t="undefined"!=typeof Gibberish.context?Gibberish.context.sampleRate:44100,n=Clock.bpm/60,i=t/n;return i*e},Beats:function(e){return Clock.beats.bind(null,e)},measures:function(e){return Clock.beats(e*Clock.signature.upper)},Measures:function(e){return Clock.Beats(e*Clock.signature.upper)}};module.exports=function(e){"use strict";return Gibber=e,$=Gibber.dollar,curves=Gibber.outputCurves,LINEAR=curves.LINEAR,LOGARITHMIC=curves.LOGARITHMIC,Clock}}()},{"gibberish-dsp":33}],44:[function(require,module,exports){module.exports=function(Gibber){"use strict";for(var Percussion={Presets:{}},Gibberish=require("gibberish-dsp"),$=Gibber.dollar,Clock=Gibber.Clock,curves=Gibber.outputCurves,LINEAR=curves.LINEAR,LOGARITHMIC=curves.LOGARITHMIC,types=["Kick","Snare","Hat","Conga","Cowbell","Clave","Tom","Clap"],_mappingProperties={Drums:{pitch:{min:.25,max:4,output:LINEAR,timescale:"audio"},amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},pan:{min:0,max:1,output:LINEAR,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},XOX:{amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},pan:{min:0,max:1,output:LINEAR,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Kick:{amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Snare:{amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},snappy:{min:.25,max:1.5,output:LOGARITHMIC,timescale:"audio"},tune:{min:0,max:2,output:LOGARITHMIC,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Hat:{amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Conga:{amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Cowbell:{out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1},amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"}},Clave:{out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1},amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"}},Tom:{out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1},amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"}},Clap:{out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1},amp:{min:0,max:1,output:LOGARITHMIC,timescale:"audio"}}},i=0;i<types.length;i++)!function(){var e=Array.isArray(types[i])?types[i][0]:types[i],t=Array.isArray(types[i])?types[i][1]:types[i];Percussion[t]=function(){var n,i=Array.prototype.slice.call(arguments);return"object"==typeof i[0]&&"undefined"==typeof i[0].maxVoices?i[0].maxVoices=1:"undefined"==typeof i[0]&&(i[0]={maxVoices:1}),n=Gibber.processArguments(i,t),n=Array.isArray(n)?Gibber.construct(Gibberish[e],n).connect(Gibber.Master):new Gibberish[e](n).connect(Gibber.Master),n.type="Gen",$.extend(!0,n,Gibber.Audio.ugenTemplate),n.fx.ugen=n,n._note=n.note.bind(n),n.note=function(){var e=Array.prototype.splice.call(arguments,0);"string"==typeof e[0]&&(e[0]=Gibber.Theory.Teoria.note(e[0]).fq()),this._note.apply(this,e)},Gibber.createProxyProperties(n,_mappingProperties[t]),Gibber.createProxyMethods(n,["note","send"]),n.toString=function(){return"> "+t},Object.defineProperty(n,"_",{get:function(){return n.kill(),n},set:function(){}}),n}}();return Percussion.Drums=function(_sequence,_timeValue,_amp,_freq){var args=Array.prototype.slice.call(arguments),obj={},props=Gibber.processArguments(args,"Drums");"undefined"==typeof props&&(props={}),$.extend(!0,obj,props),obj=Array.isArray(obj)?Gibber.construct(Gibberish.Bus2,obj).connect(Gibber.Master):new Gibberish.Bus2(obj).connect(Gibber.Master),obj.name="Drums",obj.type="Gen",obj.children=[],$.extend(!0,obj,Gibber.Audio.ugenTemplate),obj.fx.ugen=obj,Object.defineProperty(obj,"_",{get:function(){return obj.kill(),obj},set:function(){}}),obj.kit=Percussion.Drums.kits["default"],"object"==typeof arguments[0]&&arguments[0].kit&&(obj.kit=Percussion.Drums.kits[arguments[0].kit],arguments[0].kit=obj.kit);for(var key in obj.kit){var drum=obj.kit[key],ugen=drum.file?{ugen:new Gibberish.Sampler({file:drum.file,pitch:1,amp:drum.amp}),pitch:drum.pitch,amp:drum.amp}:drum;ugen&&(isNaN(ugen.pitch)&&(ugen.pitch=1),isNaN(ugen.pan)&&(ugen.pan=0),isNaN(ugen.amp)&&(ugen.amp=1),"undefined"==typeof ugen.symbol&&(ugen.symbol=key),obj[key]=ugen,obj[key].ugen.pan=drum.pan,drum.file||drum.ugen.disconnect(),obj[key].ugen.connect(obj),obj[key].fx=obj[key].ugen.fx,obj.children.push(obj[key].ugen))}if(obj.mod=obj.polyMod,obj.removeMod=obj.removePolyMod,obj.connect(),Gibber.createProxyProperties(obj,_mappingProperties.Drums),obj.note=function(e){var t=obj.pitch.value;if($.isArray(e))for(var n=0;n<e.length;n++){var i=e[n];if("string"==typeof i){for(var r in obj.kit)if(i===obj.kit[r].symbol){obj[r].ugen&&obj[r].ugen.note(t,obj[r].amp);break}}else{var o=obj[Object.keys(obj.kit)[i]];o.ugen.note(t.value,o.ugen.amp)}}else if("string"==typeof e){for(var r in obj.kit)if(e===obj.kit[r].symbol){obj[r].file?(obj[r].ugen.note(t,obj[r].amp),obj[r].ugen.pitch=t):(obj[r].ugen.note(obj[r].pitch,obj[r].amp),obj[r].ugen.pitch=t);break}}else{var s=Object.keys(obj.kit),a=Math.abs(e),r=s[a%s.length],o=obj[r];o.ugen.note(t,o.ugen.amp)}},Gibber.createProxyMethods(obj,["note"]),obj.pitch=1,"object"===$.type(props[0])&&(props[0]=props[0].note),"undefined"!=typeof props)switch($.type(props[0])){case"string":for(var notes=props[0],_seqs=[],_durations=[],__durations=[],seqs=notes.split("|"),timeline={},i=0;i<seqs.length;i++){var seq=seqs[i],duration,hasTime=!1,idx=seq.indexOf(",");if(idx>-1){var _value=seq.substr(0,idx),duration=seq.substr(idx+1);duration=eval(duration),hasTime=!0,seq=_value.trim().split("")}else seq=seq.trim().split(""),duration=1/seq.length;if(seq.indexOf(".rnd(")>-1&&(seq=seq.split(".rnd")[0],seq=seq.split("").rnd()),"undefined"!=typeof props[1]){duration=props[1],Array.isArray(duration)||(duration=[duration]);var durationsPattern=Gibber.construct(Gibber.Pattern,duration);if(duration.randomFlag){durationsPattern.filters.push(function(){return[durationsPattern.values[rndi(0,durationsPattern.values.length-1)],1]});for(var i=0;i<duration.randomArgs.length;i+=2)durationsPattern.repeat(duration.randomArgs[i],duration.randomArgs[i+1])}duration=durationsPattern}obj.note.seq(seq,[duration],i)}break;case"object":"string"==typeof props[0].note&&(props[0].note=props[0].note.split("")),props[0].target=obj,props[0].durations=Gibber.Clock.Time(props[0].durations?props[0].durations:1/props[0].note.length),props[0].offset=props[0].offset?Gibber.Clock.time(props[0].offset):0;break;case"function":case"array":var length=props[0].length||props[0].values.length,durations="undefined"!=typeof arguments[1]?arguments[1]:Gibber.Clock.Time(1/length);"function"!=typeof durations&&(durations=Gibber.Clock.Time(durations)),obj.seq.add({key:"note",values:[props[0]],durations:durations,target:obj}),obj.pattern=obj.seq.seqs[obj.seq.seqs.length-1].values[0]}return"undefined"==typeof props&&(props={}),props.pitch&&(obj.pitch=props.pitch),"undefined"!=typeof props.snare&&($.extend(obj.snare.ugen,props.snare),$.extend(obj.snare,props.snare)),"undefined"!=typeof props.kick&&($.extend(obj.kick.ugen,props.kick),$.extend(obj.kick,props.kick)),"undefined"!=typeof props.hat&&($.extend(obj.hat.ugen,props.hat),$.extend(obj.hat,props.hat)),"undefined"!=typeof props.openHat&&($.extend(obj.openHat.ugen,props.openHat),$.extend(obj.openHat,props.openHat)),obj.amp=isNaN(_amp)?1:_amp,obj.seq&&obj.seq.tick&&Gibberish.future(obj.seq.tick,1),obj.start=function(){obj.seq.start(!0)},obj.stop=function(){obj.seq.stop()},obj.shuffle=function(){obj.note.values.shuffle()},obj.reset=function(){obj.seq.reset()},Gibber.createProxyMethods(obj,["play","stop","shuffle","reset","start","send"]),Object.defineProperties(obj,{offset:{get:function(){return obj.seq.offset},set:function(e){obj.seq.offset=Gibber.Clock.time(e)}}}),obj},Percussion.EDrums=function(_sequence,_timeValue,_amp,_freq){var args=Array.prototype.slice.call(arguments),obj={},props=Gibber.processArguments(args,"Drums");$.extend(!0,obj,props),obj=Array.isArray(obj)?Gibber.construct(Gibberish.Bus2,obj).connect(Gibber.Master):new Gibberish.Bus2(obj).connect(Gibber.Master),obj.name="XOX",obj.type="Gen",obj.children=[],$.extend(!0,obj,Gibber.Audio.ugenTemplate),obj.fx.ugen=obj,Object.defineProperty(obj,"_",{get:function(){return obj.kill(),obj},set:function(){}}),obj.pitch=1,obj.kick=Gibber.Audio.Percussion.Kick().disconnect(),obj.snare=Gibber.Audio.Percussion.Snare().disconnect(),obj.hat=Gibber.Audio.Percussion.Hat().disconnect(),obj.kick.connect(obj),obj.snare.connect(obj),obj.hat.connect(obj),obj.children.push(obj.kick,obj.snare,obj.hat),obj.mod=obj.polyMod,obj.removeMod=obj.removePolyMod,obj.set=function(e){obj.seq.note=e.split("")},Gibber.createProxyProperties(obj,_mappingProperties.XOX),obj.start=function(){obj.seq.start(!0)},obj.stop=function(){obj.seq.stop()},obj.shuffle=function(){obj.seq.shuffle()},obj.reset=function(){obj.seq.reset()};var kcd=1,scd=1,hcd=1,kf=null,sf=null,hf=null;if(obj.note=function(e){switch(e){case"x":1===kcd&&(kcd=0),obj.kick.note(),null!==kf&&(kf(),kf=null),kf=Gibber.Utilities.future(function(){kcd=1,kf=null},11e4*obj.kick.decay);break;case"o":1===scd&&(scd=0),obj.snare.note(),null!==sf&&(sf(),sf=null),sf=Gibber.Utilities.future(function(){scd=1,sf=null},obj.snare.decay);break;case"*":1===hcd&&(hcd=0),obj.hat.note(5e3),null!==hf&&(hf(),hf=null),hf=Gibber.Utilities.future(function(){hcd=1,hf=null},5500);break;case"-":1===hcd&&(hcd=0),obj.hat.note(3e4),null!==hf&&(hf(),hf=null),hf=Gibber.Utilities.future(function(){hcd=1,hf=null},30500)}},Gibber.createProxyMethods(obj,["play","stop","shuffle","reset","start","send","note"]),"undefined"!=typeof props)switch($.type(props[0])){case"string":for(var notes=props[0],_seqs=[],_durations=[],__durations=[],seqs=notes.split("|"),timeline={},i=0;i<seqs.length;i++){var seq=seqs[i],duration,hasTime=!1,idx=seq.indexOf(",");if(idx>-1){var _value=seq.substr(0,idx),duration=seq.substr(idx+1);duration=eval(duration),hasTime=!0,seq=_value.trim().split("")}else seq=seq.trim().split(""),duration=1/seq.length;if(seq.indexOf(".rnd(")>-1&&(seq=seq.split(".rnd")[0],seq=seq.split("").rnd()),"undefined"!=typeof props[1]){duration=props[1],Array.isArray(duration)||(duration=[duration]);var durationsPattern=Gibber.construct(Gibber.Pattern,duration);if(duration.randomFlag){durationsPattern.filters.push(function(){return[durationsPattern.values[rndi(0,durationsPattern.values.length-1)],1]});for(var i=0;i<duration.randomArgs.length;i+=2)durationsPattern.repeat(duration.randomArgs[i],duration.randomArgs[i+1])}duration=durationsPattern}obj.note.seq(Gibber.construct(Gibber.Pattern,seq),Gibber.construct(Gibber.Pattern,[duration]),i)}break;case"object":"string"==typeof props[0].note&&(props[0].note=props[0].note.split("")),props[0].target=obj,props[0].durations=Gibber.Clock.Time(props[0].durations?props[0].durations:1/props[0].note.length),props[0].offset=props[0].offset?Gibber.Clock.time(props[0].offset):0,obj.seq=Seq(props[0])}return"undefined"==typeof props&&(props={}),props.pitch&&(obj.pitch=props.pitch),"undefined"!=typeof props.snare&&($.extend(obj.snare.ugen,props.snare),$.extend(obj.snare,props.snare)),"undefined"!=typeof props.kick&&($.extend(obj.kick.ugen,props.kick),$.extend(obj.kick,props.kick)),"undefined"!=typeof props.hat&&($.extend(obj.hat.ugen,props.hat),$.extend(obj.hat,props.hat)),"undefined"!=typeof props.openHat&&($.extend(obj.openHat.ugen,props.openHat),$.extend(obj.openHat,props.openHat)),obj.amp=isNaN(_amp)?1:_amp,obj.seq.tick&&Gibberish.future(obj.seq.tick,1),obj.seq.start(!0),obj.toString=function(){return"EDrums : "+obj.seq.seqs[0].values.join("")},obj},Percussion.XOX=Percussion.EDrums,Percussion.Drums.kits={original:{kick:{file:"resources/audiofiles/kick.wav",symbol:"x",amp:1,pitch:1,pan:0},snare:{file:"resources/audiofiles/snare.wav",symbol:"o",amp:1,pitch:1,pan:.15},hat:{file:"resources/audiofiles/hat.wav",symbol:"*",amp:1,pitch:1,pan:-.1},openHat:{file:"resources/audiofiles/openHat.wav",symbol:"-",amp:1,pitch:1,pan:-.2}},electronic:{kick:{file:"resources/audiofiles/electronic/kick.wav",symbol:"x",amp:1.5,pitch:1,pan:0},snare:{file:"resources/audiofiles/electronic/snare.wav",symbol:"o",amp:1.5,pitch:1,pan:.15},hat:{file:"resources/audiofiles/electronic/hat.wav",symbol:"*",amp:1.5,pitch:1,pan:-.1},openHat:{file:"resources/audiofiles/electronic/openhat.wav",symbol:"-",amp:1.5,pitch:1,pan:-.2}},beatbox:{in_tss:{file:"resources/audiofiles/beatbox/^tss.wav",symbol:"T",amp:1,pitch:1,pan:.1},f:{file:"resources/audiofiles/beatbox/f.wav",symbol:"f",amp:1,pitch:1,pan:-.1},h:{file:"resources/audiofiles/beatbox/h.wav",symbol:"h",amp:1,pitch:1,pan:.1},s:{file:"resources/audiofiles/beatbox/s.wav",symbol:"s",amp:1,pitch:1,pan:-.1},d:{file:"resources/audiofiles/beatbox/d.wav",symbol:"d",amp:1,pitch:1,pan:.8},t:{file:"resources/audiofiles/beatbox/t.wav",symbol:"t",amp:1,pitch:1,pan:.4},k:{file:"resources/audiofiles/beatbox/k.wav",symbol:"k",amp:1,pitch:1,pan:-.1},in_k:{file:"resources/audiofiles/beatbox/^k.wav",symbol:"K",amp:1,pitch:1,pan:-.4},eight:{file:"resources/audiofiles/beatbox/8.wav",symbol:"8",amp:1,pitch:1,pan:-.8},psh:{file:"resources/audiofiles/beatbox/psh.wav",symbol:"p",amp:1,pitch:1,pan:.1},in_p:{file:"resources/audiofiles/beatbox/^p.wav",symbol:"P",amp:1,pitch:1,pan:-.1},pf:{file:"resources/audiofiles/beatbox/pf.wav",symbol:"F",amp:1,pitch:1,pan:.2},phs:{file:"resources/audiofiles/beatbox/phs.wav",symbol:"H",amp:1,pitch:1,pan:-.2},b:{file:"resources/audiofiles/beatbox/b.wav",symbol:"b",amp:1,pitch:1,pan:.3},dot:{file:"resources/audiofiles/beatbox/dot.wav",symbol:".",amp:1,pitch:1,pan:0},duf:{file:"resources/audiofiles/beatbox/duf.wav",symbol:"D",amp:1,pitch:1,pan:-.3},o:{file:"resources/audiofiles/beatbox/o.wav",symbol:"o",amp:1,pitch:1,pan:.6},a:{file:"resources/audiofiles/beatbox/a.wav",symbol:"a",amp:1,pitch:1,pan:.8},u:{file:"resources/audiofiles/beatbox/u.wav",symbol:"u",amp:1,pitch:1,pan:-.8},m:{file:"resources/audiofiles/beatbox/m.wav",symbol:"m",amp:1,pitch:1,pan:-.6},n:{file:"resources/audiofiles/beatbox/n.wav",symbol:"n",amp:1,pitch:1,pan:0}}},Percussion.Drums.kits.default=Percussion.Drums.kits.electronic,Percussion.Drums.makeKit=function(e,t){Percussion.Drums.kits[e]=t},Percussion.Presets.Kick={"short":{decay:.1,amp:.75}},Percussion.Presets.Snare={crack:{snappy:1,offset:.25}},Percussion}},{"gibberish-dsp":33}],45:[function(require,module,exports){module.exports=function(Gibber){"use strict";var Gibberish=require("gibberish-dsp"),$=Gibber.dollar,Clock=Gibber.Clock,curves=Gibber.outputCurves,LINEAR=curves.LINEAR,LOGARITHMIC=curves.LOGARITHMIC,mappingProperties={amp:{min:0,max:1,output:LINEAR,timescale:"audio"},pan:{min:-.75,max:.75,output:LINEAR,timescale:"audio"},out:{min:0,max:1,output:LINEAR,timescale:"audio",dimensions:1}},Ensemble=function(props){var obj=new Gibberish.Bus2(obj).connect(Gibber.Master);obj.name="Ensemble",obj.type="Gen",obj.children=[],$.extend(!0,obj,Gibber.Audio.ugenTemplate),obj.fx.ugen=obj,Object.defineProperty(obj,"_",{get:function(){return obj.kill(),obj},set:function(){}}),Gibber.createProxyProperties(obj,mappingProperties);for(var key in props){var ugenDesc=props[key],ugen=ugenDesc.file?{ugen:new Gibberish.Sampler({file:ugenDesc.file,pitch:1,amp:ugenDesc.amp}),pitch:ugenDesc.pitch,amp:ugenDesc.amp}:ugenDesc;ugen&&(isNaN(ugen.pitch)&&(ugen.pitch=1),isNaN(ugen.pan)&&(ugen.pan=0),isNaN(ugen.amp)&&(ugen.amp=1),"undefined"==typeof ugen.symbol&&(ugen.symbol=key),obj[key]=ugen,obj[key].ugen.pan=ugen.pan,ugenDesc.file||ugen.ugen.disconnect(),obj[key].ugen.connect(obj),obj[key].fx=obj[key].ugen.fx,obj.children.push(obj[key].ugen))}obj.note=function(e){var t=obj.pitch;if("string"==typeof e)for(var n in props){var i=props[n];if(e===i.symbol){i.file?i.ugen.note(t,obj[n].amp):i.ugen.note(i.pitch*t,i.amp);break}}else{var r=Object.keys(obj.kit),o=Math.abs(e),n=r[o%r.length],i=obj[n];i.ugen.note(t,i.ugen.amp)}};var seqNumber;return obj.play=function(pattern){for(var notes=pattern,_seqs=[],_durations=[],__durations=[],seqs=notes.split("|"),timeline={},i=0;i<obj.seq.seqs.length;i++)obj.seq.seqs[i].shouldStop=!0;obj.seq.seqs.length=0;for(var i=0;i<seqs.length;i++){var seq=seqs[i],duration,hasTime=!1,idx=seq.indexOf(",");if(idx>-1){var _value=seq.substr(0,idx),duration=seq.substr(idx+1);duration=eval(duration),hasTime=!0,seq=_value.trim().split("")}else seq=seq.trim().split(""),duration=1/seq.length;if(seq.indexOf(".rnd(")>-1&&(seq=seq.split(".rnd")[0],seq=seq.split("").rnd()),"undefined"!=typeof arguments[1]){duration=arguments[1],Array.isArray(duration)||(duration=[duration]);var durationsPattern=Gibber.construct(Gibber.Pattern,duration);if(duration.randomFlag){durationsPattern.filters.push(function(){return[durationsPattern.values[rndi(0,durationsPattern.values.length-1)],1]});for(var i=0;i<duration.randomArgs.length;i+=2)durationsPattern.repeat(duration.randomArgs[i],duration.randomArgs[i+1])}duration=durationsPattern}obj.seq.add({key:"note",values:Gibber.construct(Gibber.Pattern,seq),durations:Gibber.construct(Gibber.Pattern,[duration]),target:obj}),seqNumber=obj.seq.seqs.length-1,Object.defineProperties(obj.note,{values:{configurable:!0,get:function(){return obj.seq.seqs[seqNumber].values},set:function(e){var t=Gibber.construct(Gibber.Pattern,e);Array.isArray(t)||(t=[t]),obj.seq.seqs[seqNumber].values=t}},durations:{configurable:!0,get:function(){return obj.seq.seqs[seqNumber].durations},set:function(e){Array.isArray(e)||(e=[e]),obj.seq.seqs[seqNumber].durations=e}}})}},obj.pitch=1,obj.seq.start(),obj.connect(),obj};return Ensemble}},{"gibberish-dsp":33}],46:[function(e,t){t.exports=function(t){"use strict";for(var n={},i=e("gibberish-dsp"),r=t.dollar,o=(t.Clock,t.outputCurves),s=o.LINEAR,a=(o.LOGARITHMIC,["Curve","Line","Ease","Lines","AD","ADSR"]),u={Line:{start:{min:0,max:1,output:s,timescale:"audio"},end:{min:0,max:1,output:s,timescale:"audio"},time:{min:0,max:8,output:s,timescale:"audio"}},Lines:{time:{min:0,max:8,output:s,timescale:"audio"}},Ease:{},Curve:{start:{min:0,max:1,output:s,timescale:"audio"},end:{min:0,max:1,output:s,timescale:"audio"},time:{min:0,max:8,output:s,timescale:"audio"},a:{min:0,max:1,output:s,timescale:"audio"},b:{min:0,max:1,output:s,timescale:"audio"}},AD:{attack:{min:0,max:8,output:s,timescale:"audio"},decay:{min:0,max:8,output:s,timescale:"audio"}},ADSR:{attack:{min:0,max:8,output:s,timescale:"audio"},decay:{min:0,max:8,output:s,timescale:"audio"},sustain:{min:0,max:8,output:s,timescale:"audio"},release:{min:0,max:8,output:s,timescale:"audio"}}},c=0;c<a.length;c++)!function(){var e=Array.isArray(a[c])?a[c][0]:a[c],o=Array.isArray(a[c])?a[c][1]:a[c];n[o]=function(){var n,s=Array.prototype.slice.call(arguments,0);return n="object"!=typeof s[0]?new i[e](s[0],s[1],t.Clock.time(s[2]),s[3],s[4],s[5],s[6]):"Lines"===o?new i.Lines(s[0],s[1],s[2]):"Ease"===o?new i.Ease(s[0],s[1],s[2],s[3],s[4]):"Curve"===o?new i.Curve(s[0],s[1],s[2],s[3],s[4],s[5],s[6]):t.construct(i[e],s[0]),n.name=o,r.extend(!0,n,t.Audio.ugenTemplate),t.createProxyProperties(n,u[o]),"Lines"!==o&&t.processArguments2(n,s,n.name),("."===o||"ADSR"===o)&&t.createProxyMethods(n,["run"]),console.log(o+" is created."),n}}();return n}},{"gibberish-dsp":33}],47:[function(e,t){t.exports=function(t){"use strict";var n={Presets:{}},i=e("gibberish-dsp"),r=t.dollar,o=t.outputCurves,s=o.LINEAR,a=o.LOGARITHMIC;i.Gain=function(){i.extend(this,{name:"gain",type:"effect",properties:{input:0,amount:1},callback:function(e,t){return"object"==typeof e?(e[0]*=t,e[1]*=t):e*=t,e}}).init().processProperties(arguments)},i.Gain.prototype=i._effect;for(var u=["Reverb",["StereoReverb","StereoVerb"],"Delay","Flanger","Vibrato","Distortion","Biquad","Gain","Filter24",["RingModulation","RingMod"],["BufferShuffler","Schizo"],["Decimator","Crush"],"Tremolo"],c={Reverb:{roomSize:{min:.5,max:.995,output:s,timescale:"audio"},damping:{min:0,max:1,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},StereoReverb:{roomSize:{min:.5,max:.995,output:s,timescale:"audio"},damping:{min:0,max:1,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Delay:{feedback:{min:0,max:1,output:s,timescale:"audio"},time:{min:50,max:88200,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},RingMod:{frequency:{min:20,max:3e3,output:s,timescale:"audio"},amp:{min:0,max:1,output:s,timescale:"audio"},mix:{min:0,max:1,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Flanger:{rate:{min:.01,max:20,output:a,timescale:"audio"},feedback:{min:0,max:.99,output:s,timescale:"audio"},amount:{min:25,max:300,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Gain:{amount:{min:0,max:1,output:s,timescale:"audio"}},Vibrato:{rate:{min:.2,max:8,output:a,timescale:"audio"},amount:{min:25,max:300,output:s,timescale:"audio"},feedback:{min:.45,max:.55,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Filter24:{cutoff:{min:0,max:.7,output:s,timescale:"audio"},resonance:{min:0,max:5.5,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},LPF:{cutoff:{min:.05,max:.7,output:s,timescale:"audio"},resonance:{min:0,max:5.5,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},HPF:{cutoff:{min:0,max:.7,output:s,timescale:"audio"},resonance:{min:0,max:5.5,output:s,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Crush:{bitDepth:{min:1,max:16,output:s,timescale:"audio"},sampleRate:{min:0,max:1,output:s,timescale:"audio"},amp:{min:0,max:1,output:a,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Schizo:{amp:{min:0,max:1,output:a,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}},Tremolo:{amp:{min:0,max:1,output:a,timescale:"audio"},frequency:{min:.05,max:20,output:a,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}}},l=0;l<u.length;l++)!function(){var e=Array.isArray(u[l])?u[l][0]:u[l],o=Array.isArray(u[l])?u[l][1]:u[l];n[o]=function(){var n,s=Array.prototype.slice.call(arguments,0);return n=new i[e],n.type="FX",n.name=o,r.extend(!0,n,t.Audio.ugenTemplate),t.createProxyProperties(n,c[o]),t.createProxyMethods(n,["send"]),t.processArguments2(n,s,n.name),"Delay"===o&&(n.rate=t.Clock),s.input=0,n.toString=function(){return"> "+o},n.presetInit&&n.presetInit(),n}}();return n.Chorus=function(e,t,n){var i=e||1,r=n||ms(1),o=t||0,s=Flanger(i,o,r,30*ms(1));return s.name="Chorus",s.type="FX",s},n.LPF=function(e,t){var n=isNaN(e)?.2:e,i=isNaN(t)?3.5:t,r=Filter24(n,i,!0);return r.name="LPF",r.type="FX",r},n.HPF=function(e,t){var n=isNaN(e)?.25:e,i=isNaN(t)?3.5:t,r=Filter24(n,i,!0);return r.isLowPass=!1,r.name="HPF",r.type="FX",r},n.Presets.Schizo={sane:{chance:.1,reverseChance:0,pitchChance:.5,mix:.5},borderline:{chance:.1,pitchChance:.25,reverseChance:.5,mix:1},paranoid:{chance:.2,reverseChance:.5,pitchChance:.5,mix:1}},n.Presets.Reverb={space:{roomSize:.99,damping:.23,wet:.75,dry:.25},small:{roomSize:.6,damping:.75,wet:.15,dry:.85},medium:{roomSize:.8,damping:.5,wet:.35,dry:.65},large:{roomSize:.85,damping:.3,wet:.55,dry:.45}},n.Presets.StereoVerb={space:{roomSize:.99,damping:.23,wet:.75,dry:.25},small:{roomSize:.6,damping:.75,wet:.15,dry:.85},medium:{roomSize:.8,damping:.5,wet:.35,dry:.65},large:{roomSize:.85,damping:.3,wet:.55,dry:.45}},n.Presets.Crush={clean:{sampleRate:1,bitDepth:16},dirty:{sampleRate:.25,bitDepth:4},filthy:{sampleRate:.1,bitDepth:2.5}},n}},{"gibberish-dsp":33}],48:[function(e,t){t.exports=function(e){e.apiKey="4287s0onpqpp492n8snr27sp3o228nns".replace(/[a-zA-Z]/g,function(e){return String.fromCharCode(("Z">=e?90:122)>=(e=e.charCodeAt(0)+13)?e:e-26)});var t=function(){var n,i,r=Sampler(),o=arguments[0]||96541,s=null;r.done=function(e){s=e};var a=function(e){Gibber.log(n+" loaded."),Gibber.Audio.Core.context.decodeAudioData(e.response,function(e){t.loaded[n]=e.getChannelData(0),r.buffer=t.loaded[n],r.bufferLength=r.buffer.length,r.isLoaded=!0,r.setBuffer(r.buffer),r.setPhase(r.bufferLength),r.filename=n,r.isPlaying=!0,r.file=n,r.onload&&r.onload(),0!==r.playOnLoad&&r.note(self.playOnLoad),r.send(Master,1),s&&s()},function(e){console.log("Error with decoding audio data"+e.err)})};if("string"==typeof o){var u=o;Gibber.log("searching freesound for "+u),e.search(u,0,"duration:[0.0 TO 10.0]","rating_desc",null,null,null,function(i){if(n=i.sounds[0].original_filename,"undefined"==typeof t.loaded[n]){var o=new XMLHttpRequest;Gibber.log("now downloading "+n+", "+i.sounds[0].duration+" seconds in length"),o.open("GET",i.sounds[0].serve+"?&api_key="+e.apiKey,!0),o.responseType="arraybuffer",o.onload=function(){a(o)},o.send()}else r.buffer=t.loaded[n],r.filename=n,r.bufferLength=r.buffer.length,r.isLoaded=!0,r.end=r.bufferLength,r.setBuffer(r.buffer),r.setPhase(r.bufferLength),r.send(Master,1),s&&s()},function(){displayError("Error while searching...")})}else if("object"==typeof o){var u=o.query,c=o.filter||"",l=o.sort||"rating_desc",f=o.page||0;pick=o.pick||0,Gibber.log("searching freesound for "+u),c+=" duration:[0.0 TO 10.0]",e.search(u,f,c,l,null,null,null,function(u){if(u.num_results>0){var c=0;"number"==typeof o.pick?c=o.pick:"function"==typeof o.pick?c=o.pick():"random"===o.pick&&(c=rndi(0,u.sounds.length)),n=u.sounds[c].original_filename,"undefined"==typeof t.loaded[n]?(i=new XMLHttpRequest,Gibber.log("now downloading "+n+", "+u.sounds[c].duration+" seconds in length"),i.open("GET",u.sounds[c].serve+"?&api_key="+e.apiKey,!0),i.responseType="arraybuffer",i.onload=function(){a(i)},i.send()):(Gibber.log("using exising loaded sample "+n),r.buffer=t.loaded[n],r.bufferLength=r.buffer.length,r.isLoaded=!0,r.end=r.bufferLength,r.setBuffer(r.buffer),r.setPhase(r.bufferLength),r.send(Master,1),s&&s())}else Gibber.log("No Freesound files matched your query.")},function(){console.log("Error while searching...")})}else"number"==typeof o&&(Gibber.log("downloading sound #"+o+" from freesound.org"),e.get_sound(o,function(t){i=new XMLHttpRequest,n=t.original_filename,i.open("GET",t.serve+"?api_key="+e.apiKey,!0),i.responseType="arraybuffer",i.onload=function(){a(i)},i.send()}));return r};return t.loaded={},t}},{}],49:[function(e,t){t.exports=function(e){e.setToken("6a00f80ba02b2755a044cc4ef004febfc4ccd476");var t=function(){var n,i=Sampler(),r=arguments[0]||96541,o=null;i.done=function(e){o=e};var s=function(e){Gibber.log("Freesound file "+n+" loaded."),Gibber.Audio.Core.context.decodeAudioData(e.response,function(e){t.loaded[n]=e.getChannelData(0),i.buffer=t.loaded[n],i.bufferLength=i.buffer.length,i.isLoaded=!0,i.setBuffer(i.buffer),i.setPhase(i.bufferLength),i.filename=n,i.length=i.bufferLength,i.isPlaying=!0,Gibber.Audio.Core.audioFiles[i.filename]=e,i.buffers[i.filename]=e,i.file=n,i.send(Master,1),o&&o()},function(e){console.log("Error with decoding audio data"+e.err)})};if("string"==typeof r){var a=r;Gibber.log("searching freesound for "+a),e.textSearch(a,{page:1},function(r){r=JSON.parse(r),n=r.results[0].name;var a=r.results[0].id;"undefined"==typeof t.loaded[n]?e.getSound(a,function(e){var t=new XMLHttpRequest,n=JSON.parse(e),i=n.previews["preview-hq-mp3"];t.open("GET",i,!0),t.responseType="arraybuffer",t.onload=function(){s(t)},t.send()},null):(i.buffer=t.loaded[n],i.filename=n,i.bufferLength=i.buffer.length,i.isLoaded=!0,i.end=i.bufferLength,i.setBuffer(i.buffer),i.setPhase(i.bufferLength),i.send(Master,1),o&&o())},function(){displayError("Error while searching...")})}else if("object"==typeof r){{var a=r.query,u=r.filter||"";r.sort||"rating_desc",r.page||0}pick=r.pick||0,Gibber.log("Searching freesound for "+a),u+=" duration:[0.0 TO 10.0]",e.textSearch(a,null,function(a){var u=JSON.parse(a);if(u.count>0){var c=0;"number"==typeof r.pick?c=r.pick:"function"==typeof r.pick?c=r.pick():"random"===r.pick&&(c=rndi(0,u.results.length-1));var l=u.results[c];n=l.name;var f=l.id;"undefined"==typeof t.loaded[n]?"undefined"==typeof t.loaded[n]?e.getSound(f,function(e){var t=new XMLHttpRequest,n=JSON.parse(e),i=n.previews["preview-hq-mp3"];t.open("GET",i,!0),t.responseType="arraybuffer",t.onload=function(){s(t)},t.send()},null):(i.buffer=t.loaded[n],i.filename=n,i.bufferLength=i.buffer.length,i.isLoaded=!0,i.end=i.bufferLength,i.setBuffer(i.buffer),i.setPhase(i.bufferLength),i.send(Master,1),o&&o()):(Gibber.log("using exising loaded sample "+n),i.buffer=t.loaded[n],i.bufferLength=i.buffer.length,i.isLoaded=!0,i.end=i.bufferLength,i.setBuffer(i.buffer),i.setPhase(i.bufferLength),i.send(Master,1),o&&o())}else Gibber.log("No Freesound files matched your query.")},function(){console.log("Error while searching...")})}else if("number"==typeof r){Gibber.log("Searching for and downloading sound #"+r+" from Freesound...");var c=n=r;"undefined"==typeof t.loaded[n]?e.getSound(c,function(e){var t=new XMLHttpRequest,n=JSON.parse(e),i=n.previews["preview-hq-mp3"];t.open("GET",i,!0),t.responseType="arraybuffer",t.onload=function(){s(t)},t.send()},null):(i.buffer=t.loaded[n],i.filename=n,i.bufferLength=i.buffer.length,i.isLoaded=!0,i.end=i.bufferLength,i.setBuffer(i.buffer),i.setPhase(i.bufferLength),i.send(Master,1),o&&o())}return i};return t.getSoundByID=function(t){Gibber.log("downloading sound #"+t+" from freesound.org"),e.getSound(t,function(e){var t=JSON.parse(e),n=t.previews["preview-hq-mp3"];filename=t.name,request=new XMLHttpRequest,request.open("GET",n,!0),request.responseType="arraybuffer",request.onload=function(){onload(request)},request.send()},function(e){console.log("ERROR with id",e)})},t.loaded={},t}},{}],50:[function(e,t){t.exports=function(t){"use strict";for(var n=t.dollar,i={Presets:{}},r=e("gibberish-dsp"),o=t.outputCurves,s=o.LINEAR,a=o.LOGARITHMIC,u=["Sine","Triangle","Saw","Square","Noise","PWM"],c={frequency:{min:50,max:3200,hardMin:.01,hardMax:22050,output:a,timescale:"audio",dimensions:1},amp:{min:0,max:1,hardMax:2,output:a,timescale:"audio",dimensions:1},pulsewidth:{min:.01,max:.99,output:s,timescale:"audio",dimensions:1},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1},pan:{min:-1,max:1,output:a,timescale:"audio"},note:{min:50,max:3200,hardMin:.01,hardMax:22050,output:a,timescale:"audio",doNotProxy:!0}},l=0;l<u.length;l++)!function(){var e=Array.isArray(u[l])?u[l][0]:u[l],o=Array.isArray(u[l])?u[l][1]:u[l];i[o]=function(){var i=(new r[e]).connect(t.Master),s=Array.prototype.slice.call(arguments,0);i.type="Gen",n.extend(!0,i,t.Audio.ugenTemplate),i.fx.ugen=i,Object.defineProperty(i,"_",{get:function(){return i.kill(),i},set:function(){}}),"undefined"==typeof i.note&&(i.note=function(e){var t=this.frequency();"number"==typeof t||"function"==typeof t?this.frequency="function"==typeof e?e():e:t[0]=e}),i.name=o,t.createProxyProperties(i,c);var a=["note","send"];return"Sampler"===o&&a.push("pickBuffer"),t.createProxyMethods(i,a),t.processArguments2(i,s,o),i.toString=function(){return"> "+o},i}}();return i.Wavetable=function(e){var i=(new r.Table).connect(t.Master);return e&&i.setTable(e),i.type="Gen",n.extend(!0,i,t.Audio.ugenTemplate),i.fx.ugen=i,Object.defineProperty(i,"_",{get:function(){return i.kill(),i},set:function(){}}),"undefined"==typeof i.note&&(i.note=function(e){var t=this.frequency();"number"==typeof t||"function"==typeof t?this.frequency="function"==typeof e?e():e:t[0]=e}),t.createProxyProperties(i,{frequency:{min:50,max:3200,output:a,timescale:"audio",dimensions:1},amp:{min:0,max:1,output:a,timescale:"audio",dimensions:1},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}}),t.createProxyMethods(i,["note"]),i.toString=function(){return"> Wavetable"
},i},i.Grains=function(){var e,i,o="object"==typeof arguments[0]?arguments[0]:arguments[1],s=o.bufferLength||88200;if(o.input?e=Sampler().record(o.input,s):o.buffer&&(s=o.buffer.length),"string"==typeof arguments[0]){var a=t.Presets.Grains[arguments[0]];"undefined"!=typeof o&&n.extend(a,o),i=new r.Granulator(a)}else i=new r.Granulator(o);return i.loop=function(e,n,o,s){var a=this.position;e=isNaN(e)?.25:e,n=isNaN(n)?.75:n,o=t.Clock.time(isNaN(o)?1:o),s="undefined"==typeof s?!0:s,this.position=new r.Line(e,n,o,s);var u=this;return s===!1&&future(function(){u.position=a},t.Clock.time(o)),i},e?future(function(){i.setBuffer(e.getBuffer()),i.connect(),i.loop(0,1,s),e.disconnect()},s+1):(i.connect(),i.loop(0,1,s)),i.type="Gen",n.extend(!0,i,t.Audio.ugenTemplate),i.fx.ugen=i,Object.defineProperty(i,"_",{get:function(){return i.disconnect(),i},set:function(){}}),i.toString=function(){return"Grains"},i},i.Presets.Grains={tight:{numberOfGrains:10,grainSize:1100,positionMin:-.05,positionMax:.05,speedMin:-.1,speedMax:.1,shouldReverse:!1},cloudy:{numberOfGrains:20,positionMin:-.25,positionMax:.25,speedMin:-.1,speedMax:4,grainSize:4400,shouldReverse:!0},flurry:{speed:2,speedMin:-2,speedMax:2,position:0,positionMin:0,positionMax:0,numberOfGrains:20,grainSize:1100}},i}},{"gibberish-dsp":33}],51:[function(e,t){t.exports=function(e){"use strict";var t,n=function(e,n,i){var r=new XMLHttpRequest;r.open("GET",n,!0),r.responseType="arraybuffer",r.onload=function(){t.context.decodeAudioData(r.response,function(e){i(e)})},r.send()},i=null,r=null,o=null,s=null,a=null,u=e.AudioPostProcessing={initialized:!1,getPostgraph:function(){return s},init:function(){this.initialized||(t=e.Audio.Core,s=[t.node,t.context.destination],this.initialized=!0,$.subscribe("/gibber/clear",u.clear.bind(this)))},clear:function(){this.disconnectGraph(),s=[t.node,t.context.destination],this.connectGraph()},disconnectGraph:function(){for(var e=0;e<s.length-1;e++)s[e].disconnect(s[e+1])},connectGraph:function(){for(var e=0;e<s.length-1;e++)s[e].connect(s[e+1])},insert:function(e,t){if("undefined"!=typeof t){if(!(t>0&&t<s.length-1))return void console.error("Invalid position for inserting into postprocessing graph: ",t);u.disconnectGraph(),s.splice(t,0,e)}else u.disconnectGraph(),s.splice(1,0,e);u.connectGraph()},Compressor:function(e){if(null===i){u.init(),i=t.context.createDynamicsCompressor();var n=i.threshold,r=i.ratio,o=i.attack,s=i.release;Object.defineProperties(i,{threshold:{get:function(){return n.value},set:function(e){n.value=e}},ratio:{get:function(){return r.value},set:function(e){r.value=e}},attack:{get:function(){return o.value},set:function(e){o.value=e}},release:{get:function(){return s.value},set:function(e){s.value=e}}}),u.insert(i,e)}return i},MasterVerb:function(e){return null===a?("undefined"==typeof e&&(e="smallPlate"),a=t.context.createConvolver(),a.impulseName=e,n(t.context,"resources/impulses/"+e+".wav",function(e){a.buffer=e}),t.reverbOut.connect(a),a.gainNode=t.context.createGain(),a.gainNode.connect(t.context.destination),a.connect(a.gainNode),Object.defineProperty(a,"gain",{get:function(){return a.gainNode.gain.value},set:function(e){a.gainNode.gain.value=e}}),a.gain=.2):e!==a.impulseName&&n(t.context,"resources/impulses/"+e+".wav",function(t){a.impulseName=e,a.buffer=t}),a},LowShelf:function(e){if(null===o){o=t.context.createBiquadFilter(),o.type=3,o.frequency.value=220,o.Q.value=0,o.gain.value=6;var n=o.gain,i=o.frequency,r=o.Q;Object.defineProperties(o,{frequency:{get:function(){return i.value},set:function(e){i.value=e}},gain:{get:function(){return n.value},set:function(e){n.value=e}},Q:{get:function(){return r.value},set:function(e){r.value=e}}}),u.insert(o,e)}return o},HiShelf:function(e){if(null===r){r=t.context.createBiquadFilter(),r.type=4,r.frequency.value=880,r.Q.value=0,r.gain.value=6;var n=r.gain,i=r.frequency,o=r.Q;Object.defineProperties(r,{frequency:{get:function(){return i.value},set:function(e){i.value=e}},gain:{get:function(){return n.value},set:function(e){n.value=e}},Q:{get:function(){return o.value},set:function(e){o.value=e}}}),u.insert(r,e)}return r}};return u}},{}],52:[function(e,t){t.exports=function(t){"use strict";var n={Presets:{}},i=e("gibberish-dsp"),r=t.dollar,o=e("./clock")(t),s=t.outputCurves,a=s.LINEAR,u=s.LOGARITHMIC,c={amp:{min:0,max:1,hardMax:2,output:u,timescale:"audio",dimensions:1},start:{min:0,max:1,output:a,timescale:"audio",dimensions:1},end:{min:0,max:1,output:a,timescale:"audio",dimensions:1},pitch:{min:1,max:4,hardMin:.01,hardMax:20,output:u,timescale:"audio"},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1},pan:{min:-1,max:1,output:u,timescale:"audio"},note:{min:.1,max:4,output:u,timescale:"audio",doNotProxy:!0}};return n.Sampler=function(){var e,n,o=Array.prototype.slice.call(arguments,0),s=o[0]&&o[0].file?o[0].file:void 0,a="Sampler";o[0]&&o[0].buffer&&(n=o[0].buffer),e=n?new i.Sampler({buffer:n}).connect(t.Master):new i.Sampler(s).connect(t.Master),e.type="Gen",r.extend(!0,e,t.Audio.ugenTemplate),e.fx.ugen=e,Object.defineProperty(e,"_",{get:function(){return e.kill(),e},set:function(){}}),"undefined"==typeof e.note&&(e.note=function(e){var t=this.frequency();"number"==typeof t||"function"==typeof t?this.frequency="object"==typeof e?e.value:e:t[0]=e});var u=e.__lookupSetter__("start").bind(e),l=0;Object.defineProperty(e,"start",{configurable:!0,get:function(){return l},set:function(e){return l="number"==typeof e?e:e,u(l),l}});var f=e.__lookupSetter__("end").bind(e),h=1;Object.defineProperty(e,"end",{configurable:!0,get:function(){return h},set:function(e){return h="number"==typeof e?e:e,f(h),h}}),t.createProxyProperties(e,c);var p=["note","pickBuffer","switchBuffer","range"];return t.createProxyMethods(e,p),t.processArguments2(e,o,a),e.toString=function(){return a},e},i.Sampler.prototype.readFile=function(e){var t=this;if(e.isFile)return void e.file(function(e){t.readFile(e)});var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){i.context.decodeAudioData(n.result,function(n){var r=n.getChannelData(0);t.setBuffer(r),t.length=r.length,t.buffers[e.name]=r,t.isPlaying=!0,i.audioFiles[e.name]=r,t.onload&&t.onload(),0!==t.playOnLoad&&t.note(t.playOnLoad),t.isLoaded=!0})}},i.Sampler.prototype.ondrop=function(e){for(var t=0;t<e.length;t++)!function(n){{var i,r=e[t];new FileReader}if(i=r.webkitGetAsEntry?r.webkitGetAsEntry():r,i.isDirectory){var o=i.createReader();o.readEntries(function(e){for(var t=e.length;t--;)n.readFile(e[t])})}else n.readFile(i)}(this)},i.Sampler.prototype.pickBuffer=function(){this.switchBuffer(rndi(0,this.getNumberOfBuffers()))},i.Sampler.prototype.record=function(e,n){this.isRecording=!0,console.log("starting recording");var r=this;return this.recorder=new i.Record(e,t.Clock.time(n),function(){console.log("recording finished"),r.setBuffer(this.getBuffer()),r.length=r.getBuffer().length,r.setPhase(r.length),r.isRecording=!1}).record(),this},i.Sampler.prototype.done=function(e){return this.onload=e,this},i.Sampler.prototype.load=function(e){function n(e,n){t.Audio.Core.context.decodeAudioData(e,function(e){var t=e.getChannelData(0);o.length=t.length,o.setPhase(o.length),o.setBuffer(t),o.isPlaying=!0,o.buffers[n]=t,o.file=n,i.audioFiles[n]=t,o.onload&&o.onload(),0!==o.playOnLoad&&o.note(o.playOnLoad),o.isLoaded=!0},function(e){console.log("Error decoding file",e)})}var n,r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){n(this.response,e)},r.send(),r.onerror=function(e){console.error("Sampler file loading error",e)};var o=this;return this},i.Sampler.prototype.loadDir=function(e){function t(e,t){for(var n=r(e),o=r(n).find("a"),s=0;s<o.length;s++){var a=o[s],u=a.href.split("/"),c=u[u.length-1];""!==c&&".DS_Store"!==c&&"node-ecstatic"!==c&&i.load(t+"/"+c)}}var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="html",n.onload=function(){t(this.response,e)},n.send(),console.log("now loading directory",e),n.onerror=function(e){console.error("Error loading directory",e)};var i=this;return this},n.Looper=function(e,n,i){var s=Bus();r.extend(s,{children:[],input:e,length:o.time(n),numberOfLoops:i,pitch:1,currentLoop:0,loop:function(){s.children[s.currentLoop].record(s.input,s.length);var e={target:s.children[s.currentLoop],durations:s.length,key:"note",values:[1]};return s.seq.add(e),s.seq.start(),future(s.nextLoop,n),s},nextLoop:function(){s.children[++s.currentLoop].record(s.input,s.length),s.currentLoop<s.numberOfLoops-1&&future(s.nextLoop,n);var e={target:s.children[s.currentLoop],durations:s.length,key:"note",values:[1]};s.seq.add(e)}});var a=1;Object.defineProperty(s,"pitch",{configurable:!0,get:function(){return a},set:function(e){a=e;for(var t=0;t<s.children.length;t++)s.children[t].pitch=a}});for(var u=0;i>u;u++)s.children.push(Sampler({pitch:s.pitch})._),s.children[u].send(s,1);return t.createProxyProperties(s,{pitch:c.pitch}),s.stop=function(){s.seq.stop()},s.play=function(){s.seq.start()},s},n}},{"./clock":43,"gibberish-dsp":33}],53:[function(e,t){t.exports=function(t){"use strict";var n=e("gibberish-dsp"),i=t.dollar,r={start:function(){return this.codeblock||this.connect(),this.isPaused=!1,this},stop:function(){return this.isPaused=!0,this},loop:function(e){return this.loopPause=e||0,this.shouldLoop=!this.shouldLoop,this},pause:function(){return this.isPaused=!0,this},next:function(){return this.codeblock||this.connect(),this.isPaused=!1,this}},o=new n.ugen;i.extend(o,r);var s=function(e,n){if(!(this instanceof s)){var r=Array.prototype.slice.call(arguments,0);return t.construct(s,r)}"undefined"==typeof n&&(n={}),this.timeline=[],this.schedule=[],this.shouldLoop=!1,this.loopPause=0;for(var o=0;o<e.length;o+=2)this.schedule.push(e[o]),this.timeline.push(e[o+1]);var a=0,u=0,c=this.timeline,l=this.schedule,f=this,h=function(){f.nextTime=a=0,u=-1,f.timeline.pop()};i.extend(this,{properties:{rate:1,isPaused:!0,nextTime:0},name:"score",getIndex:function(){return u},callback:function(e,t,n){if(!t){if(a>=n&&u<c.length){var i=c[u],r=!0;if(u++,u<=c.length-1){var o=l[u];"number"==typeof o&&o!==s.wait?f.nextTime=a+o:o===s.wait?f.isPaused=!0:o.owner instanceof s&&(f.isPaused=!0,o.owner.oncomplete.listeners.push(f))}else f.shouldLoop?(c[c.length-1]!==h&&c.push(h),f.nextTime=a+f.loopPause):f.isPaused=!0,f.oncomplete();r&&i&&(i instanceof s?i.codeblock?i.rewind().next():(i.start(),console.log("STARTING SCORE")):i())}a+=e}return 0},rewind:function(){return a=u=0,this.nextTime=this.schedule[0],this},oncomplete:function(){for(var e=this.oncomplete.listeners,t=e.length-1;t>=0;t--){var n=e[t];n instanceof s&&n.next()}}}),this.oncomplete.listeners=[],this.oncomplete.owner=this,this.init(),this.nextTime=this.schedule[0];var p=this.rate,d=this.__lookupSetter__("rate");Object.defineProperty(this,"rate",{get:function(){return p},set:function(e){p=Mul(t.Clock,e),d.call(this,p)}}),this.rate=this.rate,t.createProxyProperties(this,{rate:{min:.1,max:2,output:0,timescale:"audio"}})};return s.prototype=o,s.wait=-987654321,s.combine=function(){for(var e=[0,arguments[0]],t=1;t<arguments.length;t++){var n=2*t,i=n+1,r=n-1;e[n]=e[r].oncomplete,e[i]=arguments[t]}return s(e)},s}},{"gibberish-dsp":33}],54:[function(e,t){t.exports=function(t){var n=e("gibberish-dsp"),i=t.dollar,r=["durations","target","scale","offset","doNotStart","priority"],o=function(){var e,s={},a=[];if("object"!=typeof arguments[0]||Array.isArray(arguments[0]))("function"==typeof arguments[0]||Array.isArray(arguments[0]))&&(s.seqs=[{key:"functions",values:Array.isArray(arguments[0])?arguments[0]:[arguments[0]],durations:t.Clock.time(arguments[1])}],("function"==typeof arguments[1]||Array.isArray(arguments[1]))&&(s.seqs[0].durations=arguments[1]),a.push("functions"));else{var u=arguments[0],c=(typeof u.durations,typeof u.target,u.priority);if(s.target=u.target,"object"==typeof u.scale&&(s.scale=u.scale),"number"==typeof u.offset&&(s.offset=t.Clock.time(u.offset)),s.durations=u.durations,s.keysAndValues={},s.seqs=[],s.autofire=[],s.durations){Array.isArray(s.durations)||(s.durations=[s.durations]);var l=t.construct(t.Pattern,s.durations);if(s.durations.randomFlag){l.filters.push(function(){var e=t.Utilities.rndi(0,l.values.length-1);return[l.values[e],1,e]});for(var f=0;f<s.durations.randomArgs.length;f+=2)l.repeat(s.durations.randomArgs[f],s.durations.randomArgs[f+1])}}for(var h in u)!function(){var n=h;if(-1===r.indexOf(n)){var i,o=Array.isArray(u[n]),f={key:n,target:s.target,durations:l};if(o?i=t.construct(t.Pattern,u[n]):"undefined"!=typeof u[n]&&(i=t.construct(t.Pattern,[u[n]])),u[n].randomFlag){i.filters.push(function(){var e=t.Utilities.rndi(0,i.values.length-1);return[i.values[e],1,e]});for(var p=0;p<u[n].randomArgs.length;p+=2)i.repeat(u[n].randomArgs[p],u[n].randomArgs[p+1])}f.values=i,f.stop=function(){f.shouldStop=!0},f.start=function(){f.shouldStop=!1,e.timeline[0]=[f],e.nextTime=0,e.isRunning||e.start(!1,c)},f.repeat=function(e){var t=0,n=function(n,i){return n[2]%(i.getLength()-1)===0&&0!==n[2]&&(t++,t===e&&i.seq.stop()),n};i.filters.push(n)},i.seq=f,s.seqs.push(f),a.push(n)}}();if("scale"in s){var p=(a.indexOf("note"),a.indexOf("chord"));if(p>-1){var d=i.extend([],s.seqs[p]),b=0;s.seqs[p]=[function(){var e,t=[];return e="function"==typeof d.pick?d[d.pick()]:"function"==typeof d[b]?d[b]():d[b++],t=s.scale.chord(e),b>=d.length&&(b=0),t}]}}}e=new n.PolySeq(s),e.timeModifier=t.Clock.time.bind(t.Clock),e.name="Seq",e.save={},e.oldShuffle=e.shuffle,delete e.shuffle,e.rate=t.Clock;var m=e.__lookupSetter__("rate"),g=e.rate;Object.defineProperty(e,"rate",{get:function(){return g},set:function(n){g=Mul(t.Clock,n),m.call(e,g)}});var y=e.nextTime,v=e.__lookupSetter__("nextTime");Object.defineProperty(e,"nextTime",{get:function(){return y},set:function(e){y=t.Clock.time(e),v(y)}});var x=e.offset;Object.defineProperty(e,"offset",{get:function(){return x},set:function(t){x=t,e.nextTime+=x}}),e.nextTime+=e.offset;for(var f=0;f<a.length;f++)!function(e){var t=a[f],n=f;Object.defineProperty(e,t,{get:function(){return e.seqs[n].values},set:function(t){e.seqs[n].values=t}})}(e);var k=l;return Object.defineProperty(e,"durations",{get:function(){return k},set:function(t){k=t;for(var n=0;n<e.seqs.length;n++){var i=e.seqs[n];i.durations=k}}}),arguments[0]&&!arguments[0].doNotStart&&e.start(!0),e.toString=function(){return"> Seq"},e.gibber=!0,i.extend(e,{constructor:o,replaceWith:function(){this.kill()},kill:function(){this.target&&this.target.sequencers&&this.target.sequencers.splice(this.target.sequencers.indexOf(this),1),console.log("SEQ KILL",this),this.stop().disconnect(),o.children.splice(o.children.indexOf(this),1)},applyScale:function(){},once:function(){return this.repeat(1),this},reset:function(){for(var e=0;e<this.seqs.length;e++)this.seqs[e].values[0].reset()},shuffle:function(){for(var e=0;e<this.seqs.length;e++)this.seqs[e].values[0].shuffle()}}),o.children.push(e),e};o.children=[];var s=function(){var e,n=arguments[0];return n.root=n.root||"c4",n.mode=n.mode||"aeolian",e=t.Theory.Scale(n.root,n.mode),delete n.root,delete n.mode,n.scale=e,o(n)},a={Seq:o,ScaleSeq:s};return a}},{"gibberish-dsp":33}],55:[function(e,t){t.exports=function(t,n){var i,r=e("gibberish-dsp"),o=t.outputCurves,s=e("./theory")(t).Teoria,a=o.LINEAR,u=o.LOGARITHMIC,c={amp:{min:0,max:1,hardMax:2,output:u,timescale:"audio",dimensions:1},loudness:{min:0,max:1,hardMax:2,output:u,timescale:"audio",dimensions:1},pan:{min:-1,max:1,output:a,timescale:"audio",dimensions:1}},l=function(e,t){return e*Math.pow(2,t/1200)};i={piano:"acoustic_grand_piano",guitar:"electric_guitar_clean",bass:"acoustic_bass",organ:"rock_organ",brass:"synth_brass_1",strings:"synth_strings_1",choir:"choir_aahs"};var f=function(e){var n,o=f.path;return t.Environment&&t.Environment.Storage.values.soundfonts&&t.Environment.Storage.values.soundfonts[e]&&(o=t.Environment.Storage.values.soundfonts[e]),i[e]&&(e=i[e]),n=new r.SoundFont(arguments[0],o).connect(t.Master),$.extend(!0,n,t.Audio.ugenTemplate),n.fx.ugen=n,n.chord=t.Theory.chord,Object.defineProperty(n,"_",{get:function(){return n.kill(),n},set:function(){}}),n.onload=function(){if(t.Environment&&t.Environment.Storage.values.saveSoundFonts){if(t.Environment.Storage.values.soundfonts){if(t.Environment.Storage.values.soundfonts[e])return}else t.Environment.Storage.values.soundfonts={};t.Environment.Storage.values.soundfonts[e]=t.Audio.Core.SoundFont.storage[e];try{t.Environment.Storage.save()}catch(n){console.log("STORAGE ERROR",n),"QuotaExceededError"===n.name&&console.log("Your localStorage for Gibber has been exceeded; we can't save the soundfile. It is still usable.")}}},n._note=n.note.bind(n),n.note=function(e,i){if("number"==typeof e){if(e<t.minNoteFrequency){var r=this.scale||t.scale,o=r.notes[e];if(this.octave&&0!==this.octave)for(var a=this.octave>0?1:0,u=Math.abs(this.octave),c=0;u>c;c++)o*=a?2:.5;e=o}var f,h=s.frequency.note(e),p=0;if(1===h.note.accidental.value&&"b"!==h.note.accidental.sign)for(var d=h.note.enharmonics(),c=0;c<d.length;c++){var b=d[c];if("b"===b.accidental.sign){h.note=b;break}}p=h.cents,f=h.note.name.toUpperCase(),0!==h.note.accidental.value&&(f+=h.note.accidental.sign),f+=h.note.octave,e=f}else if("string"!=typeof e)return;"undefined"==typeof i&&(i=this.loudness.value),n._note(e,i,l(1,p))},t.createProxyProperties(n,c),t.defineProperty(n,"loudness",!0,!0,{min:0,max:1,output:u,timescale:"audio",perNote:!0},!0,!0),t.createProxyMethods(n,["note","chord","send"]),n};return f.path=n||"../../../resources/soundfonts/",f}},{"./theory":57,"gibberish-dsp":33}],56:[function(e,t){t.exports=function(t){"use strict";for(var n={Presets:{}},i=e("gibberish-dsp"),r=t.dollar,o=e("./clock")(t),s=t.outputCurves,a=s.LINEAR,u=s.LOGARITHMIC,c=[["PolySynth","Synth"],["PolyFM","FM"],["PolySynth2","Synth2"],["MonoSynth","Mono"],["PolyKarplusStrong","Pluck"]],l={Synth:{note:{min:50,max:3200,output:u,timescale:"audio",doNotProxy:!0},frequency:{min:50,max:3200,output:u,timescale:"audio"},amp:{min:0,max:1,output:u,timescale:"audio"},pulsewidth:{min:.01,max:.99,output:a,timescale:"audio",perNote:!0},attack:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},decay:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},sustain:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},release:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},pan:{min:-1,max:1,output:u,timescale:"audio",perNote:!0},sustainLevel:{min:.01,max:1,output:u,timescale:"audio",perNote:!0},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1}},Synth2:{note:{min:50,max:3200,output:u,timescale:"audio",doNotProxy:!0},frequency:{min:50,max:3200,output:a,timescale:"audio"},amp:{min:0,max:1,output:u,timescale:"audio"},pulsewidth:{min:.01,max:.99,output:a,timescale:"audio",perNote:!0},attack:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},decay:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},sustain:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},release:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},sustainLevel:{min:.01,max:1,output:u,timescale:"audio",perNote:!0},cutoff:{min:0,max:.7,output:a,timescale:"audio",perNote:!0},resonance:{min:0,max:5.5,output:a,timescale:"audio",perNote:!0},pan:{min:-1,max:1,output:u,timescale:"audio",perNote:!0},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1}},Mono:{note:{min:50,max:3200,output:u,timescale:"audio",doNotProxy:!0},frequency:{min:50,max:3200,output:a,timescale:"audio"},amp:{min:0,max:1,output:u,timescale:"audio"},pulsewidth:{min:.01,max:.99,output:a,timescale:"audio"},attack:{min:o.maxMeasures+1,max:176400,output:u,timescale:"audio"},decay:{min:o.maxMeasures+1,max:176400,output:u,timescale:"audio"},cutoff:{min:0,max:.7,output:a,timescale:"audio"},detune2:{min:0,max:.15,output:a,timescale:"audio"},detune3:{min:0,max:.15,output:a,timescale:"audio"},glide:{min:.99,max:.999995,output:a,timescale:"audio"},resonance:{min:0,max:5.5,output:a,timescale:"audio"},pan:{min:-1,max:1,output:u,timescale:"audio"},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1}},FM:{note:{min:50,max:3200,output:u,timescale:"audio",doNotProxy:!0},frequency:{min:50,max:3200,output:a,timescale:"audio"},amp:{min:0,max:1,output:u,timescale:"audio"},attack:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},decay:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},sustain:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},release:{min:o.maxMeasures+1,max:176400,output:a,timescale:"audio",perNote:!0},sustainLevel:{min:.01,max:1,output:u,timescale:"audio",perNote:!0},cmRatio:{min:.1,max:50,output:a,timescale:"audio",perNote:!0},index:{min:.1,max:50,output:a,timescale:"audio",perNote:!0},pan:{min:-1,max:1,output:u,timescale:"audio",perNote:!0},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1}},Pluck:{note:{min:50,max:3200,output:u,timescale:"audio",doNotProxy:!0},frequency:{min:50,max:3200,output:a,timescale:"audio"},amp:{min:0,max:1,output:u,timescale:"audio"},blend:{min:0,max:1,output:a,timescale:"audio",perNote:!0},damping:{min:0,max:1,output:a,timescale:"audio",perNote:!0},pan:{min:-1,max:1,output:u,timescale:"audio",perNote:!0},out:{min:0,max:1,output:a,timescale:"audio",dimensions:1}}},f=0;f<c.length;f++)!function(){var e=Array.isArray(c[f])?c[f][0]:c[f],o=Array.isArray(c[f])?c[f][1]:c[f];n[o]=function(){{var n,s=Array.prototype.slice.call(arguments,0),a={};"string"==typeof s[0]?1:0}t.processArguments2(a,s,o);for(var c in a)t.Audio.Clock.timeProperties.indexOf(c)>-1&&(a[c]=t.Clock.time(a[c]));if(n=new i[e](a).connect(t.Master),n.type="Gen",r.extend(!0,n,t.Audio.ugenTemplate),n.fx.ugen=n,"Vocoder"===o)return n;"Mono"===o&&(n.note=function(e,t){"undefined"!=typeof e&&("undefined"!=typeof t&&0!==t&&(this.amp=t),0!==t&&("object"!=typeof this.frequency?this.frequency=e:"property"!==this.frequency.type?(this.frequency[0]=e,i.dirty(this)):this.frequency=e,this.lastFrequency=this.frequency,n.envelope.getState()>0&&n.envelope.run()))}),n._note=n.note.bind(n),n.note=function(){var e,i=Array.prototype.slice.call(arguments,0);if("undefined"!=typeof i[0])return Array.isArray(i[0])?(e=i[0][0],e=t.Theory.processFrequency(n,e),i[0][0]=e):i[0]=t.Theory.processFrequency(n,i[0]),"undefined"==typeof i[1]&&(i[1]=this.loudness.value),this._note.apply(this,i),this.processChildProperties(),this};var f=Object.keys(l[o]),h=0;if(n.processChildProperties=function(){for(var e=0;e<f.length;e++){var t,n=f[e],i=n+"V";if(this[i]&&"undefined"!=typeof this[i].value){if(Array.isArray(this[i].value)){var r=h%this[i].value.length;t=this[i].value[r]}else t="function"==typeof this[i].value?this[i].value():this[i].value;this.children[this.lastChild][n]=t}}h++},n.chord=t.Theory.chord.bind(n),Object.defineProperty(n,"_",{get:function(){return n.kill(),n},set:function(){}}),t.createProxyProperties(n,l[o]),t.defineProperty(n,"loudness",!0,!0,{min:0,max:1,output:u,timescale:"audio"},!0,!0),n.trig=function(){this.note(this.lastFrequency)},t.createProxyMethods(n,["note","chord","send","trig"]),n.name=o,n.toString=function(){return o},"Mono"!==o){var p=n._frequency;Object.defineProperty(n,"frequency",{configurable:!0,get:function(){return this._frequency},set:function(e){if(p=e,this.children)for(var t=0;t<this.children.length;t++)"number"==typeof this.children[t].frequency?this.children[t].frequency=p:this.children[t].frequency[0]=p}})}var d=n.scale;return n.scale&&(n.seq.scale=d),Object.defineProperty(n,"scale",{get:function(){return d},set:function(e){d=e,n.seq.scale=d}}),n.presetInit&&n.presetInit(),n}}();return n.Presets.Synth={"short":{attack:44,decay:1/16},bleep:{waveform:"Sine",attack:44,decay:1/16},bleepEcho:{waveform:"Sine",attack:44,decay:1/16,presetInit:function(){this.fx.add(Delay(1/6,.85))}},cascade:{waveform:"Sine",maxVoices:10,attack:o.maxMeasures,decay:o.beats(1/32),presetInit:function(){this.fx.add(t.Audio.FX.Delay(1/9,.2),t.Audio.FX.Flanger()),this.pan=Sine(.25,1)._}},rhodes:{waveform:"Sine",maxVoices:4,attack:44,decay:1,presetInit:function(){this.fx.add(t.Audio.FX.Tremolo(2,.2))}},calvin:{waveform:"PWM",maxVoices:4,amp:.075,attack:o.maxMeasures,decay:.25,presetInit:function(){this.fx.add(t.Audio.FX.Delay(1/6,.5),t.Audio.FX.Vibrato())}},warble:{waveform:"Sine",attack:o.maxMeasures,presetInit:function(){this.fx.add(t.Audio.FX.Vibrato(2),t.Audio.FX.Delay(1/6,.75))}}},n.Presets.Synth2={pad2:{waveform:"Saw",maxVoices:4,attack:1.5,decay:.5,cutoff:.3,filterMult:.35,resonance:4.5,amp:.2,presetInit:function(){this.fx.add(t.Audio.FX.Delay(1/9,.75))}},pad4:{waveform:"Saw",maxVoices:4,attack:2,decay:2,cutoff:.3,filterMult:.35,resonance:4.5,amp:.2,presetInit:function(){this.fx.add(t.Audio.FX.Delay(1/9,.75))}}},n.Presets.Mono={"short":{attack:44,decay:1/16},lead:{presetInit:function(){this.fx.add(t.Audio.FX.Delay(.25,.35),t.Audio.FX.Reverb())},attack:1/8,decay:.5,octave3:0,cutoff:.2,filterMult:.5,resonance:5,isLowPass:!1},winsome:{presetInit:function(){this.lfo=t.Audio.Oscillators.Sine(2,.075)._,this.cutoff=this.lfo,this.detune2=this.lfo},attack:o.maxMeasures,decay:1,cutoff:.2},bass:{attack:o.maxMeasures,decay:1/8-o.maxMeasures,octave:-2,octave2:-1,cutoff:.5,filterMult:.2,resonance:1},bass2:{attack:o.maxMeasures,decay:1/6,octave:-2,octave2:0,octave3:0,cutoff:.5,filterMult:.2,resonance:1,amp:.65},edgy:{presetInit:function(){this.decay=1/8,this.attack=ms(1)},octave:-2,octave2:-1,cutoff:.5,filterMult:.2,resonance:1,waveform:"PWM",pulsewidth:.2,detune2:0,amp:.2},easy:{attack:o.maxMeasures,decay:2,octave2:0,octave3:0,cutoff:.3,glide:.9995},easyfx:{attack:o.maxMeasures,decay:2,presetInit:function(){this.fx.add(t.Audio.FX.Delay(o.time(1/6),.3))},amp:.3,octave2:0,octave3:0,cutoff:.3,glide:.9995},dark:{resonance:0,attack:44,cutoff:.075,amp:.35,filterMult:0},dark2:{filterMult:.1,attack:o.maxMeasures,octave2:0,octave3:0,decay:.25,amp:.45},noise:{resonance:20,decay:.5,cutoff:.3,glide:.99995,detune3:0,detune2:0,filterMult:0,presetInit:function(){this.fx.add(t.Audio.FX.Gain(.1),t.Audio.FX.Delay(1/6,.35))}}},n.Presets.FM={stabs:{maxVoices:4,cmRatio:1/1.0007,index:5,attack:o.maxMeasures,decay:1/8,amp:.1,presetInit:function(){this.bus=t.Audio.Busses.Bus().fx.add(t.Audio.FX.Delay(1/8,.75),t.Audio.FX.LPF({resonance:4})),this.bus.fx[1].cutoff=t.Audio.Core.Binops.Add(.25,t.Audio.Oscillators.Sine(.1,.2)._),this.send(this.bus,.65)}},bass:{cmRatio:1,index:3,presetInit:function(){this.attack=ms(1)},decay:1/16,octave:-2},glockenspiel:{cmRatio:3.5307,index:1,attack:44,decay:44100},radio:{cmRatio:1,index:40,attack:13230,decay:22050},noise:{cmRatio:.04,index:1e3,attack:44.1,decay:4410},frog:{cmRatio:.1,index:2,attack:13230,decay:220.5},gong:{cmRatio:1.4,index:.95,attack:44.1,decay:220500},drum:{cmRatio:1.40007,index:2,attack:44,decay:44100},drum2:{cmRatio:1+Math.sqrt(2),index:.2,attack:44,decay:882},brass:{maxVoices:4,cmRatio:1/1.0007,index:5,attack:4100,decay:1},clarinet:{cmRatio:1.5,index:1.5,attack:2205,decay:8820}},n}},{"./clock":43,"gibberish-dsp":33}],57:[function(e,t){t.exports=function(t){"use strict";var n=e("../../external/teoria.min"),i=t.dollar,r=function(e){return!isNaN(e)&&function(e){return(0|e)===e}(parseFloat(e))},o={Teoria:n,Scale:function(e,r){var s={root:"string"==typeof e?n.note(e):e,notes:[],degree:1,chord:function(e,t){var n=[];t=t||0,console.log("CHORD",e,this);for(var i=0;i<e.length;i++)n.push(this.notes[e[i]+t]);return n},create:function(){var e="number"!=typeof u?n.note(u).fq():u,i=a;if(this.notes.length=0,t.Theory.Scales[i]){var r=t.Theory.Scales[i](e);r.create(e),this.notes=r.notes}else console.log("No scale for the mode "+a+" exists.")},set:function(e,t){Array.isArray(arguments[0])?(this.root=arguments[0][0],this.mode=arguments[0][1]):(this.root=e,this.mode=t)}},a=r||"aeolian";Object.defineProperty(s,"mode",{configurable:!0,get:function(){return a},set:function(e){a=e,s.create()}});var u=e||440;return Object.defineProperty(s,"root",{get:function(){return u},set:function(e){"number"==typeof e?u=e:"string"==typeof e?u=o.Teoria.note(e).fq():"object"==typeof e&&(u=e.accidental?e.fq():o.Teoria.note(e.value).fq()),s.create()}}),s.gibber=!0,t.createProxyProperty(s,"root",!0,!1,null,!1,1),t.createProxyProperty(s,"mode",!0,!1,null,!1,1),i.subscribe("/gibber/clear",function(){s.seq.isConnected=!1,s.seq.isRunning=!1,s.seq.destinations.length=0}),s.create(u),s},CustomScale:function(e,t){var i={notes:[],degree:1,ratios:t||[1,1.1,1.25,1.3333,1.5,1.666,1.75],create:function(e){this.notes=[];for(var t="number"==typeof e?e:n.note(e).fq(),i=0;8>i;i++){for(var r=0;r<this.ratios.length;r++){var o=r,s=t*(1+Math.floor(o/this.ratios.length));this.notes.push(s*this.ratios[o%this.ratios.length])}t*=2}t="number"==typeof e?e:n.note(e).fq();for(var i=-1;i>=-8;i--){t/=2;for(var r=0;r<this.ratios.length;r++){var a=i*this.ratios.length+r,o=r,s=t*(1+Math.floor(o/this.ratios.length));this.notes[a]=s*this.ratios[o%this.ratios.length]}}},chord:function(e,t){var n=[];t=t||0;for(var i=0;i<e.length;i++)n.push(this.notes[e[i]+t]);return n}};return i.create(e),i},Scales:{Major:function(e){return o.CustomScale(e,[1,9/8,5/4,4/3,1.5,5/3,15/8])},Ionian:function(e){return o.CustomScale(e,[1,9/8,5/4,4/3,1.5,5/3,15/8])},Dorian:function(e){return o.CustomScale(e,[1,9/8,1.2,4/3,1.5,5/3,1.8])},Phrygian:function(e){return o.CustomScale(e,[1,16/15,1.2,4/3,1.5,1.6,1.8])},Lydian:function(e){return o.CustomScale(e,[1,9/8,5/4,45/32,1.5,5/3,15/8])},Mixolydian:function(e){return o.CustomScale(e,[1,9/8,5/4,4/3,1.5,1.6,1.8])},Minor:function(e){return o.CustomScale(e,[1,9/8,1.2,4/3,1.5,1.6,1.8])},Aeolian:function(e){return o.CustomScale(e,[1,9/8,1.2,4/3,1.5,1.6,1.8])},Locrian:function(e){return o.CustomScale(e,[1,16/15,1.2,4/3,62/45,1.6,15/8])},MajorPentatonic:function(e){return o.CustomScale(e,[1,9/8,5/4,1.5,5/3])},MinorPentatonic:function(e){return o.CustomScale(e,[1,1.2,4/3,1.5,15/8])},Chromatic:function(e){return o.CustomScale(e,[1,16/15,9/8,1.2,5/4,4/3,45/32,1.5,1.6,5/3,7/4,15/8])},HalfWhole:function(e){return o.CustomScale(e,[1,1.059463,1.189207,1.259921,1.414214,1.498307,1.681793,1.781797])},WholeHalf:function(e){return o.CustomScale(e,[1,1.122462,1.189207,1.33484,1.414214,1.587401,1.681793,1.887749])},Pythagorean:function(e){return o.CustomScale(e,[1,256/243,9/8,32/27,81/64,4/3,729/512,1.5,128/81,27/16,16/9,243/128])},PythagoreanMajor:function(e){return o.CustomScale(e,[1,9/8,81/64,4/3,1.5,27/16,243/128])},PythagoreanMinor:function(e){return o.CustomScale(e,[1,9/8,32/27,4/3,1.5,128/81,16/9])},Limit5:function(e){return o.CustomScale(e,[1,16/15,9/8,1.2,5/4,4/3,45/32,1.5,1.6,5/3,1.8,15/8])},Limit5Major:function(e){return o.CustomScale(e,[1,9/8,5/4,4/3,1.5,5/3,15/8])},Limit5Minor:function(e){return o.CustomScale(e,[1,9/8,1.2,4/3,1.5,1.6,1.8])},Mess3:function(e){return o.CustomScale(e,[1,1.122462,1.189207,1.259921,1.414214,1.498307,1.587401,1.781797,1.887749])},Mess4:function(e){return o.CustomScale(e,[1,1.059463,1.122462,1.33484,1.414214,1.498307,1.587401,1.887749])},Mess5:function(e){return o.CustomScale(e,[1,1.059463,1.33484,1.414214,1.498307,1.887749])},Mess6:function(e){return o.CustomScale(e,[1,1.122462,1.259921,1.33484,1.414214,1.587401,1.781797,1.887749])},Mess7:function(e){return o.CustomScale(e,[1,1.059463,1.122462,1.189207,1.33484,1.414214,1.498307,1.587401,1.681793,1.887749])},Adams:function(e){return o.CustomScale(e,[1,1.122462,1.259921,1.414214,1.498307,1.681793,1.781797])},Equal5Tone:function(e){return o.CustomScale(e,[1,1.15,1.32,1.35,1.52,1.74])},Equal7Tone:function(e){return o.CustomScale(e,[1,1.1,1.22,1.35,1.49,1.64,1.81])},Just:function(e){return o.CustomScale(e,[1,1.0417,1.125,1.2,1.25,1.3333,1.4063,1.5,1.6,1.6667,1.8,1.875])},Shruti:function(e){return o.CustomScale(e,[1,256/243,16/15,10/9,9/8,32/27,1.2,5/4,81/64,4/3,1.35,45/32,729/512,1.5,128/81,1.6,5/3,27/16,16/9,1.8,15/8,243/128,2])}},processFrequency:function(e,n){var i=n;if("string"==typeof n)i=t.Theory.Teoria.note(n).fq();else if(n<t.minNoteFrequency){var i,o=e.scale||t.scale,s=n,a=r(s);
if(a)i=o.notes[n];else{var u=o.notes[Math.floor(s)],c=o.notes[Math.ceil(s)],l=s%1,f=c-u;i=u+l*f}if(e.octave&&0!==e.octave)for(var h=e.octave>0?1:0,p=Math.abs(e.octave),d=0;p>d;d++)i*=h?2:.5}return i},chord:function(e){if(this.notation=e,"string"==typeof this.notation){var t,i,r=this.notation.slice(0,1);isNaN(this.notation.charAt(1))?(r+=this.notation.charAt(1),t=parseInt(this.notation.slice(2,3)),i=this.notation.slice(3)):(t=parseInt(this.notation.slice(1,2)),i=this.notation.slice(2));for(var s=n.note(r+t).chord(i),a=0;a<s.notes.length;a++){var u=s.notes[a];this.note("number"==typeof l?l:u.fq())}}else for(var c=0;c<this.notation.length;c++){var l,f=this.scale?this.scale.notes[this.notation[c]]:this.notation[c];switch(typeof f){case"number":l=f;break;case"object":l=f.fq?f.fq():f;break;case"string":l=o.Teoria.note(f).fq()}this.note(l)}return"undefined"!=typeof arguments[1]&&(this.amp=arguments[1]),this}};return o}},{"../../external/teoria.min":36}],58:[function(e,t){t.exports=function(e){var t=function(t){var n=function(n){var i={};if($.extend(i,{properties:$.extend({},t.inputs),callback:t.callback.bind(i),_init:t.init.bind(i),name:t.name}),i.__proto__=e.Audio.Core._synth,"object"==typeof n)for(var r in n)i[r]=n[r];var o=["name","inputs","callback","init"],s=[];for(var r in t)-1===o.indexOf(r)&&(i[r]=t[r].bind(i),s.push(r));i.init.call(i),i.oscillatorInit.call(i),e.createProxyProperties(i,i.properties),e.createProxyMethods(i,s);for(var r in t.inputs)i[r]="object"==typeof n&&n[r]?n[r]:t.inputs[r].default;return i._init(),i.connect(e.Master),arguments.length>0&&e.processArguments2(i,Array.prototype.slice.call(arguments,0),i.name),$.extend(!0,i,e.Audio.ugenTemplate),i.fx.ugen=i,i};return n};return t}},{}],59:[function(e,t){t.exports=function(t){"use strict";var n={Presets:{}},i=e("gibberish-dsp"),r=t.dollar,o=(e("./clock")(t),t.outputCurves),s=o.LINEAR,a=o.LOGARITHMIC,u={amp:{min:0,max:1,output:a,timescale:"audio"},pan:{min:-1,max:1,output:a,timescale:"audio"},out:{min:0,max:1,output:s,timescale:"audio",dimensions:1}};return n.Vocoder=function(e,n,o,s,a,u){var c=new i.Vocoder(e,n,o,s,a,u).connect(t.Master);return c.type="Gen",r.extend(!0,c,t.Audio.ugenTemplate),c.fx.ugen=c,c},n.Robot=function(e){function n(){i.modulator=Speak(o),i.modulator._,i.say=i.modulator.say.bind(i),t.defineSequencedProperty(i,"say"),c&&(i.say.values=s,i.say.durations=a),i.connect()}var i,o=e||{};i=t.Audio.Vocoder.Vocoder(null,null,o.numBands||16),i.disconnect(),isNaN(o.maxVoices)&&(o.maxVoices=1),isNaN(o.resonance)&&(o.resonance=4),isNaN(o.attack)&&(o.attack=ms(1)),isNaN(o.decay)&&(o.decay=measures(8)),isNaN(o.pulsewidth)&&(o.pulsewidth=.05),i.carrier=t.Audio.Synths.Synth2(o),i.note=i.carrier.note.bind(i),i._note=i.carrier._note.bind(i),i.chord=i.carrier.chord.bind(i),i.carrier._;var s,a,c=!1;return i.say=function(e,t){c===!1&&(s=e,a=t,c=!0)},t.Modules["gibber/publications/SpeakLib"]?n():t.import("gibber/publications/SpeakLib").done(function(){var e=setInterval(function(){"undefined"!=typeof Speak&&(n(),clearInterval(e))},250)}),t.defineSequencedProperty(i,"say"),t.defineSequencedProperty(i,"chord"),t.defineSequencedProperty(i,"note"),r.extend(!0,i,t.Audio.ugenTemplate),t.createProxyProperties(i,u),i},n}},{"./clock":43,"gibberish-dsp":33}],60:[function(e,t){(function(e){!function(){"use strict";function n(e,t,i){for(var r in t)i&&(l(t[r])||u(t[r]))?(l(t[r])&&!l(e[r])&&(e[r]={}),u(t[r])&&!u(e[r])&&(e[r]=[]),n(e[r],t[r],i)):void 0!==t[r]&&(e[r]=t[r])}var i="function"==typeof Zepto,r="function"==typeof jQuery,o="object"==typeof e.$||"function"==typeof e.$,s=null,a=i||r||o,u=Array.isArray,c=function(e){return"object"==typeof e},l=function(e){return c(e)&&Object.getPrototypeOf(e)==Object.prototype};s=a?r?jQuery:i?Zepto:o?e.$:{}:{},a||(s.extend=function(e){var t,i=Array.prototype.slice.call(arguments,1);return"boolean"==typeof e&&(t=e,e=i.shift()),i.forEach(function(i){n(e,i,t)}),e},s.isArray=Array.isArray,s.isPlainObject=l,s.type=function(e){return typeof e});var f={};s.subscribe=function(e,t){"undefined"==typeof f[e]&&(f[e]=[]),f[e].push(t)},s.unsubscribe=function(e,t){if("undefined"!=typeof f[e]){var n=f[e];n.splice(n.indexOf(t),1)}},s.publish=function(e,t){if("undefined"!=typeof f[e])for(var n=f[e],i=0;i<n.length;i++)n[i](t)},t.exports=s}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(e,t){t.exports=function(){"use strict";var e=function(){for(var t=[],n=0,i=this.length;i>n;n++){var r=Object.prototype.toString.call(this[n]).split(" ").pop().split("]").shift().toLowerCase();r&&(t=t.concat(/^(array|collection|arguments|object)$/.test(r)?e.call(this[n]):this[n]))}return t},t=function(e,t){for(var n=[],i=0;t>i;i++)n.push([1]);for(var r=i;e>r;r++)n.push(0);return n},n=function(e){for(var t=0,n=0,i=0;i<e.length;i++)Array.isArray(e[i])&&(e[i].length>t?(t=e[i].length,n=1):e[i].length===t&&n++);return n},i=function(i,o,s){function a(t,i){var r=0===u++?i:n(c),o=c.length-r,s=r>=o?o:r;if(s>1||1===u)for(var l=0;s>l;l++){var f=c.pop(),h=Array.isArray(f);c[l].push(f),h&&e.call(c[l])}return t%i!==0?a(i,t%i):e.call(c)}var u=0,c=t(o,i);return r(a(o,i),s)},r=function(e,t){var n=[];console.log(e,t),"undefined"==typeof t&&(t=1/e.length);for(var i=0,r=0;i<e.length;)i++,r+=t,(1==e[i]||i===e.length)&&(n.push(r),r=0);return n},o={"1,4":"1000","2,3":"101","2,5":"10100","3,4":"1011","3,5":"10101","3,7":"1010100","3,8":"10010010","4,7":"1010101","4,9":"101010100","4,11":"10010010010","5,6":"101111","5,7":"1011011","5,8":"10110110","5,9":"101010101","5,11":"10101010100","5,12":"100101001010","5,16":"1001001001001000","7,8":"10111111","11,24":"100101010101001010101010"};return i.test=function(t){var n=0,r=0;if("string"!=typeof t){for(var s in o){var a=o[s],u=e.call(i.apply(null,s.split(","))).join("");console.log(u,a),u===a?(console.log("TEST PASSED",s),r++):(console.log("TEST FAILED",s),n++)}console.log("*****************************TEST RESULTS - Passed: "+r+", Failed: "+n)}else{var a=o[t],u=e.call(i.apply(null,t.split(","))).join("");console.log(u,a),u==a?console.log("TEST PASSED FOR",t):console.log("TEST FAILED FOR",t)}},i}},{}],62:[function(require,module,exports){!function(){var $=require("./dollar"),Gibber={dollar:$,Presets:{},scale:null,minNoteFrequency:50,started:!1,outputCurves:{LINEAR:0,LOGARITHMIC:1},Pattern:require("./pattern"),"export":function(e){Gibber.Utilities.export(e),e.Pattern=Gibber.Pattern,e.Score=Gibber.Score,e.Euclid=Gibber.Euclid,Gibber.Audio&&Gibber.Audio.export(e),Gibber.Graphics&&Gibber.Graphics.export(e),Gibber.Interface&&Gibber.Interface.export(e),Gibber.Communication&&Gibber.Communication.export(e)},init:function(e){"undefined"==typeof window?(window=GLOBAL,document=GLOBAL.document=!1):"undefined"!=typeof GLOBAL&&(GLOBAL.document||(document=GLOBAL.document=!1));var t={globalize:!0,canvas:null,target:window,graphicsMode:"3d"};if("object"==typeof e&&$.extend(t,e),Gibber.Pattern=Gibber.Pattern(Gibber),Gibber.Audio)if(Gibber.Audio.init(),t.globalize);else{var n=Gibber.export.bind(Gibber);$.extend(Gibber,Gibber.Audio),Gibber.export=n}Gibber.Graphics,Gibber.Interface,t.globalize&&Gibber.export(t.target),t.target.$=$,Gibber.Utilities.init()},Modules:{},"import":function(e,t){var n=null;if(console.log("Loading module "+e+"..."),-1===e.indexOf("http:"))$.post(Gibber.Environment.SERVER_URL+"/gibber/"+e,{},function(i){i=JSON.parse(i);var r=new Function("return "+i.text);return Gibber.Modules[e]=r(),t&&Gibber.Modules[e]&&$.extend(t,Gibber.Modules[e]),Gibber.Modules[e]?("function"==typeof Gibber.Modules[e].init&&Gibber.Modules[e].init(),"object"==typeof Gibber.Modules[e]&&(Gibber.Modules[e].moduleText=i.text),console.log("Module "+e+" is now loaded.")):console.log("Publication "+e+" is loaded. It may not be a valid module."),null!==n&&n(Gibber.Modules[e]),!1});else{var i=document.createElement("script");i.src=e,i.onload=function(){console.log("Module "+e+" is now loaded."),null!==n&&n()},document.head.appendChild(i)}return{done:function(e){n=e}}},loadText:function(e){var t=null;return console.log("Loading text "+e+"...."),$.post(Gibber.Environment.SERVER_URL+"/gibber/"+e,{},function(e){var n=JSON.parse(e);t&&t(n.text)}),{done:function(e){t=e}}},scriptCallbacks:[],run:function(script,pos,cm){var _start=pos.start?pos.start.line:pos.line,tree;try{tree=Gibber.Esprima.parse(script,{loc:!0,range:!0})}catch(e){return void console.error("Parse error on line "+(_start+e.lineNumber)+" : "+e.message.split(":")[1])}for(var __i__=0;__i__<tree.body.length;__i__++){var obj=tree.body[__i__],start={line:_start+obj.loc.start.line-1,ch:obj.loc.start.column},end={line:_start+obj.loc.end.line-1,ch:obj.loc.end.column},src=cm.getRange(start,end),result=null;try{result=eval(src),log("function"!=typeof result?result:"Function")}catch(e){console.error("Error evaluating expression beginning on line "+(start.line+1)+"\n"+e.message)}if(this.scriptCallbacks.length>0)for(var ___i___=0;___i___<this.scriptCallbacks.length;___i___++)this.scriptCallbacks[___i___](obj,cm,pos,start,end,src,_start)}},processArguments:function(e,t){var n;return e.length?"string"==typeof e[0]&&"Drums"!==t&&"XOX"!==t?(n=Gibber.getPreset(e[0],t),"object"==typeof e[1]&&$.extend(n,e[1]),n):Array.prototype.slice.call(e,0):n},processArguments2:function(e,t,n){if(t.length){var i=t[0];if("string"==typeof i&&"Drums"!==n&&"XOX"!==n&&"Shader"!==n)preset=Gibber.getPreset(t[0],n),"object"==typeof t[1]&&$.extend(preset,t[1]),$.extend(e,preset);else if($.isPlainObject(i)&&"undefined"==typeof i.type)$.extend(e,i);else{var r=Object.keys(e.properties);if("FX"===e.type)for(var o=0;o<t.length;o++)e[r[o+1]]=t[o];else for(var o=0;o<t.length;o++)e[r[o]]=t[o]}}},getPreset:function(e,t){var n={};return Gibber.Presets[t]&&Gibber.Presets[t][e]?n=Gibber.Presets[t][e]:Gibber.log(t+" does not have a preset named "+e+"."),n},clear:function(){var e=Array.prototype.slice.call(arguments,0);Gibber.Audio&&Gibber.Audio.clear.apply(Gibber.Audio,e),Gibber.Graphics&&Gibber.Graphics.clear(Gibber.Graphics,e),Gibber.proxy(window),$.publish("/gibber/clear",{}),console.log("Gibber has been cleared.")},singleton:function(e,t){if(t||(t=window),$.isArray(e))for(var n=0;n<e.length;n++)Gibber.singleton(e[n],t);else{"undefined"!=typeof t[e]&&(delete t[e],delete t["___"+e]);var i=e;Object.defineProperty(t,i,{configurable:!0,get:function(){return t["___"+i]},set:function(e){if(e)t["___"+i]&&"function"==typeof t["___"+i].replaceWith&&(t["___"+i].replaceWith(e),console.log(t["___"+i].name+" was replaced with "+e.name)),t["___"+i]=e;else if(t["___"+i]){var n=t["___"+i];n&&"function"==typeof n.kill&&n.kill()}}})}},proxy:function(e){for(var t="abcdefghijklmnopqrstuvwxyz",n=0;n<t.length;n++){var i=t.charAt(n);Gibber.singleton(i,e)}},construct:function(e,t){function n(){return e.apply(this,t)}return n.prototype=e.prototype,new n},createMappingObject:function(e,t){var n="function"==typeof e.min?e.min():e.min,i="function"==typeof e.max?e.max():e.max,r="function"==typeof t.min?t.min():t.min,o="function"==typeof t.max?t.max():t.max;if("undefined"==typeof t.object&&t.Value&&(t=t.Value),"undefined"!=typeof e.object[e.Name].mapping)return void e.object[e.Name].mapping.replace(t.object,t.propertyName,t.Name);"undefined"!=typeof t.targets&&-1===t.targets.indexOf(e)&&t.targets.push([e,e.Name]);var s="Out"!==t.Name?t.timescale:"audioOut";return mapping=Gibber.mappings[e.timescale][s](e,t),Object.defineProperties(e.object[e.Name],{min:{configurable:!0,get:function(){return n},set:function(t){n=t,e.object[e.Name].mapping.outputMin=n}},max:{configurable:!0,get:function(){return i},set:function(t){i=t,e.object[e.Name].mapping.outputMax=i}}}),e.object[e.Name].mappingObjects=[],Gibber.createProxyProperty(e.object[e.Name],"min",1,0,{min:n,max:i,output:e.output,timescale:e.timescale,dimensions:1}),Gibber.createProxyProperty(e.object[e.Name],"max",1,0,{min:n,max:i,output:e.output,timescale:e.timescale,dimensions:1}),Object.defineProperties(t.object[t.Name],{min:{configurable:!0,get:function(){return r},set:function(t){r=t,e.object[e.Name].mapping.inputMin=r}},max:{configurable:!0,get:function(){return o},set:function(t){o=t,e.object[e.Name].mapping.inputMax=o}}}),e.object[e.Name].invert=function(){e.object[e.Name].mapping.invert()},"undefined"==typeof e.object.mappings&&(e.object.mappings=[]),e.object.mappings.push(mapping),"undefined"==typeof t.object.mappings&&(t.object.mappings=[]),t.object.mappings.push(mapping),Gibber.defineSequencedProperty(e.object[e.Name],"invert"),mapping},defineSequencedProperty:function(e,t,n){var i=e[t],r={},o={};!e.seq&&Gibber.Audio&&(e.seq=Gibber.Audio.Seqs.Seq({doNotStart:!0,scale:e.scale,priority:n,target:e})),i.score=function(e,t,n){return function(){i.seq(e,t,n)}},e[t+"_"]=function(){var t=Array.prototype.slice.call(arguments,0),n=function(){i.apply(e,t)};return n},i.seq=function(s,a,u){var c,l=!1;"string"!=typeof s||"Drums"!==e.name&&"XOX"!==e.name&&"Ensemble"!==e.name?"undefined"==typeof a&&(l=!0):(s=s.split(""),"undefined"==typeof a&&(a=1/s.length)),"function"==typeof e.seq&&(e.seq=e.object.seq),o=e.seq.seqs;var f=$.isArray(s)?s:[s],h=$.isArray(a)?a:"undefined"!=typeof a?[a]:null,p=Gibber.construct(Gibber.Pattern,f),d=Gibber.construct(Gibber.Pattern,h),b={key:t,values:[p],durations:null!==h?[d]:null,target:e,priority:n};p.patternName=t+"_values",d.patternName=t+"_durations","undefined"==typeof u&&(u=0),"undefined"==typeof r[t]&&(r[t]=[]),c=r[t][u];var m=-1;if("undefined"!=typeof c&&"undefined"!=typeof o[c]&&(m=c),f.randomFlag){p.filters.push(function(){var e=Gibber.Utilities.rndi(0,p.values.length-1);return[p.values[e],1,e]});for(var g=0;g<f.randomArgs.length;g+=2)p.repeat(f.randomArgs[g],f.randomArgs[g+1])}if(null!==h){if(h.randomFlag){d.filters.push(function(){var e=Gibber.Utilities.rndi(0,d.values.length-1);return[d.values[e],1,e]});for(var g=0;g<h.randomArgs.length;g+=2)d.repeat(h.randomArgs[g],h.randomArgs[g+1])}d.seq=e.seq}if(p.seq=e.seq,m>-1){var y=l?e.seq.autofire.splice(m,1)[0]:o.splice(m,1)[0];for(var v in e.seq.timeline){var x=e.seq.timeline[v],k=x.indexOf(y);k>-1&&x.splice(k,1)}e.seq.add(b,m)}else e.seq.add(b),c=e.seq.seqs.length-1;return l||(r[t][u]=c),i[u]={},Object.defineProperties(i[u],{values:{configurable:!0,get:function(){return p},set:function(t){var n=Gibber.construct(Gibber.Pattern,t);Array.isArray(n)||(n=[n]),null!==h?e.seq.seqs[c].values=n:e.seq.autofire[c].values=n}},durations:{configurable:!0,get:function(){return d},set:function(t){Array.isArray(t)||(t=[t]);var n=Gibber.construct(Gibber.Pattern,t);Array.isArray(n)||(n=[n]),e.seq.seqs[c].durations=n}}}),i[u].seq=function(e,t){i.seq(e,t,u)},e.seq.isRunning||(e.seq.offset=Gibber.Clock.time(e.offset),e.seq.start(!0,n)),i.seq.stop=function(){for(var e=r[t],n=0;n<e.length;n++){var i=e[n],s=o[i];s.shouldStop=!0}},i[u].stop=function(){o[c].shouldStop=!0},i.seq.start=function(){for(var i=r[t],s=0;s<i.length;s++){var a=i[s],u=o[a];u.shouldStop=!1,e.seq.timeline[0]||(e.seq.timeline[0]=[]),e.seq.timeline[0].push(u),e.seq.nextTime=0}e.seq.isRunning||e.seq.start(!1,n)},i[u].start=function(){var t=o[c];t.shouldStop=!1,e.seq.timeline[0]=[t],e.seq.nextTime=0,e.seq.isRunning||e.seq.start(!1,n),o[c].shouldStop=!1},i.seq.repeat=function(e){var t=0,n=function(n,i){return n[2]%(i.getLength()-1)===0&&0!==n[2]&&(t++,t===e&&i.seq.stop()),n};i.values.filters.push(n)},i[u].score=function(t,n){return i.seq.bind(e,t,n,u)},Object.defineProperties(i,{values:{configurable:!0,get:function(){return i[u].values},set:function(e){return i[u].values=e}},durations:{configurable:!0,get:function(){return i[u].durations},set:function(e){return i[u].durations=e}}}),e}},defineRampedProperty:function(e,t){var n,i=e[t],r=t.slice(1);i.ramp=function(t,i,o){return arguments.length<2?void console.err("ramp requires at least two arguments: target and time."):("undefined"==typeof o&&(o=i,i=t,t=e[r]()),n&&n(),"object"!=typeof t?e[r]=Line(t,i,o):t.retrigger(i,Gibber.Clock.time(o)),n=future(function(){e[r]=i},o),e)}},createProxyMethods:function(e,t,n){for(var i=0;i<t.length;i++)Gibber.defineSequencedProperty(e,t[i],n)},defineProperty:function(e,t,n,i,r,o,s){var a="object"==typeof e[t]?e[t].valueOf():e[t],u=t.charAt(0).toUpperCase()+t.slice(1),c=function(n){var i=c;return"undefined"!=typeof n&&(c.oldSetter?c.oldSetter.call(e,n):e[t]=n,i=e),i};r=o?r||e.mappingProperties[t]:null,$.extend(c,r),$.extend(c,{propertyName:t,Name:u,value:a,type:"property",object:e,targets:[],valueOf:function(){return c.value},toString:function(){var e="";return e="object"==typeof c.value?c.value.toString():c.value},oldSetter:e.__lookupSetter__(t),oldGetter:e.__lookupGetter__(t),oldMappingObjectGetter:e.__lookupGetter__(u),oldMappingObjectSetter:e.__lookupSetter__(u)}),Object.defineProperty(e,t,{configurable:!0,get:function(){return c},set:function(t){if("function"!=typeof t&&("object"!=typeof t||"mapping"!==t.type)||"property"!==t.type&&"mapping"!==t.type){o&&e[c.Name]&&"undefined"!=typeof e[c.Name].mapping&&e[c.Name].mapping.remove&&e[c.Name].mapping.remove(!0);var n=t;if(c.oldSetter){var i=c.oldSetter.call(e,t);"undefined"!=typeof i&&(n=i)}c.value=n}else Gibber.createMappingObject(c,t);return e}}),n&&Gibber.defineSequencedProperty(e,t,s),i&&Gibber.defineRampedProperty(e,t),o&&Object.defineProperty(e,c.Name,{configurable:!0,get:function(){return"function"==typeof c.oldMappingObjectGetter&&c.oldMappingObjectGetter(),c},set:function(t){e[c.Name]=t,"function"==typeof mapping.oldMappingObjectSetter&&mapping.oldMappingObjectSetter(t)}})},createProxyProperty:function(e,t,n,i,r,o,s){o=o===!1?!1:!0,Gibber.defineProperty(e,t,n,i,r,o,s),r&&r.perNote&&Gibber.defineProperty(e,t+"V",n,i,r,o,s)},createProxyProperties:function(e,t,n,i){var r="undefined"==typeof n?!0:n,o="undefined"==typeof i?!0:i;e.gibber=!0,e.mappingProperties=t,e.mappingObjects=[];for(var s in t)t[s].doNotProxy||Gibber.createProxyProperty(e,s,r,o,t[s])}};Gibber.Utilities=require("./utilities")(Gibber),Gibber.mappings=require("./mappings")(Gibber),Gibber.Euclid=require("./euclidean")(Gibber),module.exports=Gibber}()},{"./dollar":60,"./euclidean":61,"./mappings":63,"./pattern":64,"./utilities":65}],63:[function(e,t){t.exports=function(e){var t={audio:{graphics:function(t,n){"undefined"==typeof n.object.track&&(n.object.track={});var i,r="undefined"!=typeof n.object.track[n.propertyName]?n.object.track[n.propertyName]:new e.Audio.Core.Proxy2(n.object,n.propertyName),o=new e.Audio.Core.OnePole({a0:.005,b1:.995});return n.object.track=r,i=t.object[t.Name].mapping=e.Audio.Core.Binops.Map(r,t.min,t.max,n.min,n.max,t.output,n.wrap),o.input=i,t.object[t.propertyName]=o,i.proxy=r,i.op=o,i.remove=function(e){e||(t.object[t.propertyName]=t.object[t.Name].mapping.getValue()),delete t.object[t.Name].mapping},i},"interface":function(t,n){var i,r="undefined"!=typeof n.track?n.track:new e.Audio.Core.Proxy2(n.object,n.propertyName),o=new e.Audio.Core.OnePole({a0:.005,b1:.995}),s=t.max-t.min,a=(t.object[t.propertyName]-t.min)/s,u=n.min+(n.max-n.min)*a;if(n.object.setValue&&n.object.setValue(u),n.track=r,i=t.object[t.Name].mapping=e.Audio.Core.Binops.Map(r,t.min,t.max,n.min,n.max,t.output,n.wrap),o.input=i,t.object[t.propertyName]=o,i.proxy=r,i.op=o,i.remove=function(e){e||(t.object[t.propertyName]=i.getValue()),delete i},"undefined"!=typeof n.object.label){for(var c="",l=0;l<n.targets.length;l++){var f=n.targets[l];c+=f[0].object.name+"."+f[1],l!==n.targets.length-1&&(c+=" & ")}n.object.label=c}return i.replace=function(e,n,i){r.setInput(e),-1===e[i].targets.indexOf(t)&&e[i].targets.push([t,t.Name])},i},audio:function(t,n){var i,r;return"undefined"!=typeof n.object.track?(i=n.object.track,i.count++):(i=new e.Audio.Core.Proxy2(n.object,n.propertyName),i.count=1),n.object.track=i,t.object[t.propertyName]=e.Audio.Core.Binops.Map(i,t.min,t.max,n.min,n.max),r=t.object[t.Name].mapping=t.object[t.propertyName],r.remove=function(e){e||(t.object[t.propertyName]=r.getValue()),r.op&&r.op.remove(),delete t.object[t.Name].mapping},r.replace=function(n,i,o){var s=new e.Audio.Core.Proxy2(n,i);r.input=s,n[o].targets&&-1===n[o].targets.indexOf(t)&&n[o].targets.push([t,t.Name])},r},audioOut:function(t,n){var i;i=e.Audio.Core.Binops.Map(null,t.min,t.max,0,1,0),t.object[t.propertyName]=t.object[t.Name].mapping=i,"undefined"!=typeof n.object.track?(i.follow=n.object.track,i.follow.count++):(i.follow=new e.Audio.Analysis.Follow({input:n.object,useAbsoluteValue:!0}),i.follow.count=1),n.object.track=i.input=i.follow,i.remove=function(e){e||(t.object[t.propertyName]=t.object[t.Name].mapping.getValue()),i.bus&&i.bus.disconnect(),i.follow&&(i.follow.count--,0===i.follow.count&&(delete n.object.track,i.follow.remove())),delete t.object[t.Name].mapping},i.replace=function(e,n,r){i.follow.input=e,-1===e[r].targets.indexOf(t)&&e[r].targets.push([t,t.Name])};var r=i.follow.bufferSize;return Object.defineProperty(t.object[t.Name],"env",{configurable:!0,get:function(){return r},set:function(t){r=e.Clock.time(t),i.follow.bufferSize=r}}),i}},graphics:{graphics:function(t,n){var i,r=e.Audio.Core.Binops.Map(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap),o=r.getValue.bind(r);return r.getValue=function(){return r.callback(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap),o()},i=t.object[t.Name].mapping=r,t.object.mod?t.object.mod(t.propertyName,i,"="):t.modObject.mod(t.modName,i,"="),i.remove=function(){t.object.mod?t.object.removeMod(t.propertyName):t.modObject.removeMod(t.modName),t.object[t.propertyName]=t.object[t.Name].mapping.getValue(),delete t.object[t.Name].mapping},i.replace=function(e){i.input=e},i},"interface":function(t,n){var i,r=e.Audio.Core.Binops.Map(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap);"undefined"==typeof n.object.functions&&(n.object.functions={},n.object.onvaluechange=function(){for(var e in n.object.functions)n.object.functions[e]()}),i=t.object[t.Name].mapping=r,t.mapping.from=n;var o=t.propertyName+" <- "+n.object.propertyName+"."+n.Name;if(n.object.functions[o]=function(){var e=i.callback(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap);t.object[t.Name].oldSetter.call(t.object[t.Name],e)},i.replace=function(){},i.remove=function(){console.log("mapping removed"),delete n.object.functions[o]},n.object.setValue&&n.object.setValue(t.object[t.propertyName]),"undefined"!=typeof n.object.label){for(var s="",a=0;a<n.targets.length;a++){var u=n.targets[a];s+=u[0].object.propertyName+"."+u[1],a!==n.targets.length-1&&(s+=" & ")}n.object.label=s}return i},audio:function(t,n){var i;i=t.object[t.Name].mapping=e.Audio.Core.Binops.Map(null,t.min,t.max,n.min,n.max,t.output,n.wrap),i.follow="undefined"!=typeof n.object.track?n.object.track:new e.Audio.Core.Follow({input:n.object[n.propertyName],useAbsoluteValue:!1}),n.object.track=t.object[t.Name].mapping.follow,i.input=i.follow,i.bus=new e.Audio.Core.Bus2({amp:0}).connect(),i.connect(i.bus),i.replace=function(e,n,r){i.follow.input=e,-1===e[r].targets.indexOf(t)&&e[r].targets.push([t,t.Name])};var r=i.follow.bufferSize;return Object.defineProperty(t.object[t.Name],"env",{get:function(){return r},set:function(t){r=e.Clock.time(t),i.follow.bufferSize=r}}),t.object.mod?t.object.mod(t.propertyName,i,"="):t.modObject.mod(t.modName,i,"="),i.remove=function(){this.bus.disconnect(),this.follow&&(this.follow.count--,0===this.follow.count&&(delete n.object.track,this.follow.remove())),t.object.mod?t.object.removeMod(t.propertyName):t.modObject.removeMod(t.modName),delete t.object[t.Name].mapping},i},audioOut:function(n,i){if("undefined"!=typeof n.object[n.Name].mapping)return r.replace(i.object,i.propertyName,i.Name),r;var r=n.object[n.Name].mapping=e.Audio.Core.Binops.Map(null,n.min,n.max,0,1,0);"undefined"!=typeof i.object.track?(r.follow=i.object.track,r.follow.count++):(r.follow=new e.Audio.Core.Follow({input:i.object}),r.follow.count=1),i.object.track=r.follow;var o=r.follow.bufferSize;return Object.defineProperty(n.object[n.Name],"env",{configurable:!0,get:function(){return o},set:function(t){o=e.Clock.time(t),r.follow.bufferSize=o}}),r.input=r.follow,r.bus=new e.Audio.Core.Bus2({amp:0}).connect(),r.connect(r.bus),r.replace=function(t,o,s){if(t[s].timescale===i.timescale){var a=r.follow.input[i.Name].targets.indexOf(n);a>=-1&&r.follow.input[i.Name].targets.splice(a,1),r.follow.input=t,-1===t[s].targets.indexOf(n)&&t[s].targets.push([n,n.Name])}else r.bus.disconnect(),r.follow.remove(),e.createMappingObject(n,t)},n.object.mod?n.object.mod(n.propertyName,r,"="):n.modObject?n.modObject.mod(n.modName,r,"="):!function(){var e=r;n.object.update=function(){n.object[n.propertyName](e.getValue())}}(),r.remove=function(){this.bus.disconnect(),this.follow&&(this.follow.count--,0===this.follow.count&&(delete i.object.track,this.follow.remove())),n.object.mod?n.object.removeMod(n.propertyName):n.modObject&&n.modObject.removeMod(n.modName),n.object.mappings.splice(n.object.mappings.indexOf(r),1),i.object.mappings.splice(i.object.mappings.indexOf(r),1);var e=n.object[n.Name].targets,o=e.indexOf(t);-1!==o&&e.splice(o,1),delete n.object[n.Name].mapping},r}},notation:{graphics:function(t,n){var i,r=e.Audio.Core.Binops.Map(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap),o=r.getValue.bind(r);return r.getValue=function(){return r.callback(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap),o()},i=t.object[t.Name].mapping=r,t.object.mod?t.object.mod(t.propertyName,i,"="):t.modObject.mod(t.modName,i,"="),i.remove=function(){t.object.mod?t.object.removeMod(t.propertyName):t.modObject.removeMod(t.modName),t.object[t.propertyName]=t.object[t.Name].mapping.getValue(),delete t.object[t.Name].mapping},i.replace=function(e){i.input=e},i},"interface":function(t,n){var i,r=e.Audio.Core.Binops.Map(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap);"undefined"==typeof n.object.functions&&(n.object.functions={},n.object.onvaluechange=function(){for(var e in n.object.functions)n.object.functions[e]()}),i=t.object[t.Name].mapping=r,t.mapping.from=n;var o=t.propertyName+" <- "+n.object.propertyName+"."+n.Name;if(n.object.functions[o]=function(){var e=i.callback(n.object[n.propertyName],t.min,t.max,n.min,n.max,t.output,n.wrap);t.object[t.Name].oldSetter.call(t.object[t.Name],e)},i.replace=function(){},i.remove=function(){console.log("mapping removed"),delete n.object.functions[o]},n.object.setValue&&n.object.setValue(t.object[t.propertyName]),"undefined"!=typeof n.object.label){for(var s="",a=0;a<n.targets.length;a++){var u=n.targets[a];s+=u[0].object.propertyName+"."+u[1],a!==n.targets.length-1&&(s+=" & ")}n.object.label=s}return i},audio:function(t,n){var i;i=t.object[t.Name].mapping=e.Audio.Core.Binops.Map(null,t.min,t.max,n.min,n.max,t.output,n.wrap),"undefined"!=typeof n.object.track&&n.object.track.input===n.object.properties[n.propertyName]?(i.follow=n.object.track,i.follow.count++):(i.follow=new e.Audio.Core.Follow({input:n.object.properties[n.propertyName],useAbsoluteValue:!1}),i.follow.count=1),n.object.track=t.object[t.Name].mapping.follow,i.input=i.follow,i.bus=new e.Audio.Core.Bus2({amp:0}).connect(),i.connect(i.bus),i.replace=function(e,n,r){i.follow.input=e,-1===e[r].targets.indexOf(t)&&e[r].targets.push([t,t.Name])};var r=i.follow.bufferSize;return Object.defineProperty(t.object[t.Name],"env",{get:function(){return r},set:function(t){r=e.Clock.time(t),i.follow.bufferSize=r}}),i.update=function(){t.object[t.propertyName](i.getValue())},i.text=t.object,e.Environment.Notation.add(i),i.remove=function(){this.bus.disconnect(),this.follow&&(this.follow.count--,0===this.follow.count&&(delete n.object.track,this.follow.remove())),e.Environment.Notation.remove(i),delete t.object[t.Name].mapping},i},audioOut:function(t,n){if("undefined"!=typeof t.object[t.Name].mapping)return i.replace(n.object,n.propertyName,n.Name),i;var i=t.object[t.Name].mapping=e.Audio.Core.Binops.Map(null,t.min,t.max,0,1,0);"undefined"!=typeof n.object.track&&n.object.track.input===n.object.properties[n.propertyName]?(i.follow=n.object.track,i.follow.count++):(i.follow=new e.Audio.Core.Follow({input:n.object,useAbsoluteValue:!0}),i.follow.count=1),n.object.track=i.follow;var r=i.follow.bufferSize;return Object.defineProperty(t.object[t.Name],"env",{configurable:!0,get:function(){return r},set:function(t){r=e.Clock.time(t),i.follow.bufferSize=r}}),i.input=i.follow,i.bus=new e.Audio.Core.Bus2({amp:0}).connect(),i.connect(i.bus),i.replace=function(r,o,s){if(r[s].timescale===n.timescale){var a=i.follow.input[n.Name].targets.indexOf(t);a>=-1&&i.follow.input[n.Name].targets.splice(a,1),i.follow.input=r,-1===r[s].targets.indexOf(t)&&r[s].targets.push([t,t.Name])}else i.bus.disconnect(),i.follow.remove(),e.createMappingObject(t,r)},i.update=function(){t.object[t.propertyName](i.getValue())},i.text=t.object,e.Environment.Notation.add(i),i.remove=function(){this.bus.disconnect(),this.follow&&(this.follow.count--,0===this.follow.count&&(delete n.object.track,this.follow.remove())),e.Environment.Notation.remove(i),delete t.object[t.Name].mapping},i}}};return t},t.exports.outputCurves={LINEAR:0,LOGARITHMIC:1}},{}],64:[function(e,t){t.exports=function(t){"use strict";var n=e("./dollar"),i={concat:function(e){this.values=this.values.concat(e.values)},toString:function(){return this.values.toString()},valueOf:function(){return this.values},getLength:function(){var e;return e=this.start<=this.end?this.end-this.start+1:this.values.length+this.end-this.start+1},runFilters:function(e,t){for(var n=[e,1,t],i=0;i<this.filters.length;i++)n=this.filters[i](n,this);return n},checkForUpdateFunction:function(e,t){var n=Array.prototype.slice.call(t,0);this.listeners[e]?this.listeners[e].apply(this,n):r.listeners[e]&&r.listeners[e].apply(this,n)},_onchange:function(){}},r=function(){if(!(this instanceof r)){var e=Array.prototype.slice.call(arguments,0);return t.construct(r,e)}var i=function(){var e,t,n,r=i.getLength();return e=1===r?0:Math.floor(i.phase>-1?i.start+i.phase%r:i.end+i.phase%r),t=i.values[Math.floor(e%i.values.length)],n=i.runFilters(t,e),i.phase+=i.stepSize*n[1],t=n[0],"function"==typeof t&&(t=t()),i.update&&(i.update.value=t),t};n.extend(i,{start:0,end:0,phase:0,values:Array.prototype.slice.call(arguments,0),original:null,storage:[],stepSize:1,integersOnly:!1,filters:[],onchange:null,range:function(){var e,t;return Array.isArray(arguments[0])?(e=arguments[0][0],t=arguments[0][1]):(e=arguments[0],t=arguments[1]),t>e?(i.start=e,i.end=t):(i.start=t,i.end=e),this.checkForUpdateFunction("range",[i]),i},set:function(){var e=Array.isArray(arguments[0])?arguments[0]:arguments;i.values.length=0;for(var t=0;t<e.length;t++)i.values.push(e[t]);return i.end=i.values.length-1,i._onchange(),i},reverse:function(){var e,t=i.values,n=null,r=null,o=t.length;for(n=0,r=o-1;r>n;n+=1,r-=1)e=t[n],t[n]=t[r],t[r]=e;return i._onchange(),i},repeat:function(){for(var e={},t=0;t<arguments.length;t+=2)e[arguments[t]]={phase:0,target:arguments[t+1]};var n=!1,r=null,o=null,s=function(t){var i=t[0],s=(t[1],t);return n===!1&&e[i]&&(n=!0,r=i,o=t[2]),n===!0&&(e[r].phase!==e[r].target?(s[0]=r,s[1]=0,s[2]=o,e[r].phase++):(e[r].phase=0,s[1]=1,i!==r?n=!1:e[r].phase++)),s};return i.filters.push(s),i},reset:function(){return i.values=i.original.slice(0),i._onchange(),i},store:function(){return i.storage[i.storage.length]=i.values.slice(0),i},transpose:function(e){for(var t=0;t<i.values.length;t++){var r=i.values[t];if(n.isArray(r))for(var o=0;o<r.length;o++)"number"==typeof r[o]&&(r[o]=i.integersOnly?Math.round(r[o]+e):r[o]+e);else"number"==typeof r&&(i.values[t]=i.integersOnly?Math.round(i.values[t]+e):i.values[t]+e)}return i._onchange(),i},shuffle:function(){return t.Utilities.shuffle(i.values),i._onchange(),i},scale:function(e){for(var t=0;t<i.values.length;t++){var r=i.values[t];if(n.isArray(r))for(var o=0;o<r.length;o++)"number"==typeof r[o]&&(r[o]=i.integersOnly?Math.round(r[o]*e):r[o]*e);else"number"==typeof r&&(i.values[t]=i.integersOnly?Math.round(i.values[t]*e):i.values[t]*e)
}return i._onchange(),i},flip:function(){var e=[],t=null;t=i.values.filter(function(t){var n=-1===e.indexOf(t);return n&&e.push(t),n}),t=t.sort(function(e,t){return e-t});for(var n=0;n<i.values.length;n++){var r=t.indexOf(i.values[n]);i.values[n]=t[t.length-r-1]}return i._onchange(),i},invert:function(){for(var e=i.values[0],t=1;t<i.values.length;t++)if("number"==typeof i.values[t]){var n=e+(e-i.values[t]);i.values[t]=n}return i._onchange(),i},"switch":function(e){return i.storage[e]&&(i.values=i.storage[e].slice(0)),i._onchange(),i},rotate:function(e){if(e>0)for(;e>0;){var t=i.values.pop();i.values.unshift(t),e--}else if(0>e)for(;0>e;){var n=i.values.shift();i.values.push(n),e++}return i._onchange(),i}}),Object.defineProperty(i,"size",{get:function(){return this.values.length},set:function(){t.log("cannot set size of pattern; use pattern.set() to update pattern contents.")}}),i.retrograde=i.reverse.bind(i),i.end=i.values.length-1,i.original=i.values.slice(0),i.storage[0]=i.original.slice(0),i.integersOnly=i.values.every(function(e){return e===+e&&e===(0|e)});var o=["rotate","switch","invert","reset","flip","transpose","reverse","shuffle","scale","store","range","set"];return t.createProxyMethods(i,o,!0),i.listeners={},t.createProxyProperties(i,{stepSize:0,start:0,end:0}),i.__proto__=this.__proto__,i};return r.listeners={},r.prototype=i,r}},{"./dollar":60}],65:[function(e,t){t.exports=function(e){"use strict";var t=[],n=!1,i=(e.dollar,e.Audio?e.Audio.Core:null,e.Clock,Math.random,{seq:function(){var e=arguments[0],t=typeof e,n=null;return"object"===t&&Array.isArray(e)&&(t="array"),n},random:function(){return this.randomFlag=!0,this.randomArgs=Array.prototype.slice.call(arguments,0),this},random2:function(){for(var e={},t=null,n=this,r=0;r<arguments.length;r+=2)e[""+arguments[r]]={repeat:arguments[r+1],count:0};return this.pick=function(){var r,o,s=0;return n[t]&&(o=n[t]),null!==t&&e[o].count++<=e[o].repeat?(r=t,e[o].count>=e[o].repeat&&(e[o].count=0,t=null)):(r=i.rndi(0,n.length-1),s=n[r],"undefined"!=typeof e[""+s]?(e[""+s].count=1,t=r):t=null),n[r]},this.pick},choose:function(e){var t=null;if(isNaN(e)&&(e=1),1!==e){for(var n=[],r=0;e>r;r++)n[r]=this[i.rndi(0,this.length-1)];t=n}else t=this[i.rndi(0,this.length-1)];return t},future:function(t,n){var i=0,r=e.Audio.Seqs.Seq(function(){1===i&&(t(),r.stop(),r.disconnect()),i++},e.Audio.Clock.time(n));return function(){r.stop(),r.disconnect()}},shuffle:function(e){for(var t,n,i=e.length;i;t=parseInt(Math.random()*i),n=e[--i],e[i]=e[t],e[t]=n);},solo:function(e){var r=Array.prototype.slice.call(arguments,0);if(e){n&&i.solo();for(var o=0;o<r.length;o++){var s=r[o];s.fx.length>0&&(r[o]=s.fx[s.fx.length-1])}for(var a=0;a<Master.inputs.length;a++){var u=r.indexOf(Master.inputs[a].value),c=Master.inputs[a].value,l=c.name;-1===u&&"polyseq"!==l&&"Seq"!==l&&(Master.inputs[a]._amp=Master.inputs[a].amp,Master.inputs[a].amp=0,t.push(Master.inputs[a]))}n=!0}else{for(var a=0;a<t.length;a++)t[a].amp=t[a]._amp;t.length=0,n=!1}},fill:function(e,t){isNaN(e)&&(e=16),"function"!=typeof t&&(t=Rndf()),t=t.bind(this);for(var n=0;e>n;n++)this[n]=t();return this},merge:function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];if(Array.isArray(n))for(var i=0;i<n.length;i++)e.push(n[i]);else e.push(n)}return e},weight:function(){var e=Array.prototype.slice.call(arguments,0);return this.pick=function(){for(var t=this[0],n=0,r=i.rndf(),o=0;o<e.length;o++)if(n+=e[o],n>r){t=o;break}return t},this},gibberArray:function(){},rndf:function(e,t,n,r){if(r="undefined"==typeof r?!0:r,"undefined"==typeof n&&"object"!=typeof e){1==arguments.length?(t=arguments[0],e=0):2==arguments.length?(e=arguments[0],t=arguments[1]):(e=0,t=1);var o=t-e,s=Math.random(),a=o*s;return e+a}var u=[],c=[];"undefined"==typeof n&&(n=t||e.length);for(var l=0;n>l;l++){var f;if("object"==typeof arguments[0])f=arguments[0][rndi(0,arguments[0].length-1)];else if(r)f=i.rndf(e,t);else{for(f=i.rndf(e,t);c.indexOf(f)>-1;)f=i.rndf(e,t);c.push(f)}u.push(f)}return u},Rndf:function(){{var e,t,n,r;Math.random}return 0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2]):(e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3]),function(){var o,s,a;return s="function"==typeof e?e():e,a="function"==typeof t?t():t,o="undefined"==typeof n?i.rndf(s,a):i.rndf(s,a,n,r)}},rndi:function(e,t,n,r){var o;if(0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):(e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3]),o=t-e,n>o&&(r=!0),"undefined"==typeof n)return o=t-e,Math.round(e+Math.random()*o);for(var s=[],a=[],u=0;n>u;u++){var c;if(r)c=i.rndi(e,t);else{for(c=i.rndi(e,t);a.indexOf(c)>-1;)c=i.rndi(e,t);a.push(c)}s.push(c)}return s},Rndi:function(){{var e,t,n,r,o;Math.random,Math.round}return 0===arguments.length?(e=0,t=1):1===arguments.length?(t=arguments[0],e=0):2===arguments.length?(e=arguments[0],t=arguments[1]):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2]):(e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3]),o=t-e,"number"==typeof n&&n>o&&(r=!0),function(){var o,s,a;return s="function"==typeof e?e():e,a="function"==typeof t?t():t,o="undefined"==typeof n?i.rndi(s,a):i.rndi(s,a,n,r)}},"export":function(e){e.rndi=i.rndi,e.rndf=i.rndf,e.Rndi=i.Rndi,e.Rndf=i.Rndf,e.future=i.future,e.solo=i.solo},init:function(){Array.prototype.random=Array.prototype.rnd=i.random}});return i}},{}]},{},[1]);