Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atomiix/atomiix

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomiix/atomiix - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

lib/atomiix.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,c=this.tokenTypes.length;a.length>0;){for(var s=!1,f=0;f<c;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);s=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;s=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!s){var d=a.substring(0,15),y=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+y+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var c=parseInt(u,10),s=String.fromCharCode(c);r+=s}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new c("No tokens provided to the parser");if(!(e instanceof Array))throw new c("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new c("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new c("Expected "+e+" but found EOF");if(!this.la1(e))throw new c("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new c("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=c,e.Lexer=s,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return Re}),n.d(r,"UNMARKTEXT",function(){return je}),n.d(r,"REPLACETEXT",function(){return Ce}),n.d(r,"REPLACELINE",function(){return Ne}),n.d(r,"DISPLAYINFO",function(){return Me});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,c="PROGRAM",s="PLAY",f="ADDFXCHAIN",p="RMFXCHAIN",l="INCRAMP",h="DECRAMP",m="COMMAND",d="FUTURE",y="GROUP",g="AGENT",v="SCORE",b="PERCUSSIVE",w="MELODIC",T="CONCRETE",k="SCOREOPERATOR",E="SCOREMODIFIER",x="PANNING",O="SUSTAIN",P="ATTACK",S="EFFECT",A="BEAT",R="NUMBER",j="STRING";function C(e){return{type:c,statements:e}}function N(e){return{type:l,agent:e}}function M(e){return{type:h,agent:e}}function I(e,t,n,r,a,i,o,u,c){return{type:v,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:c}}function _(e){return{type:S,name:e}}function L(e,t){return{type:A,value:e,modifier:t}}function F(e,t){return{type:R,value:e,modifier:t}}function D(e,t,n){var r=t.content,i=r.charAt(0),o=r.slice(-1),u=!1;switch(i){case"|":u="|"===o;break;case"[":u="]"===o;break;case"{":u="}"===o}if(!u)throw new a.ParserException("Score delimiters don't match. Starts with ".concat(i," but ends with ").concat(o));var c,s=r.slice(1,-1);switch(i){case"|":if(e)throw new a.ParserException("Percussive score shouldn't have instrument: ".concat(e));return c=U(s),I(b,null,c.chars,c.durations,c.offset,n,r,t.line-1,t.character-1);case"[":if(!e)throw new a.ParserException("Melodic score should have an instrument");return c=U(s),I(w,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);case"{":if(!e)throw new a.ParserException("Concrete score should have an instrument");return c=U(s),I(T,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);default:throw new a.ParserException("".concat(i," is not a supported score delimiters"))}}function U(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i)),{chars:t,durations:n,offset:r}}function X(e){var t,n=e.charAt(0),r=e.slice(-1),i=!1;switch(n){case"<":t=x,i=">"===r;break;case"^":t=P,i="^"===r}if(!i)throw new a.ParserException("Score modifier delimiters don't match. Starts with ".concat(n," but ends with ").concat(r));return function(e,t){return{type:E,modifierType:e,values:t}}(t,e.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var G=new a.Parser;function z(e){return t=e.content,n=e.line-1,r=e.character-1,{type:g,name:t,line:n,position:r};var t,n,r}G.parse=function(e){var t=u.tokenize(e);return this.initialize(t),this.program()},G.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return C(e)},G.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){this.match("play arrow");var t=this.score();return function(e,t){return{type:s,agent:e,score:t}}(z(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(z(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(z(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),N(z(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),M(z(e));switch(e.content){case"group":return this.group(e);case"future":return this.future(e);case"sequence":throw new a.ParserException("No support for sequence yet");default:return this.command(e)}},G.score=function(){var e="";return this.la1("identifier")&&(e=this.match("identifier").content),D(e,this.match("score"),this.scoreModifiers())},G.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=X(this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException("Unexpected token: Expecting operator or score modifier");var r=this.sustainModifier();e.push(r)}return e},G.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:E,modifierType:O,noteLength:e,multiplier:t}}(t,e)},G.scoreOperator=function(){return function(e,t){return{type:k,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},G.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(_(n))}return function(e,t){return{type:f,agent:e,effects:t}}(e,t)},G.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(_(n))}return function(e,t){return{type:p,agent:e,effects:t}}(e,t)},G.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=F(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=L(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=N(z(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=M(z(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:d,timing:e,command:t,line:n}}(t,n,e.line-1)},G.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(F(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(L(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException("Expected number or string");var u=this.match("identifier").content;t.push({type:j,value:u})}return function(e,t,n,r){return{type:m,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},G.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException("Expected agent name");t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var B=G,K={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},q="EDITORACTION",Y="AUDIOACTION",H="INBOUNDACTION",Z="AGENTMETHOD",V="FREEAGENT",$="ADDAGENTFX",J="RMAGENTFX",W="SETAGENTAMP",Q="SETTEMPO",ee="FUTURECALLBACK",te="PLAYPERCUSSIVE",ne="PLAYMELODIC",re="PLAYCONCRETE";function ae(e,t){return{type:Y,actionType:Z,agent:e,method:t}}function ie(e){return{type:Y,actionType:V,agent:e}}function oe(e,t){return{type:Y,actionType:$,agent:e,fxList:t}}function ue(e,t){return{type:Y,actionType:J,agent:e,fxList:t}}function ce(e,t){return{type:Y,actionType:W,agent:e,amplitude:t}}function se(e,t,n,r){return{type:Y,actionType:ee,time:e,timeType:t,repeats:n,callbackID:r}}function fe(e,t){return{type:Y,actionType:te,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function pe(e,t){return{type:Y,actionType:ne,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function le(e,t){return{type:Y,actionType:re,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function de(e,t){return!t||"object"!==he(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ye(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}function ge(e){var t="function"==typeof Map?new Map:void 0;return(ge=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ve(e,arguments,we(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),be(r,e)})(e)}function ve(e,t,n){return(ve=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&be(a,n.prototype),a}).apply(null,arguments)}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=function(e){function t(e){var n;return me(this,t),(n=de(this,we(t).call(this,e))).name="AtomiixRuntimeError",n}return ye(t,ge(Error)),t}(),ke=function(e){function t(e){var n;return me(this,t),(n=de(this,we(t).call(this,e))).name="AtomiixOSCError",n}return ye(t,ge(Error)),t}();function Ee(e,t,n){if(t.length<n)throw new Te("".concat(e," expected at least ").concat(n," arguments"))}function xe(e,t){if(t.type!==j)throw new Te("".concat(e," expected String but got ").concat(t.type));return t.value}function Oe(e,t){if(t.type!==R)throw new Te("".concat(e," expected Number but got ").concat(t.type));return t.value}function Pe(e,t,n){return void 0===t?n:Oe(e,t)}function Se(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}function Ae(e,t){var n=t.name,r=t.args;Ee(n,r,1);var a=xe(n,r[0]),i=K.names[a];i?e.scale=i:e.logger.warn("".concat(n,": ").concat(a," is not a valid scale name"))}var Re="MARKTEXT",je="UNMARKTEXT",Ce="REPLACETEXT",Ne="REPLACELINE",Me="DISPLAYINFO";function Ie(e,t,n){var r=[],a=De(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:q,actionType:Ce,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},c=D(i.instrument,u,i.modifiers);return a.score=c,a.playing&&(r=r.concat(Be(e,t))),r}var _e=/^[A-Z]/,Le=/^[a-z]/;var Fe={doze:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Se(e,xe(n,r[0]),function(e,t){var r=[],a=De(e,t);return a&&(a.playing=!1,r.push(ae(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Se(e,xe(n,r[0]),function(e,t){var r=[],a=De(e,t);return a&&(a.playing=!1,r.push(ae(t,n))),r})},kill:function(e,t){return Ee(t.name,t.args,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,ie(t)})},scale:Ae,scalepush:function(e,t){Ae(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){De(e,t).playing&&(n=n.concat(Be(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;Ee(n,r,1);var a=Oe(n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),function(e,t){return{type:Y,actionType:Q,tempo:e,glide:t}}(Oe(n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Ie(e,xe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Ie(e,xe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;Ee(n,r,1);var a=xe(n,r[0]),i=Pe(n,r[1],1);return Ie(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;Ee(n,r,1);var a=xe(n,r[0]),i=Pe(n,r[1],1);return Ie(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Ie(e,xe(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Ie(e,xe(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return Ee(n,r,1),Ie(e,xe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return _e.test(e)?e.toLowerCase():Le.test(e)?e.toUpperCase():e}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];Ee(r,a,1);var u=Math.floor(Oe(r,a[0])),c=Math.floor(70/u),s=" |"+(" ".repeat(u-1)+"|").repeat(c);return o.push({type:q,actionType:Ne,line:i+n,text:s}),o},remind:function(){var e,t=Object.keys(Fe).join("\n");return[(e=t,{type:q,actionType:Me,info:e})]}};function De(e,t){var n=e.agents[t];if(!n)throw new Te("No agent called ".concat(t));return n}function Ue(e,t,n,r){if(e.groups[t.name])throw new Te("".concat(t.name," is already the name of a group"));var a,i,o,u,c,s,f=[];return t.line=t.line+r,n.line=n.line+r,e.agents[t.name]={agent:t,score:n,playing:!0,amplitude:.5},f.push((a=t.name,i=t.line,o=t.position,u=t.position+t.name.length,c=n.position,s=n.position+n.scoreString.length,{type:q,actionType:Re,group:a,sections:{agent:{line:i,start:o,finish:u},score:{line:i,start:c,finish:s}}})),f}function Xe(e,t){var n=[],r=e.agents[t];return r&&(n.push(function(e){return{type:q,actionType:je,group:e}}(r.agent.name)),delete e.agents[t]),n}function Ge(e,t){switch(t.type){case s:return t.agent;default:return null}}function ze(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=Ge(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(ie(t)),r=r.concat(Xe(e,t))}),r}function Be(e,t){var n=e.agents[t];if(!n)throw new Te("No agent called ".concat(t));return He(e,n.agent,n.score)}function Ke(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=qe(e,t.statements[a],n);i&&(r=r.concat(i))}return r}function qe(e,t,n){switch(t.type){case s:return function(e,t,n){var r=t.agent,a=t.score,i=[];a.durations.length>0?i=(i=i.concat(He(e,r,a))).concat(Ue(e,r,a,n)):(i.push(ie(r.name)),i=i.concat(Xe(e,r.name)));return i}(e,t,n);case f:return a=(r=t).agent,i=r.effects,[oe(a.name,i.map(function(e){return e.name}))];case p:return function(e,t){var n=t.agent,r=t.effects;return[ue(n.name,r.map(function(e){return e.name}))]}(0,t);case l:return Ye(e,t,.1);case h:return Ye(e,t,-.1);case m:return function(e,t,n){var r=t.name,a=e.stdlib[r];if(!a)throw new Te("".concat(r," is not an existing command"));return a(e,t,n)}(e,t,n);case d:return function(e,t,n){var r=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[r]={command:C([t.command]),line:t.line+n};var a="seconds";t.timing.type===A&&(a="beats");var i=1;t.timing.modifier&&(i=t.timing.modifier);return[se(t.timing.value,a,i,r)]}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new Te("".concat(n," is already the name of an agent"));if(e.groups[n])throw new Te("".concat(n," is already the name of a group"));var a=r.map(function(t){return De(e,t),t});return e.groups[n]=a,[]}(e,t);default:throw new Te("".concat(t.type," is not a supported statement type"))}var r,a,i}function Ye(e,t,n){var r=t.agent,a=e.agents[r.name];if(a)return a.amplitude=a.amplitude+n,[ce(r.name,a.amplitude)]}function He(e,t,n){var r=n.scoreType;switch(r){case b:return function(e,t,n){var r=Ze(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,c=r.panning,s=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:b,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,c,p,s);return[fe(t.name,l)]}(e,t,n);case w:return function(e,t,n){var r=n.values.map(function(t){return function(e,t){return e.tonic+K.notes[e.scale][t]}(e,t)}),a=Ze(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,c=a.attack,s=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:w,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,c,s,l,f);return[pe(t.name,h)]}(e,t,n);case T:return function(e,t,n){var r=Ze(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),c=n.instrument,s=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:v,scoreType:T,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,c,i,s,o);return[le(t.name,f)]}(e,t,n);default:throw new Te("".concat(r," is not a supported score type"))}}function Ze(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],c=[0],s=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===E)switch(t.modifierType){case x:c=t.values.map(function(e){return(e-1)/4-1});break;case O:o=[1/t.noteLength*(t.multiplier||1)];break;case P:u=t.values}else if(t.type===k)switch(t.operator){case"+":a=a.map(function(e){return e+t.value});break;case"-":a=a.map(function(e){return e-t.value});break;case"*":s=t.value;break;case"/":s=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*s}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:c,silences:f,timestretch:s,repeats:p}}var Ve="AGENTFINISHED",$e="CALLBACKTRIGGER";function Je(e,t){switch(t.actionType){case Ve:return function(e,t){var n=t.name;return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),[]}(e,t);case $e:return function(e,t){var n=t.callbackId,r=t.remaining,a=e.callbacks[n];if(!a)return[];var i=Ke(e,a.command);r<1&&delete e.callbacks[n];return i}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var We={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function Qe(e,t){switch(t.actionType){case Z:return n=e.command,a=(r=t).agent,i=r.method,nt(n,[{type:"string",value:i},{type:"string",value:a}]);case V:return function(e,t){var n=t.agent;return nt(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case $:return function(e,t){var n=t.agent,r=t.fxList;return nt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case J:return function(e,t){var n=t.agent,r=t.fxList;return nt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.rmFX,t);case W:return function(e,t){var n=t.agent,r=t.amplitude;return nt(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case Q:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return nt(e,a)}(e.tempo,t);case ee:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return nt(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case te:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return nt(e,r)}(e.playPattern,t);case ne:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return nt(e,r)}(e.playPattern,t);case re:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return nt(e,r)}(e.playPattern,t)}var n,r,a,i}var et={agentFinished:"/finished",callback:"/callback"};function tt(e,t){switch(t.address){case e.agentFinished:return function(e){return t=rt(e,0),{type:H,actionType:Ve,name:t};var t}(t);case e.callback:return function(e){var t=rt(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new ke("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:H,actionType:$e,callbackId:e,remaining:t}}(t,n)}(t);default:throw new ke("".concat(t.address," is not a valid incoming address"))}}function nt(e,t){return{oscType:"message",address:e,args:t}}function rt(e,t){var n=e.args[t];if("string"!==n.type)throw new ke("Expected String but got ".concat(n.type));return n.value}function at(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===Y?t.audio.push(e):e.type===q&&t.editor.push(e)}),t}t.default={editorActions:r,init:function(e){var t=e||{info:console.log,warn:console.log,error:console.log};return{scale:K.names.major,tonic:60,bpm:120,stdlib:Fe,agents:{},groups:{},callbacks:{},lastCallbackID:0,logger:t}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return at(Ke(e,B.parse(t),n))},free:function(e,t){return at(ze(e,B.parse(t)))},handleAction:Je,incomingAction:function(e,t){return at(Je(e,t))},actionToOSC:function(e){return e.map(function(e){return Qe(We,e)})},oscToAction:function(e){return tt(et,e)}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,c=this.tokenTypes.length;a.length>0;){for(var s=!1,f=0;f<c;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);s=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;s=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!s){var d=a.substring(0,15),y=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+y+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var c=parseInt(u,10),s=String.fromCharCode(c);r+=s}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new c("No tokens provided to the parser");if(!(e instanceof Array))throw new c("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new c("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new c("Expected "+e+" but found EOF");if(!this.la1(e))throw new c("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new c("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=c,e.Lexer=s,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return Re}),n.d(r,"UNMARKTEXT",function(){return je}),n.d(r,"REPLACETEXT",function(){return Ce}),n.d(r,"REPLACELINE",function(){return Me}),n.d(r,"DISPLAYINFO",function(){return Ie});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,c="PROGRAM",s="PLAY",f="ADDFXCHAIN",p="RMFXCHAIN",l="INCRAMP",h="DECRAMP",m="COMMAND",d="FUTURE",y="GROUP",g="AGENT",v="SCORE",b="PERCUSSIVE",w="MELODIC",T="CONCRETE",k="SCOREOPERATOR",E="SCOREMODIFIER",x="PANNING",P="SUSTAIN",O="ATTACK",S="EFFECT",A="BEAT",N="NUMBER",R="STRING";function j(e){return{type:c,statements:e}}function C(e){return{type:l,agent:e}}function M(e){return{type:h,agent:e}}function I(e,t,n,r,a,i,o,u,c){return{type:v,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:c}}function _(e){return{type:S,name:e}}function L(e,t){return{type:A,value:e,modifier:t}}function F(e,t){return{type:N,value:e,modifier:t}}function D(e,t,n){var r=t.content,i=r.charAt(0),o=r.slice(-1),u=!1;switch(i){case"|":u="|"===o;break;case"[":u="]"===o;break;case"{":u="}"===o}if(!u)throw new a.ParserException("Score delimiters don't match. Starts with ".concat(i," but ends with ").concat(o));var c,s=r.slice(1,-1);switch(i){case"|":if(e)throw new a.ParserException("Percussive score shouldn't have instrument: ".concat(e));return c=U(s),I(b,null,c.chars,c.durations,c.offset,n,r,t.line-1,t.character-1);case"[":if(!e)throw new a.ParserException("Melodic score should have an instrument");return c=U(s),I(w,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);case"{":if(!e)throw new a.ParserException("Concrete score should have an instrument");return c=U(s),I(T,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);default:throw new a.ParserException("".concat(i," is not a supported score delimiters"))}}function U(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i)),{chars:t,durations:n,offset:r}}function X(e){var t,n=e.charAt(0),r=e.slice(-1),i=!1;switch(n){case"<":t=x,i=">"===r;break;case"^":t=O,i="^"===r}if(!i)throw new a.ParserException("Score modifier delimiters don't match. Starts with ".concat(n," but ends with ").concat(r));return function(e,t){return{type:E,modifierType:e,values:t}}(t,e.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var G=new a.Parser;function z(e){return t=e.content,n=e.line-1,r=e.character-1,{type:g,name:t,line:n,position:r};var t,n,r}G.parse=function(e){var t=u.tokenize(e);return this.initialize(t),this.program()},G.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return j(e)},G.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){this.match("play arrow");var t=this.score();return function(e,t){return{type:s,agent:e,score:t}}(z(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(z(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(z(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),C(z(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),M(z(e));switch(e.content){case"group":return this.group(e);case"future":return this.future(e);case"sequence":throw new a.ParserException("No support for sequence yet");default:return this.command(e)}},G.score=function(){var e="";return this.la1("identifier")&&(e=this.match("identifier").content),D(e,this.match("score"),this.scoreModifiers())},G.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=X(this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException("Unexpected token: Expecting operator or score modifier");var r=this.sustainModifier();e.push(r)}return e},G.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:E,modifierType:P,noteLength:e,multiplier:t}}(t,e)},G.scoreOperator=function(){return function(e,t){return{type:k,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},G.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(_(n))}return function(e,t){return{type:f,agent:e,effects:t}}(e,t)},G.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(_(n))}return function(e,t){return{type:p,agent:e,effects:t}}(e,t)},G.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=F(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=L(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=C(z(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=M(z(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:d,timing:e,command:t,line:n}}(t,n,e.line-1)},G.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(F(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(L(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException("Expected number or string");var u=this.match("identifier").content;t.push({type:R,value:u})}return function(e,t,n,r){return{type:m,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},G.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException("Expected agent name");t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var B=G,K={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},q="EDITORACTION",Y="AUDIOACTION",H="INBOUNDACTION",Z="AGENTMETHOD",V="FREEAGENT",$="NAPAGENT",J="ADDAGENTFX",W="RMAGENTFX",Q="SETAGENTAMP",ee="SETTEMPO",te="FUTURECALLBACK",ne="PLAYPERCUSSIVE",re="PLAYMELODIC",ae="PLAYCONCRETE";function ie(e,t){return{type:Y,actionType:Z,agent:e,method:t}}function oe(e){return{type:Y,actionType:V,agent:e}}function ue(e,t){return{type:Y,actionType:J,agent:e,fxList:t}}function ce(e,t){return{type:Y,actionType:W,agent:e,fxList:t}}function se(e,t){return{type:Y,actionType:Q,agent:e,amplitude:t}}function fe(e,t,n,r){return{type:Y,actionType:te,time:e,timeType:t,repeats:n,callbackID:r}}function pe(e,t){return{type:Y,actionType:ne,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function le(e,t){return{type:Y,actionType:re,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function he(e,t){return{type:Y,actionType:ae,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}function me(e){return(me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ye(e,t){return!t||"object"!==me(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ge(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&we(e,t)}function ve(e){var t="function"==typeof Map?new Map:void 0;return(ve=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return be(e,arguments,Te(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),we(r,e)})(e)}function be(e,t,n){return(be=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&we(a,n.prototype),a}).apply(null,arguments)}function we(e,t){return(we=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Te(e){return(Te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ke=function(e){function t(e){var n;return de(this,t),(n=ye(this,Te(t).call(this,e))).name="AtomiixRuntimeError",n}return ge(t,ve(Error)),t}(),Ee=function(e){function t(e){var n;return de(this,t),(n=ye(this,Te(t).call(this,e))).name="AtomiixOSCError",n}return ge(t,ve(Error)),t}();function xe(e,t,n){if(t.length<n)throw new ke("".concat(e," expected at least ").concat(n," arguments"))}function Pe(e,t){if(t.type!==R)throw new ke("".concat(e," expected String but got ").concat(t.type));return t.value}function Oe(e,t){if(t.type!==N)throw new ke("".concat(e," expected Number but got ").concat(t.type));return t.value}function Se(e,t,n){return void 0===t?n:Oe(e,t)}function Ae(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}function Ne(e,t){var n=t.name,r=t.args;xe(n,r,1);var a=Pe(n,r[0]),i=K.names[a];i?e.scale=i:e.logger.warn("".concat(n,": ").concat(a," is not a valid scale name"))}var Re="MARKTEXT",je="UNMARKTEXT",Ce="REPLACETEXT",Me="REPLACELINE",Ie="DISPLAYINFO";function _e(e,t,n){var r=[],a=Ue(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:q,actionType:Ce,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},c=D(i.instrument,u,i.modifiers);return a.score=c,a.playing&&(r=r.concat(Ke(e,t))),r}var Le=/^[A-Z]/,Fe=/^[a-z]/;var De={doze:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),Ae(e,Pe(n,r[0]),function(e,t){var r=[],a=Ue(e,t);return a&&(a.playing=!1,r.push(ie(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),Ae(e,Pe(n,r[0]),function(e,t){var r=[],a=Ue(e,t);return a&&(a.playing=!1,r.push(ie(t,n))),r})},nap:function(e,t){var n=t.name,r=t.args;xe(n,r,2);var a=Pe(n,r[0]),i=r[1],o=i.value,u=i.type===A?"beats":"seconds",c=i.modifier||1;return Ae(e,a,function(e,t){var n=[],r=Ue(e,t);return r&&(r.playing=!1,n.push(function(e,t,n,r){return{type:Y,actionType:$,agent:e,time:t,timeType:n,repeats:r}}(t,o,u,c))),n})},kill:function(e,t){return xe(t.name,t.args,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,oe(t)})},scale:Ne,scalepush:function(e,t){Ne(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){Ue(e,t).playing&&(n=n.concat(Ke(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;xe(n,r,1);var a=Oe(n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),function(e,t){return{type:Y,actionType:ee,tempo:e,glide:t}}(Oe(n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),_e(e,Pe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),_e(e,Pe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;xe(n,r,1);var a=Pe(n,r[0]),i=Se(n,r[1],1);return _e(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;xe(n,r,1);var a=Pe(n,r[0]),i=Se(n,r[1],1);return _e(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),_e(e,Pe(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),_e(e,Pe(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return xe(n,r,1),_e(e,Pe(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return Le.test(e)?e.toLowerCase():Fe.test(e)?e.toUpperCase():e}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];xe(r,a,1);var u=Math.floor(Oe(r,a[0])),c=Math.floor(70/u),s=" |"+(" ".repeat(u-1)+"|").repeat(c);return o.push({type:q,actionType:Me,line:i+n,text:s}),o},remind:function(){var e,t=Object.keys(De).join("\n");return[(e=t,{type:q,actionType:Ie,info:e})]}};function Ue(e,t){var n=e.agents[t];if(!n)throw new ke("No agent called ".concat(t));return n}function Xe(e,t,n,r){if(e.groups[t.name])throw new ke("".concat(t.name," is already the name of a group"));var a,i,o,u,c,s,f=[];return t.line=t.line+r,n.line=n.line+r,e.agents[t.name]={agent:t,score:n,playing:!0,amplitude:.5},f.push((a=t.name,i=t.line,o=t.position,u=t.position+t.name.length,c=n.position,s=n.position+n.scoreString.length,{type:q,actionType:Re,group:a,sections:{agent:{line:i,start:o,finish:u},score:{line:i,start:c,finish:s}}})),f}function Ge(e,t){var n=[],r=e.agents[t];return r&&(n.push(function(e){return{type:q,actionType:je,group:e}}(r.agent.name)),delete e.agents[t]),n}function ze(e,t){switch(t.type){case s:return t.agent;default:return null}}function Be(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=ze(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(oe(t)),r=r.concat(Ge(e,t))}),r}function Ke(e,t){var n=e.agents[t];if(!n)throw new ke("No agent called ".concat(t));return Ze(e,n.agent,n.score)}function qe(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=Ye(e,t.statements[a],n);i&&(r=r.concat(i))}return r}function Ye(e,t,n){switch(t.type){case s:return function(e,t,n){var r=t.agent,a=t.score,i=[];a.durations.length>0?i=(i=i.concat(Ze(e,r,a))).concat(Xe(e,r,a,n)):(i.push(oe(r.name)),i=i.concat(Ge(e,r.name)));return i}(e,t,n);case f:return a=(r=t).agent,i=r.effects,[ue(a.name,i.map(function(e){return e.name}))];case p:return function(e,t){var n=t.agent,r=t.effects;return[ce(n.name,r.map(function(e){return e.name}))]}(0,t);case l:return He(e,t,.1);case h:return He(e,t,-.1);case m:return function(e,t,n){var r=t.name,a=e.stdlib[r];if(!a)throw new ke("".concat(r," is not an existing command"));return a(e,t,n)}(e,t,n);case d:return function(e,t,n){var r=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[r]={command:j([t.command]),line:t.line+n};var a="seconds";t.timing.type===A&&(a="beats");var i=1;t.timing.modifier&&(i=t.timing.modifier);return[fe(t.timing.value,a,i,r)]}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new ke("".concat(n," is already the name of an agent"));if(e.groups[n])throw new ke("".concat(n," is already the name of a group"));var a=r.map(function(t){return Ue(e,t),t});return e.groups[n]=a,[]}(e,t);default:throw new ke("".concat(t.type," is not a supported statement type"))}var r,a,i}function He(e,t,n){var r=t.agent,a=e.agents[r.name];if(a)return a.amplitude=a.amplitude+n,[se(r.name,a.amplitude)]}function Ze(e,t,n){var r=n.scoreType;switch(r){case b:return function(e,t,n){var r=Ve(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,c=r.panning,s=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:b,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,c,p,s);return[pe(t.name,l)]}(e,t,n);case w:return function(e,t,n){var r=n.values.map(function(t){return function(e,t){return e.tonic+K.notes[e.scale][t]}(e,t)}),a=Ve(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,c=a.attack,s=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:w,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,c,s,l,f);return[le(t.name,h)]}(e,t,n);case T:return function(e,t,n){var r=Ve(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),c=n.instrument,s=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:v,scoreType:T,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,c,i,s,o);return[he(t.name,f)]}(e,t,n);default:throw new ke("".concat(r," is not a supported score type"))}}function Ve(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],c=[0],s=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===E)switch(t.modifierType){case x:c=t.values.map(function(e){return(e-1)/4-1});break;case P:o=[1/t.noteLength*(t.multiplier||1)];break;case O:u=t.values}else if(t.type===k)switch(t.operator){case"+":a=a.map(function(e){return e+t.value});break;case"-":a=a.map(function(e){return e-t.value});break;case"*":s=t.value;break;case"/":s=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*s}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:c,silences:f,timestretch:s,repeats:p}}var $e="AGENTFINISHED",Je="CALLBACKTRIGGER";function We(e,t){switch(t.actionType){case $e:return function(e,t){var n=t.name;return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),[]}(e,t);case Je:return function(e,t){var n=t.callbackId,r=t.remaining,a=e.callbacks[n];if(!a)return[];var i=qe(e,a.command);r<1&&delete e.callbacks[n];return i}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var Qe={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function et(e,t){switch(t.actionType){case Z:return n=e.command,a=(r=t).agent,i=r.method,rt(n,[{type:"string",value:i},{type:"string",value:a}]);case V:return function(e,t){var n=t.agent;return rt(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case $:return function(e,t){var n=t.agent,r=t.time,a=t.timeType,i=t.repeats;return rt(e,[{type:"string",value:"nap"},{type:"string",value:n},{type:"float",value:r},{type:"string",value:a},{type:"integer",value:i}])}(e.command,t);case J:return function(e,t){var n=t.agent,r=t.fxList;return rt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case W:return function(e,t){var n=t.agent,r=t.fxList;return rt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.rmFX,t);case Q:return function(e,t){var n=t.agent,r=t.amplitude;return rt(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case ee:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return rt(e,a)}(e.tempo,t);case te:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return rt(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case ne:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return rt(e,r)}(e.playPattern,t);case re:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return rt(e,r)}(e.playPattern,t);case ae:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return rt(e,r)}(e.playPattern,t)}var n,r,a,i}var tt={agentFinished:"/finished",callback:"/callback"};function nt(e,t){switch(t.address){case e.agentFinished:return function(e){return t=at(e,0),{type:H,actionType:$e,name:t};var t}(t);case e.callback:return function(e){var t=at(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new Ee("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:H,actionType:Je,callbackId:e,remaining:t}}(t,n)}(t);default:throw new Ee("".concat(t.address," is not a valid incoming address"))}}function rt(e,t){return{oscType:"message",address:e,args:t}}function at(e,t){var n=e.args[t];if("string"!==n.type)throw new Ee("Expected String but got ".concat(n.type));return n.value}function it(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===Y?t.audio.push(e):e.type===q&&t.editor.push(e)}),t}t.default={editorActions:r,init:function(e){var t=e||{info:console.log,warn:console.log,error:console.log};return{scale:K.names.major,tonic:60,bpm:120,stdlib:De,agents:{},groups:{},callbacks:{},lastCallbackID:0,logger:t}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return it(qe(e,B.parse(t),n))},free:function(e,t){return it(Be(e,B.parse(t)))},handleAction:We,incomingAction:function(e,t){return it(We(e,t))},actionToOSC:function(e){return e.map(function(e){return et(Qe,e)})},oscToAction:function(e){return nt(tt,e)}}}])});
//# sourceMappingURL=atomiix.min.js.map
{
"name": "@atomiix/atomiix",
"version": "1.0.0",
"version": "1.1.0",
"description": "A live coding language based on Ixilang",

@@ -5,0 +5,0 @@ "main": "lib/atomiix.min.js",

@@ -21,2 +21,13 @@ import { AUDIOACTION } from '../types';

export function NapAgent(agent, time, timeType, repeats) {
return {
type: AUDIOACTION,
actionType: t.NAPAGENT,
agent,
time,
timeType,
repeats,
};
}
export function AddAgentFX(agent, fxList) {

@@ -23,0 +34,0 @@ return {

export const AGENTMETHOD = 'AGENTMETHOD';
export const FREEAGENT = 'FREEAGENT';
export const NAPAGENT = 'NAPAGENT';
export const ADDAGENTFX = 'ADDAGENTFX';

@@ -4,0 +5,0 @@ export const RMAGENTFX = 'RMAGENTFX';

import * as audioActions from '../../actions/audio';
import * as astTypes from '../ast/types';

@@ -39,2 +40,22 @@ import { getAgentInfo } from '../interpreter/state';

export function nap(state, { name, args }) {
expectArgs(name, args, 2);
const agentOrGroup = expectString(name, args[0]);
const timeArg = args[1];
const time = timeArg.value;
const timeType = timeArg.type === astTypes.BEAT ? 'beats' : 'seconds';
const repeats = timeArg.modifier || 1;
return handleGroup(state, agentOrGroup, (s, n) => {
const msgs = [];
const agentInfo = getAgentInfo(s, n);
if (agentInfo) {
agentInfo.playing = false;
msgs.push(audioActions.NapAgent(n, time, timeType, repeats));
}
return msgs;
});
}
export function ungroup(state, { name, args }) {

@@ -41,0 +62,0 @@ expectArgs(name, args, 1);

@@ -1,2 +0,2 @@

import { doze, wake } from './control';
import { doze, wake, nap } from './control';
import { kill, scale, scalepush, tonic, tempo } from './global';

@@ -9,2 +9,3 @@ import { shake, reverse, shiftr, shiftl, up, down, yoyo } from './score';

wake,
nap,
kill,

@@ -11,0 +12,0 @@ scale,

@@ -21,2 +21,4 @@ import * as inbound from '../actions/inbound';

return freeAgentOSC(addresses.command, action);
case at.NAPAGENT:
return napAgentOSC(addresses.command, action);
case at.ADDAGENTFX:

@@ -83,2 +85,14 @@ return addAgentFXOSC(addresses.addFX, action);

function napAgentOSC(address, { agent, time, timeType, repeats }) {
const msgArgs = [
{ type: 'string', value: 'nap' },
{ type: 'string', value: agent },
{ type: 'float', value: time },
{ type: 'string', value: timeType },
{ type: 'integer', value: repeats },
];
return OSCMessage(address, msgArgs);
}
function addAgentFXOSC(address, { agent, fxList }) {

@@ -85,0 +99,0 @@ const msgArgs = [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc