scribbletune 5.0.2 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -7
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/scribbletune.es.js +588 -0
- package/dist/scribbletune.js +1 -1
- package/dist/scribbletune.js.map +1 -1
- package/dist/scribbletune.umd.js +1 -0
- package/package.json +6 -9
- package/dist/max.js +0 -2
- package/dist/max.js.map +0 -1
package/README.md
CHANGED
|
@@ -38,11 +38,4 @@ const scribble = require('scribbletune/browser');
|
|
|
38
38
|
```
|
|
39
39
|
This will provide the same API but augment it a bit to support browser based functionality.
|
|
40
40
|
|
|
41
|
-
Similarly, you can use the Scribbletune API for Max for Live development by doing
|
|
42
|
-
```javascript
|
|
43
|
-
const scribble = require('scribbletune/max');
|
|
44
|
-
```
|
|
45
|
-
Just like the `browser` version this too will enable the same API but with some added bells and whistles for Max for Live.
|
|
46
|
-
|
|
47
|
-
|
|
48
41
|
Visit [scribbletune.com](https://scribbletune.com) for documentation, tutorials and examples! Listen to music generated with Scribbletune on [Soundcloud](https://soundcloud.com/scribbletune).
|
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{var e={397:(e,t)=>{(()=>{"use strict";var e={413:e=>{e.exports=JSON.parse('{"5th":"100000010000","M7#5sus4":"100001001001","7#5sus4":"100001001010","sus4":"100001010000","M7sus4":"100001010001","7sus4":"100001010010","7no5":"100010000010","aug":"100010001000","M7b6":"100010001001","maj7#5":"100010001001","7#5":"100010001010","7b13":"100010001010","M":"100010010000","maj7":"100010010001","7th":"100010010010","6th":"100010010100","7add6":"100010010110","7b6":"100010011010","Mb5":"100010100000","M7b5":"100010100001","7b5":"100010100010","maj#4":"100010110001","7#11":"100010110010","M6#11":"100010110100","7#11b13":"100010111010","m#5":"100100001000","mb6M7":"100100001001","m7#5":"100100001010","m":"100100010000","m/ma7":"100100010001","m7":"100100010010","m6":"100100010100","mMaj7b6":"100100011001","dim":"100100100000","oM7":"100100100001","m7b5":"100100100010","dim7":"100100100100","o7M7":"100100100101","4th":"100101000010","madd4":"100101010000","m7add11":"100101010010","+add#9":"100110001000","7#5#9":"100110001010","7#9":"100110010010","13#9":"100110010110","7#9b13":"100110011010","maj7#9#11":"100110110001","7#9#11":"100110110010","13#9#11":"100110110110","7#9#11b13":"100110111010","sus2":"101000010000","M9#5sus4":"101001001001","sus24":"101001010000","M9sus4":"101001010001","11th":"101001010010","9sus4":"101001010010","13sus4":"101001010110","9no5":"101010000010","13no5":"101010000110","M#5add9":"101010001000","maj9#5":"101010001001","9#5":"101010001010","9b13":"101010001010","Madd9":"101010010000","maj9":"101010010001","9th":"101010010010","6/9":"101010010100","maj13":"101010010101","M7add13":"101010010101","13th":"101010010110","M9b5":"101010100001","9b5":"101010100010","13b5":"101010100110","9#5#11":"101010101010","maj9#11":"101010110001","9#11":"101010110010","69#11":"101010110100","M13#11":"101010110101","13#11":"101010110110","9#11b13":"101010111010","m9#5":"101100001010","madd9":"101100010000","mM9":"101100010001","m9":"101100010010","m69":"101100010100","m13":"101100010110","mMaj9b6":"101100011001","m9b5":"101100100010","m11A":"101101001010","m11":"101101010010","b9sus":"110001010010","11b9":"110001010010","7sus4b9b13":"110001011010","alt7":"110010000010","7#5b9":"110010001010","Maddb9":"110010010000","M7b9":"110010010001","7b9":"110010010010","13b9":"110010010110","7b9b13":"110010011010","7#5b9#11":"110010101010","7b9#11":"110010110010","13b9#11":"110010110110","7b9b13#11":"110010111010","mb6b9":"110100001000","7b9#9":"110110010010"}')},722:e=>{e.exports=JSON.parse('{"major pentatonic":"101010010100","ionian pentatonic":"100011010001","mixolydian pentatonic":"100011010010","ritusen":"101001010100","egyptian":"101001010010","neopolitan major pentatonic":"100011100010","vietnamese 1":"100101011000","pelog":"110100011000","kumoijoshi":"110001011000","hirajoshi":"101100011000","iwato":"110001100010","in-sen":"110001010010","lydian pentatonic":"100010110001","malkos raga":"100101001010","locrian pentatonic":"100101100010","minor pentatonic":"100101010010","minor six pentatonic":"100101010100","flat three pentatonic":"101100010100","flat six pentatonic":"101010011000","scriabin":"110010010100","whole tone pentatonic":"100010101010","lydian #5P pentatonic":"100010101001","lydian dominant pentatonic":"100010110010","minor #7M pentatonic":"100101010001","super locrian pentatonic":"100110100010","minor hexatonic":"101101010001","augmented":"100110011001","major blues":"101110010100","piongio":"101001010110","prometheus neopolitan":"110010100110","prometheus":"101010100110","mystery #1":"110010101010","six tone symmetric":"110011001100","whole tone":"101010101010","messiaen\'s mode #5":"110001110001","minor blues":"100101110010","locrian major":"101011101010","double harmonic lydian":"110010111001","harmonic minor":"101101011001","altered":"110110101010","locrian #2":"101101101010","mixolydian b6":"101011011010","lydian dominant":"101010110110","lydian":"101010110101","lydian augmented":"101010101101","dorian b2":"110101010110","melodic minor":"101101010101","locrian":"110101101010","ultralocrian":"110110101100","locrian 6":"110101100110","augmented heptatonic":"100111011001","romanian minor":"101100110110","dorian #4":"101100110110","lydian diminished":"101100110101","phrygian":"110101011010","leading whole tone":"101010101011","lydian minor":"101010111010","phrygian dominant":"110011011010","balinese":"110101011001","neopolitan major":"110101010101","aeolian":"101101011010","harmonic major":"101011011001","double harmonic major":"110011011001","dorian":"101101010110","hungarian minor":"101100111001","hungarian major":"100110110110","oriental":"110011100110","flamenco":"110110110010","todi raga":"110100111001","mixolydian":"101011010110","persian":"110011101001","major":"101011010101","enigmatic":"110010101011","major augmented":"101011001101","lydian #9":"100110110101","messiaen\'s mode #4":"111001111001","purvi raga":"110011111001","spanish heptatonic":"110111011010","bebop":"101011010111","bebop minor":"101111010110","bebop major":"101011011101","bebop locrian":"110101111010","minor bebop":"101101011011","diminished":"101101101101","ichikosucho":"101011110101","minor six diminished":"101101011101","half-whole diminished":"110110110110","kafi raga":"100111010111","messiaen\'s mode #6":"101011101011","composite blues":"101111110110","messiaen\'s mode #3":"101110111011","messiaen\'s mode #7":"111101111101","chromatic":"111111111111","ionian":"101011010101","minor":"101101011010"}')}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{r.r(o),r.d(o,{chord:()=>c,chords:()=>a,inlineChord:()=>i,scale:()=>u,scales:()=>s});var e=r(722),t=r(413),n=function(n){var r=n.scale,o=n.chord,i=r||o,a=r?"scale":"chord";if("string"!=typeof i)throw new Error("".concat(i," is not a valid input for ").concat(a));var s,c,u=i.indexOf(" ");-1===u?(s=i.slice(1),c=i[0],"b"!==i[1]&&"#"!==i[1]||(s=i.slice(2),c+=i[1])):(s=i.slice(-1===u?1:u+1),c=i.slice(0,u));var l=function(e){return{"C#":"Db","D#":"Eb","F#":"Gb","G#":"Ab","A#":"Bb"}[e.toUpperCase()]||e.charAt(0).toUpperCase()+e.slice(1)}(c.replace(/\d/g,"")),p=""!==c.replace(/\D/g,"")?+c.replace(/\D/g,""):4;if(isNaN(p))throw new Error("".concat(c[0]," does not have a valid octave"));if(!e[s]&&!t[s])throw new Error("".concat(i," is not a valid ").concat(a));for(var f=function(e,t){var n=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],r=n.map((function(e){return e+t})),o=n.map((function(e){return e+(t+1)})),i=r.concat(o);return i.slice(i.indexOf(e+t))}(l,p),d=[],h=0,m=0,v=r?e:t;h<v[s].length;)"1"===v[s][h]&&d.push(f[m]),h++,m++;return d},i=function(e){var t,r,o="b9sus",i=4;return e.includes(o)?(r=o,t=e.slice(0,e.indexOf(o))):(t=e[0],r=e.slice(1),"b"!==e[1]&&"#"!==e[1]||(t+=e[1],r=e.slice(2))),e.includes("_")&&(i=+e.split("_")[1],r=r.slice(0,r.indexOf("_"))),n({chord:t+i+" "+r})},a=function(){return Object.keys(t)},s=function(){return Object.keys(e)},c=function(e){return n({chord:e})},u=function(e){return n({scale:e})}})();var i=t;for(var a in o)i[a]=o[a];o.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})()},126:function(e,t,n){e=n.nmd(e);var r={};!function(e){var t=e.DEFAULT_VOLUME=90,n=(e.DEFAULT_DURATION=128,e.DEFAULT_CHANNEL=0,{midi_letter_pitches:{a:21,b:23,c:12,d:14,e:16,f:17,g:19},midiPitchFromNote:function(e){var t=/([a-g])(#+|b+)?([0-9]+)$/i.exec(e),r=t[1].toLowerCase(),o=t[2]||"";return 12*parseInt(t[3],10)+n.midi_letter_pitches[r]+("#"==o.substr(0,1)?1:-1)*o.length},ensureMidiPitch:function(e){return"number"!=typeof e&&/[^0-9]/.test(e)?n.midiPitchFromNote(e):parseInt(e,10)},midi_pitches_letter:{12:"c",13:"c#",14:"d",15:"d#",16:"e",17:"f",18:"f#",19:"g",20:"g#",21:"a",22:"a#",23:"b"},midi_flattened_notes:{"a#":"bb","c#":"db","d#":"eb","f#":"gb","g#":"ab"},noteFromMidiPitch:function(e,t){var r,o=0,i=e;return t=t||!1,e>23&&(i=e-12*(o=Math.floor(e/12)-1)),r=n.midi_pitches_letter[i],t&&r.indexOf("#")>0&&(r=n.midi_flattened_notes[r]),r+o},mpqnFromBpm:function(e){var t=Math.floor(6e7/e),n=[];do{n.unshift(255&t),t>>=8}while(t);for(;n.length<3;)n.push(0);return n},bpmFromMpqn:function(e){if(void 0!==e[0])for(var t=0,n=e.length-1;n>=0;++t,--n)e[t];return Math.floor(6e7/e)},codes2Str:function(e){return String.fromCharCode.apply(null,e)},str2Bytes:function(e,t){if(t)for(;e.length/2<t;)e="0"+e;for(var n=[],r=e.length-1;r>=0;r-=2){var o=0===r?e[r]:e[r-1]+e[r];n.unshift(parseInt(o,16))}return n},translateTickTime:function(e){for(var t=127&e;e>>=7;)t<<=8,t|=127&e|128;for(var n=[];n.push(255&t),128&t;)t>>=8;return n}}),r=function(e){if(!this)return new r(e);!e||null===e.type&&void 0===e.type||null===e.channel&&void 0===e.channel||null===e.param1&&void 0===e.param1||(this.setTime(e.time),this.setType(e.type),this.setChannel(e.channel),this.setParam1(e.param1),this.setParam2(e.param2))};r.NOTE_OFF=128,r.NOTE_ON=144,r.AFTER_TOUCH=160,r.CONTROLLER=176,r.PROGRAM_CHANGE=192,r.CHANNEL_AFTERTOUCH=208,r.PITCH_BEND=224,r.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},r.prototype.setType=function(e){if(e<r.NOTE_OFF||e>r.PITCH_BEND)throw new Error("Trying to set an unknown event: "+e);this.type=e},r.prototype.setChannel=function(e){if(e<0||e>15)throw new Error("Channel is out of bounds.");this.channel=e},r.prototype.setParam1=function(e){this.param1=e},r.prototype.setParam2=function(e){this.param2=e},r.prototype.toBytes=function(){var e=[],t=this.type|15&this.channel;return e.push.apply(e,this.time),e.push(t),e.push(this.param1),void 0!==this.param2&&null!==this.param2&&e.push(this.param2),e};var o=function(e){if(!this)return new o(e);this.setTime(e.time),this.setType(e.type),this.setData(e.data)};o.SEQUENCE=0,o.TEXT=1,o.COPYRIGHT=2,o.TRACK_NAME=3,o.INSTRUMENT=4,o.LYRIC=5,o.MARKER=6,o.CUE_POINT=7,o.CHANNEL_PREFIX=32,o.END_OF_TRACK=47,o.TEMPO=81,o.SMPTE=84,o.TIME_SIG=88,o.KEY_SIG=89,o.SEQ_EVENT=127,o.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},o.prototype.setType=function(e){this.type=e},o.prototype.setData=function(e){this.data=e},o.prototype.toBytes=function(){if(!this.type)throw new Error("Type for meta-event not specified.");var e=[];if(e.push.apply(e,this.time),e.push(255,this.type),Array.isArray(this.data))e.push(this.data.length),e.push.apply(e,this.data);else if("number"==typeof this.data)e.push(1,this.data);else if(null!==this.data&&void 0!==this.data){e.push(this.data.length);var t=this.data.split("").map((function(e){return e.charCodeAt(0)}));e.push.apply(e,t)}else e.push(0);return e};var i=function(e){if(!this)return new i(e);var t=e||{};this.events=t.events||[]};i.START_BYTES=[77,84,114,107],i.END_BYTES=[0,255,47,0],i.prototype.addEvent=function(e){return this.events.push(e),this},i.prototype.addNoteOn=i.prototype.noteOn=function(e,o,i,a){return this.events.push(new r({type:r.NOTE_ON,channel:e,param1:n.ensureMidiPitch(o),param2:a||t,time:i||0})),this},i.prototype.addNoteOff=i.prototype.noteOff=function(e,o,i,a){return this.events.push(new r({type:r.NOTE_OFF,channel:e,param1:n.ensureMidiPitch(o),param2:a||t,time:i||0})),this},i.prototype.addNote=i.prototype.note=function(e,t,n,r,o){return this.noteOn(e,t,r,o),n&&this.noteOff(e,t,n,o),this},i.prototype.addChord=i.prototype.chord=function(e,t,n,r){if(!Array.isArray(t)&&!t.length)throw new Error("Chord must be an array of pitches");return t.forEach((function(t){this.noteOn(e,t,0,r)}),this),t.forEach((function(t,r){0===r?this.noteOff(e,t,n):this.noteOff(e,t)}),this),this},i.prototype.setInstrument=i.prototype.instrument=function(e,t,n){return this.events.push(new r({type:r.PROGRAM_CHANGE,channel:e,param1:t,time:n||0})),this},i.prototype.setTempo=i.prototype.tempo=function(e,t){return this.events.push(new o({type:o.TEMPO,data:n.mpqnFromBpm(e),time:t||0})),this},i.prototype.toBytes=function(){var e=0,t=[],r=i.START_BYTES,o=i.END_BYTES;this.events.forEach((function(n){var r=n.toBytes();e+=r.length,t.push.apply(t,r)})),e+=o.length;var a=n.str2Bytes(e.toString(16),4);return r.concat(a,t,o)};var a=function(e){if(!this)return new a(e);var t=e||{};if(t.ticks){if("number"!=typeof t.ticks)throw new Error("Ticks per beat must be a number!");if(t.ticks<=0||t.ticks>=32768||t.ticks%1!=0)throw new Error("Ticks per beat must be an integer between 1 and 32767!")}this.ticks=t.ticks||128,this.tracks=t.tracks||[]};a.HDR_CHUNKID="MThd",a.HDR_CHUNK_SIZE="\0\0\0",a.HDR_TYPE0="\0\0",a.HDR_TYPE1="\0",a.prototype.addTrack=function(e){return e?(this.tracks.push(e),this):(e=new i,this.tracks.push(e),e)},a.prototype.toBytes=function(){var e=this.tracks.length.toString(16),t=a.HDR_CHUNKID+a.HDR_CHUNK_SIZE;return parseInt(e,16)>1?t+=a.HDR_TYPE1:t+=a.HDR_TYPE0,t+=n.codes2Str(n.str2Bytes(e,2)),t+=String.fromCharCode(this.ticks/256,this.ticks%256),this.tracks.forEach((function(e){t+=n.codes2Str(e.toBytes())})),t},e.Util=n,e.File=a,e.Track=i,e.Event=r,e.MetaEvent=o}(r),null!==e?e.exports=r:null!==t?t=r:this.Midi=r},148:function(e,t,n){"use strict";var r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.arp=void 0;var o=n(397),i=n(604),a=function(e,t){var n=function(e){if(!e)throw new Error("Empty element");var t=e.replace(/\d/,""),n=e.replace(/\D/g,"")||4;if(!t)throw new Error("Incorrect note");return t+(+n+1)},o=e.map(n),i=o.map(n);return r(r(r([],e,!0),o,!0),i,!0).slice(0,t)};t.arp=function(e){var t=[],n={count:4,order:"0123",chords:""};if("string"==typeof e)n.chords=e;else{if(e.order&&e.order.match(/\D/g))throw new TypeError("Invalid value for order");if(e.count>8||e.count<2)throw new TypeError("Invalid value for count");e.count&&!e.order&&(n.order=Array.from(Array(e.count).keys()).join("")),Object.assign(n,e)}if("string"==typeof n.chords)n.chords.split(" ").forEach((function(e,i){try{var s=a((0,o.inlineChord)(e),n.count),c=n.order.split("").map((function(e){return s[e]}));t=r(r([],t,!0),c,!0)}catch(t){throw new Error("Cannot decode chord ".concat(i+1,' "').concat(e,'" in given "').concat(n.chords,'"'))}}));else{if(!Array.isArray(n.chords))throw new TypeError("Invalid value for chords");n.chords.forEach((function(e,o){try{var s=a(e,n.count),c=n.order.split("").map((function(e){return s[e]}));t=r(r([],t,!0),c,!0)}catch(t){throw new Error("".concat((0,i.errorHasMessage)(t)?t.message:t," in chord ").concat(o+1,' "').concat(e,'"'))}}))}return t}},378:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.clip=t.renderingDuration=t.totalPatternDuration=t.recursivelyApplyPatternToDurations=t.getDuration=t.getNote=void 0;var a=n(604),s="4n";t.getNote=function(e,t,n){return"R"===e&&t.randomNotes&&t.randomNotes.length>0?t.randomNotes[(0,a.randomInt)(t.randomNotes.length-1)]:t.notes?t.notes[n%(t.notes.length||1)]:""},t.getDuration=function(e,t){return e.durations?e.durations[t%e.durations.length]:e.dur||e.subdiv||"8n"},t.recursivelyApplyPatternToDurations=function(e,n,r){return void 0===r&&(r=[]),e.forEach((function(e){"string"==typeof e&&("x"!==e&&"R"!==e||r.push(n),"_"===e&&r.length&&(r[r.length-1]+=n)),Array.isArray(e)&&(0,t.recursivelyApplyPatternToDurations)(e,n/e.length,r)})),r};var c=function(e,n,r){if(r=r||Tone.getContext(),!e.pattern)throw new Error("No pattern provided!");return e.durations||e.dur||(e.durations=(0,t.recursivelyApplyPatternToDurations)((0,a.expandStr)(e.pattern),Tone.Ticks(e.subdiv||s).toSeconds())),new Tone.Sequence({callback:n.getSeqFn(e),events:(0,a.expandStr)(e.pattern),subdivision:e.subdiv||s,context:r})};t.totalPatternDuration=function(e,t){return"number"==typeof t?t*(0,a.expandStr)(e).length:Tone.Ticks(t).toSeconds()*(0,a.expandStr)(e).length},t.renderingDuration=function(e,n,r,o){var i=e.split("").filter((function(e){return"x"===e})).length,a=e.split("").filter((function(e){return"R"===e})).length,s=(null==o?void 0:o.length)?i:i+a,c=r.length||1;return(0,t.totalPatternDuration)(e,n)/s*function(e,t){for(var n=e<t?[e,t]:[t,e],r=n[0],o=n[1],i=o;i%r!=0;)i+=o;return i}(c,s)};var u,l=0;t.clip=function(e,n){if("string"==typeof(e=r(r({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",align:"1m",alignOffset:"0",amp:100,accentLow:70,randomNotes:null,offlineRendering:!1}),e||{})).notes&&(e.notes=e.notes.replace(/\s{2,}/g," "),e.notes=e.notes.split(" ")),e.notes=e.notes?e.notes.map(a.convertChordsToNotes):[],/[^x\-_[\]R]/.test(e.pattern))throw new TypeError("pattern can only comprise x - _ [ ] R, found ".concat(e.pattern));return e.shuffle&&(e.notes=(0,a.shuffle)(e.notes)),e.randomNotes&&"string"==typeof e.randomNotes&&(e.randomNotes=e.randomNotes.replace(/\s{2,}/g," ").split(/\s/)),e.randomNotes&&(e.randomNotes=e.randomNotes.map(a.convertChordsToNotes)),e.offlineRendering?function(e,t){u||(u=Tone.getContext()),l++;var n=new Tone.Player({context:u,loop:!0});return Tone.Offline((function(t){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n=c(e,t),[4,Tone.loaded()];case 1:return r.sent(),n.start(),t.transport.start(),[2]}}))}))}),t).then((function(t){var r;n.buffer=t,0==--l&&(Tone.setContext(u),null===(r=e.offlineRenderingCallback)||void 0===r||r.call(e))})),n.toDestination(),n.sync(),n}(e,(0,t.renderingDuration)(e.pattern,e.subdiv||s,e.notes,e.randomNotes)):c(e,n,u)}},773:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Session=t.midi=t.arp=t.progression=t.getChordsByProgression=t.getChordDegrees=t.clip=t.chords=t.chord=t.modes=t.scales=t.mode=t.scale=void 0;var i=n(397);Object.defineProperty(t,"scales",{enumerable:!0,get:function(){return i.scales}}),Object.defineProperty(t,"modes",{enumerable:!0,get:function(){return i.scales}}),Object.defineProperty(t,"chords",{enumerable:!0,get:function(){return i.chords}}),Object.defineProperty(t,"scale",{enumerable:!0,get:function(){return i.scale}}),Object.defineProperty(t,"mode",{enumerable:!0,get:function(){return i.scale}}),Object.defineProperty(t,"chord",{enumerable:!0,get:function(){return i.chord}});var a=n(378);Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return a.clip}});var s=n(668);Object.defineProperty(t,"getChordDegrees",{enumerable:!0,get:function(){return s.getChordDegrees}}),Object.defineProperty(t,"getChordsByProgression",{enumerable:!0,get:function(){return s.getChordsByProgression}}),Object.defineProperty(t,"progression",{enumerable:!0,get:function(){return s.progression}});var c=n(148);Object.defineProperty(t,"arp",{enumerable:!0,get:function(){return c.arp}});var u=n(267);Object.defineProperty(t,"midi",{enumerable:!0,get:function(){return u.midi}});var l=n(484);Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return l.Session}}),o(n(621),t)},594:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;var i=n(378),a=n(604),s=function(e){var t=Tone.Transport.position.split(":");if("0"===t[0]&&"0"===t[1])return 0;var n=Tone.Transport.ticks,r=(null==e?void 0:e.align)||"1m",o=(null==e?void 0:e.alignOffset)||"0",i=Tone.Ticks(r).toTicks(),a=Tone.Ticks(o).toTicks();return Tone.Ticks(Math.floor(n/i+1)*i+a)},c=function(){function e(e){var t=this;this.idx=e.idx||0,this.name=e.name||"ch "+e.idx,this.activePatternIdx=-1,this.channelClips=[],this.clipNoteCount=0,e.clips,e.samples,e.sample,e.synth;var n=o(e,["clips","samples","sample","synth"]),i=(n.external,n.sampler,n.buffer,o(n,["external","sampler","buffer"])),s=(i.player,i.instrument,i.volume,o(i,["player","instrument","volume"])),c=s.eventCb,u=s.playerCb,l=(s.effects,o(s,["eventCb","playerCb","effects"])),p=l.context,f=void 0===p?Tone.getContext():p,d=o(l,["context"]);this.eventCbFn=c,this.playerCbFn=u,this.hasLoaded=!1,this.hasFailed=!1,this.initializerTask=this.initOutputProducer(f,e).then((function(){return t.initInstrument(f,e).then((function(){return t.adjustInstrument(f,e).then((function(){return t.initEffects(f,e)}))}))}));var h=!1;try{e.clips.forEach((function(e,n){try{t.addClip(r(r({},e),d))}catch(e){throw new Error("".concat((0,a.errorHasMessage)(e)?e.message:e," in clip ").concat(n+1))}}),this)}catch(e){h=e}this.initializerTask.then((function(){if(h)throw h;t.hasLoaded=!0,t.eventCb("loaded",{})})).catch((function(e){t.hasFailed=e,t.eventCb("error",{e})}))}return e.setTransportTempo=function(e){Tone.Transport.bpm.value=e},e.startTransport=function(){Tone.start(),Tone.Transport.start()},e.stopTransport=function(e){void 0===e&&(e=!0),Tone.Transport.stop(),e&&Tone.Transport.cancel()},e.prototype.setVolume=function(e){var t,n;this.instrument&&(this.instrument.volume.value=e),this.external&&(null===(n=(t=this.external).setVolume)||void 0===n||n.call(t,e))},e.prototype.startClip=function(e,t){var n=this,r=this.channelClips[e];t=t||(0===t?0:s(r)),this.activePatternIdx>-1&&this.activePatternIdx!==e&&this.stopClip(this.activePatternIdx,t),r&&"started"!==r.state&&(this.counterResetTask=Tone.Transport.scheduleOnce((function(){n.clipNoteCount=0}),t),this.activePatternIdx=e,null==r||r.start(t))},e.prototype.stopClip=function(e,t){var n=this.channelClips[e];t=t||(0===t?0:s(n)),null==n||n.stop(t),e===this.activePatternIdx&&(this.activePatternIdx=-1)},e.prototype.addClip=function(e,t){var n=this;t=t||this.channelClips.length,e.pattern?(this.channelClips[t]=(0,i.clip)(r({},e),this),["align","alignOffset"].forEach((function(r){e[r]&&(n.channelClips[t][r]=e[r])}))):this.channelClips[t]=null},e.prototype.getSeqFn=function(e){var t=this;return this.external?function(n,r){var o,a;if("x"===r||"R"===r){var s=t.clipNoteCount;if(t.hasLoaded){var c=(0,i.getNote)(r,e,s)[0],u=(0,i.getDuration)(e,s),l=Tone.Time(u).toSeconds();t.playerCb({note:c,duration:u,time:n,counter:s});try{null===(a=(o=t.external).triggerAttackRelease)||void 0===a||a.call(o,c,l,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.Player?function(e,n){if("x"===n||"R"===n){var r=t.clipNoteCount;if(t.hasLoaded){t.playerCb({note:"",duration:"",time:e,counter:r});try{t.instrument.start(e)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.PolySynth||this.instrument instanceof Tone.Sampler?function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getNote)(r,e,o),s=(0,i.getDuration)(e,o);t.playerCb({note:a,duration:s,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,s,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.NoiseSynth?function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getDuration)(e,o);t.playerCb({note:"",duration:a,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getNote)(r,e,o)[0],s=(0,i.getDuration)(e,o);t.playerCb({note:a,duration:s,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,s,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}},e.prototype.eventCb=function(e,t){"function"==typeof this.eventCbFn&&(t.channel=this,this.eventCbFn(e,t))},e.prototype.playerCb=function(e){"function"==typeof this.playerCbFn&&(e.channel=this,this.playerCbFn(e))},e.prototype.checkToneObjLoaded=function(e,t){var n=this,r=e instanceof Tone.Sampler;if("loaded"in e){if(e.loaded)return void t();if(r)return;var o=!1;if(["buffer","_buffer","_buffers"].forEach((function(r){r in e&&(n.checkToneObjLoaded(e[r],t),o=!0)})),o)return}if(e instanceof Tone.ToneAudioBuffer||e instanceof Tone.ToneBufferSource||"loaded"in e&&"onload"in e){var i=e.onload;e.onload=function(){i&&"function"==typeof i&&(e.onload=i,i()),t()}}else t()},e.prototype.recreateToneObjectInContext=function(e,t){var n=this;return t=t||Tone.getContext(),new Promise((function(o,i){if(e instanceof Tone.PolySynth){var a=Tone.PolySynth(Tone[e._dummyVoice.name],r(r({},e.get()),{context:t}));n.checkToneObjLoaded(a,(function(){return o(a)}))}else if(e instanceof Tone.Player)var s=Tone.Player({url:e._buffer,context:t,onload:function(){return n.checkToneObjLoaded(s,(function(){return o(s)}))}});else if(e instanceof Tone.Sampler)var c=e.get(),u={attack:c.attack,curve:c.curve,release:c.release,volume:c.volume},l={baseUrl:e._buffers.baseUrl,urls:Object.fromEntries(e._buffers._buffers.entries())},p=Tone.Sampler(r(r(r({},u),l),{context:t,onload:function(){return n.checkToneObjLoaded(p,(function(){return o(p)}))}}));else{var f=Tone[e.name](r(r({},e.get()),{context:t,onload:function(){return n.checkToneObjLoaded(f,(function(){return o(f)}))}}));n.checkToneObjLoaded(f,(function(){return o(f)}))}}))},e.prototype.initOutputProducer=function(e,t){var n=this;return e=e||Tone.getContext(),new Promise((function(o,i){if(t.synth){if(t.instrument)throw new Error("Either synth or instrument can be provided, but not both.");if(t.synth.synth){var a=t.synth.synth,s=t.synth.preset||{};n.instrument=new Tone[a](r(r({},s),{context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}})),n.checkToneObjLoaded(n.instrument,o)}else n.instrument=t.synth,console.warn('The "synth" parameter with instrument will be deprecated in the future. Please use the "instrument" parameter instead.'),n.checkToneObjLoaded(n.instrument,o)}else if("string"==typeof t.instrument)n.instrument=new Tone[t.instrument]({context:e}),n.checkToneObjLoaded(n.instrument,o);else if(t.instrument)n.instrument=t.instrument,n.checkToneObjLoaded(n.instrument,o);else if(t.sample||t.buffer)n.instrument=new Tone.Player({url:t.sample||t.buffer,context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(t.samples)n.instrument=new Tone.Sampler({urls:t.samples,context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(t.sampler)n.instrument=t.sampler,n.checkToneObjLoaded(n.instrument,o);else if(t.player)n.instrument=t.player,n.checkToneObjLoaded(n.instrument,o);else{if(!t.external)throw new Error("One of required synth|instrument|sample|sampler|samples|buffer|player|external is not provided!");if(n.external=r({},t.external),n.instrument={context:e,volume:{value:0}},t.external.init)return t.external.init(e.rawContext).then((function(){o()})).catch((function(e){var t;i(new Error("".concat(e.message," loading external output module of channel idx ").concat(n.idx,", ").concat(null!==(t=n.name)&&void 0!==t?t:"(no name)")))}));o()}if(!n.instrument)throw new Error("Failed instantiating instrument from given params.")}))},e.prototype.initInstrument=function(e,t){var n,r=this;return e=e||Tone.getContext(),t.external||(null===(n=this.instrument)||void 0===n?void 0:n.context)===e?new Promise((function(e,t){e()})):this.recreateToneObjectInContext(this.instrument,e).then((function(e){r.instrument=e}))},e.prototype.adjustInstrument=function(e,t){var n=this;return e=e||Tone.getContext(),new Promise((function(e,r){t.volume&&n.setVolume(t.volume),e()}))},e.prototype.initEffects=function(e,t){var n=this;e=e||Tone.getContext();var r,o=function(e){return"function"==typeof e.start?e.start():e},i=(r=t.effects)?Array.isArray(r)?r:[r]:[];if(t.external){if(0!==i.length)throw new Error("Effects cannot be used with external output");return Promise.resolve()}return Promise.all(i.map((function(t){return new Promise((function(r,o){if("string"==typeof t)r(new Tone[t]({context:e}));else{if(t.context!==e)return n.recreateToneObjectInContext(t,e);r(t)}})).then((function(e){return e.toDestination()}))}))).then((function(e){return e.map(o)})).then((function(e){var t;(t=n.instrument).chain.apply(t,e).toDestination()}))},Object.defineProperty(e.prototype,"clips",{get:function(){return this.channelClips},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeClipIdx",{get:function(){return this.activePatternIdx},enumerable:!1,configurable:!0}),e}();t.Channel=c},267:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.midi=void 0;var s=a(n(231)),c=i(n(126));t.midi=function(e,t,n){void 0===t&&(t="music.mid");var r=l(e,n).toBytes();return null===t?r:(t.endsWith(".mid")||(t+=".mid"),"undefined"!=typeof window&&window.URL&&window.URL.createObjectURL?u(r,t):(s.default.writeFileSync(t,r,"binary"),void console.log("MIDI file generated: ".concat(t,"."))))};var u=function(e,t){for(var n=new Uint8Array(e.length),r=0;r<e.length;r++){var o=e.charCodeAt(r);n[r]=o}var i=new Blob([n],{type:"audio/midi"}),a=document.createElement("a");return a.href="undefined"!=typeof window&&void 0!==window.URL&&void 0!==window.URL.createObjectURL&&window.URL.createObjectURL(i)||"",a.download=t,a.innerText="Download MIDI file",a},l=function(e,t){var n=new c.File,r=new c.Track;"number"==typeof t&&r.setTempo(t),n.addTrack(r);for(var o=0,i=e;o<i.length;o++){var a=i[o],s=a.level||127;a.note?"string"==typeof a.note?(r.noteOn(0,a.note,a.length,s),r.noteOff(0,a.note,a.length,s)):r.addChord(0,a.note,a.length,s):r.noteOff(0,"",a.length)}return n}},668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.progression=t.getChordsByProgression=t.getChordDegrees=void 0;var r=n(397),o=n(604);t.getChordDegrees=function(e){var t={ionian:["I","ii","iii","IV","V","vi","vii°"],dorian:["i","ii","III","IV","v","vi°","VII"],phrygian:["i","II","III","iv","v°","VI","vii"],lydian:["I","II","iii","iv°","V","vi","vii"],mixolydian:["I","ii","iii°","IV","v","vi","VII"],aeolian:["i","ii°","III","iv","v","VI","VII"],locrian:["i°","II","iii","iv","V","VI","vii"],"melodic minor":["i","ii","III+","IV","V","vi°","vii°"],"harmonic minor":["i","ii°","III+","iv","V","VI","vii°"]};return t.major=t.ionian,t.minor=t.aeolian,t[e]||[]};var i={i:0,ii:1,iii:2,iv:3,v:4,vi:5,vii:6};t.getChordsByProgression=function(e,t){var n=e.split(" ");n[0].match(/\d/)||(n[0]+="4",e=n.join(" "));var o=(0,r.scale)(e);return t.replace(/\s*,+\s*/g," ").split(" ").map((function(e){var t=function(e){var t=e.replace(/\W/g,""),n="M";return t.toLowerCase()===t&&(n="m"),e.indexOf("°")>-1?n+"7b5":e.indexOf("+")>-1?n+"#5":e.indexOf("7")>-1?"M"===n?"maj7":"m7":n}(e),n=i[e.replace(/\W|\d/g,"").toLowerCase()],r=o[n],a=r.replace(/\D+/,"");return r.replace(/\d/,"")+t+"_"+a})).toString().replace(/,/g," ")};var a=function(e){var t=e.T,n=e.P,r=e.D;return function(e){void 0===e&&(e=4);var i=[];i.push((0,o.pickOne)(t));var a=1;for(a<e-1&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(i.push((0,o.pickOne)(r)),a++),a<e-1&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(i.push((0,o.pickOne)(r)),a++),a<e-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++);a<e;)i.push((0,o.pickOne)(r)),a++;return i}},s=a({T:["I","vi"],P:["ii","IV"],D:["V"]}),c=a({T:["i","VI"],P:["ii","iv"],D:["V"]});t.progression=function(e,t){return void 0===t&&(t=4),"major"===e||"M"===e?s(t):"minor"===e||"m"===e?c(t):[]}},484:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;var r=n(594),o=function(){function e(e){var t=this;e=e||[],this.sessionChannels=e.map((function(e,n){return e.idx=e.idx||n,e.idx=t.uniqueIdx(t.sessionChannels,e.idx),new r.Channel(e)}))}return e.prototype.uniqueIdx=function(e,t){if(!e)return t||0;var n=e.reduce((function(e,t){return!e.find((function(e){return e===t.idx}))&&e.concat(t.idx)||e}),[]);if(!t||n.find((function(e){return e===t}))){for(var r=e.length;n.find((function(e){return e===r}));)r+=1;return r}return t},e.prototype.createChannel=function(e){e.idx=this.uniqueIdx(this.sessionChannels,e.idx);var t=new r.Channel(e);return this.sessionChannels.push(t),t},Object.defineProperty(e.prototype,"channels",{get:function(){return this.sessionChannels},enumerable:!1,configurable:!0}),e.prototype.setTransportTempo=function(e){r.Channel.setTransportTempo(e)},e.prototype.startTransport=function(){r.Channel.startTransport()},e.prototype.stopTransport=function(e){void 0===e&&(e=!0),r.Channel.stopTransport(e)},e.prototype.startRow=function(e){this.sessionChannels.forEach((function(t){t.startClip(e)}))},e.prototype.play=function(e){var t=this,n=e.channelPatterns,r=e.clipDuration||"4:0:0",o=Tone.Time(r).toSeconds(),i=function(e,t){e.forEach((function(e){return e.stop(t)}))};n.forEach((function(e){var n=e.channelIdx,r=e.pattern,a=[],s=0,c="-";r.split("").forEach((function(e){e!==c&&"_"!==e&&(i(a,s),a=function(e,n,r){return"-"===n?[]:t.channels.filter((function(t){return t.idx===e})).map((function(e){var t;return null===(t=e.clips[n])||void 0===t?void 0:t.start(r)}))}(n,e,s)),c=e,s+=o})),i(a,s)}))},e}();t.Session=o},621:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomInt=t.convertChordsToNotes=t.convertChordToNotes=t.errorHasMessage=t.flat=t.dice=t.pickOne=t.sizzleMap=t.shuffle=t.expandStr=t.isNote=void 0;var r=n(397);t.isNote=function(e){return/^[a-gA-G](?:#|b)?\d$/.test(e)},t.expandStr=function(e){return e=(e=(e=(e=JSON.stringify(e.split(""))).replace(/,"\[",/g,", [")).replace(/"\[",/g,"[")).replace(/,"\]"/g,"]"),JSON.parse(e)},t.shuffle=function(e,t){void 0===t&&(t=!0);var n=e.length-1;return e.forEach((function(r,o){if(!(o>=n)){var i=t?Math.floor(Math.random()*(n-o))+1+o:Math.floor(Math.random()*(n+1-o))+o;e[o]=e[i],e[i]=r}})),e},t.sizzleMap=function(e){void 0===e&&(e=127);var t=Math.PI,n=[t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6,t],r=[0,t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6];return r.reverse(),n.concat(r).map((function(t){return Math.round(Math.sin(t)*e)}))},t.pickOne=function(e){return e.length>1?e[Math.round(Math.random())]:e[0]},t.dice=function(){return!!Math.round(Math.random())},t.flat=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},t.errorHasMessage=function(e){return"string"==typeof e.message},t.convertChordToNotes=function(e){var t,n,o,i;try{t=(0,r.inlineChord)(e)}catch(e){o=e}try{n=(0,r.chord)(e.replace(/_/g," "))}catch(e){i=e}if(!o&&!i){if(t.toString()!==n.toString())throw new Error("Chord ".concat(e," cannot decode, guessing ").concat(t," or ").concat(n));return t}return o?i?(0,r.chord)(e):n:t},t.convertChordsToNotes=function(e){if("string"==typeof e&&(0,t.isNote)(e))return[e];if(Array.isArray(e))return e.forEach((function(e){if(Array.isArray(e))e.forEach((function(e){if("string"!=typeof e||!(0,t.isNote)(e))throw new TypeError("array of arrays must comprise valid notes")}));else if("string"!=typeof e||!(0,t.isNote)(e))throw new TypeError("array must comprise valid notes")})),e;if(!Array.isArray(e)){var n=(0,t.convertChordToNotes)(e);if(n&&n.length)return n}throw new Error("Chord ".concat(e," not found"))},t.randomInt=function(e){return void 0===e&&(e=1),Math.round(Math.random()*e)}},231:e=>{"use strict";e.exports=require("fs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=n(773),o=exports;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
1
|
+
(()=>{var e={712(e){"use strict";var t,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(a,{chord:()=>m,chords:()=>f,getIndicesFromScale:()=>y,inlineChord:()=>h,scale:()=>v,scales:()=>d}),e.exports=(t=a,((e,t,a,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))i.call(e,a)||void 0===a||n(e,a,{get:()=>t[a],enumerable:!(s=r(t,a))||s.enumerable});return e})(n({},"__esModule",{value:!0}),t));var s={"C#":"Db","D#":"Eb","F#":"Gb","G#":"Ab","A#":"Bb",CB:"B",FB:"E","E#":"F","B#":"C"},u=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],c={"major pentatonic":"101010010100","ionian pentatonic":"100011010001","mixolydian pentatonic":"100011010010",ritusen:"101001010100",egyptian:"101001010010","neopolitan major pentatonic":"100011100010","vietnamese 1":"100101011000",pelog:"110100011000",kumoijoshi:"110001011000",hirajoshi:"101100011000",iwato:"110001100010","in-sen":"110001010010","lydian pentatonic":"100010110001","malkos raga":"100101001010","locrian pentatonic":"100101100010","minor pentatonic":"100101010010","minor six pentatonic":"100101010100","flat three pentatonic":"101100010100","flat six pentatonic":"101010011000",scriabin:"110010010100","whole tone pentatonic":"100010101010","lydian #5P pentatonic":"100010101001","lydian dominant pentatonic":"100010110010","minor #7M pentatonic":"100101010001","super locrian pentatonic":"100110100010","minor hexatonic":"101101010001",augmented:"100110011001","major blues":"101110010100",piongio:"101001010110","prometheus neopolitan":"110010100110",prometheus:"101010100110","mystery #1":"110010101010","six tone symmetric":"110011001100","whole tone":"101010101010","messiaen's mode #5":"110001110001","minor blues":"100101110010","locrian major":"101011101010","double harmonic lydian":"110010111001","harmonic minor":"101101011001",altered:"110110101010","locrian #2":"101101101010","mixolydian b6":"101011011010","lydian dominant":"101010110110",lydian:"101010110101","lydian augmented":"101010101101","dorian b2":"110101010110","melodic minor":"101101010101",locrian:"110101101010",ultralocrian:"110110101100","locrian 6":"110101100110","augmented heptatonic":"100111011001","romanian minor":"101100110110","dorian #4":"101100110110","lydian diminished":"101100110101",phrygian:"110101011010","leading whole tone":"101010101011","lydian minor":"101010111010","phrygian dominant":"110011011010",balinese:"110101011001","neopolitan major":"110101010101",aeolian:"101101011010","harmonic major":"101011011001","double harmonic major":"110011011001",dorian:"101101010110","hungarian minor":"101100111001","hungarian major":"100110110110",oriental:"110011100110",flamenco:"110110110010","todi raga":"110100111001",mixolydian:"101011010110",persian:"110011101001",major:"101011010101",enigmatic:"110010101011","major augmented":"101011001101","lydian #9":"100110110101","messiaen's mode #4":"111001111001","purvi raga":"110011111001","spanish heptatonic":"110111011010",bebop:"101011010111","bebop minor":"101111010110","bebop major":"101011011101","bebop locrian":"110101111010","minor bebop":"101101011011",diminished:"101101101101",ichikosucho:"101011110101","minor six diminished":"101101011101","half-whole diminished":"110110110110","kafi raga":"100111010111","messiaen's mode #6":"101011101011","composite blues":"101111110110","messiaen's mode #3":"101110111011","messiaen's mode #7":"111101111101",chromatic:"111111111111",ionian:"101011010101",minor:"101101011010",Kanakangi:"111001011100",Ratnangi:"111001011010",Ganamurti:"111001011001",Vanaspati:"111001010110",Manavati:"111001010101",Tanarupi:"111001010011",Senavati:"110101011100",Hanumatodi:"110101011010",Dhenuka:"110101011001",Natakapriya:"110101010110",Kokilapriya:"110101010101",Rupavati:"110101010011",Gayakapriya:"110011011100",Vakulabharanam:"110011011010",Mayamalavagowla:"110011011001",Chakravakam:"110011010110",Suryakantam:"110011010101",Hatakambari:"110011010011",Jhankaradhwani:"101101011100",Natabhairavi:"101101011010",Keeravani:"101101011001",Kharaharapriya:"101101010110",Gourimanohari:"101101010101",Varunapriya:"101101010011",Mararanjani:"101011011100",Charukesi:"101011011010",Sarasangi:"101011011001",Harikambhoji:"101011010110",Dheerasankarabaranam:"101011010101",Naganandini:"101011010011",Yagapriya:"100111011100",Ragavardhini:"100111011010",Gangeyabhushani:"100111011001",Vagadheeswari:"100111010110",Shulini:"100111010101",Chalanata:"100111010011",Salagam:"111000111100",Jalarnavam:"111000111010",Jhalavarali:"111000111001",Navaneetam:"111000110110",Pavani:"111000110101",Raghupriya:"111000110011",Gavambhodi:"110100111100",Bhavapriya:"110100111010",Shubhapantuvarali:"110100111001",Shadvidamargini:"110100110110",Suvarnangi:"110100110101",Divyamani:"110100110011",Dhavalambari:"110010111100",Namanarayani:"110010111010",Kamavardhini:"110010111001",Ramapriya:"110010110110",Gamanashrama:"110010110101",Vishwambari:"110010110011",Shamalangi:"101100111100",Shanmukhapriya:"101100111010",Simhendramadhyamam:"101100111001",Hemavati:"101100110110",Dharmavati:"101100110101",Neetimati:"101100110011",Kantamani:"101010111100",Rishabhapriya:"101010111010",Latangi:"101010111001",Vachaspati:"101010110110",Mechakalyani:"101010110101",Chitrambari:"101010110011",Sucharitra:"100110111100","Jyoti swarupini":"100110111010",Dhatuvardani:"100110111001",Nasikabhushini:"100110110110",Kosalam:"100110110101",Rasikapriya:"100110110011"},l={"5th":"100000010000","M7#5sus4":"100001001001","7#5sus4":"100001001010",sus4:"100001010000",M7sus4:"100001010001","7sus4":"100001010010","7no5":"100010000010",aug:"100010001000",M7b6:"100010001001","maj7#5":"100010001001","7#5":"100010001010","7b13":"100010001010",M:"100010010000",maj7:"100010010001","7th":"100010010010","6th":"100010010100","7add6":"100010010110","7b6":"100010011010",Mb5:"100010100000",M7b5:"100010100001","7b5":"100010100010","maj#4":"100010110001","7#11":"100010110010","M6#11":"100010110100","7#11b13":"100010111010","m#5":"100100001000",mb6M7:"100100001001","m7#5":"100100001010",m:"100100010000","m/ma7":"100100010001",m7:"100100010010",m6:"100100010100",mMaj7b6:"100100011001",dim:"100100100000",oM7:"100100100001",m7b5:"100100100010",dim7:"100100100100",o7M7:"100100100101","4th":"100101000010",madd4:"100101010000",m7add11:"100101010010","+add#9":"100110001000","7#5#9":"100110001010","7#9":"100110010010","13#9":"100110010110","7#9b13":"100110011010","maj7#9#11":"100110110001","7#9#11":"100110110010","13#9#11":"100110110110","7#9#11b13":"100110111010",sus2:"101000010000","M9#5sus4":"101001001001",sus24:"101001010000",M9sus4:"101001010001","11th":"101001010010","9sus4":"101001010010","13sus4":"101001010110","9no5":"101010000010","13no5":"101010000110","M#5add9":"101010001000","maj9#5":"101010001001","9#5":"101010001010","9b13":"101010001010",Madd9:"101010010000",maj9:"101010010001","9th":"101010010010","6/9":"101010010100",maj13:"101010010101",M7add13:"101010010101","13th":"101010010110",M9b5:"101010100001","9b5":"101010100010","13b5":"101010100110","9#5#11":"101010101010","maj9#11":"101010110001","9#11":"101010110010","69#11":"101010110100","M13#11":"101010110101","13#11":"101010110110","9#11b13":"101010111010","m9#5":"101100001010",madd9:"101100010000",mM9:"101100010001",m9:"101100010010",m69:"101100010100",m13:"101100010110",mMaj9b6:"101100011001",m9b5:"101100100010",m11A:"101101001010",m11:"101101010010",b9sus:"110001010010","11b9":"110001010010","7sus4b9b13":"110001011010",alt7:"110010000010","7#5b9":"110010001010",Maddb9:"110010010000",M7b9:"110010010001","7b9":"110010010010","13b9":"110010010110","7b9b13":"110010011010","7#5b9#11":"110010101010","7b9#11":"110010110010","13b9#11":"110010110110","7b9b13#11":"110010111010",mb6b9:"110100001000","7b9#9":"110110010010"};function p({scale:e,chord:t}){const n=e||t,r=e?"scale":"chord";if("string"!=typeof n)throw new Error(`${n} is not a valid input for ${r}`);const o=n.trim(),i=o.indexOf(" ");let a,p;-1===i?(a=o.slice(1),p=o[0],"b"!==o[1]&&"#"!==o[1]||(a=o.slice(2),p+=o[1])):(a=o.slice(-1===i?1:i+1),p=o.slice(0,i));const h=function(e){return s[e.toUpperCase()]||e.charAt(0).toUpperCase()+e.slice(1)}(p.replace(/\d/g,"")),f=""!==p.replace(/\D/g,"")?+p.replace(/\D/g,""):4;if(isNaN(f))throw new Error(`${p[0]} does not have a valid octave`);if(!c[a]&&!l[a])throw new Error(`${o} is not a valid ${r}`);const d=function(e,t){const n=u.indexOf(e);if(-1===n)throw new Error(`${e} is not a valid root note`);const r=u.map(e=>e+t),o=u.map(e=>e+(t+1));return r.concat(o).slice(n)}(h,f),m=[];let v=0,y=0;const b=e?c:l;for(;v<b[a].length;)"1"===b[a][v]&&m.push(d[y]),v++,y++;return m}function h(e){const t="b9sus";let n,r,o=4;return e.includes(t)?(r=t,n=e.slice(0,e.indexOf(t))):(n=e[0],r=e.slice(1),"b"!==e[1]&&"#"!==e[1]||(n+=e[1],r=e.slice(2))),e.includes("_")&&(o=+e.split("_")[1],r=r.slice(0,r.indexOf("_"))),p({chord:n+o+" "+r})}function f(){return Object.keys(l)}function d(){return Object.keys(c)}function m(e){return p({chord:e})}function v(e){return p({scale:e})}function y(e){const t=c[e]||e,n=[];for(let e=0;e<t.length;e++)"1"===t[e]&&n.push(e);return n.push(12),n}},79(e,t,n){e=n.nmd(e);var r={};!function(e){var t=e.DEFAULT_VOLUME=90,n=(e.DEFAULT_DURATION=128,e.DEFAULT_CHANNEL=0,{midi_letter_pitches:{a:21,b:23,c:12,d:14,e:16,f:17,g:19},midiPitchFromNote:function(e){var t=/([a-g])(#+|b+)?([0-9]+)$/i.exec(e),r=t[1].toLowerCase(),o=t[2]||"";return 12*parseInt(t[3],10)+n.midi_letter_pitches[r]+("#"==o.substr(0,1)?1:-1)*o.length},ensureMidiPitch:function(e){return"number"!=typeof e&&/[^0-9]/.test(e)?n.midiPitchFromNote(e):parseInt(e,10)},midi_pitches_letter:{12:"c",13:"c#",14:"d",15:"d#",16:"e",17:"f",18:"f#",19:"g",20:"g#",21:"a",22:"a#",23:"b"},midi_flattened_notes:{"a#":"bb","c#":"db","d#":"eb","f#":"gb","g#":"ab"},noteFromMidiPitch:function(e,t){var r,o=0,i=e;return t=t||!1,e>23&&(i=e-12*(o=Math.floor(e/12)-1)),r=n.midi_pitches_letter[i],t&&r.indexOf("#")>0&&(r=n.midi_flattened_notes[r]),r+o},mpqnFromBpm:function(e){var t=Math.floor(6e7/e),n=[];do{n.unshift(255&t),t>>=8}while(t);for(;n.length<3;)n.push(0);return n},bpmFromMpqn:function(e){if(void 0!==e[0])for(var t=0,n=e.length-1;n>=0;++t,--n)e[t];return Math.floor(6e7/e)},codes2Str:function(e){return String.fromCharCode.apply(null,e)},str2Bytes:function(e,t){if(t)for(;e.length/2<t;)e="0"+e;for(var n=[],r=e.length-1;r>=0;r-=2){var o=0===r?e[r]:e[r-1]+e[r];n.unshift(parseInt(o,16))}return n},translateTickTime:function(e){for(var t=127&e;e>>=7;)t<<=8,t|=127&e|128;for(var n=[];n.push(255&t),128&t;)t>>=8;return n}}),r=function(e){if(!this)return new r(e);!e||null===e.type&&void 0===e.type||null===e.channel&&void 0===e.channel||null===e.param1&&void 0===e.param1||(this.setTime(e.time),this.setType(e.type),this.setChannel(e.channel),this.setParam1(e.param1),this.setParam2(e.param2))};r.NOTE_OFF=128,r.NOTE_ON=144,r.AFTER_TOUCH=160,r.CONTROLLER=176,r.PROGRAM_CHANGE=192,r.CHANNEL_AFTERTOUCH=208,r.PITCH_BEND=224,r.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},r.prototype.setType=function(e){if(e<r.NOTE_OFF||e>r.PITCH_BEND)throw new Error("Trying to set an unknown event: "+e);this.type=e},r.prototype.setChannel=function(e){if(e<0||e>15)throw new Error("Channel is out of bounds.");this.channel=e},r.prototype.setParam1=function(e){this.param1=e},r.prototype.setParam2=function(e){this.param2=e},r.prototype.toBytes=function(){var e=[],t=this.type|15&this.channel;return e.push.apply(e,this.time),e.push(t),e.push(this.param1),void 0!==this.param2&&null!==this.param2&&e.push(this.param2),e};var o=function(e){if(!this)return new o(e);this.setTime(e.time),this.setType(e.type),this.setData(e.data)};o.SEQUENCE=0,o.TEXT=1,o.COPYRIGHT=2,o.TRACK_NAME=3,o.INSTRUMENT=4,o.LYRIC=5,o.MARKER=6,o.CUE_POINT=7,o.CHANNEL_PREFIX=32,o.END_OF_TRACK=47,o.TEMPO=81,o.SMPTE=84,o.TIME_SIG=88,o.KEY_SIG=89,o.SEQ_EVENT=127,o.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},o.prototype.setType=function(e){this.type=e},o.prototype.setData=function(e){this.data=e},o.prototype.toBytes=function(){if(!this.type)throw new Error("Type for meta-event not specified.");var e=[];if(e.push.apply(e,this.time),e.push(255,this.type),Array.isArray(this.data))e.push(this.data.length),e.push.apply(e,this.data);else if("number"==typeof this.data)e.push(1,this.data);else if(null!==this.data&&void 0!==this.data){e.push(this.data.length);var t=this.data.split("").map(function(e){return e.charCodeAt(0)});e.push.apply(e,t)}else e.push(0);return e};var i=function(e){if(!this)return new i(e);var t=e||{};this.events=t.events||[]};i.START_BYTES=[77,84,114,107],i.END_BYTES=[0,255,47,0],i.prototype.addEvent=function(e){return this.events.push(e),this},i.prototype.addNoteOn=i.prototype.noteOn=function(e,o,i,a){return this.events.push(new r({type:r.NOTE_ON,channel:e,param1:n.ensureMidiPitch(o),param2:a||t,time:i||0})),this},i.prototype.addNoteOff=i.prototype.noteOff=function(e,o,i,a){return this.events.push(new r({type:r.NOTE_OFF,channel:e,param1:n.ensureMidiPitch(o),param2:a||t,time:i||0})),this},i.prototype.addNote=i.prototype.note=function(e,t,n,r,o){return this.noteOn(e,t,r,o),n&&this.noteOff(e,t,n,o),this},i.prototype.addChord=i.prototype.chord=function(e,t,n,r){if(!Array.isArray(t)&&!t.length)throw new Error("Chord must be an array of pitches");return t.forEach(function(t){this.noteOn(e,t,0,r)},this),t.forEach(function(t,r){0===r?this.noteOff(e,t,n):this.noteOff(e,t)},this),this},i.prototype.setInstrument=i.prototype.instrument=function(e,t,n){return this.events.push(new r({type:r.PROGRAM_CHANGE,channel:e,param1:t,time:n||0})),this},i.prototype.setTempo=i.prototype.tempo=function(e,t){return this.events.push(new o({type:o.TEMPO,data:n.mpqnFromBpm(e),time:t||0})),this},i.prototype.toBytes=function(){var e=0,t=[],r=i.START_BYTES,o=i.END_BYTES;this.events.forEach(function(n){var r=n.toBytes();e+=r.length,t.push.apply(t,r)}),e+=o.length;var a=n.str2Bytes(e.toString(16),4);return r.concat(a,t,o)};var a=function(e){if(!this)return new a(e);var t=e||{};if(t.ticks){if("number"!=typeof t.ticks)throw new Error("Ticks per beat must be a number!");if(t.ticks<=0||t.ticks>=32768||t.ticks%1!=0)throw new Error("Ticks per beat must be an integer between 1 and 32767!")}this.ticks=t.ticks||128,this.tracks=t.tracks||[]};a.HDR_CHUNKID="MThd",a.HDR_CHUNK_SIZE="\0\0\0",a.HDR_TYPE0="\0\0",a.HDR_TYPE1="\0",a.prototype.addTrack=function(e){return e?(this.tracks.push(e),this):(e=new i,this.tracks.push(e),e)},a.prototype.toBytes=function(){var e=this.tracks.length.toString(16),t=a.HDR_CHUNKID+a.HDR_CHUNK_SIZE;return parseInt(e,16)>1?t+=a.HDR_TYPE1:t+=a.HDR_TYPE0,t+=n.codes2Str(n.str2Bytes(e,2)),t+=String.fromCharCode(this.ticks/256,this.ticks%256),this.tracks.forEach(function(e){t+=n.codes2Str(e.toBytes())}),t},e.Util=n,e.File=a,e.Track=i,e.Event=r,e.MetaEvent=o}(r),null!==e?e.exports=r:null!==t?t=r:this.Midi=r},913(e,t,n){"use strict";var r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.arp=void 0;var o=n(712),i=n(665),a=function(e,t){var n=function(e){if(!e)throw new Error("Empty element");var t=e.replace(/\d/,""),n=e.replace(/\D/g,"")||4;if(!t)throw new Error("Incorrect note");return t+(+n+1)},o=e.map(n),i=o.map(n);return r(r(r([],e,!0),o,!0),i,!0).slice(0,t)};t.arp=function(e){var t=[],n={count:4,order:"0123",chords:""};if("string"==typeof e)n.chords=e;else{if(e.order&&e.order.match(/\D/g))throw new TypeError("Invalid value for order");if(e.count>8||e.count<2)throw new TypeError("Invalid value for count");e.count&&!e.order&&(n.order=Array.from(Array(e.count).keys()).join("")),Object.assign(n,e)}if("string"==typeof n.chords)n.chords.split(" ").forEach(function(e,i){try{var s=a((0,o.inlineChord)(e),n.count),u=n.order.split("").map(function(e){return s[e]});t=r(r([],t,!0),u,!0)}catch(t){throw new Error("Cannot decode chord "+(i+1)+' "'+e+'" in given "'+n.chords+'"')}});else{if(!Array.isArray(n.chords))throw new TypeError("Invalid value for chords");n.chords.forEach(function(e,o){try{var s=a(e,n.count),u=n.order.split("").map(function(e){return s[e]});t=r(r([],t,!0),u,!0)}catch(t){throw new Error(((0,i.errorHasMessage)(t)?t.message:t)+" in chord "+(o+1)+' "'+e+'"')}})}return t}},767(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.clip=t.renderingDuration=t.totalPatternDuration=t.recursivelyApplyPatternToDurations=t.getDuration=t.getNote=void 0;var a=n(665),s="4n";t.getNote=function(e,t,n){return"R"===e&&t.randomNotes&&t.randomNotes.length>0?t.randomNotes[(0,a.randomInt)(t.randomNotes.length-1)]:t.notes?t.notes[n%(t.notes.length||1)]:""},t.getDuration=function(e,t){return e.durations?e.durations[t%e.durations.length]:e.dur||e.subdiv||"8n"},t.recursivelyApplyPatternToDurations=function(e,n,r){return void 0===r&&(r=[]),e.forEach(function(e){"string"==typeof e&&("x"!==e&&"R"!==e||r.push(n),"_"===e&&r.length&&(r[r.length-1]+=n)),Array.isArray(e)&&(0,t.recursivelyApplyPatternToDurations)(e,n/e.length,r)}),r};var u=function(e,n,r){if(r=r||Tone.getContext(),!e.pattern)throw new Error("No pattern provided!");return e.durations||e.dur||(e.durations=(0,t.recursivelyApplyPatternToDurations)((0,a.expandStr)(e.pattern),Tone.Ticks(e.subdiv||s).toSeconds())),new Tone.Sequence({callback:n.getSeqFn(e),events:(0,a.expandStr)(e.pattern),subdivision:e.subdiv||s,context:r})};t.totalPatternDuration=function(e,t){return"number"==typeof t?t*(0,a.expandStr)(e).length:Tone.Ticks(t).toSeconds()*(0,a.expandStr)(e).length},t.renderingDuration=function(e,n,r,o){var i=e.split("").filter(function(e){return"x"===e}).length,a=e.split("").filter(function(e){return"R"===e}).length,s=(null==o?void 0:o.length)?i:i+a,u=r.length||1;return(0,t.totalPatternDuration)(e,n)/s*function(e,t){for(var n=e<t?[e,t]:[t,e],r=n[0],o=n[1],i=o;i%r!==0;)i+=o;return i}(u,s)};var c,l=0;t.clip=function(e,n){if("string"==typeof(e=r(r({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",align:"1m",alignOffset:"0",amp:100,accentLow:70,randomNotes:null,offlineRendering:!1}),e||{})).notes&&(e.notes=e.notes.replace(/\s{2,}/g," "),e.notes=e.notes.split(" ")),e.notes=e.notes?e.notes.map(a.convertChordsToNotes):[],/[^x\-_[\]R]/.test(e.pattern))throw new TypeError("pattern can only comprise x - _ [ ] R, found "+e.pattern);return e.shuffle&&(e.notes=(0,a.shuffle)(e.notes)),e.randomNotes&&"string"==typeof e.randomNotes&&(e.randomNotes=e.randomNotes.replace(/\s{2,}/g," ").split(/\s/)),e.randomNotes&&(e.randomNotes=e.randomNotes.map(a.convertChordsToNotes)),e.offlineRendering?function(e,t){c||(c=Tone.getContext()),l++;var n=new Tone.Player({context:c,loop:!0});return Tone.Offline(function(t){return o(void 0,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return n=u(e,t),[4,Tone.loaded()];case 1:return r.sent(),n.start(),t.transport.start(),[2]}})})},t).then(function(t){var r;n.buffer=t,0===--l&&(Tone.setContext(c),null===(r=e.offlineRenderingCallback)||void 0===r||r.call(e))}),n.toDestination(),n.sync(),n}(e,(0,t.renderingDuration)(e.pattern,e.subdiv||s,e.notes,e.randomNotes)):u(e,n,c)}},765(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Session=t.midi=t.arp=t.progression=t.getChordsByProgression=t.getChordDegrees=t.clip=t.chords=t.chord=t.modes=t.scales=t.mode=t.scale=void 0;var i=n(712);Object.defineProperty(t,"scales",{enumerable:!0,get:function(){return i.scales}}),Object.defineProperty(t,"modes",{enumerable:!0,get:function(){return i.scales}}),Object.defineProperty(t,"chords",{enumerable:!0,get:function(){return i.chords}}),Object.defineProperty(t,"scale",{enumerable:!0,get:function(){return i.scale}}),Object.defineProperty(t,"mode",{enumerable:!0,get:function(){return i.scale}}),Object.defineProperty(t,"chord",{enumerable:!0,get:function(){return i.chord}});var a=n(767);Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return a.clip}});var s=n(903);Object.defineProperty(t,"getChordDegrees",{enumerable:!0,get:function(){return s.getChordDegrees}}),Object.defineProperty(t,"getChordsByProgression",{enumerable:!0,get:function(){return s.getChordsByProgression}}),Object.defineProperty(t,"progression",{enumerable:!0,get:function(){return s.progression}});var u=n(913);Object.defineProperty(t,"arp",{enumerable:!0,get:function(){return u.arp}});var c=n(935);Object.defineProperty(t,"midi",{enumerable:!0,get:function(){return c.midi}});var l=n(592);Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return l.Session}}),o(n(422),t)},23(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;var i=n(767),a=n(665),s=function(e){var t=Tone.Transport.position.split(":");if("0"===t[0]&&"0"===t[1])return 0;var n=Tone.Transport.ticks,r=(null==e?void 0:e.align)||"1m",o=(null==e?void 0:e.alignOffset)||"0",i=Tone.Ticks(r).toTicks(),a=Tone.Ticks(o).toTicks();return Tone.Ticks(Math.floor(n/i+1)*i+a)},u=function(){function e(e){var t=this;this.idx=e.idx||0,this.name=e.name||"ch "+e.idx,this.activePatternIdx=-1,this.channelClips=[],this.clipNoteCount=0,e.clips,e.samples,e.sample,e.synth;var n=o(e,["clips","samples","sample","synth"]),i=(n.external,n.sampler,n.buffer,o(n,["external","sampler","buffer"])),s=(i.player,i.instrument,i.volume,o(i,["player","instrument","volume"])),u=s.eventCb,c=s.playerCb,l=(s.effects,o(s,["eventCb","playerCb","effects"])),p=l.context,h=void 0===p?Tone.getContext():p,f=o(l,["context"]);this.eventCbFn=u,this.playerCbFn=c,this.hasLoaded=!1,this.hasFailed=!1,this.initializerTask=this.initOutputProducer(h,e).then(function(){return t.initInstrument(h,e).then(function(){return t.adjustInstrument(h,e).then(function(){return t.initEffects(h,e)})})});var d=!1;try{e.clips.forEach(function(e,n){try{t.addClip(r(r({},e),f))}catch(e){throw new Error(((0,a.errorHasMessage)(e)?e.message:e)+" in clip "+(n+1))}},this)}catch(e){d=e}this.initializerTask.then(function(){if(d)throw d;t.hasLoaded=!0,t.eventCb("loaded",{})}).catch(function(e){t.hasFailed=e,t.eventCb("error",{e})})}return e.setTransportTempo=function(e){Tone.Transport.bpm.value=e},e.startTransport=function(){Tone.start(),Tone.Transport.start()},e.stopTransport=function(e){void 0===e&&(e=!0),Tone.Transport.stop(),e&&Tone.Transport.cancel()},e.prototype.setVolume=function(e){var t,n;this.instrument&&(this.instrument.volume.value=e),this.external&&(null===(n=(t=this.external).setVolume)||void 0===n||n.call(t,e))},e.prototype.startClip=function(e,t){var n=this,r=this.channelClips[e];t=t||(0===t?0:s(r)),this.activePatternIdx>-1&&this.activePatternIdx!==e&&this.stopClip(this.activePatternIdx,t),r&&"started"!==r.state&&(this.counterResetTask=Tone.Transport.scheduleOnce(function(){n.clipNoteCount=0},t),this.activePatternIdx=e,null==r||r.start(t))},e.prototype.stopClip=function(e,t){var n=this.channelClips[e];t=t||(0===t?0:s(n)),null==n||n.stop(t),e===this.activePatternIdx&&(this.activePatternIdx=-1)},e.prototype.addClip=function(e,t){var n=this;t=t||this.channelClips.length,e.pattern?(this.channelClips[t]=(0,i.clip)(r({},e),this),["align","alignOffset"].forEach(function(r){e[r]&&(n.channelClips[t][r]=e[r])})):this.channelClips[t]=null},e.prototype.getSeqFn=function(e){var t=this;return this.external?function(n,r){var o,a;if("x"===r||"R"===r){var s=t.clipNoteCount;if(t.hasLoaded){var u=(0,i.getNote)(r,e,s)[0],c=(0,i.getDuration)(e,s),l=Tone.Time(c).toSeconds();t.playerCb({note:u,duration:c,time:n,counter:s});try{null===(a=(o=t.external).triggerAttackRelease)||void 0===a||a.call(o,u,l,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.Player?function(e,n){if("x"===n||"R"===n){var r=t.clipNoteCount;if(t.hasLoaded){t.playerCb({note:"",duration:"",time:e,counter:r});try{t.instrument.start(e)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.PolySynth||this.instrument instanceof Tone.Sampler?function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getNote)(r,e,o),s=(0,i.getDuration)(e,o);t.playerCb({note:a,duration:s,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,s,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:this.instrument instanceof Tone.NoiseSynth?function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getDuration)(e,o);t.playerCb({note:"",duration:a,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}:function(n,r){if("x"===r||"R"===r){var o=t.clipNoteCount;if(t.hasLoaded){var a=(0,i.getNote)(r,e,o)[0],s=(0,i.getDuration)(e,o);t.playerCb({note:a,duration:s,time:n,counter:o});try{t.instrument.triggerAttackRelease(a,s,n)}catch(e){t.eventCb("error",{e})}}t.clipNoteCount++}}},e.prototype.eventCb=function(e,t){"function"==typeof this.eventCbFn&&(t.channel=this,this.eventCbFn(e,t))},e.prototype.playerCb=function(e){"function"==typeof this.playerCbFn&&(e.channel=this,this.playerCbFn(e))},e.prototype.checkToneObjLoaded=function(e,t){var n=this,r=e instanceof Tone.Sampler;if("loaded"in e){if(e.loaded)return void t();if(r)return;var o=!1;if(["buffer","_buffer","_buffers"].forEach(function(r){r in e&&(n.checkToneObjLoaded(e[r],t),o=!0)}),o)return}if(e instanceof Tone.ToneAudioBuffer||e instanceof Tone.ToneBufferSource||"loaded"in e&&"onload"in e){var i=e.onload;e.onload=function(){i&&"function"==typeof i&&(e.onload=i,i()),t()}}else t()},e.prototype.recreateToneObjectInContext=function(e,t){var n=this;return t=t||Tone.getContext(),new Promise(function(o,i){if(e instanceof Tone.PolySynth){var a=Tone.PolySynth(Tone[e._dummyVoice.name],r(r({},e.get()),{context:t}));n.checkToneObjLoaded(a,function(){return o(a)})}else if(e instanceof Tone.Player)var s=Tone.Player({url:e._buffer,context:t,onload:function(){return n.checkToneObjLoaded(s,function(){return o(s)})}});else if(e instanceof Tone.Sampler)var u=e.get(),c={attack:u.attack,curve:u.curve,release:u.release,volume:u.volume},l={baseUrl:e._buffers.baseUrl,urls:Object.fromEntries(e._buffers._buffers.entries())},p=Tone.Sampler(r(r(r({},c),l),{context:t,onload:function(){return n.checkToneObjLoaded(p,function(){return o(p)})}}));else{var h=Tone[e.name](r(r({},e.get()),{context:t,onload:function(){return n.checkToneObjLoaded(h,function(){return o(h)})}}));n.checkToneObjLoaded(h,function(){return o(h)})}})},e.prototype.initOutputProducer=function(e,t){var n=this;return e=e||Tone.getContext(),new Promise(function(o,i){if(t.synth){if(t.instrument)throw new Error("Either synth or instrument can be provided, but not both.");if(t.synth.synth){var a=t.synth.synth,s=t.synth.preset||{};n.instrument=new Tone[a](r(r({},s),{context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}})),n.checkToneObjLoaded(n.instrument,o)}else n.instrument=t.synth,console.warn('The "synth" parameter with instrument will be deprecated in the future. Please use the "instrument" parameter instead.'),n.checkToneObjLoaded(n.instrument,o)}else if("string"==typeof t.instrument)n.instrument=new Tone[t.instrument]({context:e}),n.checkToneObjLoaded(n.instrument,o);else if(t.instrument)n.instrument=t.instrument,n.checkToneObjLoaded(n.instrument,o);else if(t.sample||t.buffer)n.instrument=new Tone.Player({url:t.sample||t.buffer,context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(t.samples)n.instrument=new Tone.Sampler({urls:t.samples,context:e,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(t.sampler)n.instrument=t.sampler,n.checkToneObjLoaded(n.instrument,o);else if(t.player)n.instrument=t.player,n.checkToneObjLoaded(n.instrument,o);else{if(!t.external)throw new Error("One of required synth|instrument|sample|sampler|samples|buffer|player|external is not provided!");if(n.external=r({},t.external),n.instrument={context:e,volume:{value:0}},t.external.init)return t.external.init(e.rawContext).then(function(){o()}).catch(function(e){var t;i(new Error(e.message+" loading external output module of channel idx "+n.idx+", "+(null!==(t=n.name)&&void 0!==t?t:"(no name)")))});o()}if(!n.instrument)throw new Error("Failed instantiating instrument from given params.")})},e.prototype.initInstrument=function(e,t){var n,r=this;return e=e||Tone.getContext(),t.external||(null===(n=this.instrument)||void 0===n?void 0:n.context)===e?new Promise(function(e,t){e()}):this.recreateToneObjectInContext(this.instrument,e).then(function(e){r.instrument=e})},e.prototype.adjustInstrument=function(e,t){var n=this;return e=e||Tone.getContext(),new Promise(function(e,r){t.volume&&n.setVolume(t.volume),e()})},e.prototype.initEffects=function(e,t){var n=this;e=e||Tone.getContext();var r,o=function(e){return"function"==typeof e.start?e.start():e},i=(r=t.effects)?Array.isArray(r)?r:[r]:[];if(t.external){if(0!==i.length)throw new Error("Effects cannot be used with external output");return Promise.resolve()}return Promise.all(i.map(function(t){return new Promise(function(r,o){if("string"==typeof t)r(new Tone[t]({context:e}));else{if(t.context!==e)return n.recreateToneObjectInContext(t,e);r(t)}}).then(function(e){return e.toDestination()})})).then(function(e){return e.map(o)}).then(function(e){var t;(t=n.instrument).chain.apply(t,e).toDestination()})},Object.defineProperty(e.prototype,"clips",{get:function(){return this.channelClips},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeClipIdx",{get:function(){return this.activePatternIdx},enumerable:!1,configurable:!0}),e}();t.Channel=u},935(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.midi=void 0;var s=a(n(383)),u=i(n(79));t.midi=function(e,t,n){void 0===t&&(t="music.mid");var r=l(e,n).toBytes();return null===t?r:(t.endsWith(".mid")||(t+=".mid"),"undefined"!=typeof window&&window.URL&&window.URL.createObjectURL?c(r,t):(s.default.writeFileSync(t,r,"binary"),void console.log("MIDI file generated: "+t+".")))};var c=function(e,t){for(var n=new Uint8Array(e.length),r=0;r<e.length;r++){var o=e.charCodeAt(r);n[r]=o}var i=new Blob([n],{type:"audio/midi"}),a=document.createElement("a");return a.href="undefined"!=typeof window&&void 0!==window.URL&&void 0!==window.URL.createObjectURL&&window.URL.createObjectURL(i)||"",a.download=t,a.innerText="Download MIDI file",a},l=function(e,t){var n=new u.File,r=new u.Track;"number"==typeof t&&r.setTempo(t),n.addTrack(r);for(var o=0,i=e;o<i.length;o++){var a=i[o],s=a.level||127;a.note?"string"==typeof a.note?(r.noteOn(0,a.note,a.length,s),r.noteOff(0,a.note,a.length,s)):r.addChord(0,a.note,a.length,s):r.noteOff(0,"",a.length)}return n}},903(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.progression=t.getChordsByProgression=t.getChordDegrees=void 0;var r=n(712),o=n(665);t.getChordDegrees=function(e){var t={ionian:["I","ii","iii","IV","V","vi","vii°"],dorian:["i","ii","III","IV","v","vi°","VII"],phrygian:["i","II","III","iv","v°","VI","vii"],lydian:["I","II","iii","iv°","V","vi","vii"],mixolydian:["I","ii","iii°","IV","v","vi","VII"],aeolian:["i","ii°","III","iv","v","VI","VII"],locrian:["i°","II","iii","iv","V","VI","vii"],"melodic minor":["i","ii","III+","IV","V","vi°","vii°"],"harmonic minor":["i","ii°","III+","iv","V","VI","vii°"]};return t.major=t.ionian,t.minor=t.aeolian,t[e]||[]};var i={i:0,ii:1,iii:2,iv:3,v:4,vi:5,vii:6};t.getChordsByProgression=function(e,t){var n=e.split(" ");n[0].match(/\d/)||(n[0]+="4",e=n.join(" "));var o=(0,r.scale)(e);return t.replace(/\s*,+\s*/g," ").split(" ").map(function(e){var t=function(e){var t=e.replace(/\W/g,""),n="M";return t.toLowerCase()===t&&(n="m"),e.indexOf("°")>-1?n+"7b5":e.indexOf("+")>-1?n+"#5":e.indexOf("7")>-1?"M"===n?"maj7":"m7":n}(e),n=i[e.replace(/\W|\d/g,"").toLowerCase()],r=o[n],a=r.replace(/\D+/,"");return r.replace(/\d/,"")+t+"_"+a}).toString().replace(/,/g," ")};var a=function(e){var t=e.T,n=e.P,r=e.D;return function(e){void 0===e&&(e=4);var i=[];i.push((0,o.pickOne)(t));var a=1;for(a<e-1&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(i.push((0,o.pickOne)(r)),a++),a<e-1&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(i.push((0,o.pickOne)(r)),a++),a<e-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++);a<e;)i.push((0,o.pickOne)(r)),a++;return i}},s=a({T:["I","vi"],P:["ii","IV"],D:["V"]}),u=a({T:["i","VI"],P:["ii","iv"],D:["V"]});t.progression=function(e,t){return void 0===t&&(t=4),"major"===e||"M"===e?s(t):"minor"===e||"m"===e?u(t):[]}},592(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;var r=n(23),o=function(){function e(e){var t=this;e=e||[],this.sessionChannels=e.map(function(e,n){return e.idx=e.idx||n,e.idx=t.uniqueIdx(t.sessionChannels,e.idx),new r.Channel(e)})}return e.prototype.uniqueIdx=function(e,t){if(!e)return t||0;var n=e.reduce(function(e,t){return!e.find(function(e){return e===t.idx})&&e.concat(t.idx)||e},[]);if(!t||n.find(function(e){return e===t})){for(var r=e.length;n.find(function(e){return e===r});)r+=1;return r}return t},e.prototype.createChannel=function(e){e.idx=this.uniqueIdx(this.sessionChannels,e.idx);var t=new r.Channel(e);return this.sessionChannels.push(t),t},Object.defineProperty(e.prototype,"channels",{get:function(){return this.sessionChannels},enumerable:!1,configurable:!0}),e.prototype.setTransportTempo=function(e){r.Channel.setTransportTempo(e)},e.prototype.startTransport=function(){r.Channel.startTransport()},e.prototype.stopTransport=function(e){void 0===e&&(e=!0),r.Channel.stopTransport(e)},e.prototype.startRow=function(e){this.sessionChannels.forEach(function(t){t.startClip(e)})},e.prototype.play=function(e){var t=this,n=e.channelPatterns,r=e.clipDuration||"4:0:0",o=Tone.Time(r).toSeconds(),i=function(e,t){e.forEach(function(e){return e.stop(t)})};n.forEach(function(e){var n=e.channelIdx,r=e.pattern,a=[],s=0,u="-";r.split("").forEach(function(e){e!==u&&"_"!==e&&(i(a,s),a=function(e,n,r){return"-"===n?[]:t.channels.filter(function(t){return t.idx===e}).map(function(e){var t;return null===(t=e.clips[n])||void 0===t?void 0:t.start(r)})}(n,e,s)),u=e,s+=o}),i(a,s)})},e}();t.Session=o},422(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},665(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomInt=t.convertChordsToNotes=t.convertChordToNotes=t.errorHasMessage=t.flat=t.dice=t.pickOne=t.sizzleMap=t.shuffle=t.expandStr=t.isNote=void 0;var r=n(712);t.isNote=function(e){return/^[a-gA-G](?:#|b)?\d$/.test(e)},t.expandStr=function(e){return e=(e=(e=(e=JSON.stringify(e.split(""))).replace(/,"\[",/g,", [")).replace(/"\[",/g,"[")).replace(/,"\]"/g,"]"),JSON.parse(e)},t.shuffle=function(e,t){void 0===t&&(t=!0);var n=e.length-1;return e.forEach(function(r,o){if(!(o>=n)){var i=t?Math.floor(Math.random()*(n-o))+1+o:Math.floor(Math.random()*(n+1-o))+o;e[o]=e[i],e[i]=r}}),e},t.sizzleMap=function(e){void 0===e&&(e=127);var t=Math.PI,n=[t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6,t],r=[0,t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6];return r.reverse(),n.concat(r).map(function(t){return Math.round(Math.sin(t)*e)})},t.pickOne=function(e){return e.length>1?e[Math.round(Math.random())]:e[0]},t.dice=function(){return!!Math.round(Math.random())},t.flat=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},t.errorHasMessage=function(e){return"string"==typeof e.message},t.convertChordToNotes=function(e){var t,n,o,i;try{t=(0,r.inlineChord)(e)}catch(e){o=e}try{n=(0,r.chord)(e.replace(/_/g," "))}catch(e){i=e}if(!o&&!i){if(t.toString()!==n.toString())throw new Error("Chord "+e+" cannot decode, guessing "+t+" or "+n);return t}return o?i?(0,r.chord)(e):n:t},t.convertChordsToNotes=function(e){if("string"==typeof e&&(0,t.isNote)(e))return[e];if(Array.isArray(e))return e.forEach(function(e){if(Array.isArray(e))e.forEach(function(e){if("string"!=typeof e||!(0,t.isNote)(e))throw new TypeError("array of arrays must comprise valid notes")});else if("string"!=typeof e||!(0,t.isNote)(e))throw new TypeError("array must comprise valid notes")}),e;if(!Array.isArray(e)){var n=(0,t.convertChordToNotes)(e);if(n&&n.length)return n}throw new Error("Chord "+e+" not found")},t.randomInt=function(e){return void 0===e&&(e=1),Math.round(Math.random()*e)}},383(e){"use strict";e.exports=require("fs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=n(765),o=exports;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
2
2
|
//# sourceMappingURL=browser.js.map
|