scribbletune 5.1.2 → 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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":"iCACA,IAgBoBA,EAhBhBC,EAAYC,OAAOC,eACnBC,EAAmBF,OAAOG,yBAC1BC,EAAoBJ,OAAOK,oBAC3BC,EAAeN,OAAOO,UAAUC,eAgBhCC,EAAgB,CAAC,EAfN,EAACC,EAAQC,KACtB,IAAK,IAAIC,KAAQD,EACfZ,EAAUW,EAAQE,EAAM,CAAEC,IAAKF,EAAIC,GAAOE,YAAY,KAc1DC,CAASN,EAAe,CACtBO,MAAO,IAAMA,EACbC,OAAQ,IAAMA,EACdC,oBAAqB,IAAMA,EAC3BC,YAAa,IAAMA,EACnBC,MAAO,IAAMA,EACbC,OAAQ,IAAMA,IAEhBC,EAAOC,SAZazB,EAYUW,EApBZ,EAACe,EAAIC,EAAMC,EAAQC,KACnC,GAAIF,GAAwB,iBAATA,GAAqC,mBAATA,EAC7C,IAAK,IAAIG,KAAOxB,EAAkBqB,GAC3BnB,EAAauB,KAAKL,EAAII,SAKLE,IALaF,GACjC7B,EAAUyB,EAAII,EAAK,CAAEf,IAAK,IAAMY,EAAKG,GAAMd,aAAca,EAAOzB,EAAiBuB,EAAMG,KAASD,EAAKb,aAE3G,OAAOU,GAEmBM,CAAY/B,EAAU,CAAC,EAAG,aAAc,CAAEgC,OAAO,IAASjC,IAetF,IA0RIkC,EAAiB,CACnB,KAAM,KACN,KAAM,KACN,KAAM,KACN,KAAM,KACN,KAAM,KACN,GAAM,IACN,GAAM,IACN,KAAM,IACN,KAAM,KAKJC,EAAY,CACd,IACA,KACA,IACA,KACA,IACA,IACA,KACA,IACA,KACA,IACA,KACA,KAYEC,EAhUoB,CACtB,mBAAoB,eACpB,oBAAqB,eACrB,wBAAyB,eACzBC,QAAS,eACTC,SAAU,eACV,8BAA+B,eAC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index.js","webpack://scribbletune/./node_modules/jsmidgen/lib/jsmidgen.js","webpack://scribbletune/./src/arp.ts","webpack://scribbletune/./src/clip.ts","webpack://scribbletune/./src/index.ts","webpack://scribbletune/./src/midi.ts","webpack://scribbletune/./src/progression.ts","webpack://scribbletune/./src/types/index.ts","webpack://scribbletune/./src/utils.ts","webpack://scribbletune/external commonjs \"fs\"","webpack://scribbletune/webpack/bootstrap","webpack://scribbletune/webpack/runtime/node module decorator","webpack://scribbletune/webpack/startup"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/index.ts\nvar index_exports = {};\n__export(index_exports, {\n chord: () => chord,\n chords: () => chords,\n getIndicesFromScale: () => getIndicesFromScale,\n inlineChord: () => inlineChord,\n scale: () => scale,\n scales: () => scales\n});\nmodule.exports = __toCommonJS(index_exports);\n\n// src/gen/scaleMaps.json\nvar scaleMaps_default = {\n \"major pentatonic\": \"101010010100\",\n \"ionian pentatonic\": \"100011010001\",\n \"mixolydian pentatonic\": \"100011010010\",\n ritusen: \"101001010100\",\n egyptian: \"101001010010\",\n \"neopolitan major pentatonic\": \"100011100010\",\n \"vietnamese 1\": \"100101011000\",\n pelog: \"110100011000\",\n kumoijoshi: \"110001011000\",\n hirajoshi: \"101100011000\",\n iwato: \"110001100010\",\n \"in-sen\": \"110001010010\",\n \"lydian pentatonic\": \"100010110001\",\n \"malkos raga\": \"100101001010\",\n \"locrian pentatonic\": \"100101100010\",\n \"minor pentatonic\": \"100101010010\",\n \"minor six pentatonic\": \"100101010100\",\n \"flat three pentatonic\": \"101100010100\",\n \"flat six pentatonic\": \"101010011000\",\n scriabin: \"110010010100\",\n \"whole tone pentatonic\": \"100010101010\",\n \"lydian #5P pentatonic\": \"100010101001\",\n \"lydian dominant pentatonic\": \"100010110010\",\n \"minor #7M pentatonic\": \"100101010001\",\n \"super locrian pentatonic\": \"100110100010\",\n \"minor hexatonic\": \"101101010001\",\n augmented: \"100110011001\",\n \"major blues\": \"101110010100\",\n piongio: \"101001010110\",\n \"prometheus neopolitan\": \"110010100110\",\n prometheus: \"101010100110\",\n \"mystery #1\": \"110010101010\",\n \"six tone symmetric\": \"110011001100\",\n \"whole tone\": \"101010101010\",\n \"messiaen's mode #5\": \"110001110001\",\n \"minor blues\": \"100101110010\",\n \"locrian major\": \"101011101010\",\n \"double harmonic lydian\": \"110010111001\",\n \"harmonic minor\": \"101101011001\",\n altered: \"110110101010\",\n \"locrian #2\": \"101101101010\",\n \"mixolydian b6\": \"101011011010\",\n \"lydian dominant\": \"101010110110\",\n lydian: \"101010110101\",\n \"lydian augmented\": \"101010101101\",\n \"dorian b2\": \"110101010110\",\n \"melodic minor\": \"101101010101\",\n locrian: \"110101101010\",\n ultralocrian: \"110110101100\",\n \"locrian 6\": \"110101100110\",\n \"augmented heptatonic\": \"100111011001\",\n \"romanian minor\": \"101100110110\",\n \"dorian #4\": \"101100110110\",\n \"lydian diminished\": \"101100110101\",\n phrygian: \"110101011010\",\n \"leading whole tone\": \"101010101011\",\n \"lydian minor\": \"101010111010\",\n \"phrygian dominant\": \"110011011010\",\n balinese: \"110101011001\",\n \"neopolitan major\": \"110101010101\",\n aeolian: \"101101011010\",\n \"harmonic major\": \"101011011001\",\n \"double harmonic major\": \"110011011001\",\n dorian: \"101101010110\",\n \"hungarian minor\": \"101100111001\",\n \"hungarian major\": \"100110110110\",\n oriental: \"110011100110\",\n flamenco: \"110110110010\",\n \"todi raga\": \"110100111001\",\n mixolydian: \"101011010110\",\n persian: \"110011101001\",\n major: \"101011010101\",\n enigmatic: \"110010101011\",\n \"major augmented\": \"101011001101\",\n \"lydian #9\": \"100110110101\",\n \"messiaen's mode #4\": \"111001111001\",\n \"purvi raga\": \"110011111001\",\n \"spanish heptatonic\": \"110111011010\",\n bebop: \"101011010111\",\n \"bebop minor\": \"101111010110\",\n \"bebop major\": \"101011011101\",\n \"bebop locrian\": \"110101111010\",\n \"minor bebop\": \"101101011011\",\n diminished: \"101101101101\",\n ichikosucho: \"101011110101\",\n \"minor six diminished\": \"101101011101\",\n \"half-whole diminished\": \"110110110110\",\n \"kafi raga\": \"100111010111\",\n \"messiaen's mode #6\": \"101011101011\",\n \"composite blues\": \"101111110110\",\n \"messiaen's mode #3\": \"101110111011\",\n \"messiaen's mode #7\": \"111101111101\",\n chromatic: \"111111111111\",\n ionian: \"101011010101\",\n minor: \"101101011010\",\n Kanakangi: \"111001011100\",\n Ratnangi: \"111001011010\",\n Ganamurti: \"111001011001\",\n Vanaspati: \"111001010110\",\n Manavati: \"111001010101\",\n Tanarupi: \"111001010011\",\n Senavati: \"110101011100\",\n Hanumatodi: \"110101011010\",\n Dhenuka: \"110101011001\",\n Natakapriya: \"110101010110\",\n Kokilapriya: \"110101010101\",\n Rupavati: \"110101010011\",\n Gayakapriya: \"110011011100\",\n Vakulabharanam: \"110011011010\",\n Mayamalavagowla: \"110011011001\",\n Chakravakam: \"110011010110\",\n Suryakantam: \"110011010101\",\n Hatakambari: \"110011010011\",\n Jhankaradhwani: \"101101011100\",\n Natabhairavi: \"101101011010\",\n Keeravani: \"101101011001\",\n Kharaharapriya: \"101101010110\",\n Gourimanohari: \"101101010101\",\n Varunapriya: \"101101010011\",\n Mararanjani: \"101011011100\",\n Charukesi: \"101011011010\",\n Sarasangi: \"101011011001\",\n Harikambhoji: \"101011010110\",\n Dheerasankarabaranam: \"101011010101\",\n Naganandini: \"101011010011\",\n Yagapriya: \"100111011100\",\n Ragavardhini: \"100111011010\",\n Gangeyabhushani: \"100111011001\",\n Vagadheeswari: \"100111010110\",\n Shulini: \"100111010101\",\n Chalanata: \"100111010011\",\n Salagam: \"111000111100\",\n Jalarnavam: \"111000111010\",\n Jhalavarali: \"111000111001\",\n Navaneetam: \"111000110110\",\n Pavani: \"111000110101\",\n Raghupriya: \"111000110011\",\n Gavambhodi: \"110100111100\",\n Bhavapriya: \"110100111010\",\n Shubhapantuvarali: \"110100111001\",\n Shadvidamargini: \"110100110110\",\n Suvarnangi: \"110100110101\",\n Divyamani: \"110100110011\",\n Dhavalambari: \"110010111100\",\n Namanarayani: \"110010111010\",\n Kamavardhini: \"110010111001\",\n Ramapriya: \"110010110110\",\n Gamanashrama: \"110010110101\",\n Vishwambari: \"110010110011\",\n Shamalangi: \"101100111100\",\n Shanmukhapriya: \"101100111010\",\n Simhendramadhyamam: \"101100111001\",\n Hemavati: \"101100110110\",\n Dharmavati: \"101100110101\",\n Neetimati: \"101100110011\",\n Kantamani: \"101010111100\",\n Rishabhapriya: \"101010111010\",\n Latangi: \"101010111001\",\n Vachaspati: \"101010110110\",\n Mechakalyani: \"101010110101\",\n Chitrambari: \"101010110011\",\n Sucharitra: \"100110111100\",\n \"Jyoti swarupini\": \"100110111010\",\n Dhatuvardani: \"100110111001\",\n Nasikabhushini: \"100110110110\",\n Kosalam: \"100110110101\",\n Rasikapriya: \"100110110011\"\n};\n\n// src/gen/chordMaps.json\nvar chordMaps_default = {\n \"5th\": \"100000010000\",\n \"M7#5sus4\": \"100001001001\",\n \"7#5sus4\": \"100001001010\",\n sus4: \"100001010000\",\n M7sus4: \"100001010001\",\n \"7sus4\": \"100001010010\",\n \"7no5\": \"100010000010\",\n aug: \"100010001000\",\n M7b6: \"100010001001\",\n \"maj7#5\": \"100010001001\",\n \"7#5\": \"100010001010\",\n \"7b13\": \"100010001010\",\n M: \"100010010000\",\n maj7: \"100010010001\",\n \"7th\": \"100010010010\",\n \"6th\": \"100010010100\",\n \"7add6\": \"100010010110\",\n \"7b6\": \"100010011010\",\n Mb5: \"100010100000\",\n M7b5: \"100010100001\",\n \"7b5\": \"100010100010\",\n \"maj#4\": \"100010110001\",\n \"7#11\": \"100010110010\",\n \"M6#11\": \"100010110100\",\n \"7#11b13\": \"100010111010\",\n \"m#5\": \"100100001000\",\n mb6M7: \"100100001001\",\n \"m7#5\": \"100100001010\",\n m: \"100100010000\",\n \"m/ma7\": \"100100010001\",\n m7: \"100100010010\",\n m6: \"100100010100\",\n mMaj7b6: \"100100011001\",\n dim: \"100100100000\",\n oM7: \"100100100001\",\n m7b5: \"100100100010\",\n dim7: \"100100100100\",\n o7M7: \"100100100101\",\n \"4th\": \"100101000010\",\n madd4: \"100101010000\",\n m7add11: \"100101010010\",\n \"+add#9\": \"100110001000\",\n \"7#5#9\": \"100110001010\",\n \"7#9\": \"100110010010\",\n \"13#9\": \"100110010110\",\n \"7#9b13\": \"100110011010\",\n \"maj7#9#11\": \"100110110001\",\n \"7#9#11\": \"100110110010\",\n \"13#9#11\": \"100110110110\",\n \"7#9#11b13\": \"100110111010\",\n sus2: \"101000010000\",\n \"M9#5sus4\": \"101001001001\",\n sus24: \"101001010000\",\n M9sus4: \"101001010001\",\n \"11th\": \"101001010010\",\n \"9sus4\": \"101001010010\",\n \"13sus4\": \"101001010110\",\n \"9no5\": \"101010000010\",\n \"13no5\": \"101010000110\",\n \"M#5add9\": \"101010001000\",\n \"maj9#5\": \"101010001001\",\n \"9#5\": \"101010001010\",\n \"9b13\": \"101010001010\",\n Madd9: \"101010010000\",\n maj9: \"101010010001\",\n \"9th\": \"101010010010\",\n \"6/9\": \"101010010100\",\n maj13: \"101010010101\",\n M7add13: \"101010010101\",\n \"13th\": \"101010010110\",\n M9b5: \"101010100001\",\n \"9b5\": \"101010100010\",\n \"13b5\": \"101010100110\",\n \"9#5#11\": \"101010101010\",\n \"maj9#11\": \"101010110001\",\n \"9#11\": \"101010110010\",\n \"69#11\": \"101010110100\",\n \"M13#11\": \"101010110101\",\n \"13#11\": \"101010110110\",\n \"9#11b13\": \"101010111010\",\n \"m9#5\": \"101100001010\",\n madd9: \"101100010000\",\n mM9: \"101100010001\",\n m9: \"101100010010\",\n m69: \"101100010100\",\n m13: \"101100010110\",\n mMaj9b6: \"101100011001\",\n m9b5: \"101100100010\",\n m11A: \"101101001010\",\n m11: \"101101010010\",\n b9sus: \"110001010010\",\n \"11b9\": \"110001010010\",\n \"7sus4b9b13\": \"110001011010\",\n alt7: \"110010000010\",\n \"7#5b9\": \"110010001010\",\n Maddb9: \"110010010000\",\n M7b9: \"110010010001\",\n \"7b9\": \"110010010010\",\n \"13b9\": \"110010010110\",\n \"7b9b13\": \"110010011010\",\n \"7#5b9#11\": \"110010101010\",\n \"7b9#11\": \"110010110010\",\n \"13b9#11\": \"110010110110\",\n \"7b9b13#11\": \"110010111010\",\n mb6b9: \"110100001000\",\n \"7b9#9\": \"110110010010\"\n};\n\n// src/scalesAndChords.ts\nvar DEFAULT_OCTAVE = 4;\nvar sharpToFlatMap = {\n \"C#\": \"Db\",\n \"D#\": \"Eb\",\n \"F#\": \"Gb\",\n \"G#\": \"Ab\",\n \"A#\": \"Bb\",\n \"CB\": \"B\",\n \"FB\": \"E\",\n \"E#\": \"F\",\n \"B#\": \"C\"\n};\nfunction sharpToFlat(root) {\n return sharpToFlatMap[root.toUpperCase()] || root.charAt(0).toUpperCase() + root.slice(1);\n}\nvar CHROMATIC = [\n \"C\",\n \"Db\",\n \"D\",\n \"Eb\",\n \"E\",\n \"F\",\n \"Gb\",\n \"G\",\n \"Ab\",\n \"A\",\n \"Bb\",\n \"B\"\n];\nfunction getChromatic(root, octave) {\n const index = CHROMATIC.indexOf(root);\n if (index === -1) {\n throw new Error(`${root} is not a valid root note`);\n }\n const o1 = CHROMATIC.map((n) => n + octave);\n const o2 = CHROMATIC.map((n) => n + (octave + 1));\n const c = o1.concat(o2);\n return c.slice(index);\n}\nvar scaleMap = scaleMaps_default;\nvar chordMap = chordMaps_default;\nfunction _getNotesForScaleOrChord({ scale: scale2, chord: chord2 }) {\n const input = scale2 || chord2;\n const SCALE_OR_CHORD = scale2 ? \"scale\" : \"chord\";\n if (typeof input !== \"string\") {\n throw new Error(`${input} is not a valid input for ${SCALE_OR_CHORD}`);\n }\n const rootOctaveScale = input.trim();\n const indexOfFirstSpace = rootOctaveScale.indexOf(\" \");\n let scaleOrChord;\n let rootOctave;\n if (indexOfFirstSpace === -1) {\n scaleOrChord = rootOctaveScale.slice(1);\n rootOctave = rootOctaveScale[0];\n if (rootOctaveScale[1] === \"b\" || rootOctaveScale[1] === \"#\") {\n scaleOrChord = rootOctaveScale.slice(2);\n rootOctave += rootOctaveScale[1];\n }\n } else {\n scaleOrChord = rootOctaveScale.slice(indexOfFirstSpace === -1 ? 1 : indexOfFirstSpace + 1);\n rootOctave = rootOctaveScale.slice(0, indexOfFirstSpace);\n }\n const root = sharpToFlat(rootOctave.replace(/\\d/g, \"\"));\n const octaveNumber = rootOctave.replace(/\\D/g, \"\");\n const octave = octaveNumber !== \"\" ? +rootOctave.replace(/\\D/g, \"\") : DEFAULT_OCTAVE;\n if (isNaN(octave)) {\n throw new Error(`${rootOctave[0]} does not have a valid octave`);\n }\n if (!scaleMap[scaleOrChord] && !chordMap[scaleOrChord]) {\n throw new Error(`${rootOctaveScale} is not a valid ${SCALE_OR_CHORD}`);\n }\n const chroma = getChromatic(root, octave);\n const acc = [];\n let p1 = 0, p2 = 0;\n const map = scale2 ? scaleMap : chordMap;\n while (p1 < map[scaleOrChord].length) {\n if (map[scaleOrChord][p1] === \"1\") {\n acc.push(chroma[p2]);\n }\n p1++;\n p2++;\n }\n return acc;\n}\nfunction inlineChord(rootChord_Oct) {\n const B9SUS = \"b9sus\";\n let root, chord2, octave = DEFAULT_OCTAVE;\n if (rootChord_Oct.includes(B9SUS)) {\n chord2 = B9SUS;\n root = rootChord_Oct.slice(0, rootChord_Oct.indexOf(B9SUS));\n } else {\n root = rootChord_Oct[0];\n chord2 = rootChord_Oct.slice(1);\n if (rootChord_Oct[1] === \"b\" || rootChord_Oct[1] === \"#\") {\n root += rootChord_Oct[1];\n chord2 = rootChord_Oct.slice(2);\n }\n }\n if (rootChord_Oct.includes(\"_\")) {\n octave = +rootChord_Oct.split(\"_\")[1];\n chord2 = chord2.slice(0, chord2.indexOf(\"_\"));\n }\n return _getNotesForScaleOrChord({ chord: root + octave + \" \" + chord2 });\n}\nfunction chords() {\n return Object.keys(chordMap);\n}\nfunction scales() {\n return Object.keys(scaleMap);\n}\nfunction chord(chord2) {\n return _getNotesForScaleOrChord({ chord: chord2 });\n}\nfunction scale(scale2) {\n return _getNotesForScaleOrChord({ scale: scale2 });\n}\nfunction getIndicesFromScale(scaleOrBitmap) {\n const str = scaleMap[scaleOrBitmap] || scaleOrBitmap;\n const intervals = [];\n for (let i = 0; i < str.length; i++) {\n if (str[i] === \"1\") {\n intervals.push(i);\n }\n }\n intervals.push(12);\n return intervals;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n chord,\n chords,\n getIndicesFromScale,\n inlineChord,\n scale,\n scales\n});\n","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.midi = 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 midi_1 = require(\"./midi\");\nObject.defineProperty(exports, \"midi\", { enumerable: true, get: function () { return midi_1.midi; } });\n__exportStar(require(\"./types\"), exports);\n","\"use strict\";\n// global LiveAPI:true\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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.midi = void 0;\nvar fs_1 = __importDefault(require(\"fs\"));\nvar jsmidgen = __importStar(require(\"jsmidgen\"));\n/**\n * Take an array of note objects to generate a MIDI file in the same location as this method is called\n * @param {NoteObject[]} notes Notes are in the format: {note: ['c3'], level: 127, length: 64}\n * @param {String | null} fileName If a filename is not provided, then `music.mid` is used by default\n * If `null` is passed for `fileName`, bytes are returned instead of creating a file\n * If this method is called from a browser then it will return a HTML link that you can append in your page\n * This link will enable the generated MIDI as a downloadable file.\n * @param {Number | null} bpm If a value is provided, the generated midi file will be set to this bpm value.\n */\nvar midi = function (notes, fileName, bpm) {\n if (fileName === void 0) { fileName = 'music.mid'; }\n var file = createFileFromNotes(notes, bpm);\n var bytes = file.toBytes();\n if (fileName === null) {\n return bytes;\n }\n if (!fileName.endsWith('.mid')) {\n fileName = fileName + '.mid';\n }\n if (typeof window !== 'undefined' &&\n window.URL &&\n window.URL.createObjectURL) {\n return createDownloadLink(bytes, fileName);\n }\n fs_1.default.writeFileSync(fileName, bytes, 'binary');\n console.log(\"MIDI file generated: \" + fileName + \".\");\n};\nexports.midi = midi;\n/**\n * Create a downloadable link\n * @param b\n */\nvar createDownloadLink = function (b, fileName) {\n // Convert bytes to array buffer\n // Accepted answer on https://stackoverflow.com/questions/35038884/download-file-from-bytes-in-javascript\n var bytes = new Uint8Array(b.length);\n for (var i = 0; i < b.length; i++) {\n var ascii = b.charCodeAt(i);\n bytes[i] = ascii;\n }\n // Create a Blob so that we can set it up with the type of file we want (for eg MIDI)\n var blob = new Blob([bytes], { type: 'audio/midi' });\n // Create a link element to be used (you can use an existing link on the page as well)\n var link = document.createElement('a');\n link.href =\n (typeof window !== 'undefined' &&\n typeof window.URL !== 'undefined' &&\n typeof window.URL.createObjectURL !== 'undefined' &&\n window.URL.createObjectURL(blob)) ||\n '';\n // Give the downloadable file a name\n link.download = fileName;\n link.innerText = 'Download MIDI file';\n return link;\n};\nvar createFileFromNotes = function (notes, bpm) {\n var file = new jsmidgen.File();\n var track = new jsmidgen.Track();\n // set the track's bpm if it is provided\n if (typeof bpm === 'number') {\n track.setTempo(bpm);\n }\n file.addTrack(track);\n for (var _i = 0, notes_1 = notes; _i < notes_1.length; _i++) {\n var noteObj = notes_1[_i];\n var level = noteObj.level || 127;\n // While writing chords (multiple notes per tick)\n // only the first noteOn (or noteOff) needs the complete arity of the function call\n // subsequent calls need only the first 2 args (channel and note)\n if (noteObj.note) {\n if (typeof noteObj.note === 'string') {\n track.noteOn(0, noteObj.note, noteObj.length, level); // channel, pitch(note), length, velocity\n track.noteOff(0, noteObj.note, noteObj.length, level);\n }\n else {\n track.addChord(0, noteObj.note, noteObj.length, level);\n }\n }\n else {\n track.noteOff(0, '', noteObj.length);\n }\n }\n return file;\n};\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","module.exports = require(\"fs\");","// 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__(772);\n"],"names":["mod","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","index_exports","target","all","name","get","enumerable","__export","chord","chords","getIndicesFromScale","inlineChord","scale","scales","module","exports","to","from","except","desc","key","call","__copyProps","value","sharpToFlatMap","CHROMATIC","scaleMap","ritusen","egyptian","pelog","kumoijoshi","hirajoshi","iwato","scriabin","augmented","piongio","prometheus","altered","lydian","locrian","ultralocrian","phrygian","balinese","aeolian","dorian","oriental","flamenco","mixolydian","persian","major","enigmatic","bebop","diminished","ichikosucho","chromatic","ionian","minor","Kanakangi","Ratnangi","Ganamurti","Vanaspati","Manavati","Tanarupi","Senavati","Hanumatodi","Dhenuka","Natakapriya","Kokilapriya","Rupavati","Gayakapriya","Vakulabharanam","Mayamalavagowla","Chakravakam","Suryakantam","Hatakambari","Jhankaradhwani","Natabhairavi","Keeravani","Kharaharapriya","Gourimanohari","Varunapriya","Mararanjani","Charukesi","Sarasangi","Harikambhoji","Dheerasankarabaranam","Naganandini","Yagapriya","Ragavardhini","Gangeyabhushani","Vagadheeswari","Shulini","Chalanata","Salagam","Jalarnavam","Jhalavarali","Navaneetam","Pavani","Raghupriya","Gavambhodi","Bhavapriya","Shubhapantuvarali","Shadvidamargini","Suvarnangi","Divyamani","Dhavalambari","Namanarayani","Kamavardhini","Ramapriya","Gamanashrama","Vishwambari","Shamalangi","Shanmukhapriya","Simhendramadhyamam","Hemavati","Dharmavati","Neetimati","Kantamani","Rishabhapriya","Latangi","Vachaspati","Mechakalyani","Chitrambari","Sucharitra","Dhatuvardani","Nasikabhushini","Kosalam","Rasikapriya","chordMap","sus4","M7sus4","aug","M7b6","M","maj7","Mb5","M7b5","mb6M7","m","m7","m6","mMaj7b6","dim","oM7","m7b5","dim7","o7M7","madd4","m7add11","sus2","sus24","M9sus4","Madd9","maj9","maj13","M7add13","M9b5","madd9","mM9","m9","m69","m13","mMaj9b6","m9b5","m11A","m11","b9sus","alt7","Maddb9","M7b9","mb6b9","_getNotesForScaleOrChord","scale2","chord2","input","SCALE_OR_CHORD","Error","rootOctaveScale","trim","indexOfFirstSpace","indexOf","scaleOrChord","rootOctave","slice","root","toUpperCase","charAt","sharpToFlat","replace","octave","isNaN","chroma","index","o1","map","n","o2","concat","getChromatic","acc","p1","p2","length","push","rootChord_Oct","B9SUS","includes","split","keys","scaleOrBitmap","str","intervals","i","Midi","exported","DEFAULT_VOLUME","Util","DEFAULT_DURATION","DEFAULT_CHANNEL","midi_letter_pitches","a","b","c","d","e","f","g","midiPitchFromNote","matches","exec","note","toLowerCase","accidental","parseInt","substr","ensureMidiPitch","p","test","midi_pitches_letter","midi_flattened_notes","noteFromMidiPitch","returnFlattened","noteName","noteNum","Math","floor","mpqnFromBpm","bpm","mpqn","ret","unshift","bpmFromMpqn","l","codes2Str","byteArray","String","fromCharCode","apply","str2Bytes","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","t","Array","isArray","dataBytes","x","charCodeAt","Track","config","events","START_BYTES","END_BYTES","addEvent","event","addNoteOn","noteOn","pitch","velocity","addNoteOff","noteOff","addNote","dur","addChord","forEach","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","__spreadArray","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","s","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","o","k","k2","__exportStar","midi","progression","getChordsByProgression","getChordDegrees","modes","mode","clip_1","progression_1","arp_1","midi_1","__setModuleDefault","v","__importStar","__esModule","result","__importDefault","fs_1","jsmidgen","fileName","createFileFromNotes","endsWith","window","URL","createObjectURL","createDownloadLink","default","writeFileSync","console","log","Uint8Array","ascii","blob","Blob","link","document","createElement","href","download","innerText","file","notes_1","noteObj","theRomans","idxByDegree","ii","iii","iv","vi","vii","noteOctaveScale","chordDegress","noteOctaveScaleArr","roman","chordName","prefix","getChordName","scaleId","getProgFactory","T","P","D","pickOne","dice","scaleType","convertChordToNotes","flat","sizzleMap","isNote","JSON","stringify","parse","fullShuffle","lastIndex","rnd","random","maxLevel","pi","piArr","piArrRev","reverse","element","sin","reduce","val","c1","c2","e1","e2","n1","num","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","id","loaded","__webpack_modules__","nmd","paths","children","__webpack_exports__"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"iCACA,IAgBoBA,EAhBhBC,EAAYC,OAAOC,eACnBC,EAAmBF,OAAOG,yBAC1BC,EAAoBJ,OAAOK,oBAC3BC,EAAeN,OAAOO,UAAUC,eAgBhCC,EAAgB,CAAC,EAfN,EAACC,EAAQC,KACtB,IAAK,IAAIC,KAAQD,EACfZ,EAAUW,EAAQE,EAAM,CAAEC,IAAKF,EAAIC,GAAOE,YAAY,KAc1DC,CAASN,EAAe,CACtBO,MAAO,IAAMA,EACbC,OAAQ,IAAMA,EACdC,oBAAqB,IAAMA,EAC3BC,YAAa,IAAMA,EACnBC,MAAO,IAAMA,EACbC,OAAQ,IAAMA,IAEhBC,EAAOC,SAZazB,EAYUW,EApBZ,EAACe,EAAIC,EAAMC,EAAQC,KACnC,GAAIF,GAAwB,iBAATA,GAAqC,mBAATA,EAC7C,IAAK,IAAIG,KAAOxB,EAAkBqB,GAC3BnB,EAAauB,KAAKL,EAAII,SAKLE,IALaF,GACjC7B,EAAUyB,EAAII,EAAK,CAAEf,IAAK,IAAMY,EAAKG,GAAMd,aAAca,EAAOzB,EAAiBuB,EAAMG,KAASD,EAAKb,aAE3G,OAAOU,GAEmBM,CAAY/B,EAAU,CAAC,EAAG,aAAc,CAAEgC,OAAO,IAASjC,IAetF,IA0RIkC,EAAiB,CACnB,KAAM,KACN,KAAM,KACN,KAAM,KACN,KAAM,KACN,KAAM,KACN,GAAM,IACN,GAAM,IACN,KAAM,IACN,KAAM,KAKJC,EAAY,CACd,IACA,KACA,IACA,KACA,IACA,IACA,KACA,IACA,KACA,IACA,KACA,KAYEC,EAhUoB,CACtB,mBAAoB,eACpB,oBAAqB,eACrB,wBAAyB,eACzBC,QAAS,eACTC,SAAU,eACV,8BAA+B,eAC/B,eAAgB,eAChBC,MAAO,eACPC,WAAY,eACZC,UAAW,eACXC,MAAO,eACP,SAAU,eACV,oBAAqB,eACrB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AID,EAASwgB,EAAyBG,GAAY,CAGjD1gB,QAAS,CAAC,GAOX,OAHA4gB,EAAoBF,GAAUpgB,KAAKP,EAAOC,QAASD,EAAQA,EAAOC,QAASygB,GAGpE1gB,EAAOC,OACf,CCnB0BygB,CAAoB,K","sources":["webpack://scribbletune/./node_modules/harmonics/dist/index.js","webpack://scribbletune/./src/arp.ts","webpack://scribbletune/./src/clip.ts","webpack://scribbletune/./src/index.ts","webpack://scribbletune/./src/midi.ts","webpack://scribbletune/./src/progression.ts","webpack://scribbletune/./src/types/index.ts","webpack://scribbletune/./src/utils.ts","webpack://scribbletune/external commonjs \"fs\"","webpack://scribbletune/./node_modules/@scribbletune/midi/dist/index.cjs","webpack://scribbletune/webpack/bootstrap","webpack://scribbletune/webpack/startup"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/index.ts\nvar index_exports = {};\n__export(index_exports, {\n chord: () => chord,\n chords: () => chords,\n getIndicesFromScale: () => getIndicesFromScale,\n inlineChord: () => inlineChord,\n scale: () => scale,\n scales: () => scales\n});\nmodule.exports = __toCommonJS(index_exports);\n\n// src/gen/scaleMaps.json\nvar scaleMaps_default = {\n \"major pentatonic\": \"101010010100\",\n \"ionian pentatonic\": \"100011010001\",\n \"mixolydian pentatonic\": \"100011010010\",\n ritusen: \"101001010100\",\n egyptian: \"101001010010\",\n \"neopolitan major pentatonic\": \"100011100010\",\n \"vietnamese 1\": \"100101011000\",\n pelog: \"110100011000\",\n kumoijoshi: \"110001011000\",\n hirajoshi: \"101100011000\",\n iwato: \"110001100010\",\n \"in-sen\": \"110001010010\",\n \"lydian pentatonic\": \"100010110001\",\n \"malkos raga\": \"100101001010\",\n \"locrian pentatonic\": \"100101100010\",\n \"minor pentatonic\": \"100101010010\",\n \"minor six pentatonic\": \"100101010100\",\n \"flat three pentatonic\": \"101100010100\",\n \"flat six pentatonic\": \"101010011000\",\n scriabin: \"110010010100\",\n \"whole tone pentatonic\": \"100010101010\",\n \"lydian #5P pentatonic\": \"100010101001\",\n \"lydian dominant pentatonic\": \"100010110010\",\n \"minor #7M pentatonic\": \"100101010001\",\n \"super locrian pentatonic\": \"100110100010\",\n \"minor hexatonic\": \"101101010001\",\n augmented: \"100110011001\",\n \"major blues\": \"101110010100\",\n piongio: \"101001010110\",\n \"prometheus neopolitan\": \"110010100110\",\n prometheus: \"101010100110\",\n \"mystery #1\": \"110010101010\",\n \"six tone symmetric\": \"110011001100\",\n \"whole tone\": \"101010101010\",\n \"messiaen's mode #5\": \"110001110001\",\n \"minor blues\": \"100101110010\",\n \"locrian major\": \"101011101010\",\n \"double harmonic lydian\": \"110010111001\",\n \"harmonic minor\": \"101101011001\",\n altered: \"110110101010\",\n \"locrian #2\": \"101101101010\",\n \"mixolydian b6\": \"101011011010\",\n \"lydian dominant\": \"101010110110\",\n lydian: \"101010110101\",\n \"lydian augmented\": \"101010101101\",\n \"dorian b2\": \"110101010110\",\n \"melodic minor\": \"101101010101\",\n locrian: \"110101101010\",\n ultralocrian: \"110110101100\",\n \"locrian 6\": \"110101100110\",\n \"augmented heptatonic\": \"100111011001\",\n \"romanian minor\": \"101100110110\",\n \"dorian #4\": \"101100110110\",\n \"lydian diminished\": \"101100110101\",\n phrygian: \"110101011010\",\n \"leading whole tone\": \"101010101011\",\n \"lydian minor\": \"101010111010\",\n \"phrygian dominant\": \"110011011010\",\n balinese: \"110101011001\",\n \"neopolitan major\": \"110101010101\",\n aeolian: \"101101011010\",\n \"harmonic major\": \"101011011001\",\n \"double harmonic major\": \"110011011001\",\n dorian: \"101101010110\",\n \"hungarian minor\": \"101100111001\",\n \"hungarian major\": \"100110110110\",\n oriental: \"110011100110\",\n flamenco: \"110110110010\",\n \"todi raga\": \"110100111001\",\n mixolydian: \"101011010110\",\n persian: \"110011101001\",\n major: \"101011010101\",\n enigmatic: \"110010101011\",\n \"major augmented\": \"101011001101\",\n \"lydian #9\": \"100110110101\",\n \"messiaen's mode #4\": \"111001111001\",\n \"purvi raga\": \"110011111001\",\n \"spanish heptatonic\": \"110111011010\",\n bebop: \"101011010111\",\n \"bebop minor\": \"101111010110\",\n \"bebop major\": \"101011011101\",\n \"bebop locrian\": \"110101111010\",\n \"minor bebop\": \"101101011011\",\n diminished: \"101101101101\",\n ichikosucho: \"101011110101\",\n \"minor six diminished\": \"101101011101\",\n \"half-whole diminished\": \"110110110110\",\n \"kafi raga\": \"100111010111\",\n \"messiaen's mode #6\": \"101011101011\",\n \"composite blues\": \"101111110110\",\n \"messiaen's mode #3\": \"101110111011\",\n \"messiaen's mode #7\": \"111101111101\",\n chromatic: \"111111111111\",\n ionian: \"101011010101\",\n minor: \"101101011010\",\n Kanakangi: \"111001011100\",\n Ratnangi: \"111001011010\",\n Ganamurti: \"111001011001\",\n Vanaspati: \"111001010110\",\n Manavati: \"111001010101\",\n Tanarupi: \"111001010011\",\n Senavati: \"110101011100\",\n Hanumatodi: \"110101011010\",\n Dhenuka: \"110101011001\",\n Natakapriya: \"110101010110\",\n Kokilapriya: \"110101010101\",\n Rupavati: \"110101010011\",\n Gayakapriya: \"110011011100\",\n Vakulabharanam: \"110011011010\",\n Mayamalavagowla: \"110011011001\",\n Chakravakam: \"110011010110\",\n Suryakantam: \"110011010101\",\n Hatakambari: \"110011010011\",\n Jhankaradhwani: \"101101011100\",\n Natabhairavi: \"101101011010\",\n Keeravani: \"101101011001\",\n Kharaharapriya: \"101101010110\",\n Gourimanohari: \"101101010101\",\n Varunapriya: \"101101010011\",\n Mararanjani: \"101011011100\",\n Charukesi: \"101011011010\",\n Sarasangi: \"101011011001\",\n Harikambhoji: \"101011010110\",\n Dheerasankarabaranam: \"101011010101\",\n Naganandini: \"101011010011\",\n Yagapriya: \"100111011100\",\n Ragavardhini: \"100111011010\",\n Gangeyabhushani: \"100111011001\",\n Vagadheeswari: \"100111010110\",\n Shulini: \"100111010101\",\n Chalanata: \"100111010011\",\n Salagam: \"111000111100\",\n Jalarnavam: \"111000111010\",\n Jhalavarali: \"111000111001\",\n Navaneetam: \"111000110110\",\n Pavani: \"111000110101\",\n Raghupriya: \"111000110011\",\n Gavambhodi: \"110100111100\",\n Bhavapriya: \"110100111010\",\n Shubhapantuvarali: \"110100111001\",\n Shadvidamargini: \"110100110110\",\n Suvarnangi: \"110100110101\",\n Divyamani: \"110100110011\",\n Dhavalambari: \"110010111100\",\n Namanarayani: \"110010111010\",\n Kamavardhini: \"110010111001\",\n Ramapriya: \"110010110110\",\n Gamanashrama: \"110010110101\",\n Vishwambari: \"110010110011\",\n Shamalangi: \"101100111100\",\n Shanmukhapriya: \"101100111010\",\n Simhendramadhyamam: \"101100111001\",\n Hemavati: \"101100110110\",\n Dharmavati: \"101100110101\",\n Neetimati: \"101100110011\",\n Kantamani: \"101010111100\",\n Rishabhapriya: \"101010111010\",\n Latangi: \"101010111001\",\n Vachaspati: \"101010110110\",\n Mechakalyani: \"101010110101\",\n Chitrambari: \"101010110011\",\n Sucharitra: \"100110111100\",\n \"Jyoti swarupini\": \"100110111010\",\n Dhatuvardani: \"100110111001\",\n Nasikabhushini: \"100110110110\",\n Kosalam: \"100110110101\",\n Rasikapriya: \"100110110011\"\n};\n\n// src/gen/chordMaps.json\nvar chordMaps_default = {\n \"5th\": \"100000010000\",\n \"M7#5sus4\": \"100001001001\",\n \"7#5sus4\": \"100001001010\",\n sus4: \"100001010000\",\n M7sus4: \"100001010001\",\n \"7sus4\": \"100001010010\",\n \"7no5\": \"100010000010\",\n aug: \"100010001000\",\n M7b6: \"100010001001\",\n \"maj7#5\": \"100010001001\",\n \"7#5\": \"100010001010\",\n \"7b13\": \"100010001010\",\n M: \"100010010000\",\n maj7: \"100010010001\",\n \"7th\": \"100010010010\",\n \"6th\": \"100010010100\",\n \"7add6\": \"100010010110\",\n \"7b6\": \"100010011010\",\n Mb5: \"100010100000\",\n M7b5: \"100010100001\",\n \"7b5\": \"100010100010\",\n \"maj#4\": \"100010110001\",\n \"7#11\": \"100010110010\",\n \"M6#11\": \"100010110100\",\n \"7#11b13\": \"100010111010\",\n \"m#5\": \"100100001000\",\n mb6M7: \"100100001001\",\n \"m7#5\": \"100100001010\",\n m: \"100100010000\",\n \"m/ma7\": \"100100010001\",\n m7: \"100100010010\",\n m6: \"100100010100\",\n mMaj7b6: \"100100011001\",\n dim: \"100100100000\",\n oM7: \"100100100001\",\n m7b5: \"100100100010\",\n dim7: \"100100100100\",\n o7M7: \"100100100101\",\n \"4th\": \"100101000010\",\n madd4: \"100101010000\",\n m7add11: \"100101010010\",\n \"+add#9\": \"100110001000\",\n \"7#5#9\": \"100110001010\",\n \"7#9\": \"100110010010\",\n \"13#9\": \"100110010110\",\n \"7#9b13\": \"100110011010\",\n \"maj7#9#11\": \"100110110001\",\n \"7#9#11\": \"100110110010\",\n \"13#9#11\": \"100110110110\",\n \"7#9#11b13\": \"100110111010\",\n sus2: \"101000010000\",\n \"M9#5sus4\": \"101001001001\",\n sus24: \"101001010000\",\n M9sus4: \"101001010001\",\n \"11th\": \"101001010010\",\n \"9sus4\": \"101001010010\",\n \"13sus4\": \"101001010110\",\n \"9no5\": \"101010000010\",\n \"13no5\": \"101010000110\",\n \"M#5add9\": \"101010001000\",\n \"maj9#5\": \"101010001001\",\n \"9#5\": \"101010001010\",\n \"9b13\": \"101010001010\",\n Madd9: \"101010010000\",\n maj9: \"101010010001\",\n \"9th\": \"101010010010\",\n \"6/9\": \"101010010100\",\n maj13: \"101010010101\",\n M7add13: \"101010010101\",\n \"13th\": \"101010010110\",\n M9b5: \"101010100001\",\n \"9b5\": \"101010100010\",\n \"13b5\": \"101010100110\",\n \"9#5#11\": \"101010101010\",\n \"maj9#11\": \"101010110001\",\n \"9#11\": \"101010110010\",\n \"69#11\": \"101010110100\",\n \"M13#11\": \"101010110101\",\n \"13#11\": \"101010110110\",\n \"9#11b13\": \"101010111010\",\n \"m9#5\": \"101100001010\",\n madd9: \"101100010000\",\n mM9: \"101100010001\",\n m9: \"101100010010\",\n m69: \"101100010100\",\n m13: \"101100010110\",\n mMaj9b6: \"101100011001\",\n m9b5: \"101100100010\",\n m11A: \"101101001010\",\n m11: \"101101010010\",\n b9sus: \"110001010010\",\n \"11b9\": \"110001010010\",\n \"7sus4b9b13\": \"110001011010\",\n alt7: \"110010000010\",\n \"7#5b9\": \"110010001010\",\n Maddb9: \"110010010000\",\n M7b9: \"110010010001\",\n \"7b9\": \"110010010010\",\n \"13b9\": \"110010010110\",\n \"7b9b13\": \"110010011010\",\n \"7#5b9#11\": \"110010101010\",\n \"7b9#11\": \"110010110010\",\n \"13b9#11\": \"110010110110\",\n \"7b9b13#11\": \"110010111010\",\n mb6b9: \"110100001000\",\n \"7b9#9\": \"110110010010\"\n};\n\n// src/scalesAndChords.ts\nvar DEFAULT_OCTAVE = 4;\nvar sharpToFlatMap = {\n \"C#\": \"Db\",\n \"D#\": \"Eb\",\n \"F#\": \"Gb\",\n \"G#\": \"Ab\",\n \"A#\": \"Bb\",\n \"CB\": \"B\",\n \"FB\": \"E\",\n \"E#\": \"F\",\n \"B#\": \"C\"\n};\nfunction sharpToFlat(root) {\n return sharpToFlatMap[root.toUpperCase()] || root.charAt(0).toUpperCase() + root.slice(1);\n}\nvar CHROMATIC = [\n \"C\",\n \"Db\",\n \"D\",\n \"Eb\",\n \"E\",\n \"F\",\n \"Gb\",\n \"G\",\n \"Ab\",\n \"A\",\n \"Bb\",\n \"B\"\n];\nfunction getChromatic(root, octave) {\n const index = CHROMATIC.indexOf(root);\n if (index === -1) {\n throw new Error(`${root} is not a valid root note`);\n }\n const o1 = CHROMATIC.map((n) => n + octave);\n const o2 = CHROMATIC.map((n) => n + (octave + 1));\n const c = o1.concat(o2);\n return c.slice(index);\n}\nvar scaleMap = scaleMaps_default;\nvar chordMap = chordMaps_default;\nfunction _getNotesForScaleOrChord({ scale: scale2, chord: chord2 }) {\n const input = scale2 || chord2;\n const SCALE_OR_CHORD = scale2 ? \"scale\" : \"chord\";\n if (typeof input !== \"string\") {\n throw new Error(`${input} is not a valid input for ${SCALE_OR_CHORD}`);\n }\n const rootOctaveScale = input.trim();\n const indexOfFirstSpace = rootOctaveScale.indexOf(\" \");\n let scaleOrChord;\n let rootOctave;\n if (indexOfFirstSpace === -1) {\n scaleOrChord = rootOctaveScale.slice(1);\n rootOctave = rootOctaveScale[0];\n if (rootOctaveScale[1] === \"b\" || rootOctaveScale[1] === \"#\") {\n scaleOrChord = rootOctaveScale.slice(2);\n rootOctave += rootOctaveScale[1];\n }\n } else {\n scaleOrChord = rootOctaveScale.slice(indexOfFirstSpace === -1 ? 1 : indexOfFirstSpace + 1);\n rootOctave = rootOctaveScale.slice(0, indexOfFirstSpace);\n }\n const root = sharpToFlat(rootOctave.replace(/\\d/g, \"\"));\n const octaveNumber = rootOctave.replace(/\\D/g, \"\");\n const octave = octaveNumber !== \"\" ? +rootOctave.replace(/\\D/g, \"\") : DEFAULT_OCTAVE;\n if (isNaN(octave)) {\n throw new Error(`${rootOctave[0]} does not have a valid octave`);\n }\n if (!scaleMap[scaleOrChord] && !chordMap[scaleOrChord]) {\n throw new Error(`${rootOctaveScale} is not a valid ${SCALE_OR_CHORD}`);\n }\n const chroma = getChromatic(root, octave);\n const acc = [];\n let p1 = 0, p2 = 0;\n const map = scale2 ? scaleMap : chordMap;\n while (p1 < map[scaleOrChord].length) {\n if (map[scaleOrChord][p1] === \"1\") {\n acc.push(chroma[p2]);\n }\n p1++;\n p2++;\n }\n return acc;\n}\nfunction inlineChord(rootChord_Oct) {\n const B9SUS = \"b9sus\";\n let root, chord2, octave = DEFAULT_OCTAVE;\n if (rootChord_Oct.includes(B9SUS)) {\n chord2 = B9SUS;\n root = rootChord_Oct.slice(0, rootChord_Oct.indexOf(B9SUS));\n } else {\n root = rootChord_Oct[0];\n chord2 = rootChord_Oct.slice(1);\n if (rootChord_Oct[1] === \"b\" || rootChord_Oct[1] === \"#\") {\n root += rootChord_Oct[1];\n chord2 = rootChord_Oct.slice(2);\n }\n }\n if (rootChord_Oct.includes(\"_\")) {\n octave = +rootChord_Oct.split(\"_\")[1];\n chord2 = chord2.slice(0, chord2.indexOf(\"_\"));\n }\n return _getNotesForScaleOrChord({ chord: root + octave + \" \" + chord2 });\n}\nfunction chords() {\n return Object.keys(chordMap);\n}\nfunction scales() {\n return Object.keys(scaleMap);\n}\nfunction chord(chord2) {\n return _getNotesForScaleOrChord({ chord: chord2 });\n}\nfunction scale(scale2) {\n return _getNotesForScaleOrChord({ scale: scale2 });\n}\nfunction getIndicesFromScale(scaleOrBitmap) {\n const str = scaleMap[scaleOrBitmap] || scaleOrBitmap;\n const intervals = [];\n for (let i = 0; i < str.length; i++) {\n if (str[i] === \"1\") {\n intervals.push(i);\n }\n }\n intervals.push(12);\n return intervals;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n chord,\n chords,\n getIndicesFromScale,\n inlineChord,\n scale,\n scales\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 \".concat(i + 1, \" \\\"\").concat(c, \"\\\" in given \\\"\").concat(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(\"\".concat((0, utils_1.errorHasMessage)(e) ? e.message : e, \" in chord \").concat(i + 1, \" \\\"\").concat(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 \".concat(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 var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\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.midi = 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 midi_1 = require(\"./midi\");\nObject.defineProperty(exports, \"midi\", { enumerable: true, get: function () { return midi_1.midi; } });\n__exportStar(require(\"./types\"), exports);\n","\"use strict\";\n// global LiveAPI:true\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.midi = void 0;\nvar fs_1 = __importDefault(require(\"fs\"));\nvar midi_1 = require(\"@scribbletune/midi\");\n/**\n * Take an array of note objects to generate a MIDI file in the same location as this method is called\n * @param {NoteObject[]} notes Notes are in the format: {note: ['c3'], level: 127, length: 64}\n * @param {String | null} fileName If a filename is not provided, then `music.mid` is used by default\n * If `null` is passed for `fileName`, bytes are returned instead of creating a file\n * If this method is called from a browser then it will return a HTML link that you can append in your page\n * This link will enable the generated MIDI as a downloadable file.\n * @param {Number | null} bpm If a value is provided, the generated midi file will be set to this bpm value.\n */\nvar midi = function (notes, fileName, bpm) {\n if (fileName === void 0) { fileName = 'music.mid'; }\n var file = createFileFromNotes(notes, bpm);\n var bytes = file.toBytes();\n if (fileName === null) {\n return bytes;\n }\n if (!fileName.endsWith('.mid')) {\n fileName = fileName + '.mid';\n }\n if (typeof window !== 'undefined' &&\n window.URL &&\n typeof window.URL.createObjectURL === 'function') {\n return createDownloadLink(bytes, fileName);\n }\n fs_1.default.writeFileSync(fileName, bytes, 'binary');\n console.log(\"MIDI file generated: \".concat(fileName, \".\"));\n};\nexports.midi = midi;\n/**\n * Create a downloadable link\n * @param b\n */\nvar createDownloadLink = function (b, fileName) {\n // Convert bytes to array buffer\n // Accepted answer on https://stackoverflow.com/questions/35038884/download-file-from-bytes-in-javascript\n var bytes = new Uint8Array(b.length);\n for (var i = 0; i < b.length; i++) {\n var ascii = b.charCodeAt(i);\n bytes[i] = ascii;\n }\n // Create a Blob so that we can set it up with the type of file we want (for eg MIDI)\n var blob = new Blob([bytes], { type: 'audio/midi' });\n // Create a link element to be used (you can use an existing link on the page as well)\n var link = document.createElement('a');\n link.href =\n (typeof window !== 'undefined' &&\n typeof window.URL !== 'undefined' &&\n typeof window.URL.createObjectURL !== 'undefined' &&\n window.URL.createObjectURL(blob)) ||\n '';\n // Give the downloadable file a name\n link.download = fileName;\n link.innerText = 'Download MIDI file';\n return link;\n};\nvar createFileFromNotes = function (notes, bpm) {\n var file = new midi_1.File();\n var track = new midi_1.Track();\n // set the track's bpm if it is provided\n if (typeof bpm === 'number') {\n track.setTempo(bpm);\n }\n file.addTrack(track);\n for (var _i = 0, notes_1 = notes; _i < notes_1.length; _i++) {\n var noteObj = notes_1[_i];\n var level = noteObj.level || 127;\n // While writing chords (multiple notes per tick)\n // only the first noteOn (or noteOff) needs the complete arity of the function call\n // subsequent calls need only the first 2 args (channel and note)\n if (noteObj.note) {\n if (typeof noteObj.note === 'string') {\n track.noteOn(0, noteObj.note, noteObj.length, level); // channel, pitch(note), length, velocity\n track.noteOff(0, noteObj.note, noteObj.length, level);\n }\n else {\n track.addChord(0, noteObj.note, noteObj.length, level);\n }\n }\n else {\n track.noteOff(0, '', noteObj.length);\n }\n }\n return file;\n};\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 \".concat(el, \" cannot decode, guessing \").concat(c1, \" or \").concat(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 \".concat(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","module.exports = require(\"fs\");","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n// src/util.ts\nvar midi_letter_pitches = {\n a: 21,\n b: 23,\n c: 12,\n d: 14,\n e: 16,\n f: 17,\n g: 19\n};\nvar midi_pitches_letter = {\n \"12\": \"c\",\n \"13\": \"c#\",\n \"14\": \"d\",\n \"15\": \"d#\",\n \"16\": \"e\",\n \"17\": \"f\",\n \"18\": \"f#\",\n \"19\": \"g\",\n \"20\": \"g#\",\n \"21\": \"a\",\n \"22\": \"a#\",\n \"23\": \"b\"\n};\nvar midi_flattened_notes = {\n \"a#\": \"bb\",\n \"c#\": \"db\",\n \"d#\": \"eb\",\n \"f#\": \"gb\",\n \"g#\": \"ab\"\n};\nfunction midiPitchFromNote(n) {\n const matches = /([a-g])(#+|b+)?([0-9]+)$/i.exec(n);\n if (!matches) {\n throw new Error(`Invalid note name: ${n}`);\n }\n const note = matches[1].toLowerCase();\n const accidental = matches[2] || \"\";\n const octave = parseInt(matches[3], 10);\n return 12 * octave + midi_letter_pitches[note] + (accidental.substring(0, 1) === \"#\" ? 1 : -1) * accidental.length;\n}\nfunction ensureMidiPitch(p) {\n if (typeof p === \"number\" || !/[^0-9]/.test(p)) {\n return parseInt(String(p), 10);\n }\n return midiPitchFromNote(p);\n}\nfunction noteFromMidiPitch(n, returnFlattened) {\n let octave = 0;\n let noteNum = n;\n if (n > 23) {\n octave = Math.floor(n / 12) - 1;\n noteNum = n - octave * 12;\n }\n let noteName = midi_pitches_letter[String(noteNum)];\n if (!noteName) {\n throw new Error(`Invalid MIDI pitch: ${n}`);\n }\n if (returnFlattened && noteName.indexOf(\"#\") > 0) {\n noteName = midi_flattened_notes[noteName];\n }\n return noteName + octave;\n}\nfunction mpqnFromBpm(bpm) {\n let mpqn = Math.floor(6e7 / bpm);\n const ret = [];\n do {\n ret.unshift(mpqn & 255);\n mpqn >>= 8;\n } while (mpqn);\n while (ret.length < 3) {\n ret.push(0);\n }\n return ret;\n}\nfunction bpmFromMpqn(mpqn) {\n let m;\n if (Array.isArray(mpqn)) {\n m = 0;\n for (let i = 0, l = mpqn.length - 1; l >= 0; ++i, --l) {\n m |= mpqn[i] << l * 8;\n }\n } else {\n m = mpqn;\n }\n return Math.floor(6e7 / m);\n}\nfunction codes2Str(byteArray) {\n return String.fromCharCode(...byteArray);\n}\nfunction str2Bytes(str, finalBytes) {\n let s = str;\n if (finalBytes) {\n while (s.length / 2 < finalBytes) {\n s = \"0\" + s;\n }\n }\n const bytes = [];\n for (let i = s.length - 1; i >= 0; i = i - 2) {\n const chars = i === 0 ? s[i] : s[i - 1] + s[i];\n bytes.unshift(parseInt(chars, 16));\n }\n return bytes;\n}\nfunction translateTickTime(ticks) {\n let buffer = ticks & 127;\n let t = ticks >> 7;\n while (t) {\n buffer <<= 8;\n buffer |= t & 127 | 128;\n t = t >> 7;\n }\n const bList = [];\n while (true) {\n bList.push(buffer & 255);\n if (buffer & 128) {\n buffer >>= 8;\n } else {\n break;\n }\n }\n return bList;\n}\nvar Util = {\n midi_letter_pitches,\n midi_pitches_letter,\n midi_flattened_notes,\n midiPitchFromNote,\n ensureMidiPitch,\n noteFromMidiPitch,\n mpqnFromBpm,\n bpmFromMpqn,\n codes2Str,\n str2Bytes,\n translateTickTime\n};\n\n// src/types.ts\nvar MidiEventType = {\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};\nvar MetaEventType = {\n SEQUENCE: 0,\n TEXT: 1,\n COPYRIGHT: 2,\n TRACK_NAME: 3,\n INSTRUMENT: 4,\n LYRIC: 5,\n MARKER: 6,\n CUE_POINT: 7,\n CHANNEL_PREFIX: 32,\n END_OF_TRACK: 47,\n TEMPO: 81,\n SMPTE: 84,\n TIME_SIG: 88,\n KEY_SIG: 89,\n SEQ_EVENT: 127\n};\n\n// src/event.ts\nvar MidiEvent = class _MidiEvent {\n static NOTE_OFF = MidiEventType.NOTE_OFF;\n static NOTE_ON = MidiEventType.NOTE_ON;\n static AFTER_TOUCH = MidiEventType.AFTER_TOUCH;\n static CONTROLLER = MidiEventType.CONTROLLER;\n static PROGRAM_CHANGE = MidiEventType.PROGRAM_CHANGE;\n static CHANNEL_AFTERTOUCH = MidiEventType.CHANNEL_AFTERTOUCH;\n static PITCH_BEND = MidiEventType.PITCH_BEND;\n time;\n type;\n channel;\n param1;\n param2;\n constructor(params) {\n this.setTime(params.time);\n this.setType(params.type);\n this.setChannel(params.channel);\n this.setParam1(params.param1);\n if (params.param2 !== void 0) {\n this.setParam2(params.param2);\n }\n }\n setTime(ticks) {\n this.time = translateTickTime(ticks || 0);\n }\n setType(type) {\n if (type < _MidiEvent.NOTE_OFF || type > _MidiEvent.PITCH_BEND) {\n throw new Error(\"Trying to set an unknown event: \" + type);\n }\n this.type = type;\n }\n setChannel(channel) {\n if (channel < 0 || channel > 15) {\n throw new Error(\"Channel is out of bounds.\");\n }\n this.channel = channel;\n }\n setParam1(p) {\n this.param1 = p;\n }\n setParam2(p) {\n this.param2 = p;\n }\n toBytes() {\n const byteArray = [];\n const typeChannelByte = this.type | this.channel & 15;\n byteArray.push(...this.time);\n byteArray.push(typeChannelByte);\n byteArray.push(this.param1);\n if (this.param2 !== void 0 && this.param2 !== null) {\n byteArray.push(this.param2);\n }\n return byteArray;\n }\n};\n\n// src/meta-event.ts\nvar MetaEvent = class {\n static SEQUENCE = MetaEventType.SEQUENCE;\n static TEXT = MetaEventType.TEXT;\n static COPYRIGHT = MetaEventType.COPYRIGHT;\n static TRACK_NAME = MetaEventType.TRACK_NAME;\n static INSTRUMENT = MetaEventType.INSTRUMENT;\n static LYRIC = MetaEventType.LYRIC;\n static MARKER = MetaEventType.MARKER;\n static CUE_POINT = MetaEventType.CUE_POINT;\n static CHANNEL_PREFIX = MetaEventType.CHANNEL_PREFIX;\n static END_OF_TRACK = MetaEventType.END_OF_TRACK;\n static TEMPO = MetaEventType.TEMPO;\n static SMPTE = MetaEventType.SMPTE;\n static TIME_SIG = MetaEventType.TIME_SIG;\n static KEY_SIG = MetaEventType.KEY_SIG;\n static SEQ_EVENT = MetaEventType.SEQ_EVENT;\n time;\n type;\n data;\n constructor(params) {\n this.time = translateTickTime(0);\n this.type = 0;\n this.setTime(params.time);\n this.setType(params.type);\n this.setData(params.data);\n }\n setTime(ticks) {\n this.time = translateTickTime(ticks || 0);\n }\n setType(t) {\n this.type = t;\n }\n setData(d) {\n this.data = d;\n }\n toBytes() {\n if (!this.type) {\n throw new Error(\"Type for meta-event not specified.\");\n }\n const byteArray = [];\n byteArray.push(...this.time);\n byteArray.push(255, this.type);\n if (Array.isArray(this.data)) {\n byteArray.push(this.data.length);\n byteArray.push(...this.data);\n } else if (typeof this.data === \"number\") {\n byteArray.push(1, this.data);\n } else if (this.data !== null && this.data !== void 0) {\n byteArray.push(this.data.length);\n const dataBytes = this.data.split(\"\").map((x) => x.charCodeAt(0));\n byteArray.push(...dataBytes);\n } else {\n byteArray.push(0);\n }\n return byteArray;\n }\n};\n\n// src/constants.ts\nvar DEFAULT_VOLUME = 90;\nvar DEFAULT_DURATION = 128;\nvar DEFAULT_CHANNEL = 0;\n\n// src/track.ts\nvar Track = class _Track {\n static START_BYTES = [77, 84, 114, 107];\n static END_BYTES = [0, 255, 47, 0];\n events;\n constructor(config) {\n this.events = config?.events ?? [];\n }\n addEvent(event) {\n this.events.push(event);\n return this;\n }\n addNoteOn(channel, pitch, time, velocity) {\n this.events.push(\n new MidiEvent({\n type: MidiEvent.NOTE_ON,\n channel,\n param1: ensureMidiPitch(pitch),\n param2: velocity || DEFAULT_VOLUME,\n time: time || 0\n })\n );\n return this;\n }\n addNoteOff(channel, pitch, time, velocity) {\n this.events.push(\n new MidiEvent({\n type: MidiEvent.NOTE_OFF,\n channel,\n param1: ensureMidiPitch(pitch),\n param2: velocity || DEFAULT_VOLUME,\n time: time || 0\n })\n );\n return this;\n }\n addNote(channel, pitch, dur, time, velocity) {\n this.addNoteOn(channel, pitch, time, velocity);\n if (dur) {\n this.addNoteOff(channel, pitch, dur, velocity);\n }\n return this;\n }\n addChord(channel, chord, dur, velocity) {\n if (!Array.isArray(chord) || chord.length === 0) {\n throw new Error(\"Chord must be a non-empty array of pitches\");\n }\n chord.forEach((note) => {\n this.addNoteOn(channel, note, 0, velocity);\n });\n chord.forEach((note, index) => {\n if (index === 0) {\n this.addNoteOff(channel, note, dur);\n } else {\n this.addNoteOff(channel, note);\n }\n });\n return this;\n }\n setInstrument(channel, instrument, time) {\n this.events.push(\n new MidiEvent({\n type: MidiEvent.PROGRAM_CHANGE,\n channel,\n param1: instrument,\n time: time || 0\n })\n );\n return this;\n }\n setTempo(bpm, time) {\n this.events.push(\n new MetaEvent({\n type: MetaEvent.TEMPO,\n data: mpqnFromBpm(bpm),\n time: time || 0\n })\n );\n return this;\n }\n setTimeSignature(numerator, denominator, time) {\n const ddlog2 = Math.log2(denominator);\n if (ddlog2 !== Math.floor(ddlog2)) {\n throw new Error(\n \"Time signature denominator must be an exact power of 2!\"\n );\n }\n this.events.push(\n new MetaEvent({\n type: MetaEvent.TIME_SIG,\n data: [numerator & 255, Math.floor(ddlog2) & 255, 24, 8],\n time: time || 0\n })\n );\n return this;\n }\n setKeySignature(accidentals, minor, time) {\n this.events.push(\n new MetaEvent({\n type: MetaEvent.KEY_SIG,\n data: [accidentals & 255, minor ? 1 : 0],\n time: time || 0\n })\n );\n return this;\n }\n toBytes() {\n let trackLength = 0;\n const eventBytes = [];\n const startBytes = _Track.START_BYTES;\n const endBytes = _Track.END_BYTES;\n this.events.forEach((event) => {\n const bytes = event.toBytes();\n trackLength += bytes.length;\n eventBytes.push(...bytes);\n });\n trackLength += endBytes.length;\n const lengthBytes = str2Bytes(trackLength.toString(16), 4);\n return startBytes.concat(lengthBytes, eventBytes, endBytes);\n }\n};\nTrack.prototype.noteOn = Track.prototype.addNoteOn;\nTrack.prototype.noteOff = Track.prototype.addNoteOff;\nTrack.prototype.note = Track.prototype.addNote;\nTrack.prototype.chord = Track.prototype.addChord;\nTrack.prototype.instrument = Track.prototype.setInstrument;\nTrack.prototype.tempo = Track.prototype.setTempo;\nTrack.prototype.timeSignature = Track.prototype.setTimeSignature;\nTrack.prototype.keySignature = Track.prototype.setKeySignature;\n\n// src/file.ts\nvar File = class _File {\n static HDR_CHUNKID = \"MThd\";\n static HDR_CHUNK_SIZE = \"\\0\\0\\0\u0006\";\n static HDR_TYPE0 = \"\\0\\0\";\n static HDR_TYPE1 = \"\\0\u0001\";\n ticks;\n tracks;\n constructor(config) {\n const c = config || {};\n if (c.ticks !== void 0) {\n if (typeof c.ticks !== \"number\") {\n throw new Error(\"Ticks per beat must be a number!\");\n }\n if (c.ticks <= 0 || c.ticks >= 1 << 15 || c.ticks % 1 !== 0) {\n throw new Error(\"Ticks per beat must be an integer between 1 and 32767!\");\n }\n }\n this.ticks = c.ticks || 128;\n this.tracks = [];\n }\n addTrack(track) {\n if (track) {\n this.tracks.push(track);\n return this;\n } else {\n const newTrack = new Track();\n this.tracks.push(newTrack);\n return newTrack;\n }\n }\n toBytes() {\n const trackCount = this.tracks.length.toString(16);\n let bytes = _File.HDR_CHUNKID + _File.HDR_CHUNK_SIZE;\n if (parseInt(trackCount, 16) > 1) {\n bytes += _File.HDR_TYPE1;\n } else {\n bytes += _File.HDR_TYPE0;\n }\n bytes += codes2Str(str2Bytes(trackCount, 2));\n bytes += String.fromCharCode(this.ticks / 256, this.ticks % 256);\n this.tracks.forEach((track) => {\n bytes += codes2Str(track.toBytes());\n });\n return bytes;\n }\n toUint8Array() {\n const str = this.toBytes();\n const arr = new Uint8Array(str.length);\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i);\n }\n return arr;\n }\n toBlob(genericType) {\n return new Blob([this.toUint8Array()], {\n type: genericType ? \"application/octet-stream\" : \"audio/x-midi\"\n });\n }\n};\n\n// src/index.ts\nvar Midi = {\n Util,\n File,\n Track,\n Event: MidiEvent,\n MetaEvent,\n DEFAULT_VOLUME,\n DEFAULT_DURATION,\n DEFAULT_CHANNEL\n};\nvar index_default = Midi;\n\nexports.DEFAULT_CHANNEL = DEFAULT_CHANNEL;\nexports.DEFAULT_DURATION = DEFAULT_DURATION;\nexports.DEFAULT_VOLUME = DEFAULT_VOLUME;\nexports.Event = MidiEvent;\nexports.File = File;\nexports.MetaEvent = MetaEvent;\nexports.MetaEventType = MetaEventType;\nexports.MidiEvent = MidiEvent;\nexports.MidiEventType = MidiEventType;\nexports.Track = Track;\nexports.Util = Util;\nexports.default = index_default;\n//# sourceMappingURL=index.cjs.map\n//# sourceMappingURL=index.cjs.map","// 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\t// no module.id needed\n\t\t// no module.loaded needed\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// Return the exports of the module\n\treturn module.exports;\n}\n\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__(729);\n"],"names":["mod","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","index_exports","target","all","name","get","enumerable","__export","chord","chords","getIndicesFromScale","inlineChord","scale","scales","module","exports","to","from","except","desc","key","call","__copyProps","value","sharpToFlatMap","CHROMATIC","scaleMap","ritusen","egyptian","pelog","kumoijoshi","hirajoshi","iwato","scriabin","augmented","piongio","prometheus","altered","lydian","locrian","ultralocrian","phrygian","balinese","aeolian","dorian","oriental","flamenco","mixolydian","persian","major","enigmatic","bebop","diminished","ichikosucho","chromatic","ionian","minor","Kanakangi","Ratnangi","Ganamurti","Vanaspati","Manavati","Tanarupi","Senavati","Hanumatodi","Dhenuka","Natakapriya","Kokilapriya","Rupavati","Gayakapriya","Vakulabharanam","Mayamalavagowla","Chakravakam","Suryakantam","Hatakambari","Jhankaradhwani","Natabhairavi","Keeravani","Kharaharapriya","Gourimanohari","Varunapriya","Mararanjani","Charukesi","Sarasangi","Harikambhoji","Dheerasankarabaranam","Naganandini","Yagapriya","Ragavardhini","Gangeyabhushani","Vagadheeswari","Shulini","Chalanata","Salagam","Jalarnavam","Jhalavarali","Navaneetam","Pavani","Raghupriya","Gavambhodi","Bhavapriya","Shubhapantuvarali","Shadvidamargini","Suvarnangi","Divyamani","Dhavalambari","Namanarayani","Kamavardhini","Ramapriya","Gamanashrama","Vishwambari","Shamalangi","Shanmukhapriya","Simhendramadhyamam","Hemavati","Dharmavati","Neetimati","Kantamani","Rishabhapriya","Latangi","Vachaspati","Mechakalyani","Chitrambari","Sucharitra","Dhatuvardani","Nasikabhushini","Kosalam","Rasikapriya","chordMap","sus4","M7sus4","aug","M7b6","M","maj7","Mb5","M7b5","mb6M7","m","m7","m6","mMaj7b6","dim","oM7","m7b5","dim7","o7M7","madd4","m7add11","sus2","sus24","M9sus4","Madd9","maj9","maj13","M7add13","M9b5","madd9","mM9","m9","m69","m13","mMaj9b6","m9b5","m11A","m11","b9sus","alt7","Maddb9","M7b9","mb6b9","_getNotesForScaleOrChord","scale2","chord2","input","SCALE_OR_CHORD","Error","rootOctaveScale","trim","indexOfFirstSpace","indexOf","scaleOrChord","rootOctave","slice","root","toUpperCase","charAt","sharpToFlat","replace","octave","isNaN","chroma","index","o1","map","n","o2","concat","getChromatic","acc","p1","p2","length","push","rootChord_Oct","B9SUS","includes","split","keys","scaleOrBitmap","str","intervals","i","__spreadArray","this","pack","arguments","ar","l","Array","arp","harmonics_1","utils_1","fillArr","arr","len","bumpOctave","el","note","oct","arr1","arr2","chordsOrParams","finalArr","params","count","order","match","TypeError","join","assign","forEach","c","filledArr_1","reorderedArr","idx","e","isArray","filledArr_2","errorHasMessage","message","__assign","t","s","p","apply","clip","hdr","notes","pattern","shuffle","sizzle","sizzleReps","arpegiate","subdiv","amp","accentLow","randomNotes","offlineRendering","convertChordsToNotes","test","clipNotes","step","recursivelyApplyPatternToNotes","patternArr","parentNoteLength","totalLength","char","_a","randomInt","level","diff","Math","abs","lastClipNote","isTriplet","round","expandStr","volArr","style","beats","stepLevel","PI","accent","a","_i","clipNotes_1","clipNote","__createBinding","create","o","k","k2","undefined","__esModule","writable","configurable","__exportStar","midi","progression","getChordsByProgression","getChordDegrees","modes","mode","clip_1","progression_1","arp_1","midi_1","__importDefault","fs_1","fileName","bpm","bytes","createFileFromNotes","toBytes","endsWith","window","URL","createObjectURL","createDownloadLink","default","writeFileSync","console","log","b","Uint8Array","ascii","charCodeAt","blob","Blob","type","link","document","createElement","href","download","innerText","file","File","track","Track","setTempo","addTrack","notes_1","noteObj","noteOn","noteOff","addChord","theRomans","idxByDegree","ii","iii","iv","v","vi","vii","noteOctaveScale","chordDegress","noteOctaveScaleArr","roman","chordName","prefix","toLowerCase","getChordName","scaleId","toString","getProgFactory","T","P","D","pickOne","dice","scaleType","convertChordToNotes","flat","sizzleMap","isNote","JSON","stringify","parse","fullShuffle","lastIndex","rnd","floor","random","maxLevel","pi","piArr","piArrRev","reverse","element","sin","reduce","val","x","c1","c2","e1","e2","n1","num","require","midi_letter_pitches","d","f","g","midi_pitches_letter","midi_flattened_notes","midiPitchFromNote","matches","exec","accidental","parseInt","substring","ensureMidiPitch","String","mpqnFromBpm","mpqn","ret","unshift","codes2Str","byteArray","fromCharCode","str2Bytes","finalBytes","chars","translateTickTime","ticks","buffer","bList","Util","noteFromMidiPitch","returnFlattened","noteNum","noteName","bpmFromMpqn","MidiEventType","NOTE_OFF","NOTE_ON","AFTER_TOUCH","CONTROLLER","PROGRAM_CHANGE","CHANNEL_AFTERTOUCH","PITCH_BEND","MetaEventType","SEQUENCE","TEXT","COPYRIGHT","TRACK_NAME","INSTRUMENT","LYRIC","MARKER","CUE_POINT","CHANNEL_PREFIX","END_OF_TRACK","TEMPO","SMPTE","TIME_SIG","KEY_SIG","SEQ_EVENT","MidiEvent","_MidiEvent","static","time","channel","param1","param2","constructor","setTime","setType","setChannel","setParam1","setParam2","typeChannelByte","MetaEvent","data","setData","dataBytes","_Track","events","config","addEvent","event","addNoteOn","pitch","velocity","addNoteOff","addNote","dur","setInstrument","instrument","setTimeSignature","numerator","denominator","ddlog2","log2","setKeySignature","accidentals","trackLength","eventBytes","startBytes","START_BYTES","endBytes","END_BYTES","lengthBytes","tempo","timeSignature","keySignature","_File","tracks","newTrack","trackCount","HDR_CHUNKID","HDR_CHUNK_SIZE","HDR_TYPE1","HDR_TYPE0","toUint8Array","toBlob","genericType","index_default","Event","DEFAULT_VOLUME","DEFAULT_DURATION","DEFAULT_CHANNEL","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}