scribbletune 5.1.0 → 5.2.0

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/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "scribbletune",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Create music with JavaScript and Node.js!",
5
- "main": "./index.js",
5
+ "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [
8
8
  "dist"
@@ -35,17 +35,17 @@
35
35
  "bump-patch": "npm version patch --no-git-tag-version"
36
36
  },
37
37
  "dependencies": {
38
- "harmonics": "^1.0.8",
39
- "jsmidgen": "~0.1.5"
38
+ "@scribbletune/midi": "^1.0.0",
39
+ "harmonics": "^1.1.2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/jest": "^27.0.1",
43
43
  "@types/node": "^12.19.15",
44
- "@typescript-eslint/eslint-plugin": "^4.31.1",
45
- "@typescript-eslint/parser": "^4.31.1",
44
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
45
+ "@typescript-eslint/parser": "^6.21.0",
46
46
  "cross-env": "^7.0.3",
47
47
  "dts-bundle": "^0.7.3",
48
- "eslint": "^7.32.0",
48
+ "eslint": "^8.57.1",
49
49
  "eslint-config-prettier": "^8.3.0",
50
50
  "eslint-loader": "^4.0.2",
51
51
  "eslint-plugin-prettier": "^4.0.0",
@@ -55,7 +55,7 @@
55
55
  "ts-loader": "^9.2.5",
56
56
  "ts-node": "^10.2.0",
57
57
  "typedoc": "^0.21.5",
58
- "typescript": "^4.4.3",
58
+ "typescript": "^5.9.3",
59
59
  "webpack": "^5.53.0",
60
60
  "webpack-cli": "^4.8.0"
61
61
  },
@@ -64,12 +64,10 @@
64
64
  "url": "git://github.com/scribbletune/scribbletune.git"
65
65
  },
66
66
  "keywords": [
67
- "javascript",
68
67
  "music",
69
68
  "music theory",
70
69
  "midi",
71
70
  "web audio api",
72
- "jsmidgen",
73
71
  "tone.js",
74
72
  "tonal",
75
73
  "harmonics"
package/dist/max.js DELETED
@@ -1,2 +0,0 @@
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"}')}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{n.r(o),n.d(o,{chord:()=>c,chords:()=>a,inlineChord:()=>i,scale:()=>u,scales:()=>s});var e=n(722),t=n(413),r=function(r){var n=r.scale,o=r.chord,i=n||o,a=n?"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 p=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,"")),h=""!==c.replace(/\D/g,"")?+c.replace(/\D/g,""):4;if(isNaN(h))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 d=function(e,t){var r=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],n=r.map((function(e){return e+t})),o=r.map((function(e){return e+(t+1)})),i=n.concat(o);return i.slice(i.indexOf(e+t))}(p,h),l=[],f=0,m=0,v=n?e:t;f<v[s].length;)"1"===v[s][f]&&l.push(d[m]),f++,m++;return l},i=function(e){var t,n,o="b9sus",i=4;return e.includes(o)?(n=o,t=e.slice(0,e.indexOf(o))):(t=e[0],n=e.slice(1),"b"!==e[1]&&"#"!==e[1]||(t+=e[1],n=e.slice(2))),e.includes("_")&&(i=+e.split("_")[1],n=n.slice(0,n.indexOf("_"))),r({chord:t+i+" "+n})},a=function(){return Object.keys(t)},s=function(){return Object.keys(e)},c=function(e){return r({chord:e})},u=function(e){return r({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,r){e=r.nmd(e);var n={};!function(e){var t=e.DEFAULT_VOLUME=90,r=(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),n=t[1].toLowerCase(),o=t[2]||"";return 12*parseInt(t[3],10)+r.midi_letter_pitches[n]+("#"==o.substr(0,1)?1:-1)*o.length},ensureMidiPitch:function(e){return"number"!=typeof e&&/[^0-9]/.test(e)?r.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 n,o=0,i=e;return t=t||!1,e>23&&(i=e-12*(o=Math.floor(e/12)-1)),n=r.midi_pitches_letter[i],t&&n.indexOf("#")>0&&(n=r.midi_flattened_notes[n]),n+o},mpqnFromBpm:function(e){var t=Math.floor(6e7/e),r=[];do{r.unshift(255&t),t>>=8}while(t);for(;r.length<3;)r.push(0);return r},bpmFromMpqn:function(e){if(void 0!==e[0])for(var t=0,r=e.length-1;r>=0;++t,--r)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 r=[],n=e.length-1;n>=0;n-=2){var o=0===n?e[n]:e[n-1]+e[n];r.unshift(parseInt(o,16))}return r},translateTickTime:function(e){for(var t=127&e;e>>=7;)t<<=8,t|=127&e|128;for(var r=[];r.push(255&t),128&t;)t>>=8;return r}}),n=function(e){if(!this)return new n(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))};n.NOTE_OFF=128,n.NOTE_ON=144,n.AFTER_TOUCH=160,n.CONTROLLER=176,n.PROGRAM_CHANGE=192,n.CHANNEL_AFTERTOUCH=208,n.PITCH_BEND=224,n.prototype.setTime=function(e){this.time=r.translateTickTime(e||0)},n.prototype.setType=function(e){if(e<n.NOTE_OFF||e>n.PITCH_BEND)throw new Error("Trying to set an unknown event: "+e);this.type=e},n.prototype.setChannel=function(e){if(e<0||e>15)throw new Error("Channel is out of bounds.");this.channel=e},n.prototype.setParam1=function(e){this.param1=e},n.prototype.setParam2=function(e){this.param2=e},n.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=r.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 n({type:n.NOTE_ON,channel:e,param1:r.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 n({type:n.NOTE_OFF,channel:e,param1:r.ensureMidiPitch(o),param2:a||t,time:i||0})),this},i.prototype.addNote=i.prototype.note=function(e,t,r,n,o){return this.noteOn(e,t,n,o),r&&this.noteOff(e,t,r,o),this},i.prototype.addChord=i.prototype.chord=function(e,t,r,n){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,n)}),this),t.forEach((function(t,n){0===n?this.noteOff(e,t,r):this.noteOff(e,t)}),this),this},i.prototype.setInstrument=i.prototype.instrument=function(e,t,r){return this.events.push(new n({type:n.PROGRAM_CHANGE,channel:e,param1:t,time:r||0})),this},i.prototype.setTempo=i.prototype.tempo=function(e,t){return this.events.push(new o({type:o.TEMPO,data:r.mpqnFromBpm(e),time:t||0})),this},i.prototype.toBytes=function(){var e=0,t=[],n=i.START_BYTES,o=i.END_BYTES;this.events.forEach((function(r){var n=r.toBytes();e+=n.length,t.push.apply(t,n)})),e+=o.length;var a=r.str2Bytes(e.toString(16),4);return n.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+=r.codes2Str(r.str2Bytes(e,2)),t+=String.fromCharCode(this.ticks/256,this.ticks%256),this.tracks.forEach((function(e){t+=r.codes2Str(e.toBytes())})),t},e.Util=r,e.File=a,e.Track=i,e.Event=n,e.MetaEvent=o}(n),null!==e?e.exports=n:null!==t?t=n:this.Midi=n},148:function(e,t,r){"use strict";var n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.arp=void 0;var o=r(397),i=r(604),a=function(e,t){var r=function(e){if(!e)throw new Error("Empty element");var t=e.replace(/\d/,""),r=e.replace(/\D/g,"")||4;if(!t)throw new Error("Incorrect note");return t+(+r+1)},o=e.map(r),i=o.map(r);return n(n(n([],e,!0),o,!0),i,!0).slice(0,t)};t.arp=function(e){var t=[],r={count:4,order:"0123",chords:""};if("string"==typeof e)r.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&&(r.order=Array.from(Array(e.count).keys()).join("")),Object.assign(r,e)}if("string"==typeof r.chords)r.chords.split(" ").forEach((function(e,i){try{var s=a((0,o.inlineChord)(e),r.count),c=r.order.split("").map((function(e){return s[e]}));t=n(n([],t,!0),c,!0)}catch(t){throw new Error("Cannot decode chord "+(i+1)+' "'+e+'" in given "'+r.chords+'"')}}));else{if(!Array.isArray(r.chords))throw new TypeError("Invalid value for chords");r.chords.forEach((function(e,o){try{var s=a(e,r.count),c=r.order.split("").map((function(e){return s[e]}));t=n(n([],t,!0),c,!0)}catch(t){throw new Error(((0,i.errorHasMessage)(t)?t.message:t)+" in chord "+(o+1)+' "'+e+'"')}}))}return t}},768:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.clip=void 0;var o=r(604),i={"1m":2048,"2m":4096,"3m":6144,"4m":8192,"1n":512,"2n":256,"4n":128,"8n":64,"16n":32};t.clip=function(e){if("string"==typeof(e=n(n({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",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(o.convertChordsToNotes):[],/[^x\-_[\]R]/.test(e.pattern))throw new TypeError("pattern can only comprise x - _ [ ] R, found "+e.pattern);e.shuffle&&(e.notes=(0,o.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(o.convertChordsToNotes));var t=[],r=0,a=function(n,i,s){var c=0;n.forEach((function(u,p){var h;if("string"==typeof u){var d=null;if("-"===u||("R"===u&&(0,o.randomInt)()&&e.randomNotes&&e.randomNotes.length>0?d=e.randomNotes[(0,o.randomInt)(e.randomNotes.length-1)]:e.notes&&(d=e.notes[r])),"x"!==u&&"R"!==u||r++,"x"!==u&&"-"!==u&&"R"!==u||(t.push({note:d,length:i,level:"R"!==u||e.randomNotes?e.amp:e.accentLow}),c+=i),"_"===u&&t.length&&(t[t.length-1].length+=i,c+=i),s&&c!==s&&p===n.length-1){var l=Math.abs(s-c),f=t[t.length-1];f.length>l?f.length=f.length-l:f.length=f.length+l}r===(null===(h=e.notes)||void 0===h?void 0:h.length)&&(r=0)}if(Array.isArray(u)){var m=!1;u.length%2==0&&i%2==0||(m=!0),a(u,Math.round(i/u.length),m&&i),c+=i}}))};if(a((0,o.expandStr)(e.pattern),i[e.subdiv]||i["4n"],!1),e.sizzle){var s=[],c=!0===e.sizzle?"sin":e.sizzle,u=t.length,p=e.amp,h=e.sizzleReps,d=p/(u/h);if("sin"===c||"cos"===c)for(var l=0;l<u;l++){var f=Math[c](l*Math.PI/(u/h))*p;s.push(Math.round(Math.abs(f)))}if("rampUp"===c)for(f=0,l=0;l<u;l++)l%(u/h)==0?f=0:f+=d,s.push(Math.round(Math.abs(f)));if("rampDown"===c)for(f=p,l=0;l<u;l++)l%(u/h)==0?f=p:f-=d,s.push(Math.round(Math.abs(f)));for(l=0;l<s.length;l++)t[l].level=s[l]?s[l]:1}if(e.accent){if(/[^x-]/.test(e.accent))throw new TypeError("Accent can only have x and - characters");for(var m=0,v=0,y=t;v<y.length;v++){var g=y[v];f="x"===e.accent[m]?e.amp:e.accentLow,e.sizzle&&(f=(g.level+f)/2),g.level=Math.round(f),(m+=1)===e.accent.length&&(m=0)}}return t}},890:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.max=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=r(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=r(768);Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return a.clip}});var s=r(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=r(148);Object.defineProperty(t,"arp",{enumerable:!0,get:function(){return c.arp}});var u=r(528);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return u.max}}),o(r(621),t)},528:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(126);t.max=function(e,t){void 0===t&&(t="live_set view highlighted_clip_slot clip");var r=new LiveAPI(t),o=e.reduce((function(e,t){return e+t.length}),0);r.set("loop_end",o/512),r.call("remove_notes",0,1,258,127),r.call("set_notes");var i=e.reduce((function(e,t){return e+(t.note?t.note.length:0)}),0);r.call("notes",i);var a=0;e.forEach((function(e){e.note?(e.note.forEach((function(t){r.call("note",n.Util.midiPitchFromNote(t),a.toFixed(2).toString(),(e.length/512).toFixed(2).toString(),e.level||100,0)})),a+=e.length/512):a+=e.length/512})),r.call("done")}},668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.progression=t.getChordsByProgression=t.getChordDegrees=void 0;var n=r(397),o=r(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 r=e.split(" ");r[0].match(/\d/)||(r[0]+="4",e=r.join(" "));var o=(0,n.scale)(e);return t.replace(/\s*,+\s*/g," ").split(" ").map((function(e){var t=function(e){var t=e.replace(/\W/g,""),r="M";return t.toLowerCase()===t&&(r="m"),e.indexOf("°")>-1?r+"7b5":e.indexOf("+")>-1?r+"#5":e.indexOf("7")>-1?"M"===r?"maj7":"m7":r}(e),r=i[e.replace(/\W|\d/g,"").toLowerCase()],n=o[r],a=n.replace(/\D+/,"");return n.replace(/\d/,"")+t+"_"+a})).toString().replace(/,/g," ")};var a=function(e){var t=e.T,r=e.P,n=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)(r)),a++),a<e-1&&(0,o.dice)()&&(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&&(i.push((0,o.pickOne)(n)),a++),a<e-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(r)),a++);a<e;)i.push((0,o.pickOne)(n)),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):[]}},621:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},604:(e,t,r)=>{"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 n=r(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 r=e.length-1;return e.forEach((function(n,o){if(!(o>=r)){var i=t?Math.floor(Math.random()*(r-o))+1+o:Math.floor(Math.random()*(r+1-o))+o;e[o]=e[i],e[i]=n}})),e},t.sizzleMap=function(e){void 0===e&&(e=127);var t=Math.PI,r=[t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6,t],n=[0,t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6];return n.reverse(),r.concat(n).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,r,o,i;try{t=(0,n.inlineChord)(e)}catch(e){o=e}try{r=(0,n.chord)(e.replace(/_/g," "))}catch(e){i=e}if(!o&&!i){if(t.toString()!==r.toString())throw new Error("Chord "+e+" cannot decode, guessing "+t+" or "+r);return t}return o?i?(0,n.chord)(e):r: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 r=(0,t.convertChordToNotes)(e);if(r&&r.length)return r}throw new Error("Chord "+e+" not found")},t.randomInt=function(e){return void 0===e&&(e=1),Math.round(Math.random()*e)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n=r(890),o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
2
- //# sourceMappingURL=max.js.map
package/dist/max.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"max.js","mappings":"yBAAA,MAAM,aAAa,IAAIA,EAAE,CAAC,IAAIA,IAAIA,EAAEC,QAAQC,KAAKC,MAAM,82EAA62E,EAAG,IAAIH,IAAIA,EAAEC,QAAQC,KAAKC,MAAM,o5FAAm5F,GAAIC,EAAE,CAAC,EAAE,SAASC,EAAEC,GAAG,IAAIC,EAAEH,EAAEE,GAAG,QAAG,IAASC,EAAE,OAAOA,EAAEN,QAAQ,IAAIO,EAAEJ,EAAEE,GAAG,CAACL,QAAQ,CAAC,GAAG,OAAOD,EAAEM,GAAGE,EAAEA,EAAEP,QAAQI,GAAGG,EAAEP,OAAO,CAACI,EAAEI,EAAE,CAACT,EAAEI,KAAK,IAAI,I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AAK,aACpC,EAMAlM,EAAQ2O,UAJQ,SAAUkG,GAEtB,YADY,IAARA,IAAkBA,EAAM,GACrBnQ,KAAKuK,MAAMvK,KAAKoP,SAAWe,EACtC,C,GCrMIC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB5O,IAAjB6O,EACH,OAAOA,EAAajV,QAGrB,IAAIoL,EAAS0J,EAAyBE,GAAY,CACjDE,GAAIF,EACJG,QAAQ,EACRnV,QAAS,CAAC,GAUX,OANAoV,EAAoBJ,GAAUjU,KAAKqK,EAAOpL,QAASoL,EAAQA,EAAOpL,QAAS+U,GAG3E3J,EAAO+J,QAAS,EAGT/J,EAAOpL,OACf,CCzBA+U,EAAoBM,IAAOjK,IAC1BA,EAAOkK,MAAQ,GACVlK,EAAOmK,WAAUnK,EAAOmK,SAAW,IACjCnK,GCAR,IAAIoK,EAAsBT,EAAoB,K","sources":["webpack://scribbletune/./node_modules/harmonics/main.js","webpack://scribbletune/./node_modules/jsmidgen/lib/jsmidgen.js","webpack://scribbletune/./src/arp.ts","webpack://scribbletune/./src/clip.ts","webpack://scribbletune/./src/max-index.ts","webpack://scribbletune/./src/max.ts","webpack://scribbletune/./src/progression.ts","webpack://scribbletune/./src/types/index.ts","webpack://scribbletune/./src/utils.ts","webpack://scribbletune/webpack/bootstrap","webpack://scribbletune/webpack/runtime/node module decorator","webpack://scribbletune/webpack/startup"],"sourcesContent":["(()=>{\"use strict\";var n={413:n=>{n.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:n=>{n.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\"}')}},e={};function o(a){var i=e[a];if(void 0!==i)return i.exports;var r=e[a]={exports:{}};return n[a](r,r.exports,o),r.exports}o.d=(n,e)=>{for(var a in e)o.o(e,a)&&!o.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:e[a]})},o.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),o.r=n=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(n,\"__esModule\",{value:!0})};var a={};(()=>{o.r(a),o.d(a,{chord:()=>m,chords:()=>t,inlineChord:()=>r,scale:()=>c,scales:()=>s});var n=o(722),e=o(413),i=function(o){var a=o.scale,i=o.chord,r=a||i,t=a?\"scale\":\"chord\";if(\"string\"!=typeof r)throw new Error(\"\".concat(r,\" is not a valid input for \").concat(t));var s,m,c=r.indexOf(\" \");-1===c?(s=r.slice(1),m=r[0],\"b\"!==r[1]&&\"#\"!==r[1]||(s=r.slice(2),m+=r[1])):(s=r.slice(-1===c?1:c+1),m=r.slice(0,c));var d=function(n){return{\"C#\":\"Db\",\"D#\":\"Eb\",\"F#\":\"Gb\",\"G#\":\"Ab\",\"A#\":\"Bb\"}[n.toUpperCase()]||n.charAt(0).toUpperCase()+n.slice(1)}(m.replace(/\\d/g,\"\")),l=\"\"!==m.replace(/\\D/g,\"\")?+m.replace(/\\D/g,\"\"):4;if(isNaN(l))throw new Error(\"\".concat(m[0],\" does not have a valid octave\"));if(!n[s]&&!e[s])throw new Error(\"\".concat(r,\" is not a valid \").concat(t));for(var b=function(n,e){var o=[\"C\",\"Db\",\"D\",\"Eb\",\"E\",\"F\",\"Gb\",\"G\",\"Ab\",\"A\",\"Bb\",\"B\"],a=o.map((function(n){return n+e})),i=o.map((function(n){return n+(e+1)})),r=a.concat(i);return r.slice(r.indexOf(n+e))}(d,l),u=[],p=0,h=0,f=a?n:e;p<f[s].length;)\"1\"===f[s][p]&&u.push(b[h]),p++,h++;return u},r=function(n){var e,o,a=\"b9sus\",r=4;return n.includes(a)?(o=a,e=n.slice(0,n.indexOf(a))):(e=n[0],o=n.slice(1),\"b\"!==n[1]&&\"#\"!==n[1]||(e+=n[1],o=n.slice(2))),n.includes(\"_\")&&(r=+n.split(\"_\")[1],o=o.slice(0,o.indexOf(\"_\"))),i({chord:e+r+\" \"+o})},t=function(){return Object.keys(e)},s=function(){return Object.keys(n)},m=function(n){return i({chord:n})},c=function(n){return i({scale:n})}})();var i=exports;for(var r in a)i[r]=a[r];a.__esModule&&Object.defineProperty(i,\"__esModule\",{value:!0})})();\n//# sourceMappingURL=main.js.map","var Midi = {};\n\n(function(exported) {\n\n\tvar DEFAULT_VOLUME = exported.DEFAULT_VOLUME = 90;\n\tvar DEFAULT_DURATION = exported.DEFAULT_DURATION = 128;\n\tvar DEFAULT_CHANNEL = exported.DEFAULT_CHANNEL = 0;\n\n\t/* ******************************************************************\n\t * Utility functions\n\t ****************************************************************** */\n\n\tvar Util = {\n\n\t\tmidi_letter_pitches: { a:21, b:23, c:12, d:14, e:16, f:17, g:19 },\n\n\t\t/**\n\t\t * Convert a symbolic note name (e.g. \"c4\") to a numeric MIDI pitch (e.g.\n\t\t * 60, middle C).\n\t\t *\n\t\t * @param {string} n - The symbolic note name to parse.\n\t\t * @returns {number} The MIDI pitch that corresponds to the symbolic note\n\t\t * name.\n\t\t */\n\t\tmidiPitchFromNote: function(n) {\n\t\t\tvar matches = /([a-g])(#+|b+)?([0-9]+)$/i.exec(n);\n\t\t\tvar note = matches[1].toLowerCase(), accidental = matches[2] || '', octave = parseInt(matches[3], 10);\n\t\t\treturn (12 * octave) + Util.midi_letter_pitches[note] + (accidental.substr(0,1)=='#'?1:-1) * accidental.length;\n\t\t},\n\n\t\t/**\n\t\t * Ensure that the given argument is converted to a MIDI pitch. Note that\n\t\t * it may already be one (including a purely numeric string).\n\t\t *\n\t\t * @param {string|number} p - The pitch to convert.\n\t\t * @returns {number} The resulting numeric MIDI pitch.\n\t\t */\n\t\tensureMidiPitch: function(p) {\n\t\t\tif (typeof p == 'number' || !/[^0-9]/.test(p)) {\n\t\t\t\t// numeric pitch\n\t\t\t\treturn parseInt(p, 10);\n\t\t\t} else {\n\t\t\t\t// assume it's a note name\n\t\t\t\treturn Util.midiPitchFromNote(p);\n\t\t\t}\n\t\t},\n\n\t\tmidi_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' },\n\t\tmidi_flattened_notes: { 'a#':'bb', 'c#':'db', 'd#':'eb', 'f#':'gb', 'g#':'ab' },\n\n\t\t/**\n\t\t * Convert a numeric MIDI pitch value (e.g. 60) to a symbolic note name\n\t\t * (e.g. \"c4\").\n\t\t *\n\t\t * @param {number} n - The numeric MIDI pitch value to convert.\n\t\t * @param {boolean} [returnFlattened=false] - Whether to prefer flattened\n\t\t * notes to sharpened ones. Optional, default false.\n\t\t * @returns {string} The resulting symbolic note name.\n\t\t */\n\t\tnoteFromMidiPitch: function(n, returnFlattened) {\n\t\t\tvar octave = 0, noteNum = n, noteName, returnFlattened = returnFlattened || false;\n\t\t\tif (n > 23) {\n\t\t\t\t// noteNum is on octave 1 or more\n\t\t\t\toctave = Math.floor(n/12) - 1;\n\t\t\t\t// subtract number of octaves from noteNum\n\t\t\t\tnoteNum = n - octave * 12;\n\t\t\t}\n\n\t\t\t// get note name (c#, d, f# etc)\n\t\t\tnoteName = Util.midi_pitches_letter[noteNum];\n\t\t\t// Use flattened notes if requested (e.g. f# should be output as gb)\n\t\t\tif (returnFlattened && noteName.indexOf('#') > 0) {\n\t\t\t\tnoteName = Util.midi_flattened_notes[noteName];\n\t\t\t}\n\t\t\treturn noteName + octave;\n\t\t},\n\n\t\t/**\n\t\t * Convert beats per minute (BPM) to microseconds per quarter note (MPQN).\n\t\t *\n\t\t * @param {number} bpm - A number in beats per minute.\n\t\t * @returns {number} The number of microseconds per quarter note.\n\t\t */\n\t\tmpqnFromBpm: function(bpm) {\n\t\t\tvar mpqn = Math.floor(60000000 / bpm);\n\t\t\tvar ret=[];\n\t\t\tdo {\n\t\t\t\tret.unshift(mpqn & 0xFF);\n\t\t\t\tmpqn >>= 8;\n\t\t\t} while (mpqn);\n\t\t\twhile (ret.length < 3) {\n\t\t\t\tret.push(0);\n\t\t\t}\n\t\t\treturn ret;\n\t\t},\n\n\t\t/**\n\t\t * Convert microseconds per quarter note (MPQN) to beats per minute (BPM).\n\t\t *\n\t\t * @param {number} mpqn - The number of microseconds per quarter note.\n\t\t * @returns {number} A number in beats per minute.\n\t\t */\n\t\tbpmFromMpqn: function(mpqn) {\n\t\t\tvar m = mpqn;\n\t\t\tif (typeof mpqn[0] != 'undefined') {\n\t\t\t\tm = 0;\n\t\t\t\tfor (var i=0, l=mpqn.length-1; l >= 0; ++i, --l) {\n\t\t\t\t\tm |= mpqn[i] << l;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Math.floor(60000000 / mpqn);\n\t\t},\n\n\t\t/**\n\t\t * Converts an array of bytes to a string of hexadecimal characters. Prepares\n\t\t * it to be converted into a base64 string.\n\t\t *\n\t\t * @param {Array} byteArray - Array of bytes to be converted.\n\t\t * @returns {string} Hexadecimal string, e.g. \"097B8A\".\n\t\t */\n\t\tcodes2Str: function(byteArray) {\n\t\t\treturn String.fromCharCode.apply(null, byteArray);\n\t\t},\n\n\t\t/**\n\t\t * Converts a string of hexadecimal values to an array of bytes. It can also\n\t\t * add remaining \"0\" nibbles in order to have enough bytes in the array as the\n\t\t * `finalBytes` parameter.\n\t\t *\n\t\t * @param {string} str - string of hexadecimal values e.g. \"097B8A\"\n\t\t * @param {number} [finalBytes] - Optional. The desired number of bytes\n\t\t * (not nibbles) that the returned array should contain.\n\t\t * @returns {Array} An array of nibbles.\n\t\t */\n\t\tstr2Bytes: function (str, finalBytes) {\n\t\t\tif (finalBytes) {\n\t\t\t\twhile ((str.length / 2) < finalBytes) { str = \"0\" + str; }\n\t\t\t}\n\n\t\t\tvar bytes = [];\n\t\t\tfor (var i=str.length-1; i>=0; i = i-2) {\n\t\t\t\tvar chars = i === 0 ? str[i] : str[i-1] + str[i];\n\t\t\t\tbytes.unshift(parseInt(chars, 16));\n\t\t\t}\n\n\t\t\treturn bytes;\n\t\t},\n\n\t\t/**\n\t\t * Translates number of ticks to MIDI timestamp format, returning an array\n\t\t * of bytes with the time values. MIDI has a very particular way to express\n\t\t * time; take a good look at the spec before ever touching this function.\n\t\t *\n\t\t * @param {number} ticks - Number of ticks to be translated.\n\t\t * @returns {number} Array of bytes that form the MIDI time value.\n\t\t */\n\t\ttranslateTickTime: function(ticks) {\n\t\t\tvar buffer = ticks & 0x7F;\n\n\t\t\twhile (ticks = ticks >> 7) {\n\t\t\t\tbuffer <<= 8;\n\t\t\t\tbuffer |= ((ticks & 0x7F) | 0x80);\n\t\t\t}\n\n\t\t\tvar bList = [];\n\t\t\twhile (true) {\n\t\t\t\tbList.push(buffer & 0xff);\n\n\t\t\t\tif (buffer & 0x80) { buffer >>= 8; }\n\t\t\t\telse { break; }\n\t\t\t}\n\t\t\treturn bList;\n\t\t},\n\n\t};\n\n\t/* ******************************************************************\n\t * Event class\n\t ****************************************************************** */\n\n\t/**\n\t * Construct a MIDI event.\n\t *\n\t * Parameters include:\n\t * - time [optional number] - Ticks since previous event.\n\t * - type [required number] - Type of event.\n\t * - channel [required number] - Channel for the event.\n\t * - param1 [required number] - First event parameter.\n\t * - param2 [optional number] - Second event parameter.\n\t */\n\tvar MidiEvent = function(params) {\n\t\tif (!this) return new MidiEvent(params);\n\t\tif (params &&\n\t\t\t\t(params.type !== null || params.type !== undefined) &&\n\t\t\t\t(params.channel !== null || params.channel !== undefined) &&\n\t\t\t\t(params.param1 !== null || params.param1 !== undefined)) {\n\t\t\tthis.setTime(params.time);\n\t\t\tthis.setType(params.type);\n\t\t\tthis.setChannel(params.channel);\n\t\t\tthis.setParam1(params.param1);\n\t\t\tthis.setParam2(params.param2);\n\t\t}\n\t};\n\n\t// event codes\n\tMidiEvent.NOTE_OFF = 0x80;\n\tMidiEvent.NOTE_ON = 0x90;\n\tMidiEvent.AFTER_TOUCH = 0xA0;\n\tMidiEvent.CONTROLLER = 0xB0;\n\tMidiEvent.PROGRAM_CHANGE = 0xC0;\n\tMidiEvent.CHANNEL_AFTERTOUCH = 0xD0;\n\tMidiEvent.PITCH_BEND = 0xE0;\n\n\n\t/**\n\t * Set the time for the event in ticks since the previous event.\n\t *\n\t * @param {number} ticks - The number of ticks since the previous event. May\n\t * be zero.\n\t */\n\tMidiEvent.prototype.setTime = function(ticks) {\n\t\tthis.time = Util.translateTickTime(ticks || 0);\n\t};\n\n\t/**\n\t * Set the type of the event. Must be one of the event codes on MidiEvent.\n\t *\n\t * @param {number} type - Event type.\n\t */\n\tMidiEvent.prototype.setType = function(type) {\n\t\tif (type < MidiEvent.NOTE_OFF || type > MidiEvent.PITCH_BEND) {\n\t\t\tthrow new Error(\"Trying to set an unknown event: \" + type);\n\t\t}\n\n\t\tthis.type = type;\n\t};\n\n\t/**\n\t * Set the channel for the event. Must be between 0 and 15, inclusive.\n\t *\n\t * @param {number} channel - The event channel.\n\t */\n\tMidiEvent.prototype.setChannel = function(channel) {\n\t\tif (channel < 0 || channel > 15) {\n\t\t\tthrow new Error(\"Channel is out of bounds.\");\n\t\t}\n\n\t\tthis.channel = channel;\n\t};\n\n\t/**\n\t * Set the first parameter for the event. Must be between 0 and 255,\n\t * inclusive.\n\t *\n\t * @param {number} p - The first event parameter value.\n\t */\n\tMidiEvent.prototype.setParam1 = function(p) {\n\t\tthis.param1 = p;\n\t};\n\n\t/**\n\t * Set the second parameter for the event. Must be between 0 and 255,\n\t * inclusive.\n\t *\n\t * @param {number} p - The second event parameter value.\n\t */\n\tMidiEvent.prototype.setParam2 = function(p) {\n\t\tthis.param2 = p;\n\t};\n\n\t/**\n\t * Serialize the event to an array of bytes.\n\t *\n\t * @returns {Array} The array of serialized bytes.\n\t */\n\tMidiEvent.prototype.toBytes = function() {\n\t\tvar byteArray = [];\n\n\t\tvar typeChannelByte = this.type | (this.channel & 0xF);\n\n\t\tbyteArray.push.apply(byteArray, this.time);\n\t\tbyteArray.push(typeChannelByte);\n\t\tbyteArray.push(this.param1);\n\n\t\t// Some events don't have a second parameter\n\t\tif (this.param2 !== undefined && this.param2 !== null) {\n\t\t\tbyteArray.push(this.param2);\n\t\t}\n\t\treturn byteArray;\n\t};\n\n\t/* ******************************************************************\n\t * MetaEvent class\n\t ****************************************************************** */\n\n\t/**\n\t * Construct a meta event.\n\t *\n\t * Parameters include:\n\t * - time [optional number] - Ticks since previous event.\n\t * - type [required number] - Type of event.\n\t * - data [optional array|string] - Event data.\n\t */\n\tvar MetaEvent = function(params) {\n\t\tif (!this) return new MetaEvent(params);\n\t\tvar p = params || {};\n\t\tthis.setTime(params.time);\n\t\tthis.setType(params.type);\n\t\tthis.setData(params.data);\n\t};\n\n\tMetaEvent.SEQUENCE = 0x00;\n\tMetaEvent.TEXT = 0x01;\n\tMetaEvent.COPYRIGHT = 0x02;\n\tMetaEvent.TRACK_NAME = 0x03;\n\tMetaEvent.INSTRUMENT = 0x04;\n\tMetaEvent.LYRIC = 0x05;\n\tMetaEvent.MARKER = 0x06;\n\tMetaEvent.CUE_POINT = 0x07;\n\tMetaEvent.CHANNEL_PREFIX = 0x20;\n\tMetaEvent.END_OF_TRACK = 0x2f;\n\tMetaEvent.TEMPO = 0x51;\n\tMetaEvent.SMPTE = 0x54;\n\tMetaEvent.TIME_SIG = 0x58;\n\tMetaEvent.KEY_SIG = 0x59;\n\tMetaEvent.SEQ_EVENT = 0x7f;\n\n\t/**\n\t * Set the time for the event in ticks since the previous event.\n\t *\n\t * @param {number} ticks - The number of ticks since the previous event. May\n\t * be zero.\n\t */\n\tMetaEvent.prototype.setTime = function(ticks) {\n\t\tthis.time = Util.translateTickTime(ticks || 0);\n\t};\n\n\t/**\n\t * Set the type of the event. Must be one of the event codes on MetaEvent.\n\t *\n\t * @param {number} t - Event type.\n\t */\n\tMetaEvent.prototype.setType = function(t) {\n\t\tthis.type = t;\n\t};\n\n\t/**\n\t * Set the data associated with the event. May be a string or array of byte\n\t * values.\n\t *\n\t * @param {string|Array} d - Event data.\n\t */\n\tMetaEvent.prototype.setData = function(d) {\n\t\tthis.data = d;\n\t};\n\n\t/**\n\t * Serialize the event to an array of bytes.\n\t *\n\t * @returns {Array} The array of serialized bytes.\n\t */\n\tMetaEvent.prototype.toBytes = function() {\n\t\tif (!this.type) {\n\t\t\tthrow new Error(\"Type for meta-event not specified.\");\n\t\t}\n\n\t\tvar byteArray = [];\n\t\tbyteArray.push.apply(byteArray, this.time);\n\t\tbyteArray.push(0xFF, this.type);\n\n\t\t// If data is an array, we assume that it contains several bytes. We\n\t\t// apend them to byteArray.\n\t\tif (Array.isArray(this.data)) {\n\t\t\tbyteArray.push(this.data.length);\n\t\t\tbyteArray.push.apply(byteArray, this.data);\n\t\t} else if (typeof this.data == 'number') {\n\t\t\tbyteArray.push(1, this.data);\n\t\t} else if (this.data !== null && this.data !== undefined) {\n\t\t\t// assume string; may be a bad assumption\n\t\t\tbyteArray.push(this.data.length);\n\t\t\tvar dataBytes = this.data.split('').map(function(x){ return x.charCodeAt(0) });\n\t\t\tbyteArray.push.apply(byteArray, dataBytes);\n\t\t} else {\n\t\t\tbyteArray.push(0);\n\t\t}\n\n\t\treturn byteArray;\n\t};\n\n\t/* ******************************************************************\n\t * Track class\n\t ****************************************************************** */\n\n\t/**\n\t * Construct a MIDI track.\n\t *\n\t * Parameters include:\n\t * - events [optional array] - Array of events for the track.\n\t */\n\tvar Track = function(config) {\n\t\tif (!this) return new Track(config);\n\t\tvar c = config || {};\n\t\tthis.events = c.events || [];\n\t};\n\n\tTrack.START_BYTES = [0x4d, 0x54, 0x72, 0x6b];\n\tTrack.END_BYTES = [0x00, 0xFF, 0x2F, 0x00];\n\n\t/**\n\t * Add an event to the track.\n\t *\n\t * @param {MidiEvent|MetaEvent} event - The event to add.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.addEvent = function(event) {\n\t\tthis.events.push(event);\n\t\treturn this;\n\t};\n\n\t/**\n\t * Add a note-on event to the track.\n\t *\n\t * @param {number} channel - The channel to add the event to.\n\t * @param {number|string} pitch - The pitch of the note, either numeric or\n\t * symbolic.\n\t * @param {number} [time=0] - The number of ticks since the previous event,\n\t * defaults to 0.\n\t * @param {number} [velocity=90] - The volume for the note, defaults to\n\t * DEFAULT_VOLUME.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.addNoteOn = Track.prototype.noteOn = function(channel, pitch, time, velocity) {\n\t\tthis.events.push(new MidiEvent({\n\t\t\ttype: MidiEvent.NOTE_ON,\n\t\t\tchannel: channel,\n\t\t\tparam1: Util.ensureMidiPitch(pitch),\n\t\t\tparam2: velocity || DEFAULT_VOLUME,\n\t\t\ttime: time || 0,\n\t\t}));\n\t\treturn this;\n\t};\n\n\t/**\n\t * Add a note-off event to the track.\n\t *\n\t * @param {number} channel - The channel to add the event to.\n\t * @param {number|string} pitch - The pitch of the note, either numeric or\n\t * symbolic.\n\t * @param {number} [time=0] - The number of ticks since the previous event,\n\t * defaults to 0.\n\t * @param {number} [velocity=90] - The velocity the note was released,\n\t * defaults to DEFAULT_VOLUME.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.addNoteOff = Track.prototype.noteOff = function(channel, pitch, time, velocity) {\n\t\tthis.events.push(new MidiEvent({\n\t\t\ttype: MidiEvent.NOTE_OFF,\n\t\t\tchannel: channel,\n\t\t\tparam1: Util.ensureMidiPitch(pitch),\n\t\t\tparam2: velocity || DEFAULT_VOLUME,\n\t\t\ttime: time || 0,\n\t\t}));\n\t\treturn this;\n\t};\n\n\t/**\n\t * Add a note-on and -off event to the track.\n\t *\n\t * @param {number} channel - The channel to add the event to.\n\t * @param {number|string} pitch - The pitch of the note, either numeric or\n\t * symbolic.\n\t * @param {number} dur - The duration of the note, in ticks.\n\t * @param {number} [time=0] - The number of ticks since the previous event,\n\t * defaults to 0.\n\t * @param {number} [velocity=90] - The velocity the note was released,\n\t * defaults to DEFAULT_VOLUME.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.addNote = Track.prototype.note = function(channel, pitch, dur, time, velocity) {\n\t\tthis.noteOn(channel, pitch, time, velocity);\n\t\tif (dur) {\n\t\t\tthis.noteOff(channel, pitch, dur, velocity);\n\t\t}\n\t\treturn this;\n\t};\n\n\t/**\n\t * Add a note-on and -off event to the track for each pitch in an array of pitches.\n\t *\n\t * @param {number} channel - The channel to add the event to.\n\t * @param {array} chord - An array of pitches, either numeric or\n\t * symbolic.\n\t * @param {number} dur - The duration of the chord, in ticks.\n\t * @param {number} [velocity=90] - The velocity of the chord,\n\t * defaults to DEFAULT_VOLUME.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.addChord = Track.prototype.chord = function(channel, chord, dur, velocity) {\n\t\tif (!Array.isArray(chord) && !chord.length) {\n\t\t\tthrow new Error('Chord must be an array of pitches');\n\t\t}\n\t\tchord.forEach(function(note) {\n\t\t\tthis.noteOn(channel, note, 0, velocity);\n\t\t}, this);\n\t\tchord.forEach(function(note, index) {\n\t\t\tif (index === 0) {\n\t\t\t\tthis.noteOff(channel, note, dur);\n\t\t\t} else {\n\t\t\t\tthis.noteOff(channel, note);\n\t\t\t}\n\t\t}, this);\n\t\treturn this;\n\t};\n\n\t/**\n\t * Set instrument for the track.\n\t *\n\t * @param {number} channel - The channel to set the instrument on.\n\t * @param {number} instrument - The instrument to set it to.\n\t * @param {number} [time=0] - The number of ticks since the previous event,\n\t * defaults to 0.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.setInstrument = Track.prototype.instrument = function(channel, instrument, time) {\n\t\tthis.events.push(new MidiEvent({\n\t\t\ttype: MidiEvent.PROGRAM_CHANGE,\n\t\t\tchannel: channel,\n\t\t\tparam1: instrument,\n\t\t\ttime: time || 0,\n\t\t}));\n\t\treturn this;\n\t};\n\n\t/**\n\t * Set the tempo for the track.\n\t *\n\t * @param {number} bpm - The new number of beats per minute.\n\t * @param {number} [time=0] - The number of ticks since the previous event,\n\t * defaults to 0.\n\t * @returns {Track} The current track.\n\t */\n\tTrack.prototype.setTempo = Track.prototype.tempo = function(bpm, time) {\n\t\tthis.events.push(new MetaEvent({\n\t\t\ttype: MetaEvent.TEMPO,\n\t\t\tdata: Util.mpqnFromBpm(bpm),\n\t\t\ttime: time || 0,\n\t\t}));\n\t\treturn this;\n\t};\n\n\t/**\n\t * Serialize the track to an array of bytes.\n\t *\n\t * @returns {Array} The array of serialized bytes.\n\t */\n\tTrack.prototype.toBytes = function() {\n\t\tvar trackLength = 0;\n\t\tvar eventBytes = [];\n\t\tvar startBytes = Track.START_BYTES;\n\t\tvar endBytes = Track.END_BYTES;\n\n\t\tvar addEventBytes = function(event) {\n\t\t\tvar bytes = event.toBytes();\n\t\t\ttrackLength += bytes.length;\n\t\t\teventBytes.push.apply(eventBytes, bytes);\n\t\t};\n\n\t\tthis.events.forEach(addEventBytes);\n\n\t\t// Add the end-of-track bytes to the sum of bytes for the track, since\n\t\t// they are counted (unlike the start-of-track ones).\n\t\ttrackLength += endBytes.length;\n\n\t\t// Makes sure that track length will fill up 4 bytes with 0s in case\n\t\t// the length is less than that (the usual case).\n\t\tvar lengthBytes = Util.str2Bytes(trackLength.toString(16), 4);\n\n\t\treturn startBytes.concat(lengthBytes, eventBytes, endBytes);\n\t};\n\n\t/* ******************************************************************\n\t * File class\n\t ****************************************************************** */\n\n\t/**\n\t * Construct a file object.\n\t *\n\t * Parameters include:\n\t * - ticks [optional number] - Number of ticks per beat, defaults to 128.\n\t * Must be 1-32767.\n\t * - tracks [optional array] - Track data.\n\t */\n\tvar File = function(config){\n\t\tif (!this) return new File(config);\n\n\t\tvar c = config || {};\n\t\tif (c.ticks) {\n\t\t\tif (typeof c.ticks !== 'number') {\n\t\t\t\tthrow new Error('Ticks per beat must be a number!');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (c.ticks <= 0 || c.ticks >= (1 << 15) || c.ticks % 1 !== 0) {\n\t\t\t\tthrow new Error('Ticks per beat must be an integer between 1 and 32767!');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.ticks = c.ticks || 128;\n\t\tthis.tracks = c.tracks || [];\n\t};\n\n\tFile.HDR_CHUNKID = \"MThd\"; // File magic cookie\n\tFile.HDR_CHUNK_SIZE = \"\\x00\\x00\\x00\\x06\"; // Header length for SMF\n\tFile.HDR_TYPE0 = \"\\x00\\x00\"; // Midi Type 0 id\n\tFile.HDR_TYPE1 = \"\\x00\\x01\"; // Midi Type 1 id\n\n\t/**\n\t * Add a track to the file.\n\t *\n\t * @param {Track} track - The track to add.\n\t */\n\tFile.prototype.addTrack = function(track) {\n\t\tif (track) {\n\t\t\tthis.tracks.push(track);\n\t\t\treturn this;\n\t\t} else {\n\t\t\ttrack = new Track();\n\t\t\tthis.tracks.push(track);\n\t\t\treturn track;\n\t\t}\n\t};\n\n\t/**\n\t * Serialize the MIDI file to an array of bytes.\n\t *\n\t * @returns {Array} The array of serialized bytes.\n\t */\n\tFile.prototype.toBytes = function() {\n\t\tvar trackCount = this.tracks.length.toString(16);\n\n\t\t// prepare the file header\n\t\tvar bytes = File.HDR_CHUNKID + File.HDR_CHUNK_SIZE;\n\n\t\t// set Midi type based on number of tracks\n\t\tif (parseInt(trackCount, 16) > 1) {\n\t\t\tbytes += File.HDR_TYPE1;\n\t\t} else {\n\t\t\tbytes += File.HDR_TYPE0;\n\t\t}\n\n\t\t// add the number of tracks (2 bytes)\n\t\tbytes += Util.codes2Str(Util.str2Bytes(trackCount, 2));\n\t\t// add the number of ticks per beat (currently hardcoded)\n\t\tbytes += String.fromCharCode((this.ticks/256), this.ticks%256);;\n\n\t\t// iterate over the tracks, converting to bytes too\n\t\tthis.tracks.forEach(function(track) {\n\t\t\tbytes += Util.codes2Str(track.toBytes());\n\t\t});\n\n\t\treturn bytes;\n\t};\n\n\t/* ******************************************************************\n\t * Exports\n\t ****************************************************************** */\n\n\texported.Util = Util;\n\texported.File = File;\n\texported.Track = Track;\n\texported.Event = MidiEvent;\n\texported.MetaEvent = MetaEvent;\n\n})( Midi );\n\nif (typeof module != 'undefined' && module !== null) {\n\tmodule.exports = Midi;\n} else if (typeof exports != 'undefined' && exports !== null) {\n\texports = Midi;\n} else {\n\tthis.Midi = Midi;\n}\n","\"use strict\";\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.arp = void 0;\nvar harmonics_1 = require(\"harmonics\");\nvar utils_1 = require(\"./utils\");\nvar DEFAULT_OCTAVE = 4;\n/**\n * Take an array and fill it with it s own elements in the next octave till it s of the specified `len`\n * @param {Array} arr e.g. ['a4', 'b4']\n * @param {Number} e.g. len 4\n * @return {Array} e.g. ['a4', 'b4', 'a5', 'b5']\n */\nvar fillArr = function (arr, len) {\n var bumpOctave = function (el) {\n if (!el) {\n throw new Error('Empty element');\n }\n var note = el.replace(/\\d/, '');\n var oct = el.replace(/\\D/g, '') || DEFAULT_OCTAVE;\n if (!note) {\n throw new Error('Incorrect note');\n }\n return note + (+oct + 1);\n };\n // Create a couple of chord arrays with bumped octaves\n // so that something like [c3, e3, g4] turns into [c4, e4, g5] and [c5, e5, g6]\n var arr1 = arr.map(bumpOctave);\n var arr2 = arr1.map(bumpOctave);\n var finalArr = __spreadArray(__spreadArray(__spreadArray([], arr, true), arr1, true), arr2, true);\n // Slice and return only as much as required\n return finalArr.slice(0, len);\n};\n/**\n *\n * @param chordsOrParams a string that denotes space (comma?) separated chords to be used or an object with additional properties\n * By default, if this is a string, the count of notes generated is 8 and the order is ascending.\n * For instance arp('CM FM') will result in an array of notes [C4, E4, G4, F4, A4, C4, C5, E5]\n * You can even provide Params as an object.\n * For e.g. arp({count: 8, order: '10325476', chords: 'FM_4 Gm7b5_4 AbM_4 Bbm_4 Cm_5 DbM_5 EbM_5})\n */\nvar arp = function (chordsOrParams) {\n var finalArr = [];\n var params = {\n count: 4,\n order: '0123',\n chords: '',\n };\n if (typeof chordsOrParams === 'string') {\n params.chords = chordsOrParams;\n }\n else {\n if (chordsOrParams.order && chordsOrParams.order.match(/\\D/g)) {\n throw new TypeError('Invalid value for order');\n }\n if (chordsOrParams.count > 8 || chordsOrParams.count < 2) {\n throw new TypeError('Invalid value for count');\n }\n // Provision a order for the notes in case only count was provided\n if (chordsOrParams.count && !chordsOrParams.order) {\n params.order = Array.from(Array(chordsOrParams.count).keys()).join('');\n }\n Object.assign(params, chordsOrParams);\n }\n // Chords can be passed as a string, e.g. 'CM_4 FM_4'\n // or as an array of notes arrays e.g. [['C3', 'E3', 'G3', 'B3'], ['F3', 'A3', 'C4', 'E4']]\n if (typeof params.chords === 'string') {\n var chordsArr = params.chords.split(' ');\n chordsArr.forEach(function (c, i) {\n try {\n var filledArr_1 = fillArr((0, harmonics_1.inlineChord)(c), params.count);\n // reorder the filledArr as per params.order\n var reorderedArr = params.order\n .split('')\n .map(function (idx) { return filledArr_1[idx]; });\n finalArr = __spreadArray(__spreadArray([], finalArr, true), reorderedArr, true);\n }\n catch (e) {\n throw new Error(\"Cannot decode chord \" + (i + 1) + \" \\\"\" + c + \"\\\" in given \\\"\" + params.chords + \"\\\"\");\n }\n });\n }\n else if (Array.isArray(params.chords)) {\n params.chords.forEach(function (c, i) {\n try {\n var filledArr_2 = fillArr(c, params.count);\n // reorder the filledArr as per params.order\n var reorderedArr = params.order\n .split('')\n .map(function (idx) { return filledArr_2[idx]; });\n finalArr = __spreadArray(__spreadArray([], finalArr, true), reorderedArr, true);\n }\n catch (e) {\n throw new Error(((0, utils_1.errorHasMessage)(e) ? e.message : e) + \" in chord \" + (i + 1) + \" \\\"\" + c + \"\\\"\");\n }\n });\n }\n else {\n throw new TypeError('Invalid value for chords');\n }\n return finalArr;\n};\nexports.arp = arp;\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clip = void 0;\nvar utils_1 = require(\"./utils\");\n/**\n * Get default params for a clip, such as root note, pattern etc\n * @return {Object}\n */\nvar getDefaultParams = function () { return ({\n notes: ['C4'],\n pattern: 'x',\n shuffle: false,\n sizzle: false,\n sizzleReps: 1,\n arpegiate: false,\n subdiv: '4n',\n amp: 100,\n accentLow: 70,\n randomNotes: null,\n offlineRendering: false,\n}); };\n/**\n * HDR speed is denoted by the number of ticks per note\n * By default this is set to a quarter note (4n) to be in line with Tone.js' default subdivision\n * Technically a bar is 512 ticks long. So it's HDR speed is 512\n * @type {Object}\n */\nvar hdr = {\n '1m': 2048,\n '2m': 4096,\n '3m': 6144,\n '4m': 8192,\n '1n': 512,\n '2n': 256,\n '4n': 128,\n '8n': 64,\n '16n': 32,\n};\nvar clip = function (params) {\n params = __assign(__assign({}, getDefaultParams()), (params || {}));\n // If notes is a string, split it into an array\n if (typeof params.notes === 'string') {\n // Remove any accidental double spaces\n params.notes = params.notes.replace(/\\s{2,}/g, ' ');\n params.notes = params.notes.split(' ');\n }\n params.notes = params.notes ? params.notes.map(utils_1.convertChordsToNotes) : [];\n if (/[^x\\-_[\\]R]/.test(params.pattern)) {\n throw new TypeError(\"pattern can only comprise x - _ [ ] R, found \" + params.pattern);\n }\n if (params.shuffle) {\n params.notes = (0, utils_1.shuffle)(params.notes);\n }\n if (params.randomNotes && typeof params.randomNotes === 'string') {\n params.randomNotes = params.randomNotes.replace(/\\s{2,}/g, ' ').split(/\\s/);\n }\n if (params.randomNotes) {\n params.randomNotes = params.randomNotes.map(utils_1.convertChordsToNotes);\n }\n var clipNotes = [];\n var step = 0;\n /**\n * Recursively apply pattern to notes\n *\n * Pass in a pattern array such as ['x', '-', 'x', 'x'] with a length for each element\n * The length is the HDR speed or tick length (obtained from the hdr object in this script)\n * If the element of this array is also a (pattern) array, then divide the length by\n * the length of the inner array and then call the recursive function on that inner array\n */\n var recursivelyApplyPatternToNotes = function (patternArr, length, parentNoteLength) {\n var totalLength = 0;\n patternArr.forEach(function (char, idx) {\n var _a;\n if (typeof char === 'string') {\n var note = null;\n if (char === '-') {\n // note = null;\n }\n else if (char === 'R' &&\n (0, utils_1.randomInt)() && // Use 1/2 probability for R to pick from param.notes\n params.randomNotes &&\n params.randomNotes.length > 0) {\n note = params.randomNotes[(0, utils_1.randomInt)(params.randomNotes.length - 1)];\n }\n else if (params.notes) {\n note = params.notes[step];\n }\n if (char === 'x' || char === 'R') {\n step++;\n }\n // Push only note on OR off messages to the clip notes array\n if (char === 'x' || char === '-' || char === 'R') {\n clipNotes.push({\n note: note,\n length: length,\n level: char === 'R' && !params.randomNotes\n ? params.accentLow\n : params.amp,\n });\n totalLength += length;\n }\n // In case of an underscore, simply extend the previous note's length\n if (char === '_' && clipNotes.length) {\n clipNotes[clipNotes.length - 1].length += length;\n totalLength += length;\n }\n // if there were triplets in this iteration then ajust length of the last note\n if (parentNoteLength &&\n totalLength !== parentNoteLength &&\n idx === patternArr.length - 1) {\n var diff = Math.abs(parentNoteLength - totalLength);\n var lastClipNote = clipNotes[clipNotes.length - 1];\n if (lastClipNote.length > diff) {\n lastClipNote.length = lastClipNote.length - diff;\n }\n else {\n lastClipNote.length = lastClipNote.length + diff;\n }\n }\n // If the pattern is longer than the notes, then repeat notes\n if (step === ((_a = params.notes) === null || _a === void 0 ? void 0 : _a.length)) {\n step = 0;\n }\n }\n // Note: The following condition is not in a else if simply because\n // we do need to increment the totalLength in order to support triplets\n if (Array.isArray(char)) {\n var isTriplet = false;\n // either this is a triplet or not\n if (char.length % 2 !== 0 || length % 2 !== 0) {\n isTriplet = true;\n }\n recursivelyApplyPatternToNotes(char, Math.round(length / char.length), isTriplet && length);\n // Increment total length to support subsequent operations\n // once we are out of the recursion\n totalLength += length;\n }\n });\n };\n recursivelyApplyPatternToNotes((0, utils_1.expandStr)(params.pattern), hdr[params.subdiv] || hdr['4n'], false);\n // Many thanks to @R1G for the following functionality\n if (params.sizzle) {\n var volArr = [];\n var style = params.sizzle === true ? 'sin' : params.sizzle;\n var beats = clipNotes.length;\n var amp = params.amp;\n var sizzleReps = params.sizzleReps;\n var stepLevel = amp / (beats / sizzleReps);\n if (style === 'sin' || style === 'cos') {\n for (var i = 0; i < beats; i++) {\n var level = Math[style]((i * Math.PI) / (beats / sizzleReps)) * amp;\n volArr.push(Math.round(Math.abs(level)));\n }\n }\n if (style === 'rampUp') {\n var level = 0;\n for (var i = 0; i < beats; i++) {\n if (i % (beats / sizzleReps) === 0) {\n level = 0;\n }\n else {\n level = level + stepLevel;\n }\n volArr.push(Math.round(Math.abs(level)));\n }\n }\n if (style === 'rampDown') {\n var level = amp;\n for (var i = 0; i < beats; i++) {\n if (i % (beats / sizzleReps) === 0) {\n level = amp;\n }\n else {\n level = level - stepLevel;\n }\n volArr.push(Math.round(Math.abs(level)));\n }\n }\n for (var i = 0; i < volArr.length; i++) {\n clipNotes[i].level = volArr[i] ? volArr[i] : 1; // Cannot allow 0 value on level\n }\n }\n if (params.accent) {\n // TODO: Eslint barks at \\- as useless, need to verify that JS handles - without \\ properly.\n if (/[^x-]/.test(params.accent)) {\n throw new TypeError('Accent can only have x and - characters');\n }\n var a = 0;\n for (var _i = 0, clipNotes_1 = clipNotes; _i < clipNotes_1.length; _i++) {\n var clipNote = clipNotes_1[_i];\n var level = params.accent[a] === 'x'\n ? params.amp\n : params.accentLow;\n if (params.sizzle) {\n level = (clipNote.level + level) / 2;\n }\n clipNote.level = Math.round(level);\n // Step to the next character in the accent\n a = a + 1;\n // Reset `a` so that it can loop over the accent\n if (a === params.accent.length) {\n a = 0;\n }\n }\n }\n return clipNotes;\n};\nexports.clip = clip;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.max = exports.arp = exports.progression = exports.getChordsByProgression = exports.getChordDegrees = exports.clip = exports.chords = exports.chord = exports.modes = exports.scales = exports.mode = exports.scale = void 0;\nvar harmonics_1 = require(\"harmonics\");\nObject.defineProperty(exports, \"scales\", { enumerable: true, get: function () { return harmonics_1.scales; } });\nObject.defineProperty(exports, \"modes\", { enumerable: true, get: function () { return harmonics_1.scales; } });\nObject.defineProperty(exports, \"chords\", { enumerable: true, get: function () { return harmonics_1.chords; } });\nObject.defineProperty(exports, \"scale\", { enumerable: true, get: function () { return harmonics_1.scale; } });\nObject.defineProperty(exports, \"mode\", { enumerable: true, get: function () { return harmonics_1.scale; } });\nObject.defineProperty(exports, \"chord\", { enumerable: true, get: function () { return harmonics_1.chord; } });\nvar clip_1 = require(\"./clip\");\nObject.defineProperty(exports, \"clip\", { enumerable: true, get: function () { return clip_1.clip; } });\nvar progression_1 = require(\"./progression\");\nObject.defineProperty(exports, \"getChordDegrees\", { enumerable: true, get: function () { return progression_1.getChordDegrees; } });\nObject.defineProperty(exports, \"getChordsByProgression\", { enumerable: true, get: function () { return progression_1.getChordsByProgression; } });\nObject.defineProperty(exports, \"progression\", { enumerable: true, get: function () { return progression_1.progression; } });\nvar arp_1 = require(\"./arp\");\nObject.defineProperty(exports, \"arp\", { enumerable: true, get: function () { return arp_1.arp; } });\nvar max_1 = require(\"./max\");\nObject.defineProperty(exports, \"max\", { enumerable: true, get: function () { return max_1.max; } });\n__exportStar(require(\"./types\"), exports);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.max = void 0;\nvar jsmidgen_1 = require(\"jsmidgen\");\n/**\n * Take an array of note objects to populate a clip selected in Ableton Live via Max4Live\n * @param {NoteObject[]} notes Notes are in the format: {note: ['c3'], level: 127, length: 64}\n */\nvar max = function (notes, liveClip) {\n if (liveClip === void 0) { liveClip = 'live_set view highlighted_clip_slot clip'; }\n var liveObject = new LiveAPI(liveClip);\n var totalLength = notes.reduce(function (a, b) {\n return a + b.length;\n }, 0);\n liveObject.set('loop_end', totalLength / 512);\n liveObject.call('remove_notes', 0, 1, 258, 127);\n liveObject.call('set_notes');\n var noteCount = notes.reduce(function (a, b) {\n return (a = a + (b.note ? b.note.length : 0));\n }, 0);\n liveObject.call('notes', noteCount);\n var cursor = 0;\n notes.forEach(function (noteObj) {\n if (noteObj.note) {\n noteObj.note.forEach(function (n) {\n liveObject.call('note', jsmidgen_1.Util.midiPitchFromNote(n), cursor.toFixed(2).toString(), (noteObj.length / 512).toFixed(2).toString(), noteObj.level || 100, 0);\n });\n cursor = cursor + noteObj.length / 512;\n }\n else {\n cursor = cursor + noteObj.length / 512;\n }\n });\n liveObject.call('done');\n};\nexports.max = max;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.progression = exports.getChordsByProgression = exports.getChordDegrees = void 0;\nvar harmonics_1 = require(\"harmonics\");\nvar utils_1 = require(\"./utils\");\n/**\n * Get the chords that go with a given scale/mode\n * This is useful only in case you want to check what chords work with a scale/mode\n * so that you can come up with chord progressions\n * @param {String} mode e.g. major\n * @return {Array} e.g.['I', 'ii', 'iii', 'IV', 'V', 'vi', 'vii°']\n */\nvar getChordDegrees = function (mode) {\n var theRomans = {\n ionian: ['I', 'ii', 'iii', 'IV', 'V', 'vi', 'vii°'],\n dorian: ['i', 'ii', 'III', 'IV', 'v', 'vi°', 'VII'],\n phrygian: ['i', 'II', 'III', 'iv', 'v°', 'VI', 'vii'],\n lydian: ['I', 'II', 'iii', 'iv°', 'V', 'vi', 'vii'],\n mixolydian: ['I', 'ii', 'iii°', 'IV', 'v', 'vi', 'VII'],\n aeolian: ['i', 'ii°', 'III', 'iv', 'v', 'VI', 'VII'],\n locrian: ['i°', 'II', 'iii', 'iv', 'V', 'VI', 'vii'],\n 'melodic minor': ['i', 'ii', 'III+', 'IV', 'V', 'vi°', 'vii°'],\n 'harmonic minor': ['i', 'ii°', 'III+', 'iv', 'V', 'VI', 'vii°'],\n };\n theRomans.major = theRomans.ionian;\n theRomans.minor = theRomans.aeolian;\n return theRomans[mode] || [];\n};\nexports.getChordDegrees = getChordDegrees;\nvar idxByDegree = {\n i: 0,\n ii: 1,\n iii: 2,\n iv: 3,\n v: 4,\n vi: 5,\n vii: 6,\n};\n/**\n * Get a chord name from degree\n * @param {String} roman e.g. ii OR ii° OR V7\n * @return {String} e.g. m OR m7b5 OR Maj7\n */\nvar getChordName = function (roman) {\n // remove any non character\n var str = roman.replace(/\\W/g, '');\n var prefix = 'M';\n // check if it s lowercase\n if (str.toLowerCase() === str) {\n prefix = 'm';\n }\n if (roman.indexOf('°') > -1) {\n return prefix + '7b5';\n }\n if (roman.indexOf('+') > -1) {\n return prefix + '#5';\n }\n if (roman.indexOf('7') > -1) {\n return prefix === 'M' ? 'maj7' : 'm7';\n }\n return prefix;\n};\n/**\n * Take the specified scale and degrees and return the chord names for them\n * These can be used as the value for the `notes` param of the `clip` method\n * @param {String} noteOctaveScale e.g. 'C4 major'\n * @param {String} chordDegress e.g. 'I IV V IV'\n * @return {String} e.g. 'CM FM GM FM'\n */\nvar getChordsByProgression = function (noteOctaveScale, chordDegress) {\n // Set the octave if missing\n // For example if the method was called with `C major` instead of `C4 major`, then add the 4\n var noteOctaveScaleArr = noteOctaveScale.split(' ');\n if (!noteOctaveScaleArr[0].match(/\\d/)) {\n noteOctaveScaleArr[0] += '4';\n noteOctaveScale = noteOctaveScaleArr.join(' ');\n }\n // Get the scale from the given note and scale/mode combination\n var mode = (0, harmonics_1.scale)(noteOctaveScale);\n var chordDegreesArr = chordDegress.replace(/\\s*,+\\s*/g, ' ').split(' ');\n // Now we have something like ['i', 'ii', 'IV']\n // Convert it to a chord family such as ['Cm', 'Dm', 'FM']\n var chordFamily = chordDegreesArr.map(function (roman) {\n var chordName = getChordName(roman); // e.g. m\n // get the index to be used by removing any digit or non alphabet character\n var scaleId = idxByDegree[roman.replace(/\\W|\\d/g, '').toLowerCase()]; // e.g. 0\n // get the note itself\n var note = mode[scaleId]; // e.g. C\n // get the octave of the note;\n var oct = note.replace(/\\D+/, ''); // e.g. 4\n // now get the chord\n return note.replace(/\\d/, '') + chordName + '_' + oct;\n });\n return chordFamily.toString().replace(/,/g, ' ');\n};\nexports.getChordsByProgression = getChordsByProgression;\nvar getProgFactory = function (_a) {\n var T = _a.T, P = _a.P, D = _a.D;\n return function (count) {\n if (count === void 0) { count = 4; }\n var chords = [];\n // Push root/tonic\n chords.push((0, utils_1.pickOne)(T));\n var i = 1;\n // Pick a predominant\n if (i < count - 1) {\n chords.push((0, utils_1.pickOne)(P));\n i++;\n }\n // Try another predominant\n if (i < count - 1 && (0, utils_1.dice)()) {\n chords.push((0, utils_1.pickOne)(P));\n i++;\n }\n // /////// 4 or more//////////\n if (i < count - 1) {\n // Pick a dominant\n chords.push((0, utils_1.pickOne)(D));\n i++;\n }\n if (i < count - 1) {\n // Pick a predominant\n chords.push((0, utils_1.pickOne)(P));\n i++;\n }\n if (i < count - 1) {\n // Pick a dominant\n chords.push((0, utils_1.pickOne)(D));\n i++;\n }\n // Pick a predominant if possible\n if (i < count - 1 && (0, utils_1.dice)()) {\n chords.push((0, utils_1.pickOne)(P));\n i++;\n }\n // //////////////////////////\n // Fill the rest with dominant\n while (i < count) {\n chords.push((0, utils_1.pickOne)(D));\n i++;\n }\n return chords;\n };\n};\nvar M = getProgFactory({ T: ['I', 'vi'], P: ['ii', 'IV'], D: ['V'] });\nvar m = getProgFactory({ T: ['i', 'VI'], P: ['ii', 'iv'], D: ['V'] });\n/**\n * Generate a chord progression based on basic music theory\n * where we follow tonic to optionally predominant and then dominant\n * and then randomly to predominant and continue this till we reach `count`\n * @param scaleType e.g. M (for major chord progression), m (for minor chord progression)\n * @param count e.g. 4\n */\nvar progression = function (scaleType, count) {\n if (count === void 0) { count = 4; }\n if (scaleType === 'major' || scaleType === 'M') {\n return M(count);\n }\n if (scaleType === 'minor' || scaleType === 'm') {\n return m(count);\n }\n return [];\n};\nexports.progression = progression;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.randomInt = exports.convertChordsToNotes = exports.convertChordToNotes = exports.errorHasMessage = exports.flat = exports.dice = exports.pickOne = exports.sizzleMap = exports.shuffle = exports.expandStr = exports.isNote = void 0;\nvar harmonics_1 = require(\"harmonics\");\n/**\n * Take a string input and check if it s a note name or not\n * @param {String} str Note name e.g. c4\n * @return {Boolean} Return true for c4 or return false for something like CM\n */\nvar isNote = function (str) {\n return /^[a-gA-G](?:#|b)?\\d$/.test(str);\n};\nexports.isNote = isNote;\n/**\n * Take a String input such as xxx[xx[xx]]\n * and return an Array as ['x', 'x', 'x', ['x', 'x', ['x', 'x']]]\n * @param {String} str\n * @return {Array}\n */\nvar expandStr = function (str) {\n str = JSON.stringify(str.split(''));\n str = str.replace(/,\"\\[\",/g, ', [');\n str = str.replace(/\"\\[\",/g, '[');\n str = str.replace(/,\"\\]\"/g, ']');\n return JSON.parse(str);\n};\nexports.expandStr = expandStr;\n/**\n * Basic Array randomizer\n * @param {Array} arr\n * @param {boolean} fullShuffle Ensure no elements remain in old place\n * @return {Array}\n */\nvar shuffle = function (arr, fullShuffle) {\n if (fullShuffle === void 0) { fullShuffle = true; }\n var lastIndex = arr.length - 1;\n // Shuffle algorithm by Richard Durstenfeld (Donald E. Knuth), also Ronald Fisher and Frank Yates.\n // \"Full Shuffle\" Modification to ensure no elements remain in their original place (by taking each element once\n // and swapping with any remaining elements)\n arr.forEach(function (el, idx) {\n if (idx >= lastIndex) {\n // No shuffling last element\n // One before last is always swapped with last at the end of the loop\n // Since previous swaps can move last element into other places, there is still a random shuffle of last element\n return;\n }\n // Swap el with one of the higher elements randomly\n var rnd = fullShuffle\n ? // Pick random number from idx+1 to lastIndex (Modified algorithm, (N-1)! combinations)\n // Math.random -> [0, 1) -> [0, lastIndex-idx ) --floor-> [0, lastIndex-idx-1]\n // rnd = [0, lastIndex-idx-1] + 1 + idx = [1 + idx, lastIndex]\n // (Original algorithm would pick rnd = [idx, lastIndex], thus any element could arrive back into its slot)\n Math.floor(Math.random() * (lastIndex - idx)) + 1 + idx\n : // Pick random number from idx to lastIndex (Unmodified Richard Durstenfeld, N! combinations)\n Math.floor(Math.random() * (lastIndex + 1 - idx)) + idx;\n arr[idx] = arr[rnd];\n arr[rnd] = el;\n });\n return arr;\n};\nexports.shuffle = shuffle;\n/**\n * Return an array of numbers relative to maxLevel || 127 ordered in a Sine wave format\n * This is used by the `sizzle` param of the `clip` method to add a rudimentary variation to the accent of each note\n * @param {Number} maxLevel A number between not more than 127\n * @return {Array} Example output [63, 90, 110, 127, 110, 90, 63, 0, 63, 90, 110, 127, 110, 90, 63, 0]\n */\nvar sizzleMap = function (maxLevel) {\n if (maxLevel === void 0) { maxLevel = 127; }\n var pi = Math.PI;\n var piArr = [\n pi / 6,\n pi / 4,\n pi / 3,\n pi / 2,\n (2 * pi) / 3,\n (3 * pi) / 4,\n (5 * pi) / 6,\n pi,\n ];\n var piArrRev = [\n 0,\n pi / 6,\n pi / 4,\n pi / 3,\n pi / 2,\n (2 * pi) / 3,\n (3 * pi) / 4,\n (5 * pi) / 6,\n ];\n piArrRev.reverse();\n var arr = piArr.concat(piArrRev);\n return arr.map(function (element) { return Math.round(Math.sin(element) * maxLevel); });\n};\nexports.sizzleMap = sizzleMap;\n/**\n * Pick one item randomly from an array and return it\n * @param arr\n */\nvar pickOne = function (arr) {\n return arr.length > 1 ? arr[Math.round(Math.random())] : arr[0];\n};\nexports.pickOne = pickOne;\n/**\n * Boolean generator\n */\nvar dice = function () { return !!Math.round(Math.random()); };\nexports.dice = dice;\n/**\n * Polyfill for Array.prototype.flat\n */\nvar flat = function (arr) {\n return arr.reduce(function (acc, val) { return acc.concat(val); }, []);\n};\nexports.flat = flat;\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nvar errorHasMessage = function (x) {\n return typeof x.message === 'string';\n};\nexports.errorHasMessage = errorHasMessage;\n/**\n * 'el' could be an inlineChord() e.g. Cmaj7 or Dbsus2_5\n * or a chord() e.g. 'C3 M'\n */\nvar convertChordToNotes = function (el) {\n // Try both inlineChord() and chord()\n var c1;\n var c2;\n var e1;\n var e2;\n try {\n c1 = (0, harmonics_1.inlineChord)(el);\n }\n catch (e) {\n e1 = e;\n }\n try {\n c2 = (0, harmonics_1.chord)(el.replace(/_/g, ' ')); // chord() is not friendly to underscores\n }\n catch (e) {\n e2 = e;\n }\n if (!e1 && !e2) {\n // Both inlineChord() and chord() have result\n if (c1.toString() !== c2.toString()) {\n throw new Error(\"Chord \" + el + \" cannot decode, guessing \" + c1 + \" or \" + c2);\n }\n return c1;\n } // else\n if (!e1) {\n return c1;\n } // else\n if (!e2) {\n return c2;\n } // else\n // Give up, last try:\n return (0, harmonics_1.chord)(el);\n};\nexports.convertChordToNotes = convertChordToNotes;\nvar convertChordsToNotes = function (el) {\n if (typeof el === 'string' && (0, exports.isNote)(el)) {\n // A note needs to be an array so that it can accomodate chords or single notes with a single interface\n return [el];\n }\n if (Array.isArray(el)) {\n // This could be a chord provided as an array or an array of arrays\n el.forEach(function (n) {\n // This could be a chord provided as an array\n if (Array.isArray(n)) {\n // TODO: Can we convert it to something useful?\n // make sure it uses valid notes\n n.forEach(function (n1) {\n if (typeof n1 !== 'string' || !(0, exports.isNote)(n1)) {\n throw new TypeError('array of arrays must comprise valid notes');\n }\n });\n // throw new TypeError('cannot decode array of arrays');\n }\n else if (typeof n !== 'string' || !(0, exports.isNote)(n)) {\n // make sure it uses valid notes\n throw new TypeError('array must comprise valid notes');\n }\n });\n return el;\n // ? return el as (string | string[])[];\n }\n if (!Array.isArray(el)) {\n var c = (0, exports.convertChordToNotes)(el);\n if (c && c.length) {\n return c;\n }\n }\n throw new Error(\"Chord \" + el + \" not found\");\n};\nexports.convertChordsToNotes = convertChordsToNotes;\nvar randomInt = function (num) {\n if (num === void 0) { num = 1; }\n return Math.round(Math.random() * num);\n};\nexports.randomInt = randomInt;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(890);\n"],"names":["n","exports","JSON","parse","e","o","a","i","r","d","Object","defineProperty","enumerable","get","prototype","hasOwnProperty","call","Symbol","toStringTag","value","chord","m","chords","t","inlineChord","scale","c","scales","s","Error","concat","indexOf","slice","toUpperCase","charAt","replace","l","isNaN","b","map","u","p","h","f","length","push","includes","split","keys","__esModule","Midi","exported","DEFAULT_VOLUME","Util","DEFAULT_DURATION","DEFAULT_CHANNEL","midi_letter_pitches","g","midiPitchFromNote","matches","exec","note","toLowerCase","accidental","parseInt","substr","ensureMidiPitch","test","midi_pitches_letter","midi_flattened_notes","noteFromMidiPitch","returnFlattened","noteName","octave","noteNum","Math","floor","mpqnFromBpm","bpm","mpqn","ret","unshift","bpmFromMpqn","codes2Str","byteArray","String","fromCharCode","apply","str2Bytes","str","finalBytes","bytes","chars","translateTickTime","ticks","buffer","bList","MidiEvent","params","this","type","undefined","channel","param1","setTime","time","setType","setChannel","setParam1","setParam2","param2","NOTE_OFF","NOTE_ON","AFTER_TOUCH","CONTROLLER","PROGRAM_CHANGE","CHANNEL_AFTERTOUCH","PITCH_BEND","toBytes","typeChannelByte","MetaEvent","setData","data","SEQUENCE","TEXT","COPYRIGHT","TRACK_NAME","INSTRUMENT","LYRIC","MARKER","CUE_POINT","CHANNEL_PREFIX","END_OF_TRACK","TEMPO","SMPTE","TIME_SIG","KEY_SIG","SEQ_EVENT","Array","isArray","dataBytes","x","charCodeAt","Track","config","events","START_BYTES","END_BYTES","addEvent","event","addNoteOn","noteOn","pitch","velocity","addNoteOff","noteOff","addNote","dur","addChord","forEach","index","setInstrument","instrument","setTempo","tempo","trackLength","eventBytes","startBytes","endBytes","lengthBytes","toString","File","tracks","HDR_CHUNKID","HDR_CHUNK_SIZE","HDR_TYPE0","HDR_TYPE1","addTrack","track","trackCount","Event","module","__spreadArray","to","from","pack","arguments","ar","arp","harmonics_1","utils_1","fillArr","arr","len","bumpOctave","el","oct","arr1","arr2","chordsOrParams","finalArr","count","order","match","TypeError","join","assign","filledArr_1","reorderedArr","idx","filledArr_2","errorHasMessage","message","__assign","clip","hdr","notes","pattern","shuffle","sizzle","sizzleReps","arpegiate","subdiv","amp","accentLow","randomNotes","offlineRendering","convertChordsToNotes","clipNotes","step","recursivelyApplyPatternToNotes","patternArr","parentNoteLength","totalLength","char","_a","randomInt","level","diff","abs","lastClipNote","isTriplet","round","expandStr","volArr","style","beats","stepLevel","PI","accent","_i","clipNotes_1","clipNote","__createBinding","create","k","k2","__exportStar","max","progression","getChordsByProgression","getChordDegrees","modes","mode","clip_1","progression_1","arp_1","max_1","jsmidgen_1","liveClip","liveObject","LiveAPI","reduce","set","noteCount","cursor","noteObj","toFixed","theRomans","ionian","dorian","phrygian","lydian","mixolydian","aeolian","locrian","major","minor","idxByDegree","ii","iii","iv","v","vi","vii","noteOctaveScale","chordDegress","noteOctaveScaleArr","roman","chordName","prefix","getChordName","scaleId","getProgFactory","T","P","D","pickOne","dice","M","scaleType","convertChordToNotes","flat","sizzleMap","isNote","stringify","fullShuffle","lastIndex","rnd","random","maxLevel","pi","piArr","piArrRev","reverse","element","sin","acc","val","c1","c2","e1","e2","n1","num","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","id","loaded","__webpack_modules__","nmd","paths","children","__webpack_exports__"],"sourceRoot":""}