diff --git a/browser/midiwriter.js b/browser/midiwriter.js index ca814d3..8f0dbb1 100644 --- a/browser/midiwriter.js +++ b/browser/midiwriter.js @@ -1,4 +1,4 @@ -var MidiWriter = (function () { +var MidiWriter = (function (exports) { 'use strict'; /** @@ -6,7 +6,7 @@ var MidiWriter = (function () { * @return {Constants} */ var Constants = { - VERSION: '2.1.4', + VERSION: '3.0.0', HEADER_CHUNK_TYPE: [0x4d, 0x54, 0x68, 0x64], HEADER_CHUNK_LENGTH: [0x00, 0x00, 0x00, 0x06], HEADER_CHUNK_FORMAT0: [0x00, 0x00], @@ -17,133 +17,109 @@ var MidiWriter = (function () { META_SMTPE_OFFSET: 0x54 }; - function isNum (x) { return typeof x === 'number' } - function isStr (x) { return typeof x === 'string' } - function isDef (x) { return typeof x !== 'undefined' } - function midiToFreq (midi, tuning) { - return Math.pow(2, (midi - 69) / 12) * (tuning || 440) - } - - var REGEX = /^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/; + // src/utils.ts + var fillStr = (s, n) => Array(Math.abs(n) + 1).join(s); - var SEMITONES = [0, 2, 4, 5, 7, 9, 11]; - /** - * Parse a note name in scientific notation an return it's components, - * and some numeric properties including midi number and frequency. - * - * @name parse - * @function - * @param {String} note - the note string to be parsed - * @param {Boolean} isTonic - true the strings it's supposed to contain a note number - * and some category (for example an scale: 'C# major'). It's false by default, - * but when true, en extra tonicOf property is returned with the category ('major') - * @param {Float} tunning - The frequency of A4 note to calculate frequencies. - * By default it 440. - * @return {Object} the parsed note name or null if not a valid note - * - * The parsed note name object will ALWAYS contains: - * - letter: the uppercase letter of the note - * - acc: the accidentals of the note (only sharps or flats) - * - pc: the pitch class (letter + acc) - * - step: s a numeric representation of the letter. It's an integer from 0 to 6 - * where 0 = C, 1 = D ... 6 = B - * - alt: a numeric representation of the accidentals. 0 means no alteration, - * positive numbers are for sharps and negative for flats - * - chroma: a numeric representation of the pitch class. It's like midi for - * pitch classes. 0 = C, 1 = C#, 2 = D ... 11 = B. Can be used to find enharmonics - * since, for example, chroma of 'Cb' and 'B' are both 11 - * - * If the note has octave, the parser object will contain: - * - oct: the octave number (as integer) - * - midi: the midi number - * - freq: the frequency (using tuning parameter as base) - * - * If the parameter `isTonic` is set to true, the parsed object will contain: - * - tonicOf: the rest of the string that follows note name (left and right trimmed) - * - * @example - * var parse = require('note-parser').parse - * parse('Cb4') - * // => { letter: 'C', acc: 'b', pc: 'Cb', step: 0, alt: -1, chroma: -1, - * oct: 4, midi: 59, freq: 246.94165062806206 } - * // if no octave, no midi, no freq - * parse('fx') - * // => { letter: 'F', acc: '##', pc: 'F##', step: 3, alt: 2, chroma: 7 }) - */ - function parse (str, isTonic, tuning) { - if (typeof str !== 'string') return null - var m = REGEX.exec(str); - if (!m || (!isTonic && m[4])) return null + // src/named.ts + function isNamed(src) { + return src !== null && typeof src === "object" && typeof src.name === "string" ? true : false; + } - var p = { letter: m[1].toUpperCase(), acc: m[2].replace(/x/g, '##') }; - p.pc = p.letter + p.acc; - p.step = (p.letter.charCodeAt(0) + 3) % 7; - p.alt = p.acc[0] === 'b' ? -p.acc.length : p.acc.length; - var pos = SEMITONES[p.step] + p.alt; - p.chroma = pos < 0 ? 12 + pos : pos % 12; - if (m[3]) { // has octave - p.oct = +m[3]; - p.midi = pos + 12 * (p.oct + 1); - p.freq = midiToFreq(p.midi, tuning); + // src/pitch.ts + function isPitch(pitch) { + return pitch !== null && typeof pitch === "object" && typeof pitch.step === "number" && typeof pitch.alt === "number" ? true : false; + } + var FIFTHS = [0, 2, 4, -1, 1, 3, 5]; + var STEPS_TO_OCTS = FIFTHS.map( + (fifths) => Math.floor(fifths * 7 / 12) + ); + function encode(pitch) { + const { step, alt, oct, dir = 1 } = pitch; + const f = FIFTHS[step] + 7 * alt; + if (oct === void 0) { + return [dir * f]; } - if (isTonic) p.tonicOf = m[4]; - return p + const o = oct - STEPS_TO_OCTS[step] - 4 * alt; + return [dir * f, dir * o]; } - /** - * Get midi of a note - * - * @name midi - * @function - * @param {String|Integer} note - the note name or midi number - * @return {Integer} the midi number of the note or null if not a valid note - * or the note does NOT contains octave - * @example - * var parser = require('note-parser') - * parser.midi('A4') // => 69 - * parser.midi('A') // => null - * @example - * // midi numbers are bypassed (even as strings) - * parser.midi(60) // => 60 - * parser.midi('60') // => 60 - */ - function midi (note) { - if ((isNum(note) || isStr(note)) && note >= 0 && note < 128) return +note - var p = parse(note); - return p && isDef(p.midi) ? p.midi : null + // src/note.ts + var NoNote = { empty: true, name: "", pc: "", acc: "" }; + var cache = /* @__PURE__ */ new Map(); + var stepToLetter = (step) => "CDEFGAB".charAt(step); + var altToAcc = (alt) => alt < 0 ? fillStr("b", -alt) : fillStr("#", alt); + var accToAlt = (acc) => acc[0] === "b" ? -acc.length : acc.length; + function note(src) { + const stringSrc = JSON.stringify(src); + const cached = cache.get(stringSrc); + if (cached) { + return cached; + } + const value = typeof src === "string" ? parse(src) : isPitch(src) ? note(pitchName(src)) : isNamed(src) ? note(src.name) : NoNote; + cache.set(stringSrc, value); + return value; + } + var REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/; + function tokenizeNote(str) { + const m = REGEX.exec(str); + return [m[1].toUpperCase(), m[2].replace(/x/g, "##"), m[3], m[4]]; + } + var mod = (n, m) => (n % m + m) % m; + var SEMI = [0, 2, 4, 5, 7, 9, 11]; + function parse(noteName) { + const tokens = tokenizeNote(noteName); + if (tokens[0] === "" || tokens[3] !== "") { + return NoNote; + } + const letter = tokens[0]; + const acc = tokens[1]; + const octStr = tokens[2]; + const step = (letter.charCodeAt(0) + 3) % 7; + const alt = accToAlt(acc); + const oct = octStr.length ? +octStr : void 0; + const coord = encode({ step, alt, oct }); + const name = letter + acc + octStr; + const pc = letter + acc; + const chroma = (SEMI[step] + alt + 120) % 12; + const height = oct === void 0 ? mod(SEMI[step] + alt, 12) - 12 * 99 : SEMI[step] + alt + 12 * (oct + 1); + const midi = height >= 0 && height <= 127 ? height : null; + const freq = oct === void 0 ? null : Math.pow(2, (height - 69) / 12) * 440; + return { + empty: false, + acc, + alt, + chroma, + coord, + freq, + height, + letter, + midi, + name, + oct, + pc, + step + }; + } + function pitchName(props) { + const { step, alt, oct } = props; + const letter = stepToLetter(step); + if (!letter) { + return ""; + } + const pc = letter + altToAcc(alt); + return oct || oct === 0 ? pc + oct : pc; } - /** - * A midi note number is a number representation of a note pitch. It can be - * integers so it's equal tempered tuned, or float to indicate it's not - * tuned into equal temepered scale. - * - * This module contains functions to convert to and from midi notes. - * - * @example - * var midi = require('tonal-midi') - * midi.toMidi('A4') // => 69 - * midi.note(69) // => 'A4' - * midi.note(61) // => 'Db4' - * midi.note(61, true) // => 'C#4' - * - * @module midi - */ - - /** - * Convert the given note to a midi note number. If you pass a midi number it - * will returned as is. - * - * @param {Array|String|Number} note - the note to get the midi number from - * @return {Integer} the midi number or null if not valid pitch - * @example - * midi.toMidi('C4') // => 60 - * midi.toMidi(60) // => 60 - * midi.toMidi('60') // => 60 - */ - function toMidi (val) { - if (Array.isArray(val) && val.length === 2) return val[0] * 7 + val[1] * 12 + 12 - return midi(val) + // index.ts + function isMidi(arg) { + return +arg >= 0 && +arg <= 127; + } + function toMidi(note$1) { + if (isMidi(note$1)) { + return +note$1; + } + const n = note(note$1); + return n.empty ? null : n.midi; } /** @@ -1355,31 +1331,31 @@ var MidiWriter = (function () { return Writer; }()); - var main = { - Constants: Constants, - ControllerChangeEvent: ControllerChangeEvent, - CopyrightEvent: CopyrightEvent, - CuePointEvent: CuePointEvent, - EndTrackEvent: EndTrackEvent, - InstrumentNameEvent: InstrumentNameEvent, - KeySignatureEvent: KeySignatureEvent, - LyricEvent: LyricEvent, - MarkerEvent: MarkerEvent, - NoteOnEvent: NoteOnEvent, - NoteOffEvent: NoteOffEvent, - NoteEvent: NoteEvent, - PitchBendEvent: PitchBendEvent, - ProgramChangeEvent: ProgramChangeEvent, - TempoEvent: TempoEvent, - TextEvent: TextEvent, - TimeSignatureEvent: TimeSignatureEvent, - Track: Track, - TrackNameEvent: TrackNameEvent, - Utils: Utils, - VexFlow: VexFlow, - Writer: Writer - }; + exports.Constants = Constants; + exports.ControllerChangeEvent = ControllerChangeEvent; + exports.CopyrightEvent = CopyrightEvent; + exports.CuePointEvent = CuePointEvent; + exports.EndTrackEvent = EndTrackEvent; + exports.InstrumentNameEvent = InstrumentNameEvent; + exports.KeySignatureEvent = KeySignatureEvent; + exports.LyricEvent = LyricEvent; + exports.MarkerEvent = MarkerEvent; + exports.NoteEvent = NoteEvent; + exports.NoteOffEvent = NoteOffEvent; + exports.NoteOnEvent = NoteOnEvent; + exports.PitchBendEvent = PitchBendEvent; + exports.ProgramChangeEvent = ProgramChangeEvent; + exports.TempoEvent = TempoEvent; + exports.TextEvent = TextEvent; + exports.TimeSignatureEvent = TimeSignatureEvent; + exports.Track = Track; + exports.TrackNameEvent = TrackNameEvent; + exports.Utils = Utils; + exports.VexFlow = VexFlow; + exports.Writer = Writer; + + Object.defineProperty(exports, '__esModule', { value: true }); - return main; + return exports; -})(); +})({}); diff --git a/docs/Chunk.html b/docs/Chunk.html deleted file mode 100644 index f956a4d..0000000 --- a/docs/Chunk.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - Chunk - Documentation - - - - - - - - - - - - - - - - - -
- -

Chunk

- - - - - - - -
- -
- -

- Chunk -

- -
Object representation of the chunk section of a MIDI file.
- - -
- -
-
- - -
- - -

Constructor

- - -

new Chunk(fields) → {Chunk}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {type: number, data: array, size: array} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Chunk - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/ControllerChangeEvent.html b/docs/ControllerChangeEvent.html deleted file mode 100644 index 86dbfb0..0000000 --- a/docs/ControllerChangeEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - ControllerChangeEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

ControllerChangeEvent

- - - - - - - -
- -
- -

- ControllerChangeEvent -

- -
Holds all data for a "controller change" MIDI event
- - -
- -
-
- - -
- - -

Constructor

- - -

new ControllerChangeEvent(fields) → {ControllerChangeEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {controllerNumber: integer, controllerValue: integer, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -ControllerChangeEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/CopyrightEvent.html b/docs/CopyrightEvent.html deleted file mode 100644 index 90fc873..0000000 --- a/docs/CopyrightEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - CopyrightEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

CopyrightEvent

- - - - - - - -
- -
- -

- CopyrightEvent -

- -
Object representation of a tempo meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new CopyrightEvent(fields) → {CopyrightEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -CopyrightEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/CuePointEvent.html b/docs/CuePointEvent.html deleted file mode 100644 index 792361f..0000000 --- a/docs/CuePointEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - CuePointEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

CuePointEvent

- - - - - - - -
- -
- -

- CuePointEvent -

- -
Object representation of a cue point meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new CuePointEvent(fields) → {CuePointEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -CuePointEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/EndTrackEvent.html b/docs/EndTrackEvent.html deleted file mode 100644 index 487cb36..0000000 --- a/docs/EndTrackEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - EndTrackEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

EndTrackEvent

- - - - - - - -
- -
- -

- EndTrackEvent -

- -
Object representation of a end track meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new EndTrackEvent(fields) → {EndTrackEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -EndTrackEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/HeaderChunk.html b/docs/HeaderChunk.html deleted file mode 100644 index 1039823..0000000 --- a/docs/HeaderChunk.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - HeaderChunk - Documentation - - - - - - - - - - - - - - - - - -
- -

HeaderChunk

- - - - - - - -
- -
- -

- HeaderChunk -

- -
Object representation of a header chunk section of a MIDI file.
- - -
- -
-
- - -
- - -

Constructor

- - -

new HeaderChunk(numberOfTracks) → {HeaderChunk}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
numberOfTracks - - -number - - - - - Number of tracks - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -HeaderChunk - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/InstrumentNameEvent.html b/docs/InstrumentNameEvent.html deleted file mode 100644 index dafe867..0000000 --- a/docs/InstrumentNameEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - InstrumentNameEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

InstrumentNameEvent

- - - - - - - -
- -
- -

- InstrumentNameEvent -

- -
Object representation of an instrument name meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new InstrumentNameEvent(fields) → {InstrumentNameEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -InstrumentNameEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/KeySignatureEvent.html b/docs/KeySignatureEvent.html deleted file mode 100644 index 6892e82..0000000 --- a/docs/KeySignatureEvent.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - KeySignatureEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

KeySignatureEvent

- - - - - - - -
- -
- -

- KeySignatureEvent -

- -
Object representation of a key signature meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new KeySignatureEvent() → {KeySignatureEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -KeySignatureEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/LyricEvent.html b/docs/LyricEvent.html deleted file mode 100644 index ddd3af2..0000000 --- a/docs/LyricEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - LyricEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

LyricEvent

- - - - - - - -
- -
- -

- LyricEvent -

- -
Object representation of a lyric meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new LyricEvent(fields) → {LyricEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -LyricEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/MarkerEvent.html b/docs/MarkerEvent.html deleted file mode 100644 index 8f09340..0000000 --- a/docs/MarkerEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - MarkerEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

MarkerEvent

- - - - - - - -
- -
- -

- MarkerEvent -

- -
Object representation of a marker meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new MarkerEvent(fields) → {MarkerEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -MarkerEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/MetaEvent.html b/docs/MetaEvent.html deleted file mode 100644 index 9d445c9..0000000 --- a/docs/MetaEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - MetaEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

MetaEvent

- - - - - - - -
- -
- -

- MetaEvent -

- -
Object representation of a meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new MetaEvent(fields) → {MetaEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - type, data - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -MetaEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/NoteEvent.html b/docs/NoteEvent.html deleted file mode 100644 index 74d726f..0000000 --- a/docs/NoteEvent.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - NoteEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

NoteEvent

- - - - - - - -
- -
- -

- NoteEvent -

- -
Wrapper for noteOnEvent/noteOffEvent objects that builds both events.
- - -
- -
-
- - -
- - -

Constructor

- - -

new NoteEvent(fields) → {NoteEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {pitch: '[C4]', duration: '4', wait: '4', velocity: 1-100} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

buildData() → {NoteEvent}

- - - - - -
- Builds int array for this event. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteEvent - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/NoteOffEvent.html b/docs/NoteOffEvent.html deleted file mode 100644 index b5a286b..0000000 --- a/docs/NoteOffEvent.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - NoteOffEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

NoteOffEvent

- - - - - - - -
- -
- -

- NoteOffEvent -

- -
Holds all data for a "note off" MIDI event
- - -
- -
-
- - -
- - -

Constructor

- - -

new NoteOffEvent(fields) → {NoteOffEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {data: []} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteOffEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

buildData(track) → {NoteOffEvent}

- - - - - -
- Builds int array for this event. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
track - - -Track - - - - - parent track - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteOffEvent - - -
-
- - - -
- - - -
- - -
- - - -

getStatusByte() → {number}

- - - - - -
- Gets the note off status code based on the selected channel. 0x8{0-F} -Note off at channel 0 is 0x80 (128) -0 = Ch 1 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/NoteOnEvent.html b/docs/NoteOnEvent.html deleted file mode 100644 index 2e4e337..0000000 --- a/docs/NoteOnEvent.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - NoteOnEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

NoteOnEvent

- - - - - - - -
- -
- -

- NoteOnEvent -

- -
Holds all data for a "note on" MIDI event
- - -
- -
-
- - -
- - -

Constructor

- - -

new NoteOnEvent(fields) → {NoteOnEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {data: []} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteOnEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

buildData(track) → {NoteOnEvent}

- - - - - -
- Builds int array for this event. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
track - - -Track - - - - - parent track - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -NoteOnEvent - - -
-
- - - -
- - - -
- - -
- - - -

getStatusByte() → {number}

- - - - - -
- Gets the note on status code based on the selected channel. 0x9{0-F} -Note on at channel 0 is 0x90 (144) -0 = Ch 1 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/ProgramChangeEvent.html b/docs/ProgramChangeEvent.html deleted file mode 100644 index 21dfeb5..0000000 --- a/docs/ProgramChangeEvent.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - ProgramChangeEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

ProgramChangeEvent

- - - - - - - -
- -
- -

- ProgramChangeEvent -

- -
Holds all data for a "program change" MIDI event
- - -
- -
-
- - -
- - -

Constructor

- - -

new ProgramChangeEvent(fields) → {ProgramChangeEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {instrument: integer, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -ProgramChangeEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

getStatusByte() → {number}

- - - - - -
- Gets the status code based on the selected channel. 0xC{0-F} -Program change status byte for channel 0 is 0xC0 (192) -0 = Ch 1 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/TempoEvent.html b/docs/TempoEvent.html deleted file mode 100644 index 1dd986d..0000000 --- a/docs/TempoEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - TempoEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

TempoEvent

- - - - - - - -
- -
- -

- TempoEvent -

- -
Object representation of a tempo meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new TempoEvent(fields) → {TempoEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {bpm: integer, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -TempoEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/TextEvent.html b/docs/TextEvent.html deleted file mode 100644 index d1c39e9..0000000 --- a/docs/TextEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - TextEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

TextEvent

- - - - - - - -
- -
- -

- TextEvent -

- -
Object representation of a tempo meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new TextEvent(fields) → {TextEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -TextEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/TimeSignatureEvent.html b/docs/TimeSignatureEvent.html deleted file mode 100644 index 7dce06a..0000000 --- a/docs/TimeSignatureEvent.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - TimeSignatureEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

TimeSignatureEvent

- - - - - - - -
- -
- -

- TimeSignatureEvent -

- -
Object representation of a time signature meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new TimeSignatureEvent() → {TimeSignatureEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -TimeSignatureEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/Track.html b/docs/Track.html deleted file mode 100644 index b46e48b..0000000 --- a/docs/Track.html +++ /dev/null @@ -1,3209 +0,0 @@ - - - - - - Track - Documentation - - - - - - - - - - - - - - - - - -
- -

Track

- - - - - - - -
- -
- -

- Track -

- -
Holds all data for a track.
- - -
- -
-
- - -
- - -

Constructor

- - -

new Track(fields) → {Track}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {type: number, data: array, size: array, events: array} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

addCopyright(text) → {Track}

- - - - - -
- Adds copyright to MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Text of copyright line. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addCuePoint(text) → {Track}

- - - - - -
- Adds cue point to MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Text of cue point. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addEvent(events, mapFunction) → {Track}

- - - - - -
- Adds any event type to the track. -Events without a specific startTick property are assumed to be added in order of how they should output. -Events with a specific startTick property are set aside for now will be merged in during build process. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
events - - -NoteEvent -| - -ProgramChangeEvent - - - - - Event object or array of Event objects. - -
mapFunction - - -function - - - - - Callback which can be used to apply specific properties to all events. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addInstrumentName(text) → {Track}

- - - - - -
- Sets instrument name of track. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Name of instrument. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addLyric(text) → {Track}

- - - - - -
- Adds lyric to MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Lyric text to add. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addMarker(text) → {Track}

- - - - - -
- Adds marker to MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Marker text. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addText(text) → {Track}

- - - - - -
- Adds text to MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Text to add. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

addTrackName(text) → {Track}

- - - - - -
- Adds Sequence/Track Name. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
text - - -string - - - - - Text of track name. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

buildData(options) → {Track}

- - - - - -
- Builds int array of all events. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -object - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

controllerChange(number, value) → {Track}

- - - - - -
- Adds a controller change event -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
number - - -number - - - - - Control number. - -
value - - -number - - - - - Control value. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

mergeSingleEvent(event) → {Track}

- - - - - -
- Merges a single event into this track's list of events based on event.tick property. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
event - - -NoteOnEvent -| - -NoteOffEvent - - - - - event - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

mergeTrack(track) → {Track}

- - - - - -
- Merges another track's events with this track. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
track - - -Track - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

polyModeOn() → {Track}

- - - - - -
- Channel mode messages -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

removeEventsByType(eventType) → {Track}

- - - - - -
- Removes all events matching specified type. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
eventType - - -string - - - - - Event type - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

setKeySignature(sf, mi) → {Track}

- - - - - -
- Sets key signature. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
sf - - -* - - - - - - - -
mi - - -* - - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

setPitchBend(bend) → {Track}

- - - - - -
- Sets a pitch bend. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bend - - -float - - - - - Bend value ranging [-1,1], zero meaning no bend. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

setTempo(bpm, tick) → {Track}

- - - - - -
- Sets tempo of the MIDI file. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
bpm - - -number - - - - - - - Tempo in beats per minute. - -
tick - - -number - - - - - - 0 - - - Start tick. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - -
- - - -

setTimeSignature(numerator, denominator, midiclockspertick, notespermidiclock) → {Track}

- - - - - -
- Sets time signature. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
numerator - - -number - - - - - Top number of the time signature. - -
denominator - - -number - - - - - Bottom number of the time signature. - -
midiclockspertick - - -number - - - - - Defaults to 24. - -
notespermidiclock - - -number - - - - - Defaults to 8. - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Track - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/TrackNameEvent.html b/docs/TrackNameEvent.html deleted file mode 100644 index f008280..0000000 --- a/docs/TrackNameEvent.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - TrackNameEvent - Documentation - - - - - - - - - - - - - - - - - -
- -

TrackNameEvent

- - - - - - - -
- -
- -

- TrackNameEvent -

- -
Object representation of a tempo meta event.
- - -
- -
-
- - -
- - -

Constructor

- - -

new TrackNameEvent(fields) → {TrackNameEvent}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - {text: string, delta: integer} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -TrackNameEvent - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/Utils.html b/docs/Utils.html deleted file mode 100644 index bd2b706..0000000 --- a/docs/Utils.html +++ /dev/null @@ -1,2397 +0,0 @@ - - - - - - Utils - Documentation - - - - - - - - - - - - - - - - - -
- -

Utils

- - - - - - - -
- -
- -

- Utils -

- -
Static utility functions used throughout the library.
- - -
- -
-
- - -
- - -

Constructor

- - -

new Utils()

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

(static) convertVelocity(velocity) → {number}

- - - - - -
- Converts velocity to value 0-127 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
velocity - - -number - - - - - Velocity value 1-100 - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) getDurationMultiplier(duration) → {number}

- - - - - -
- Gets what to multiple ticks/quarter note by to get the specified duration. -Note: type=='note' defaults to quarter note, type==='rest' defaults to 0 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
duration - - -string - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) getPitch(pitch, middleC) → {number}

- - - - - -
- Returns the correct MIDI number for the specified pitch. -Uses Tonal Midi - https://github.com/danigb/tonal/tree/master/packages/midi -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
pitch - - -string -| - -number - - - - - - - 'C#4' or midi note code - -
middleC - - -string - - - - - - C4 - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) getPrecisionLoss(tick) → {number}

- - - - - -
- Due to low precision of MIDI, -we need to keep track of rounding errors in deltas. -This function will calculate the rounding error for a given duration. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
tick - - -number - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) getRoundedIfClose(tick) → {number}

- - - - - -
- Due to rounding errors in JavaScript engines, -it's safe to round when we're very close to the actual tick number -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
tick - - -number - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) getTickDuration(duration) → {number}

- - - - - -
- Gets the total number of ticks of a specified duration. -Note: type=='note' defaults to quarter note, type==='rest' defaults to 0 -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
duration - - -string -| - -array - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) isNumeric(n) → {boolean}

- - - - - -
- Checks if argument is a valid number. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
n - - -* - - - - - Value to check - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -boolean - - -
-
- - - -
- - - -
- - -
- - - -

(static) numberFromBytes(bytes) → {number}

- - - - - -
- Get an int from an array of bytes. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bytes - - -array - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -number - - -
-
- - - -
- - - -
- - -
- - - -

(static) numberToBytes(number, bytesNeeded) → {array}

- - - - - -
- Takes a number and splits it up into an array of bytes. Can be padded by passing a number to bytesNeeded -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
number - - -number - - - - - - -
bytesNeeded - - -number - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - -
- - Array of bytes -
- - -
- - - -
- - -
- - - -

(static) numberToVariableLength(ticks) → {array}

- - - - - -
- Translates number of ticks to MIDI timestamp format, returning an array of -hex strings with the time values. Midi has a very particular time to express time, -take a good look at the spec before ever touching this function. -Thanks to https://github.com/sergi/jsmidi -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ticks - - -number - - - - - Number of ticks to be translated - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - -
- - Bytes that form the MIDI time value -
- - -
- - - -
- - -
- - - -

(static) stringByteCount(s) → {array}

- - - - - -
- Counts number of bytes in string -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
s - - -string - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - - -
- - - -
- - -
- - - -

(static) stringToBytes(string) → {array}

- - - - - -
- Convert a string to an array of bytes -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
string - - -string - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - - -
- - - -
- - -
- - - -

(static) toArray(value) → {array}

- - - - - -
- Converts value to array if needed. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
value - - -string - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - - -
- - - -
- - -
- - - -

(static) version() → {string}

- - - - - -
- Gets MidiWriterJS version number. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -string - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/Writer.html b/docs/Writer.html deleted file mode 100644 index cd9aa17..0000000 --- a/docs/Writer.html +++ /dev/null @@ -1,982 +0,0 @@ - - - - - - Writer - Documentation - - - - - - - - - - - - - - - - - -
- -

Writer

- - - - - - - -
- -
- -

- Writer -

- -
Object that puts together tracks and provides methods for file output.
- - -
- -
-
- - -
- - -

Constructor

- - -

new Writer(tracks, options) → {Writer}

- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
tracks - - -array -| - -Track - - - - - A single {Track} object or an array of {Track} objects. - -
options - - -object - - - - - {middleC: 'C4'} - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Writer - - -
-
- - - -
- - - -
- -
- - - - - - - - - - - - - - -

Methods

- - - -
- - - -

base64() → {string}

- - - - - -
- Convert file buffer to a base64 string. Different methods depending on if browser or node. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -string - - -
-
- - - -
- - - -
- - -
- - - -

buildData() → {array}

- - - - - -
- Builds array of data from chunkschunks. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -array - - -
-
- - - -
- - - -
- - -
- - - -

buildFile() → {Uint8Array}

- - - - - -
- Builds the file into a Uint8Array -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Uint8Array - - -
-
- - - -
- - - -
- - -
- - - -

dataUri() → {string}

- - - - - -
- Get the data URI. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -string - - -
-
- - - -
- - - -
- - -
- - - -

setOption(key, value) → {Writer}

- - - - - -
- Set option on instantiated Writer. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -string - - - - - - -
value - - -any - - - - - - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -Writer - - -
-
- - - -
- - - -
- - -
- - - -

stdout() → {string}

- - - - - -
- Output to stdout -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -string - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/chunk.js.html b/docs/chunk.js.html deleted file mode 100644 index 9aede9f..0000000 --- a/docs/chunk.js.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - chunk.js - Documentation - - - - - - - - - - - - - - - - - -
- -

chunk.js

- - - - - - - -
-
-
/**
- * Object representation of the chunk section of a MIDI file.
- * @param {object} fields - {type: number, data: array, size: array}
- * @return {Chunk}
- */
-class Chunk {
-	constructor(fields) {
-		this.type = fields.type;
-		this.data = fields.data;
-		this.size = [0, 0, 0, fields.data.length];
-	}
-}
-
-export {Chunk};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/constants.js.html b/docs/constants.js.html deleted file mode 100644 index f4901e2..0000000 --- a/docs/constants.js.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - constants.js - Documentation - - - - - - - - - - - - - - - - - -
- -

constants.js

- - - - - - - -
-
-
/**
- * MIDI file format constants.
- * @return {Constants}
- */
-
-const Constants = {
-	VERSION					: '2.1.4',
-	HEADER_CHUNK_TYPE  		: [0x4d, 0x54, 0x68, 0x64], // Mthd
-	HEADER_CHUNK_LENGTH  	: [0x00, 0x00, 0x00, 0x06], // Header size for SMF
-	HEADER_CHUNK_FORMAT0    : [0x00, 0x00], // Midi Type 0 id
-	HEADER_CHUNK_FORMAT1    : [0x00, 0x01], // Midi Type 1 id
-	HEADER_CHUNK_DIVISION   : [0x00, 0x80], // Defaults to 128 ticks per beat
-	TRACK_CHUNK_TYPE		: [0x4d, 0x54, 0x72, 0x6b], // MTrk,
-	META_EVENT_ID			: 0xFF,
-	META_TEXT_ID			: 0x01,
-	META_COPYRIGHT_ID		: 0x02,
-	META_TRACK_NAME_ID		: 0x03,
-	META_INSTRUMENT_NAME_ID : 0x04,
-	META_LYRIC_ID			: 0x05,
-	META_MARKER_ID			: 0x06,
-	META_CUE_POINT			: 0x07,
-	META_TEMPO_ID			: 0x51,
-	META_SMTPE_OFFSET		: 0x54,
-	META_TIME_SIGNATURE_ID	: 0x58,
-	META_KEY_SIGNATURE_ID	: 0x59,
-	META_END_OF_TRACK_ID	: [0x2F, 0x00],
-	CONTROLLER_CHANGE_STATUS: 0xB0, // includes channel number (0)
-	PITCH_BEND_STATUS       : 0xE0, // includes channel number (0)
-};
-
-export {Constants};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/controller-change-event.js.html b/docs/controller-change-event.js.html deleted file mode 100644 index 7ed3a62..0000000 --- a/docs/controller-change-event.js.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - controller-change-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

controller-change-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils.js';
-
-/**
- * Holds all data for a "controller change" MIDI event
- * @param {object} fields {controllerNumber: integer, controllerValue: integer}
- * @return {ControllerChangeEvent}
- */
-class ControllerChangeEvent {
-	constructor(fields) {
-		this.type = 'controller';
-		// delta time defaults to 0.
-		this.data = Utils.numberToVariableLength(0x00).concat(Constants.CONTROLLER_CHANGE_STATUS, fields.controllerNumber, fields.controllerValue);
-	}
-}
-
-export {ControllerChangeEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/copyright-event.js.html b/docs/copyright-event.js.html deleted file mode 100644 index b60ffdd..0000000 --- a/docs/copyright-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - copyright-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

copyright-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {string} text - Copyright text
- * @return {CopyrightEvent}
- */
-class CopyrightEvent {
-	constructor(text) {
-		this.type = 'copyright';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_COPYRIGHT_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {CopyrightEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/cue-point-event.js.html b/docs/cue-point-event.js.html deleted file mode 100644 index 892c0b5..0000000 --- a/docs/cue-point-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - cue-point-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

cue-point-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a cue point meta event.
- * @param {string} text - Cue point text
- * @return {CuePointEvent}
- */
-class CuePointEvent {
-	constructor(text) {
-		this.type = 'marker';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_CUE_POINT,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {CuePointEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/end-track-event.js.html b/docs/end-track-event.js.html deleted file mode 100644 index 60d07d8..0000000 --- a/docs/end-track-event.js.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - end-track-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

end-track-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a end track meta event.
- * @return {EndTrackEvent}
- */
-class EndTrackEvent {
-	constructor() {
-		this.type = 'end-track';
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_END_OF_TRACK_ID
-		);
-	}
-}
-
-export {EndTrackEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/fonts/OpenSans-Bold-webfont.eot b/docs/fonts/OpenSans-Bold-webfont.eot deleted file mode 100644 index 5d20d91..0000000 Binary files a/docs/fonts/OpenSans-Bold-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Bold-webfont.svg b/docs/fonts/OpenSans-Bold-webfont.svg deleted file mode 100644 index 3ed7be4..0000000 --- a/docs/fonts/OpenSans-Bold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Bold-webfont.woff b/docs/fonts/OpenSans-Bold-webfont.woff deleted file mode 100644 index 1205787..0000000 Binary files a/docs/fonts/OpenSans-Bold-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.eot b/docs/fonts/OpenSans-BoldItalic-webfont.eot deleted file mode 100644 index 1f639a1..0000000 Binary files a/docs/fonts/OpenSans-BoldItalic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.svg b/docs/fonts/OpenSans-BoldItalic-webfont.svg deleted file mode 100644 index 6a2607b..0000000 --- a/docs/fonts/OpenSans-BoldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.woff b/docs/fonts/OpenSans-BoldItalic-webfont.woff deleted file mode 100644 index ed760c0..0000000 Binary files a/docs/fonts/OpenSans-BoldItalic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Italic-webfont.eot b/docs/fonts/OpenSans-Italic-webfont.eot deleted file mode 100644 index 0c8a0ae..0000000 Binary files a/docs/fonts/OpenSans-Italic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Italic-webfont.svg b/docs/fonts/OpenSans-Italic-webfont.svg deleted file mode 100644 index e1075dc..0000000 --- a/docs/fonts/OpenSans-Italic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Italic-webfont.woff b/docs/fonts/OpenSans-Italic-webfont.woff deleted file mode 100644 index ff652e6..0000000 Binary files a/docs/fonts/OpenSans-Italic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Light-webfont.eot b/docs/fonts/OpenSans-Light-webfont.eot deleted file mode 100644 index 1486840..0000000 Binary files a/docs/fonts/OpenSans-Light-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Light-webfont.svg b/docs/fonts/OpenSans-Light-webfont.svg deleted file mode 100644 index 11a472c..0000000 --- a/docs/fonts/OpenSans-Light-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Light-webfont.woff b/docs/fonts/OpenSans-Light-webfont.woff deleted file mode 100644 index e786074..0000000 Binary files a/docs/fonts/OpenSans-Light-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.eot b/docs/fonts/OpenSans-LightItalic-webfont.eot deleted file mode 100644 index 8f44592..0000000 Binary files a/docs/fonts/OpenSans-LightItalic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.svg b/docs/fonts/OpenSans-LightItalic-webfont.svg deleted file mode 100644 index 431d7e3..0000000 --- a/docs/fonts/OpenSans-LightItalic-webfont.svg +++ /dev/null @@ -1,1835 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-LightItalic-webfont.woff b/docs/fonts/OpenSans-LightItalic-webfont.woff deleted file mode 100644 index 43e8b9e..0000000 Binary files a/docs/fonts/OpenSans-LightItalic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Regular-webfont.eot b/docs/fonts/OpenSans-Regular-webfont.eot deleted file mode 100644 index 6bbc3cf..0000000 Binary files a/docs/fonts/OpenSans-Regular-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Regular-webfont.svg b/docs/fonts/OpenSans-Regular-webfont.svg deleted file mode 100644 index 25a3952..0000000 --- a/docs/fonts/OpenSans-Regular-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Regular-webfont.woff b/docs/fonts/OpenSans-Regular-webfont.woff deleted file mode 100644 index e231183..0000000 Binary files a/docs/fonts/OpenSans-Regular-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Semibold-webfont.eot b/docs/fonts/OpenSans-Semibold-webfont.eot deleted file mode 100755 index d8375dd..0000000 Binary files a/docs/fonts/OpenSans-Semibold-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Semibold-webfont.svg b/docs/fonts/OpenSans-Semibold-webfont.svg deleted file mode 100755 index eec4db8..0000000 --- a/docs/fonts/OpenSans-Semibold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Semibold-webfont.ttf b/docs/fonts/OpenSans-Semibold-webfont.ttf deleted file mode 100755 index b329084..0000000 Binary files a/docs/fonts/OpenSans-Semibold-webfont.ttf and /dev/null differ diff --git a/docs/fonts/OpenSans-Semibold-webfont.woff b/docs/fonts/OpenSans-Semibold-webfont.woff deleted file mode 100755 index 28d6ade..0000000 Binary files a/docs/fonts/OpenSans-Semibold-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.eot b/docs/fonts/OpenSans-SemiboldItalic-webfont.eot deleted file mode 100755 index 0ab1db2..0000000 Binary files a/docs/fonts/OpenSans-SemiboldItalic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.svg b/docs/fonts/OpenSans-SemiboldItalic-webfont.svg deleted file mode 100755 index 7166ec1..0000000 --- a/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf b/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf deleted file mode 100755 index d2d6318..0000000 Binary files a/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf and /dev/null differ diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.woff b/docs/fonts/OpenSans-SemiboldItalic-webfont.woff deleted file mode 100755 index d4dfca4..0000000 Binary files a/docs/fonts/OpenSans-SemiboldItalic-webfont.woff and /dev/null differ diff --git a/docs/global.html b/docs/global.html deleted file mode 100644 index f8f72f0..0000000 --- a/docs/global.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - Global - Documentation - - - - - - - - - - - - - - - - - -
- -

Global

- - - - - - - -
- -
- -

- -

- - -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - -

Members

- - - -
-

(constant) Constants

- - - - -
- MIDI file format constants. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
- - - - - -

Methods

- - - -
- - - -

scale14bits(fields) → {PitchBendEvent}

- - - - - -
- Holds all data for a "Pitch Bend" MIDI event -[ -1.0, 0, 1.0 ] -> [ 0, 8192, 16383] -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -object - - - - - { bend : float, channel : int, delta: int } - -
- - - - - - - - - - - - - - -
-
Returns:
- - - -
-
- Type: -
-
- -PitchBendEvent - - -
-
- - - -
- - - -
- - - - - - -
- -
- - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/header-chunk.js.html b/docs/header-chunk.js.html deleted file mode 100644 index 48ee545..0000000 --- a/docs/header-chunk.js.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - header-chunk.js - Documentation - - - - - - - - - - - - - - - - - -
- -

header-chunk.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a header chunk section of a MIDI file.
- * @param {number} numberOfTracks - Number of tracks
- * @return {HeaderChunk}
- */
-class HeaderChunk {
-	constructor(numberOfTracks) {
-		this.type = Constants.HEADER_CHUNK_TYPE;
-
-		const trackType = numberOfTracks > 1 ? Constants.HEADER_CHUNK_FORMAT1 : Constants.HEADER_CHUNK_FORMAT0;
-
-		this.data = trackType.concat(
-					Utils.numberToBytes(numberOfTracks, 2), // two bytes long,
-					Constants.HEADER_CHUNK_DIVISION
-		);
-
-		this.size = [0, 0, 0, this.data.length];
-	}
-}
-
-export {HeaderChunk};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 4be6726..0000000 --- a/docs/index.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - Home - Documentation - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-

♬ MidiWriterJS

-

npm version -Build Status -Try midi-writer-js on RunKit

-

MidiWriterJS is a JavaScript library providing an API for generating expressive multi-track MIDI files.

-

Note that the master branch is in active development so if you're looking for a tried and true stable version please use the latest release.

-

Source Documentation

-

Install

-
npm install midi-writer-js
-
-

Getting Started

-
import MidiWriter from 'midi-writer-js';
-
-// Start with a new track
-const track = new MidiWriter.Track();
-
-// Define an instrument (optional):
-track.addEvent(new MidiWriter.ProgramChangeEvent({instrument: 1}));
-
-// Add some notes:
-const note = new MidiWriter.NoteEvent({pitch: ['C4', 'D4', 'E4'], duration: '4'});
-track.addEvent(note);
-
-// Generate a data URI
-const write = new MidiWriter.Writer(track);
-console.log(write.dataUri());
-
-

Documentation

-

MidiWriter.Track()

-
    -
  • addEvent({event}, mapFunction)
  • -
  • setTempo(tempo)
  • -
  • addText(text)
  • -
  • addCopyright(text)
  • -
  • addTrackName(text)
  • -
  • addInstrumentName(text)
  • -
  • addMarker(text)
  • -
  • addCuePoint(text)
  • -
  • addLyric(text)
  • -
  • setTimeSignature(numerator, denominator)
  • -
-

MidiWriter.NoteEvent({options})

-

The NoteEvent supports these options:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
pitchstring or arrayEach pitch can be a string or valid MIDI note code. Format for string is C#4. Pro tip: You can use the output from tonal functions to build scales, chords, intervals, etc. in this parameter.
durationstring or array - How long the note should sound. -
    -
  • 1 : whole
  • -
  • 2 : half
  • -
  • d2 : dotted half
  • -
  • dd2 : double dotted half
  • -
  • 4 : quarter
  • -
  • 4t : quarter triplet
  • -
  • d4 : dotted quarter
  • -
  • dd4 : double dotted quarter
  • -
  • 8 : eighth
  • -
  • 8t : eighth triplet
  • -
  • d8 : dotted eighth
  • -
  • dd8 : double dotted eighth
  • -
  • 16 : sixteenth
  • -
  • 16t : sixteenth triplet
  • -
  • 32 : thirty-second
  • -
  • 64 : sixty-fourth
  • -
  • Tn : where n is an explicit number of ticks (T128 = 1 beat)
  • -
- If an array of durations is passed then the sum of the durations will be used. -
waitstring or array0How long to wait before sounding note (rest). Takes same values as duration.
sequentialbooleanfalseIf true then array of pitches will be played sequentially as opposed to simulatanously.
velocitynumber50How loud the note should sound, values 1-100.
repeatnumber1How many times this event should be repeated.
channelnumber1MIDI channel to use.
gracestring or arrayGrace note to be applied to note event. Takes same value format as pitch
startTicknumberSpecific tick where this event should be played. If this parameter is supplied then wait is disregarded if also supplied.
-

MidiWriter.Writer(tracks)

-

The Writer class provides a few ways to output the file:

-
    -
  • buildFile() Uint8Array
  • -
  • base64() string
  • -
  • dataUri() string
  • -
  • stdout() file stream (cli)
  • -
-

Hot Cross Buns

-

Here's an example of how everyone's favorite song "Hot Cross Buns" could be written. Note use of the mapping function passed as the second argument of addEvent(). This can be used to apply specific properties to all events. With some -street smarts you could also use it for programmatic crescendos and other property 'animation'.

-
import MidiWriter from 'midi-writer-js';
-
-const track = new MidiWriter.Track();
-
-track.addEvent([
-		new MidiWriter.NoteEvent({pitch: ['E4','D4'], duration: '4'}),
-		new MidiWriter.NoteEvent({pitch: ['C4'], duration: '2'}),
-		new MidiWriter.NoteEvent({pitch: ['E4','D4'], duration: '4'}),
-		new MidiWriter.NoteEvent({pitch: ['C4'], duration: '2'}),
-		new MidiWriter.NoteEvent({pitch: ['C4', 'C4', 'C4', 'C4', 'D4', 'D4', 'D4', 'D4'], duration: '8'}),
-		new MidiWriter.NoteEvent({pitch: ['E4','D4'], duration: '4'}),
-		new MidiWriter.NoteEvent({pitch: ['C4'], duration: '2'})
-	], function(event, index) {
-    return {sequential: true};
-  }
-);
-
-const write = new MidiWriter.Writer(track);
-console.log(write.dataUri());
-
-

VexFlow Integration

-

MidiWriterJS can export MIDI from VexFlow voices, though this feature is still experimental. Current usage is to use MidiWriter.VexFlow.trackFromVoice(voice) to create a MidiWriterJS Track object:

-

-// ...VexFlow code defining notes
-const voice = create_4_4_voice().addTickables(notes);
-
-const vexWriter = new MidiWriter.VexFlow();
-const track = vexWriter.trackFromVoice(voice);
-const writer = new MidiWriter.Writer([track]);
-console.log(writer.dataUri());
-
-
- - - - - - -
- -
- - - - - - - \ No newline at end of file diff --git a/docs/instrument-name-event.js.html b/docs/instrument-name-event.js.html deleted file mode 100644 index 033b4f1..0000000 --- a/docs/instrument-name-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - instrument-name-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

instrument-name-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of an instrument name meta event.
- * @param {number} bpm - Beats per minute
- * @return {InstrumentNameEvent}
- */
-class InstrumentNameEvent {
-	constructor(text) {
-		this.type = 'instrument-name';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_INSTRUMENT_NAME_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Instrument name
-		);
-	}
-}
-
-export {InstrumentNameEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/lyric-event.js.html b/docs/lyric-event.js.html deleted file mode 100644 index 0557f46..0000000 --- a/docs/lyric-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - lyric-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

lyric-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a lyric meta event.
- * @param {string} text - Lyric text
- * @return {LyricEvent}
- */
-class LyricEvent {
-	constructor(text) {
-		this.type = 'marker';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_LYRIC_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {LyricEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/marker-event.js.html b/docs/marker-event.js.html deleted file mode 100644 index 7e76346..0000000 --- a/docs/marker-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - marker-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

marker-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a marker meta event.
- * @param {string} text - Marker text
- * @return {MarkerEvent}
- */
-class MarkerEvent {
-	constructor(text) {
-		this.type = 'marker';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_MARKER_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {MarkerEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-event.js.html b/docs/meta-event.js.html deleted file mode 100644 index 63011e1..0000000 --- a/docs/meta-event.js.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - meta-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a meta event.
- * @param {object} fields - type, data
- * @return {MetaEvent}
- */
-class MetaEvent {
-	constructor(fields) {
-		this.type = 'meta';
-		this.data = Utils.numberToVariableLength(0x00);// Start with zero time delta
-		this.data = this.data.concat(Constants.META_EVENT_ID, fields.data);
-	}
-}
-
-export {MetaEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_controller-change-event.js.html b/docs/meta-events_controller-change-event.js.html deleted file mode 100644 index 9a9f480..0000000 --- a/docs/meta-events_controller-change-event.js.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - meta-events/controller-change-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/controller-change-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils.js';
-
-/**
- * Holds all data for a "controller change" MIDI event
- * @param {object} fields {controllerNumber: integer, controllerValue: integer, delta: integer}
- * @return {ControllerChangeEvent}
- */
-class ControllerChangeEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'controller';
-		// delta time defaults to 0.
-		this.data = Utils.numberToVariableLength(fields.delta).concat(Constants.CONTROLLER_CHANGE_STATUS, fields.controllerNumber, fields.controllerValue);
-	}
-}
-
-export {ControllerChangeEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_copyright-event.js.html b/docs/meta-events_copyright-event.js.html deleted file mode 100644 index 02c5f05..0000000 --- a/docs/meta-events_copyright-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/copyright-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/copyright-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {CopyrightEvent}
- */
-class CopyrightEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'copyright';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_COPYRIGHT_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {CopyrightEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_cue-point-event.js.html b/docs/meta-events_cue-point-event.js.html deleted file mode 100644 index bb493bd..0000000 --- a/docs/meta-events_cue-point-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/cue-point-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/cue-point-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a cue point meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {CuePointEvent}
- */
-class CuePointEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'cue-point';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_CUE_POINT,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {CuePointEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_end-track-event.js.html b/docs/meta-events_end-track-event.js.html deleted file mode 100644 index 447b89d..0000000 --- a/docs/meta-events_end-track-event.js.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - meta-events/end-track-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/end-track-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a end track meta event.
- * @param {object} fields {delta: integer}
- * @return {EndTrackEvent}
- */
-class EndTrackEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'end-track';
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_END_OF_TRACK_ID
-		);
-	}
-}
-
-export {EndTrackEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_instrument-name-event.js.html b/docs/meta-events_instrument-name-event.js.html deleted file mode 100644 index 67b82b9..0000000 --- a/docs/meta-events_instrument-name-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/instrument-name-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/instrument-name-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of an instrument name meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {InstrumentNameEvent}
- */
-class InstrumentNameEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'instrument-name';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_INSTRUMENT_NAME_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Instrument name
-		);
-	}
-}
-
-export {InstrumentNameEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_key-signature-event.js.html b/docs/meta-events_key-signature-event.js.html deleted file mode 100644 index 69af62a..0000000 --- a/docs/meta-events_key-signature-event.js.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - meta-events/key-signature-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/key-signature-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a key signature meta event.
- * @return {KeySignatureEvent}
- */
-class KeySignatureEvent {
-	constructor(sf, mi) {
-		this.type = 'key-signature';
-
-		var mode = mi || 0;
-		sf = sf || 0;
-
-		//	Function called with string notation
-		if (typeof mi === 'undefined') {
-			var fifths = [
-				['Cb', 'Gb', 'Db', 'Ab', 'Eb', 'Bb', 'F', 'C', 'G', 'D', 'A', 'E', 'B', 'F#', 'C#'],
-				['ab', 'eb', 'bb', 'f', 'c', 'g', 'd', 'a', 'e', 'b', 'f#', 'c#', 'g#', 'd#', 'a#']
-			];
-			var _sflen = sf.length;
-			var note = sf || 'C';
-
-			if (sf[0] === sf[0].toLowerCase()) mode = 1
-
-			if (_sflen > 1) {
-				switch (sf.charAt(_sflen - 1)) {
-					case 'm':
-						mode = 1;
-						note = sf.charAt(0).toLowerCase();
-						note = note.concat(sf.substring(1, _sflen - 1));
-						break;
-					case '-':
-						mode = 1;
-						note = sf.charAt(0).toLowerCase();
-						note = note.concat(sf.substring(1, _sflen - 1));
-						break;
-					case 'M':
-						mode = 0;
-						note = sf.charAt(0).toUpperCase();
-						note = note.concat(sf.substring(1, _sflen - 1));
-						break;
-					case '+':
-						mode = 0;
-						note = sf.charAt(0).toUpperCase();
-						note = note.concat(sf.substring(1, _sflen - 1));
-						break;
-				}
-			}
-
-			var fifthindex = fifths[mode].indexOf(note);
-			sf = fifthindex === -1 ? 0 : fifthindex - 7;
-		}
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_KEY_SIGNATURE_ID,
-			[0x02], // Size
-			Utils.numberToBytes(sf, 1), // Number of sharp or flats ( < 0 flat; > 0 sharp)
-			Utils.numberToBytes(mode, 1), // Mode: 0 major, 1 minor
-		);
-	}
-}
-
-export {KeySignatureEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_lyric-event.js.html b/docs/meta-events_lyric-event.js.html deleted file mode 100644 index a52c51b..0000000 --- a/docs/meta-events_lyric-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/lyric-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/lyric-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a lyric meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {LyricEvent}
- */
-class LyricEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'lyric';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_LYRIC_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {LyricEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_marker-event.js.html b/docs/meta-events_marker-event.js.html deleted file mode 100644 index e37fbda..0000000 --- a/docs/meta-events_marker-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/marker-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/marker-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a marker meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {MarkerEvent}
- */
-class MarkerEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'marker';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_MARKER_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {MarkerEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_pitch-bend-event.js.html b/docs/meta-events_pitch-bend-event.js.html deleted file mode 100644 index deb7520..0000000 --- a/docs/meta-events_pitch-bend-event.js.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - meta-events/pitch-bend-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/pitch-bend-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Holds all data for a "Pitch Bend" MIDI event
- * [ -1.0, 0, 1.0 ] ->  [ 0, 8192, 16383]
- * @param {object} fields { bend : float, channel : int, delta: int }
- * @return {PitchBendEvent}
- */
-const scale14bits = (zeroOne) => {
-    if ( zeroOne <= 0 ) {
-        return Math.floor( 16384 * ( zeroOne + 1 ) / 2 );
-    }
-
-    return Math.floor( 16383 * ( zeroOne + 1 ) / 2 );
-}
-
-class PitchBendEvent {
-    constructor(fields) {
-        // Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'pitch-bend';
- 
-		let bend14 = scale14bits(fields.bend);
-		let channel = fields.channel || 0;
-
-		let lsbValue = bend14 & 0x7f;          
-		let msbValue = ( bend14 >> 7 ) & 0x7f;
-		this.data = Utils.numberToVariableLength(fields.delta).concat(Constants.PITCH_BEND_STATUS | channel, lsbValue, msbValue);
-    }
-}
-
-export {PitchBendEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_program-change-event.js.html b/docs/meta-events_program-change-event.js.html deleted file mode 100644 index a5d2dd6..0000000 --- a/docs/meta-events_program-change-event.js.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - meta-events/program-change-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/program-change-event.js

- - - - - - - -
-
-
import {Utils} from '../utils';
-
-/**
- * Holds all data for a "program change" MIDI event
- * @param {object} fields {instrument: integer, delta: integer}
- * @return {ProgramChangeEvent}
- */
-class ProgramChangeEvent {
-	constructor(fields) {
-		// Set default fields
-		this.fields = Object.assign({
-			channel: 1,
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'program';
-		// delta time defaults to 0.
-		this.data = Utils.numberToVariableLength(this.fields.delta).concat(this.getStatusByte(), this.fields.instrument);
-	}
-
-
-	/**
-	 * Gets the status code based on the selected channel. 0xC{0-F}
-	 * Program change status byte for channel 0 is 0xC0 (192)
-	 * 0 = Ch 1
-	 * @return {number}
-	 */
-	getStatusByte() {return 192 + this.fields.channel - 1}
-}
-
-export {ProgramChangeEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_tempo-event.js.html b/docs/meta-events_tempo-event.js.html deleted file mode 100644 index 45062e8..0000000 --- a/docs/meta-events_tempo-event.js.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - meta-events/tempo-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/tempo-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {object} fields {bpm: integer, delta: integer}
- * @return {TempoEvent}
- */
-class TempoEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'tempo';
-
-		this.tick = fields.tick;
-
-		const tempo = Math.round(60000000 / fields.bpm);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TEMPO_ID,
-			[0x03], // Size
-			Utils.numberToBytes(tempo, 3), // Tempo, 3 bytes
-		);
-	}
-}
-
-export {TempoEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_text-event.js.html b/docs/meta-events_text-event.js.html deleted file mode 100644 index a1966dc..0000000 --- a/docs/meta-events_text-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/text-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/text-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {TextEvent}
- */
-class TextEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'text';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TEXT_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {TextEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_time-signature-event.js.html b/docs/meta-events_time-signature-event.js.html deleted file mode 100644 index 7dd49da..0000000 --- a/docs/meta-events_time-signature-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - meta-events/time-signature-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/time-signature-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a time signature meta event.
- * @return {TimeSignatureEvent}
- */
-class TimeSignatureEvent {
-	constructor(numerator, denominator, midiclockspertick, notespermidiclock) {
-		this.type = 'time-signature';
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TIME_SIGNATURE_ID,
-			[0x04], // Size
-			Utils.numberToBytes(numerator, 1), // Numerator, 1 bytes
-			Utils.numberToBytes(Math.log2(denominator), 1), // Denominator is expressed as pow of 2, 1 bytes
-			Utils.numberToBytes(midiclockspertick || 24, 1), // MIDI Clocks per tick, 1 bytes
-			Utils.numberToBytes(notespermidiclock || 8, 1), // Number of 1/32 notes per MIDI clocks, 1 bytes
-		);
-	}
-}
-
-export {TimeSignatureEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/meta-events_track-name-event.js.html b/docs/meta-events_track-name-event.js.html deleted file mode 100644 index bfab2f0..0000000 --- a/docs/meta-events_track-name-event.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - meta-events/track-name-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

meta-events/track-name-event.js

- - - - - - - -
-
-
import {Constants} from '../constants';
-import {Utils} from '../utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {object} fields {text: string, delta: integer}
- * @return {TrackNameEvent}
- */
-class TrackNameEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			delta: 0x00,
-		}, fields);
-
-		this.type = 'track-name';
-
-		const textBytes = Utils.stringToBytes(fields.text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(fields.delta).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TRACK_NAME_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {TrackNameEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-event.js.html b/docs/note-event.js.html deleted file mode 100644 index 8b698d8..0000000 --- a/docs/note-event.js.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - note-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {NoteOnEvent} from './note-on-event';
-import {NoteOffEvent} from './note-off-event';
-import {Utils} from './utils';
-
-/**
- * Wrapper for noteOnEvent/noteOffEvent objects that builds both events.
- * @param {object} fields - {pitch: '[C4]', duration: '4', wait: '4', velocity: 1-100}
- * @return {NoteEvent}
- */
-class NoteEvent {
-	constructor(fields) {
-		this.data 		= [];
-		this.type 		= 'note';
-		this.pitch 		= Utils.toArray(fields.pitch);
-		this.wait 		= fields.wait || 0;
-		this.duration 	= fields.duration;
-		this.sequential = fields.sequential || false;
-		this.velocity 	= fields.velocity || 50;
-		this.channel 	= fields.channel || 1;
-		this.repeat 	= fields.repeat || 1;
-		this.grace		= fields.grace;
-		this.startTick	= fields.startTick || null;
-		this.tickDuration = Utils.getTickDuration(this.duration);
-		this.restDuration = Utils.getTickDuration(this.wait);
-
-		this.events 	= []; // Hold actual NoteOn/NoteOff events
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @return {NoteEvent}
-	 */
-	buildData() {
-		// Reset data array
-		this.data = [];
-
-		var tickDuration = this.tickDuration;
-		var restDuration = this.restDuration;
-
-		// Apply grace note(s) and subtract ticks (currently 1 tick per grace note) from tickDuration so net value is the same
-		if (this.grace) {
-			let graceDuration = 1;
-			this.grace = Utils.toArray(this.grace);
-			this.grace.forEach((pitch) => {
-				let noteEvent = new NoteEvent({pitch:this.grace, duration:'T' + graceDuration});
-				this.data = this.data.concat(noteEvent.data)
-
-				tickDuration -= graceDuration;
-			});
-		}
-
-		// fields.pitch could be an array of pitches.
-		// If so create note events for each and apply the same duration.
-		var noteOn, noteOff;
-		// By default this is a chord if it's an array of notes that requires one NoteOnEvent.
-		// If this.sequential === true then it's a sequential string of notes that requires separate NoteOnEvents.
-		if ( ! this.sequential) {
-			// Handle repeat
-			for (var j = 0; j < this.repeat; j++) {
-				// Note on
-				this.pitch.forEach((p, i) => {
-					if (i == 0) {
-						var noteOnNew = new NoteOnEvent({
-													wait: this.wait,
-													velocity: this.velocity,
-													pitch: p,
-													startTick: this.startTick
-						});
-
-					} else {
-						// Running status (can ommit the note on status)
-						//noteOn = new NoteOnEvent({data: [0, Utils.getPitch(p), Utils.convertVelocity(this.velocity)]});
-						var noteOnNew = new NoteOnEvent({
-													wait: 0,
-													velocity: this.velocity,
-													pitch: p,
-													startTick: this.startTick
-						});
-					}
-
-					this.events.push(noteOnNew);
-				});
-
-				// Note off
-				this.pitch.forEach((p, i) => {
-					if (i == 0) {
-						//noteOff = new NoteOffEvent({data: Utils.numberToVariableLength(tickDuration).concat(this.getNoteOffStatus(), Utils.getPitch(p), Utils.convertVelocity(this.velocity))});
-						var noteOffNew = new NoteOffEvent({
-													duration: this.duration,
-													velocity: this.velocity,
-													pitch: p,
-													noteOnTick: this.startTick,
-						});
-
-					} else {
-						// Running status (can ommit the note off status)
-						//noteOff = new NoteOffEvent({data: [0, Utils.getPitch(p), Utils.convertVelocity(this.velocity)]});
-						var noteOffNew = new NoteOffEvent({
-													duration: 0,
-													velocity: this.velocity,
-													pitch: p,
-													noteOnTick: this.startTick,
-						});
-					}
-
-					this.events.push(noteOffNew);
-				});
-			}
-
-		} else {
-			// Handle repeat
-			for (var j = 0; j < this.repeat; j++) {
-				this.pitch.forEach((p, i) => {
-					// restDuration only applies to first note
-					if (i > 0) {
-						restDuration = 0;
-					}
-
-					// If duration is 8th triplets we need to make sure that the total ticks == quarter note.
-					// So, the last one will need to be the remainder
-					if (this.duration === '8t' && i == this.pitch.length - 1) {
-						let quarterTicks = Utils.numberFromBytes(Constants.HEADER_CHUNK_DIVISION);
-						tickDuration = quarterTicks - (tickDuration * 2);
-					}
-
-					var noteOnNew = new NoteOnEvent({
-													wait: (i > 0 ? 0 : this.wait), // wait only applies to first note in repetition
-													velocity: this.velocity,
-													pitch: p,
-													startTick: this.startTick,
-					});
-
-					var noteOffNew = new NoteOffEvent({
-													duration: this.duration,
-													velocity: this.velocity,
-													pitch: p,
-													noteOnTick: this.startTick,
-					});
-
-					this.events.push(noteOnNew, noteOffNew);
-				});
-			}
-		}
-
-		return this;
-	};
-}
-
-export {NoteEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-events_note-event.js.html b/docs/note-events_note-event.js.html deleted file mode 100644 index 9a0cf50..0000000 --- a/docs/note-events_note-event.js.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - note-events/note-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-events/note-event.js

- - - - - - - -
-
-
import {NoteOnEvent} from './note-on-event';
-import {NoteOffEvent} from './note-off-event';
-import {Utils} from '../utils';
-
-/**
- * Wrapper for noteOnEvent/noteOffEvent objects that builds both events.
- * @param {object} fields - {pitch: '[C4]', duration: '4', wait: '4', velocity: 1-100}
- * @return {NoteEvent}
- */
-class NoteEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			channel: 1,
-			repeat: 1,
-			sequential: false,
-			startTick: null,
-			velocity: 50,
-			wait: 0,
-		}, fields);
-
-		this.data 		= [];
-		this.type 		= 'note';
-		this.pitch 		= Utils.toArray(fields.pitch);
-
-		this.channel 	= fields.channel;
-		this.duration 	= fields.duration;
-		this.grace		= fields.grace;
-		this.repeat 	= fields.repeat;
-		this.sequential = fields.sequential;
-		this.startTick	= fields.startTick;
-		this.velocity 	= fields.velocity;
-		this.wait 		= fields.wait;
-
-		this.tickDuration = Utils.getTickDuration(this.duration);
-		this.restDuration = Utils.getTickDuration(this.wait);
-
-		this.events 	= []; // Hold actual NoteOn/NoteOff events
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @return {NoteEvent}
-	 */
-	buildData() {
-		// Reset data array
-		this.data = [];
-
-		// Apply grace note(s) and subtract ticks (currently 1 tick per grace note) from tickDuration so net value is the same
-		if (this.grace) {
-			let graceDuration = 1;
-			this.grace = Utils.toArray(this.grace);
-			this.grace.forEach(() => {
-				let noteEvent = new NoteEvent({pitch: this.grace, duration:'T' + graceDuration});
-				this.data = this.data.concat(noteEvent.data);
-			});
-		}
-
-		// fields.pitch could be an array of pitches.
-		// If so create note events for each and apply the same duration.
-
-		// By default this is a chord if it's an array of notes that requires one NoteOnEvent.
-		// If this.sequential === true then it's a sequential string of notes that requires separate NoteOnEvents.
-		if ( ! this.sequential) {
-			// Handle repeat
-			for (let j = 0; j < this.repeat; j++) {
-				// Note on
-				this.pitch.forEach((p, i) => {
-					let noteOnNew;
-
-					if (i == 0) {
-						noteOnNew = new NoteOnEvent({
-							channel: this.channel,
-							wait: this.wait,
-							velocity: this.velocity,
-							pitch: p,
-							startTick: this.startTick
-						});
-
-					} else {
-						// Running status (can ommit the note on status)
-						//noteOn = new NoteOnEvent({data: [0, Utils.getPitch(p), Utils.convertVelocity(this.velocity)]});
-						noteOnNew = new NoteOnEvent({
-							channel: this.channel,
-							wait: 0,
-							velocity: this.velocity,
-							pitch: p,
-							startTick: this.startTick
-						});
-					}
-
-					this.events.push(noteOnNew);
-				});
-
-				// Note off
-				this.pitch.forEach((p, i) => {
-					let noteOffNew;
-
-					if (i == 0) {
-						//noteOff = new NoteOffEvent({data: Utils.numberToVariableLength(tickDuration).concat(this.getNoteOffStatus(), Utils.getPitch(p), Utils.convertVelocity(this.velocity))});
-						noteOffNew = new NoteOffEvent({
-							channel: this.channel,
-							duration: this.duration,
-							velocity: this.velocity,
-							pitch: p,
-							tick: this.startTick !== null ? Utils.getTickDuration(this.duration) + this.startTick : null,
-						});
-
-					} else {
-						// Running status (can ommit the note off status)
-						//noteOff = new NoteOffEvent({data: [0, Utils.getPitch(p), Utils.convertVelocity(this.velocity)]});
-						noteOffNew = new NoteOffEvent({
-							channel: this.channel,
-							duration: 0,
-							velocity: this.velocity,
-							pitch: p,
-							tick: this.startTick !== null ? Utils.getTickDuration(this.duration) + this.startTick : null,
-						});
-					}
-
-					this.events.push(noteOffNew);
-				});
-			}
-
-		} else {
-			// Handle repeat
-			for (let j = 0; j < this.repeat; j++) {
-				this.pitch.forEach((p, i) => {
-					const noteOnNew = new NoteOnEvent({
-						channel: this.channel,
-						wait: (i > 0 ? 0 : this.wait), // wait only applies to first note in repetition
-						velocity: this.velocity,
-						pitch: p,
-						startTick: this.startTick,
-					});
-
-					const noteOffNew = new NoteOffEvent({
-						channel: this.channel,
-						duration: this.duration,
-						velocity: this.velocity,
-						pitch: p,
-					});
-
-					this.events.push(noteOnNew, noteOffNew);
-				});
-			}
-		}
-
-		return this;
-	}
-}
-
-export {NoteEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-events_note-off-event.js.html b/docs/note-events_note-off-event.js.html deleted file mode 100644 index 928a406..0000000 --- a/docs/note-events_note-off-event.js.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - note-events/note-off-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-events/note-off-event.js

- - - - - - - -
-
-
import {Utils} from '../utils';
-
-/**
- * Holds all data for a "note off" MIDI event
- * @param {object} fields {data: []}
- * @return {NoteOffEvent}
- */
-class NoteOffEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			channel: 1,
-			velocity: 50,
-			tick: null,
-		}, fields);
-
-		this.type 		= 'note-off';
-		this.channel 	= fields.channel;
-		this.pitch 		= fields.pitch;
-		this.duration 	= fields.duration;
-		this.velocity 	= fields.velocity;
-
-		this.tick 		= fields.tick;
-		this.delta 		= Utils.getTickDuration(this.duration);
-		this.data 		= fields.data;
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @param {Track} track - parent track
-	 * @return {NoteOffEvent}
-	 */
-	buildData(track, precisionDelta, options = {}) {
-		if (this.tick === null) {
-			this.tick = Utils.getRoundedIfClose(this.delta + track.tickPointer);
-		}
-
-		this.deltaWithPrecisionCorrection = Utils.getRoundedIfClose(this.delta - precisionDelta);
-
-		this.data = Utils.numberToVariableLength(this.deltaWithPrecisionCorrection)
-					.concat(
-							this.getStatusByte(),
-							Utils.getPitch(this.pitch, options.middleC),
-							Utils.convertVelocity(this.velocity)
-					);
-
-		return this;
-	}
-
-	/**
-	 * Gets the note off status code based on the selected channel. 0x8{0-F}
-	 * Note off at channel 0 is 0x80 (128)
-	 * 0 = Ch 1
-	 * @return {number}
-	 */
-	getStatusByte() {return 128 + this.channel - 1}
-}
-
-export {NoteOffEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-events_note-on-event.js.html b/docs/note-events_note-on-event.js.html deleted file mode 100644 index 114d8e8..0000000 --- a/docs/note-events_note-on-event.js.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - note-events/note-on-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-events/note-on-event.js

- - - - - - - -
-
-
import {Utils} from '../utils';
-
-/**
- * Holds all data for a "note on" MIDI event
- * @param {object} fields {data: []}
- * @return {NoteOnEvent}
- */
-class NoteOnEvent {
-	constructor(fields) {
-		// Set default fields
-		fields = Object.assign({
-			channel: 1,
-			startTick: null,
-			velocity: 50,
-			wait: 0,
-		}, fields);
-
-		this.type 		= 'note-on';
-		this.channel 	= fields.channel;
-		this.pitch 		= fields.pitch;
-		this.wait 		= fields.wait;
-		this.velocity 	= fields.velocity;
-		this.startTick 	= fields.startTick;
-
-		this.tick 		= null;
-		this.delta 		= null;
-		this.data 		= fields.data;
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @param {Track} track - parent track
-	 * @return {NoteOnEvent}
-	 */
-	buildData(track, precisionDelta, options = {}) {
-		this.data = [];
-
-		// Explicitly defined startTick event
-		if (this.startTick) {
-			this.tick = Utils.getRoundedIfClose(this.startTick);
-
-			// If this is the first event in the track then use event's starting tick as delta.
-			if (track.tickPointer == 0) {
-				this.delta = this.tick;
-			}
-
-		} else {
-			this.delta = Utils.getTickDuration(this.wait);
-			this.tick = Utils.getRoundedIfClose(track.tickPointer + this.delta);
-		}
-
-		this.deltaWithPrecisionCorrection = Utils.getRoundedIfClose(this.delta - precisionDelta);
-
-		this.data = Utils.numberToVariableLength(this.deltaWithPrecisionCorrection)
-					.concat(
-							this.getStatusByte(),
-							Utils.getPitch(this.pitch, options.middleC),
-							Utils.convertVelocity(this.velocity)
-					);
-
-		return this;
-	}
-
-	/**
-	 * Gets the note on status code based on the selected channel. 0x9{0-F}
-	 * Note on at channel 0 is 0x90 (144)
-	 * 0 = Ch 1
-	 * @return {number}
-	 */
-	getStatusByte() {return 144 + this.channel - 1}
-}
-
-export {NoteOnEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-off-event.js.html b/docs/note-off-event.js.html deleted file mode 100644 index 094fb32..0000000 --- a/docs/note-off-event.js.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - note-off-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-off-event.js

- - - - - - - -
-
-
import {Utils} from './utils';
-
-/**
- * Holds all data for a "note off" MIDI event
- * @param {object} fields {data: []}
- * @return {NoteOffEvent}
- */
-class NoteOffEvent {
-	constructor(fields) {
-		this.type 		= 'note-off';
-		this.channel 	= fields.channel || 1;
-		this.pitch 		= fields.pitch;
-		this.duration 	= fields.duration;
-		this.velocity 	= fields.velocity || 50;
-		this.noteOnTick = fields.noteOnTick || null;
-
-		this.midiNumber = Utils.getPitch(this.pitch);
-		this.tick 		= null;
-		this.delta 		= Utils.getTickDuration(this.duration);
-		this.data 		= fields.data;	
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @return {NoteOffEvent}
-	 */
-	buildData(track, eventIndex) {
-		if (this.noteOnTick) {
-			this.tick = this.noteOnTick + Utils.getTickDuration(this.duration);
-
-		} else {
-			this.tick = this.delta + track.tickPointer;
-		}
-
-		this.data = Utils.numberToVariableLength(this.delta)
-					.concat(
-							this.getStatusByte(),
-							this.midiNumber,
-							Utils.convertVelocity(this.velocity)
-					);
-
-		return this;
-	}
-
-	/**
-	 * Gets the note off status code based on the selected channel. 0x8{0-F}
-	 * Note off at channel 0 is 0x80 (128)
-	 * 0 = Ch 1
-	 * @return {number}
-	 */
-	getStatusByte() {return 128 + this.channel - 1}
-}
-
-export {NoteOffEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/note-on-event.js.html b/docs/note-on-event.js.html deleted file mode 100644 index 61e0db7..0000000 --- a/docs/note-on-event.js.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - note-on-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

note-on-event.js

- - - - - - - -
-
-
import {Utils} from './utils';
-
-/**
- * Holds all data for a "note on" MIDI event
- * @param {object} fields {data: []}
- * @return {NoteOnEvent}
- */
-class NoteOnEvent {
-	constructor(fields) {
-		this.type 		= 'note-on';
-		this.channel 	= fields.channel || 1;
-		this.pitch 		= fields.pitch;
-		this.wait 		= fields.wait || 0;
-		this.velocity 	= fields.velocity || 50;
-		this.startTick 	= fields.startTick || null;
-
-		this.midiNumber = Utils.getPitch(this.pitch);
-		this.tick 		= null;
-		this.delta 		= null;
-		this.data 		= fields.data;
-	}
-
-	/**
-	 * Builds int array for this event.
-	 * @return {NoteOnEvent}
-	 */
-	buildData(track, eventIndex) {
-		this.data = [];
-
-		// Explicitly defined startTick event
-		if (this.startTick) {
-			this.tick = this.startTick;
-
-			// If this is the first event in the track then use event's starting tick as delta.
-			if (track.tickPointer == 0) {
-				this.delta = this.tick;
-			}
-
-		} else {
-			this.delta = Utils.getTickDuration(this.wait);
-			this.tick = track.tickPointer + this.delta;
-		}
-
-		this.data = Utils.numberToVariableLength(this.delta)
-					.concat(
-							this.getStatusByte(),
-							this.midiNumber,
-							Utils.convertVelocity(this.velocity)
-					);
-
-		return this;
-	}
-
-	/**
-	 * Gets the note on status code based on the selected channel. 0x9{0-F}
-	 * Note on at channel 0 is 0x90 (144)
-	 * 0 = Ch 1
-	 * @return {number}
-	 */
-	getStatusByte() {return 144 + this.channel - 1}
-}
-
-export {NoteOnEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/program-change-event.js.html b/docs/program-change-event.js.html deleted file mode 100644 index 59d241d..0000000 --- a/docs/program-change-event.js.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - program-change-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

program-change-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Holds all data for a "program change" MIDI event
- * @param {object} fields {instrument: integer}
- * @return {ProgramChangeEvent}
- */
-class ProgramChangeEvent {
-	constructor(fields) {
-		this.type = 'program';
-		// delta time defaults to 0.
-		this.data = Utils.numberToVariableLength(0x00).concat(Constants.PROGRAM_CHANGE_STATUS, fields.instrument);
-	}
-}
-
-export {ProgramChangeEvent};
-
-
-
- - - - -
- -
- - - - - - - diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js deleted file mode 100644 index 8d52f7e..0000000 --- a/docs/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = 'line' + lineNumber; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/docs/scripts/prettify/Apache-License-2.0.txt b/docs/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/docs/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/docs/scripts/prettify/lang-css.js b/docs/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f5..0000000 --- a/docs/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/docs/scripts/prettify/prettify.js b/docs/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7..0000000 --- a/docs/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p code { - font-size: 0.85em; -} - -.readme table { - margin-bottom: 1em; - border-collapse: collapse; - border-spacing: 0; -} - -.readme table tr { - background-color: #fff; - border-top: 1px solid #ccc; -} - -.readme table th, -.readme table td { - padding: 6px 13px; - border: 1px solid #ddd; -} - -.readme table tr:nth-child(2n) { - background-color: #f8f8f8; -} - -/** Nav **/ -nav { - float: left; - display: block; - width: 250px; - background: #fff; - overflow: auto; - position: fixed; - height: 100%; - padding: 10px; - border-right: 1px solid #eee; - /* box-shadow: 0 0 3px rgba(0,0,0,0.1); */ -} - -nav li { - list-style: none; - padding: 0; - margin: 0; -} - -.nav-heading { - margin-top: 10px; - font-weight: bold; -} - -.nav-heading a { - color: #888; - font-size: 14px; - display: inline-block; -} - -.nav-item-type { - /* margin-left: 5px; */ - width: 18px; - height: 18px; - display: inline-block; - text-align: center; - border-radius: 0.2em; - margin-right: 5px; - font-weight: bold; - line-height: 20px; - font-size: 13px; -} - -.type-function { - background: #B3E5FC; - color: #0288D1; -} - -.type-class { - background: #D1C4E9; - color: #4527A0; -} - -.type-member { - background: #C8E6C9; - color: #388E3C; -} - -.type-module { - background: #E1BEE7; - color: #7B1FA2; -} - - -/** Footer **/ -footer { - color: hsl(0, 0%, 28%); - margin-left: 250px; - display: block; - padding: 30px; - font-style: italic; - font-size: 90%; - border-top: 1px solid #eee; -} - -.ancestors { - color: #999 -} - -.ancestors a { - color: #999 !important; - text-decoration: none; -} - -.clear { - clear: both -} - -.important { - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px -} - -.type-signature { - color: #aaa -} - -.name, .signature { - font-family: Consolas, Monaco, 'Andale Mono', monospace -} - -.details { - margin-top: 14px; - border-left: 2px solid #DDD; - line-height: 30px; -} - -.details dt { - width: 120px; - float: left; - padding-left: 10px; -} - -.details dd { - margin-left: 70px -} - -.details ul { - margin: 0 -} - -.details ul { - list-style-type: none -} - -.details li { - margin-left: 30px -} - -.details pre.prettyprint { - margin: 0 -} - -.details .object-value { - padding-top: 0 -} - -.description { - margin-bottom: 1em; - margin-top: 1em; -} - -.code-caption { - font-style: italic; - font-size: 107%; - margin: 0; -} - -.prettyprint { - font-size: 13px; - border: 1px solid #ddd; - border-radius: 3px; - box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.05); - overflow: auto; -} - -.prettyprint.source { - width: inherit -} - -.prettyprint code { - font-size: 12px; - line-height: 18px; - display: block; - background-color: #fff; - color: #4D4E53; -} - -.prettyprint code:empty:before { - content: ''; -} - -.prettyprint > code { - padding: 15px -} - -.prettyprint .linenums code { - padding: 0 15px -} - -.prettyprint .linenums li:first-of-type code { - padding-top: 15px -} - -.prettyprint code span.line { - display: inline-block -} - -.prettyprint.linenums { - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol { - padding-left: 0 -} - -.prettyprint.linenums li { - border-left: 3px #ddd solid -} - -.prettyprint.linenums li.selected, .prettyprint.linenums li.selected * { - background-color: lightyellow -} - -.prettyprint.linenums li * { - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params, .props { - border-spacing: 0; - border: 1px solid #ddd; - border-collapse: collapse; - border-radius: 3px; - box-shadow: 0 1px 3px rgba(0,0,0,0.1); - width: 100%; - font-size: 14px; - /* margin-left: 15px; */ -} - -.params .name, .props .name, .name code { - color: #4D4E53; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 100%; -} - -.params td, .params th, .props td, .props th { - margin: 0px; - text-align: left; - vertical-align: top; - padding: 10px; - display: table-cell; -} - -.params td { - border-top: 1px solid #eee -} - -.params thead tr, .props thead tr { - background-color: #fff; - font-weight: bold; -} - -.params .params thead tr, .props .props thead tr { - background-color: #fff; - font-weight: bold; -} - -.params td.description > p:first-child, .props td.description > p:first-child { - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child, .props td.description > p:last-child { - margin-bottom: 0; - padding-bottom: 0; -} - -dl.param-type { - /* border-bottom: 1px solid hsl(0, 0%, 87%); */ - margin: 0; - padding: 0; - font-size: 16px; -} - -.param-type dt, .param-type dd { - display: inline-block -} - -.param-type dd { - font-family: Consolas, Monaco, 'Andale Mono', monospace; - display: inline-block; - padding: 0; - margin: 0; - font-size: 14px; -} - -.disabled { - color: #454545 -} - -/* navicon button */ -.navicon-button { - display: none; - position: relative; - padding: 2.0625rem 1.5rem; - transition: 0.25s; - cursor: pointer; - user-select: none; - opacity: .8; -} -.navicon-button .navicon:before, .navicon-button .navicon:after { - transition: 0.25s; -} -.navicon-button:hover { - transition: 0.5s; - opacity: 1; -} -.navicon-button:hover .navicon:before, .navicon-button:hover .navicon:after { - transition: 0.25s; -} -.navicon-button:hover .navicon:before { - top: .825rem; -} -.navicon-button:hover .navicon:after { - top: -.825rem; -} - -/* navicon */ -.navicon { - position: relative; - width: 2.5em; - height: .3125rem; - background: #000; - transition: 0.3s; - border-radius: 2.5rem; -} -.navicon:before, .navicon:after { - display: block; - content: ""; - height: .3125rem; - width: 2.5rem; - background: #000; - position: absolute; - z-index: -1; - transition: 0.3s 0.25s; - border-radius: 1rem; -} -.navicon:before { - top: .625rem; -} -.navicon:after { - top: -.625rem; -} - -/* open */ -.nav-trigger:checked + label:not(.steps) .navicon:before, -.nav-trigger:checked + label:not(.steps) .navicon:after { - top: 0 !important; -} - -.nav-trigger:checked + label .navicon:before, -.nav-trigger:checked + label .navicon:after { - transition: 0.5s; -} - -/* Minus */ -.nav-trigger:checked + label { - transform: scale(0.75); -} - -/* × and + */ -.nav-trigger:checked + label.plus .navicon, -.nav-trigger:checked + label.x .navicon { - background: transparent; -} - -.nav-trigger:checked + label.plus .navicon:before, -.nav-trigger:checked + label.x .navicon:before { - transform: rotate(-45deg); - background: #FFF; -} - -.nav-trigger:checked + label.plus .navicon:after, -.nav-trigger:checked + label.x .navicon:after { - transform: rotate(45deg); - background: #FFF; -} - -.nav-trigger:checked + label.plus { - transform: scale(0.75) rotate(45deg); -} - -.nav-trigger:checked ~ nav { - left: 0 !important; -} - -.nav-trigger:checked ~ .overlay { - display: block; -} - -.nav-trigger { - position: fixed; - top: 0; - clip: rect(0, 0, 0, 0); -} - -.overlay { - display: none; - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 100%; - height: 100%; - background: hsla(0, 0%, 0%, 0.5); - z-index: 1; -} - -.section-method { - margin-bottom: 30px; - padding-bottom: 30px; - border-bottom: 1px solid #eee; -} - -@media only screen and (min-width: 320px) and (max-width: 680px) { - body { - overflow-x: hidden; - } - - nav { - background: #FFF; - width: 250px; - height: 100%; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: -250px; - z-index: 3; - padding: 0 10px; - transition: left 0.2s; - } - - .navicon-button { - display: inline-block; - position: fixed; - top: 1.5em; - right: 0; - z-index: 2; - } - - #main { - width: 100%; - min-width: 360px; - } - - #main h1.page-title { - margin: 1em 0; - } - - #main section { - padding: 0; - } - - footer { - margin-left: 0; - } -} - -@media only print { - nav { - display: none; - } - - #main { - float: none; - width: 100%; - } -} diff --git a/docs/styles/prettify-jsdoc.css b/docs/styles/prettify-jsdoc.css deleted file mode 100644 index 834a866..0000000 --- a/docs/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: hsl(104, 100%, 24%); - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/docs/styles/prettify-tomorrow.css b/docs/styles/prettify-tomorrow.css deleted file mode 100644 index 81e74d1..0000000 --- a/docs/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: hsl(104, 100%, 24%); } - - /* a keyword */ - .kwd { - color: hsl(240, 100%, 50%); } - - /* a comment */ - .com { - color: hsl(0, 0%, 60%); } - - /* a type name */ - .typ { - color: hsl(240, 100%, 32%); } - - /* a literal value */ - .lit { - color: hsl(240, 100%, 40%); } - - /* punctuation */ - .pun { - color: #000000; } - - /* lisp open bracket */ - .opn { - color: #000000; } - - /* lisp close bracket */ - .clo { - color: #000000; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/docs/tempo-event.js.html b/docs/tempo-event.js.html deleted file mode 100644 index ae337fc..0000000 --- a/docs/tempo-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - tempo-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

tempo-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {number} bpm - Beats per minute
- * @return {TempoEvent}
- */
-class TempoEvent {
-	constructor(bpm) {
-		this.type = 'tempo';
-
-		const tempo = Math.round(60000000 / bpm);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TEMPO_ID,
-			[0x03], // Size
-			Utils.numberToBytes(tempo, 3), // Tempo, 3 bytes
-		);
-	}
-}
-
-export {TempoEvent};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Sun Jan 20 2019 22:51:58 GMT-0800 (PST) using the Minami theme. -
- - - - - diff --git a/docs/text-event.js.html b/docs/text-event.js.html deleted file mode 100644 index 906ba9e..0000000 --- a/docs/text-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - text-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

text-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {number} bpm - Beats per minute
- * @return {TextEvent}
- */
-class TextEvent {
-	constructor(text) {
-		this.type = 'text';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TEXT_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {TextEvent};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Sun Jan 20 2019 22:51:58 GMT-0800 (PST) using the Minami theme. -
- - - - - diff --git a/docs/time-signature-event.js.html b/docs/time-signature-event.js.html deleted file mode 100644 index 08a7f3e..0000000 --- a/docs/time-signature-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - time-signature-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

time-signature-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a time signature meta event.
- * @return {TimeSignatureEvent}
- */
-class TimeSignatureEvent {
-	constructor(numerator, denominator, midiclockspertick, notespermidiclock) {
-		this.type = 'time-signature';
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TIME_SIGNATURE_ID,
-			[0x04], // Size
-			Utils.numberToBytes(numerator, 1), // Numerator, 1 bytes
-			Utils.numberToBytes(Math.log2(denominator), 1), // Denominator is expressed as pow of 2, 1 bytes
-			Utils.numberToBytes(midiclockspertick || 24, 1), // MIDI Clocks per tick, 1 bytes
-			Utils.numberToBytes(notespermidiclock || 8, 1), // Number of 1/32 notes per MIDI clocks, 1 bytes
-		);
-	}
-}
-
-export {TimeSignatureEvent};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Sun Jan 20 2019 22:51:58 GMT-0800 (PST) using the Minami theme. -
- - - - - diff --git a/docs/track-name-event.js.html b/docs/track-name-event.js.html deleted file mode 100644 index ff0704c..0000000 --- a/docs/track-name-event.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - track-name-event.js - Documentation - - - - - - - - - - - - - - - - - -
- -

track-name-event.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {Utils} from './utils';
-
-/**
- * Object representation of a tempo meta event.
- * @param {number} bpm - Beats per minute
- * @return {TrackNameEvent}
- */
-class TrackNameEvent {
-	constructor(text) {
-		this.type = 'track-name';
-
-		const textBytes = Utils.stringToBytes(text);
-
-		// Start with zero time delta
-		this.data = Utils.numberToVariableLength(0x00).concat(
-			Constants.META_EVENT_ID,
-			Constants.META_TRACK_NAME_ID,
-			Utils.numberToVariableLength(textBytes.length), // Size
-			textBytes, // Text
-		);
-	}
-}
-
-export {TrackNameEvent};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.5.5 on Sun Jan 20 2019 22:51:58 GMT-0800 (PST) using the Minami theme. -
- - - - - diff --git a/docs/track.js.html b/docs/track.js.html deleted file mode 100644 index 582a743..0000000 --- a/docs/track.js.html +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - track.js - Documentation - - - - - - - - - - - - - - - - - -
- -

track.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {ControllerChangeEvent} from './meta-events/controller-change-event';
-import {CopyrightEvent} from './meta-events/copyright-event';
-import {CuePointEvent} from './meta-events/cue-point-event';
-import {EndTrackEvent} from './meta-events/end-track-event';
-import {InstrumentNameEvent} from './meta-events/instrument-name-event';
-import {KeySignatureEvent} from './meta-events/key-signature-event';
-import {LyricEvent} from './meta-events/lyric-event';
-import {MarkerEvent} from './meta-events/marker-event';
-import {NoteEvent} from './note-events/note-event';
-import {NoteOnEvent} from './note-events/note-on-event';
-import {NoteOffEvent} from './note-events/note-off-event';
-import {PitchBendEvent} from './meta-events/pitch-bend-event';
-import {TempoEvent} from './meta-events/tempo-event';
-import {TextEvent} from './meta-events/text-event';
-import {TimeSignatureEvent} from './meta-events/time-signature-event';
-import {TrackNameEvent} from './meta-events/track-name-event';
-import {Utils} from './utils';
-
-/**
- * Holds all data for a track.
- * @param {object} fields {type: number, data: array, size: array, events: array}
- * @return {Track}
- */
-class Track {
-	constructor() {
-		this.type = Constants.TRACK_CHUNK_TYPE;
-		this.data = [];
-		this.size = [];
-		this.events = [];
-		this.explicitTickEvents = [];
-
-		// If there are any events with an explicit tick defined then we will create a "sub" track for those
-		// and merge them in and the end.
-		this.tickPointer = 0; // Each time an event is added this will increase
-	}
-
-	/**
-	 * Adds any event type to the track.
-	 * Events without a specific startTick property are assumed to be added in order of how they should output.
-	 * Events with a specific startTick property are set aside for now will be merged in during build process.
-	 * @param {(NoteEvent|ProgramChangeEvent)} events - Event object or array of Event objects.
-	 * @param {function} mapFunction - Callback which can be used to apply specific properties to all events.
-	 * @return {Track}
-	 */
-	addEvent(events, mapFunction) {
-		Utils.toArray(events).forEach((event, i) => {
-			if (event instanceof NoteEvent) {
-				// Handle map function if provided
-				if (typeof mapFunction === 'function') {
-					const properties = mapFunction(i, event);
-
-					if (typeof properties === 'object') {
-						for (var j in properties) {
-							switch(j) {
-								case 'channel':
-									event.channel = properties[j];
-									break;
-								case 'duration':
-									event.duration = properties[j];
-									break;
-								case 'sequential':
-									event.sequential = properties[j];
-									break;
-								case 'velocity':
-									event.velocity = Utils.convertVelocity(properties[j]);
-									break;
-							}
-						}
-					}
-				}
-
-				// If this note event has an explicit startTick then we need to set aside for now
-				if (event.startTick !== null) {
-					this.explicitTickEvents.push(event);
-
-				} else {
-					// Push each on/off event to track's event stack
-					event.buildData().events.forEach((e) => this.events.push(e));
-				}
-
-			} else if (event instanceof EndTrackEvent) {
-				// Only one EndTrackEvent is allowed, so remove
-				// any existing ones before adding.
-				this.removeEventsByType('end-track');
-				this.events.push(event);
-
-			} else {
-				this.events.push(event);
-			}
-		});
-
-		return this;
-	}
-
-	/**
-	 * Builds int array of all events.
-	 * @param {object} options
-	 * @return {Track}
-	 */
-	buildData(options = {}) {
-		// If the last event isn't EndTrackEvent, then tack it onto the data.
-		if (!this.events.length || !(this.events[this.events.length - 1] instanceof EndTrackEvent)) {
-			this.addEvent(new EndTrackEvent());
-		}
-
-		// Reset
-		this.data = [];
-		this.size = [];
-		this.tickPointer = 0;
-
-		let precisionLoss = 0;
-
-		this.events.forEach((event) => {
-			// Build event & add to total tick duration
-			if (event instanceof NoteOnEvent || event instanceof NoteOffEvent) {
-				const built = event.buildData(this, precisionLoss, options);
-				precisionLoss = Utils.getPrecisionLoss(event.deltaWithPrecisionCorrection || 0);
-				this.data = this.data.concat(built.data);
-				this.tickPointer = Utils.getRoundedIfClose(event.tick);
-
-			} else if (event instanceof TempoEvent) {
-				this.tickPointer = Utils.getRoundedIfClose(event.tick);
-				this.data = this.data.concat(event.data);
-
-			} else {
-				this.data = this.data.concat(event.data);
-			}
-		});
-
-		this.mergeExplicitTickEvents();
-
-		this.size = Utils.numberToBytes(this.data.length, 4); // 4 bytes long
-		return this;
-	}
-
-	mergeExplicitTickEvents() {
-		if (!this.explicitTickEvents.length) return;
-
-		// First sort asc list of events by startTick
-		this.explicitTickEvents.sort((a, b) => a.startTick - b.startTick);
-
-		// Now this.explicitTickEvents is in correct order, and so is this.events naturally.
-		// For each explicit tick event, splice it into the main list of events and
-		// adjust the delta on the following events so they still play normally.
-		this.explicitTickEvents.forEach((noteEvent) => {
-			// Convert NoteEvent to it's respective NoteOn/NoteOff events
-			// Note that as we splice in events the delta for the NoteOff ones will
-			// Need to change based on what comes before them after the splice.
-			noteEvent.buildData().events.forEach((e) => e.buildData(this));
-
-			// Merge each event indivually into this track's event list.
-			noteEvent.events.forEach((event) => this.mergeSingleEvent(event));
-		});
-
-		// Hacky way to rebuild track with newly spliced events.  Need better solution.
-		this.explicitTickEvents = [];
-		this.buildData();
-	}
-
-	/**
-	 * Merges another track's events with this track.
-	 * @param {Track} track
-	 * @return {Track}
-	 */
-	mergeTrack(track) {
-		// First build this track to populate each event's tick property
-		this.buildData();
-
-		// Then build track to be merged so that tick property is populated on all events & merge each event.
-		track.buildData().events.forEach((event) => this.mergeSingleEvent(event));
-	}
-
-	/**
-	 * Merges a single event into this track's list of events based on event.tick property.
-	 * @param {NoteOnEvent|NoteOffEvent} - event
-	 * @return {Track}
-	 */
-	mergeSingleEvent(event) {
-		// There are no events yet, so just add it in.
-		if (!this.events.length) {
-			this.addEvent(event);
-			return;
-		}
-
-		// Find index of existing event we need to follow with
-		let lastEventIndex;
-
-		for (let i = 0; i < this.events.length; i++) {
-			if (this.events[i].tick > event.tick) break;
-			lastEventIndex = i;
-		}
-
-		let splicedEventIndex = lastEventIndex + 1;
-
-		// Need to adjust the delta of this event to ensure it falls on the correct tick.
-		event.delta = event.tick - this.events[lastEventIndex].tick;
-
-		// Splice this event at lastEventIndex + 1
-		this.events.splice(splicedEventIndex, 0, event);
-
-		// Now adjust delta of all following events
-		for (let i = splicedEventIndex + 1; i < this.events.length; i++) {
-			// Since each existing event should have a tick value at this point we just need to
-			// adjust delta to that the event still falls on the correct tick.
-			this.events[i].delta = this.events[i].tick - this.events[i - 1].tick;
-		}
-	}
-
-	/**
-	 * Removes all events matching specified type.
-	 * @param {string} eventType - Event type
-	 * @return {Track}
-	 */
-	removeEventsByType(eventType) {
-		this.events.forEach((event, index) => {
-			if (event.type === eventType) {
-				this.events.splice(index, 1);
-			}
-		});
-
-		return this;
-	}
-
-	/**
-	 * Sets tempo of the MIDI file.
-	 * @param {number} bpm - Tempo in beats per minute.
-	 * @param {number} tick - Start tick.
-	 * @return {Track}
-	 */
-	setTempo(bpm, tick = 0) {
-		return this.addEvent(new TempoEvent({bpm, tick}));
-	}
-
-	/**
-	 * Sets time signature.
-	 * @param {number} numerator - Top number of the time signature.
-	 * @param {number} denominator - Bottom number of the time signature.
-	 * @param {number} midiclockspertick - Defaults to 24.
-	 * @param {number} notespermidiclock - Defaults to 8.
-	 * @return {Track}
-	 */
-	setTimeSignature(numerator, denominator, midiclockspertick, notespermidiclock) {
-		return this.addEvent(new TimeSignatureEvent(numerator, denominator, midiclockspertick, notespermidiclock));
-	}
-
-	/**
-	 * Sets key signature.
-	 * @param {*} sf -
-	 * @param {*} mi -
-	 * @return {Track}
-	 */
-	setKeySignature(sf, mi) {
-		return this.addEvent(new KeySignatureEvent(sf, mi));
-	}
-
-	/**
-	 * Adds text to MIDI file.
-	 * @param {string} text - Text to add.
-	 * @return {Track}
-	 */
-	addText(text) {
-		return this.addEvent(new TextEvent({text}));
-	}
-
-	/**
-	 * Adds copyright to MIDI file.
-	 * @param {string} text - Text of copyright line.
-	 * @return {Track}
-	 */
-	addCopyright(text) {
-		return this.addEvent(new CopyrightEvent({text}));
-	}
-
-	/**
-	 * Adds Sequence/Track Name.
-	 * @param {string} text - Text of track name.
-	 * @return {Track}
-	 */
-	addTrackName(text) {
-		return this.addEvent(new TrackNameEvent({text}));
-	}
-
-	/**
-	 * Sets instrument name of track.
-	 * @param {string} text - Name of instrument.
-	 * @return {Track}
-	 */
-	addInstrumentName(text) {
-		return this.addEvent(new InstrumentNameEvent({text}));
-	}
-
-	/**
-	 * Adds marker to MIDI file.
-	 * @param {string} text - Marker text.
-	 * @return {Track}
-	 */
-	addMarker(text) {
-		return this.addEvent(new MarkerEvent({text}));
-	}
-
-	/**
-	 * Adds cue point to MIDI file.
-	 * @param {string} text - Text of cue point.
-	 * @return {Track}
-	 */
-	addCuePoint(text) {
-		return this.addEvent(new CuePointEvent({text}));
-	}
-
-	/**
-	 * Adds lyric to MIDI file.
-	 * @param {string} text - Lyric text to add.
-	 * @return {Track}
-	 */
-	addLyric(text) {
-		return this.addEvent(new LyricEvent({text}));
-	}
-
-	/**
-	 * Channel mode messages
-	 * @return {Track}
-	 */
-	polyModeOn() {
-		const event = new NoteOnEvent({data: [0x00, 0xB0, 0x7E, 0x00]});
-		return this.addEvent(event);
-	}
-
-
-	/**
-	 * Sets a pitch bend.
-	 * @param {float} bend - Bend value ranging [-1,1], zero meaning no bend.
-	 * @return {Track}
-	 */
-	setPitchBend(bend) {
-		return this.addEvent(new PitchBendEvent({bend}));
-	}
-
-
-	/**
-	 * Adds a controller change event
-	 * @param {number} number - Control number.
-	 * @param {number} value - Control value.
-	 * @return {Track}
-	 */
-	controllerChange(number, value) {
-		return this.addEvent(new ControllerChangeEvent({controllerNumber: number, controllerValue: value}));
-	}
-
-}
-
-export {Track};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.6.10 on Wed Dec 07 2022 23:32:46 GMT-0800 (Pacific Standard Time) using the Minami theme. -
- - - - - diff --git a/docs/utils.js.html b/docs/utils.js.html deleted file mode 100644 index c850220..0000000 --- a/docs/utils.js.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - utils.js - Documentation - - - - - - - - - - - - - - - - - -
- -

utils.js

- - - - - - - -
-
-
import {Constants} from './constants';
-import {toMidi} from 'tonal-midi';
-
-/**
- * Static utility functions used throughout the library.
- */
-class Utils {
-
-	/**
-	 * Gets MidiWriterJS version number.
-	 * @return {string}
-	 */
-	static version() {
-		return Constants.VERSION;
-	}
-
-	/**
-	 * Convert a string to an array of bytes
-	 * @param {string} string
-	 * @return {array}
-	 */
-	static stringToBytes(string) {
-		return string.split('').map(char => char.charCodeAt())
-	}
-
-	/**
-	 * Checks if argument is a valid number.
-	 * @param {*} n - Value to check
-	 * @return {boolean}
-	 */
-	static isNumeric(n) {
-		return !isNaN(parseFloat(n)) && isFinite(n)
-	}
-
-	/**
-	 * Returns the correct MIDI number for the specified pitch.
-	 * Uses Tonal Midi - https://github.com/danigb/tonal/tree/master/packages/midi
-	 * @param {(string|number)} pitch - 'C#4' or midi note code
-	 * @param {string} middleC
-	 * @return {number}
-	 */
-	static getPitch(pitch, middleC = 'C4') {
-		return 60 - toMidi(middleC) + toMidi(pitch);
-	}
-
-	/**
-	 * Translates number of ticks to MIDI timestamp format, returning an array of
-	 * hex strings with the time values. Midi has a very particular time to express time,
-	 * take a good look at the spec before ever touching this function.
-	 * Thanks to https://github.com/sergi/jsmidi
-	 *
-	 * @param {number} ticks - Number of ticks to be translated
-	 * @return {array} - Bytes that form the MIDI time value
-	 */
-	static numberToVariableLength(ticks) {
-		ticks = Math.round(ticks);
-		var buffer = ticks & 0x7F;
-
-		// eslint-disable-next-line no-cond-assign
-		while (ticks = ticks >> 7) {
-			buffer <<= 8;
-			buffer |= ((ticks & 0x7F) | 0x80);
-		}
-
-		var bList = [];
-		while (true) {
-			bList.push(buffer & 0xff);
-
-			if (buffer & 0x80) buffer >>= 8
-			else { break; }
-		}
-
-		return bList;
-	}
-
-	/**
-	 * Counts number of bytes in string
-	 * @param {string} s
-	 * @return {array}
-	 */
-	static stringByteCount(s) {
-		return encodeURI(s).split(/%..|./).length - 1
-	}
-
-	/**
-	 * Get an int from an array of bytes.
-	 * @param {array} bytes
-	 * @return {number}
-	 */
-	static numberFromBytes(bytes) {
-		var hex = '';
-		var stringResult;
-
-		bytes.forEach((byte) => {
-			stringResult = byte.toString(16);
-
-			// ensure string is 2 chars
-			if (stringResult.length == 1) stringResult = "0" + stringResult
-
-			hex += stringResult;
-		});
-
-		return parseInt(hex, 16);
-	}
-
-	/**
-	 * Takes a number and splits it up into an array of bytes.  Can be padded by passing a number to bytesNeeded
-	 * @param {number} number
-	 * @param {number} bytesNeeded
-	 * @return {array} - Array of bytes
-	 */
-	static numberToBytes(number, bytesNeeded) {
-		bytesNeeded = bytesNeeded || 1;
-
-		var hexString = number.toString(16);
-
-		if (hexString.length & 1) { // Make sure hex string is even number of chars
-			hexString = '0' + hexString;
-		}
-
-		// Split hex string into an array of two char elements
-		var hexArray = hexString.match(/.{2}/g);
-
-		// Now parse them out as integers
-		hexArray = hexArray.map(item => parseInt(item, 16))
-
-		// Prepend empty bytes if we don't have enough
-		if (hexArray.length < bytesNeeded) {
-			while (bytesNeeded - hexArray.length > 0) {
-				hexArray.unshift(0);
-			}
-		}
-
-		return hexArray;
-	}
-
-	/**
-	 * Converts value to array if needed.
-	 * @param {string} value
-	 * @return {array}
-	 */
-	static toArray(value) {
-		if (Array.isArray(value)) return value;
-		return [value];
-	}
-
-	/**
-	 * Converts velocity to value 0-127
-	 * @param {number} velocity - Velocity value 1-100
-	 * @return {number}
-	 */
-	static convertVelocity(velocity) {
-		// Max passed value limited to 100
-		velocity = velocity > 100 ? 100 : velocity;
-		return Math.round(velocity / 100 * 127);
-	}
-
-	/**
-	 * Gets the total number of ticks of a specified duration.
-	 * Note: type=='note' defaults to quarter note, type==='rest' defaults to 0
-	 * @param {(string|array)} duration
-	 * @return {number}
-	 */
-	static getTickDuration(duration) {
-		if (Array.isArray(duration)) {
-			// Recursively execute this method for each item in the array and return the sum of tick durations.
-			return duration.map((value) => {
-				return Utils.getTickDuration(value);
-			}).reduce((a, b) => {
-				return a + b;
-			}, 0);
-		}
-
-		duration = duration.toString();
-
-		if (duration.toLowerCase().charAt(0) === 't') {
-			// If duration starts with 't' then the number that follows is an explicit tick count
-			const ticks = parseInt(duration.substring(1));
-
-			if (isNaN(ticks) || ticks < 0) {
-				throw new Error(duration + ' is not a valid duration.');
-			}
-
-			return ticks;
-		}
-
-		// Need to apply duration here.  Quarter note == Constants.HEADER_CHUNK_DIVISION
-		var quarterTicks = Utils.numberFromBytes(Constants.HEADER_CHUNK_DIVISION);
-		const tickDuration = quarterTicks * Utils.getDurationMultiplier(duration);
-		return Utils.getRoundedIfClose(tickDuration)
-	}
-
-	/**
-	 * Due to rounding errors in JavaScript engines,
-	 * it's safe to round when we're very close to the actual tick number
-	 *
-	 * @static
-	 * @param {number} tick
-	 * @return {number}
-	 */
-	static getRoundedIfClose(tick) {
-		const roundedTick = Math.round(tick);
-		return Math.abs(roundedTick - tick) < 0.000001 ? roundedTick : tick;
-	}
-
-	/**
-	 * Due to low precision of MIDI,
-	 * we need to keep track of rounding errors in deltas.
-	 * This function will calculate the rounding error for a given duration.
-	 *
-	 * @static
-	 * @param {number} tick
-	 * @return {number}
-	 */
-	static getPrecisionLoss(tick) {
-		const roundedTick = Math.round(tick);
-		return roundedTick - tick;
-	}
-
-	/**
-	 * Gets what to multiple ticks/quarter note by to get the specified duration.
-	 * Note: type=='note' defaults to quarter note, type==='rest' defaults to 0
-	 * @param {string} duration
-	 * @return {number}
-	 */
-	static getDurationMultiplier(duration) {
-		// Need to apply duration here.
-		// Quarter note == Constants.HEADER_CHUNK_DIVISION ticks.
-
-		if (duration === '0') return 0;
-
-		const match = duration.match(/^(?<dotted>d+)?(?<base>\d+)(?:t(?<tuplet>\d*))?/);
-		if (match) {
-			const base = Number(match.groups.base);
-			// 1 or any power of two:
-			const isValidBase = base === 1 || ((base & (base - 1)) === 0);
-			if (isValidBase) {
-				// how much faster or slower is this note compared to a quarter?
-				const ratio = base / 4;
-				let durationInQuarters = 1 / ratio;
-				const {dotted, tuplet} = match.groups;
-				if (dotted) {
-					const thisManyDots = dotted.length;
-					const divisor = Math.pow(2, thisManyDots);
-					durationInQuarters = durationInQuarters + (durationInQuarters * ((divisor - 1) / divisor));
-				}
-				if (typeof tuplet === 'string') {
-					const fitInto = durationInQuarters * 2;
-					// default to triplet:
-					const thisManyNotes = Number(tuplet || '3');
-					durationInQuarters = fitInto / thisManyNotes;
-				}
-				return durationInQuarters
-			}
-		}
-		throw new Error(duration + ' is not a valid duration.');
-	}
-}
-
-export {Utils};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.6.10 on Wed Dec 07 2022 23:32:46 GMT-0800 (Pacific Standard Time) using the Minami theme. -
- - - - - diff --git a/docs/vexflow.js.html b/docs/vexflow.js.html deleted file mode 100644 index dbe3da6..0000000 --- a/docs/vexflow.js.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - vexflow.js - Documentation - - - - - - - - - - - - - - - - - -
- -

vexflow.js

- - - - - - - -
-
-
import {NoteEvent} from './note-events/note-event';
-import {Track} from './track';
-
-class VexFlow {
-
-	/**
-	 * Support for converting VexFlow voice into MidiWriterJS track
-	 * @return MidiWriter.Track object
-	 */
-	trackFromVoice(voice, options = {addRenderedAccidentals: false}) {
-		const track = new Track();
-		let wait = [];
-
-		voice.tickables.forEach(tickable => {
-			if (tickable.noteType === 'n') {
-				track.addEvent(new NoteEvent({
-					pitch: tickable.keys.map((pitch, index) => this.convertPitch(pitch, index, tickable, options.addRenderedAccidentals)),
-					duration: this.convertDuration(tickable),
-					wait
-				}));
-				// reset wait
-				wait = [];
-			} else if (tickable.noteType === 'r') {
-				// move on to the next tickable and add this to the stack
-				// of the `wait` property for the next note event
-				wait.push(this.convertDuration(tickable));
-			}
-		});
-
-		// There may be outstanding rests at the end of the track,
-		// pad with a ghost note (zero duration and velocity), just to capture the wait.
-		if(wait.length > 0) {
-			track.addEvent(new NoteEvent({pitch: '[c4]', duration: '0', wait, velocity: '0'}));
-		}
-
-		return track;
-	}
-
-	/**
-	 * Converts VexFlow pitch syntax to MidiWriterJS syntax
-	 * @param pitch string
-	 * @param index pitch index
-	 * @param note struct from Vexflow
-	 * @param addRenderedAccidentals adds Vexflow rendered accidentals
-	 */
-	convertPitch(pitch, index, note, addRenderedAccidentals = false) {
-		// Splits note name from octave
-		const pitchParts = pitch.split('/');
-
-		// Retrieves accidentals from pitch
-		// Removes natural accidentals since they are not accepted in Tonal Midi
-		let accidentals = pitchParts[0].substring(1).replace('n', '');
-		
-		if (addRenderedAccidentals) {
-			note.getAccidentals()?.forEach(accidental => {
-				if (accidental.index === index) {
-					if (accidental.type === 'n') {
-						accidentals = '';
-					} else {
-						accidentals += accidental.type;
-					}
-				}
-			});
-		}
-
-		return pitchParts[0][0] + accidentals + pitchParts[1];
-	}
-
-	/**
-	 * Converts VexFlow duration syntax to MidiWriterJS syntax
-	 * @param note struct from VexFlow
-	 */
-	convertDuration(note) {
-		return 'd'.repeat(note.dots) + this.convertBaseDuration(note.duration) + (note.tuplet ? 't' + note.tuplet.num_notes : '');
-	}
-
-	/**
-	 * Converts VexFlow base duration syntax to MidiWriterJS syntax
-	 * @param duration Vexflow duration
-	 * @returns MidiWriterJS duration
-	 */
-	convertBaseDuration(duration) {
-		switch (duration) {
-			case 'w':
-				return '1';
-			case 'h':
-				return '2';
-			case 'q':
-				return '4';
-			default:
-				return duration;
-		}
-	}
-}
-
-export {VexFlow};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.6.10 on Wed Dec 07 2022 23:32:46 GMT-0800 (Pacific Standard Time) using the Minami theme. -
- - - - - diff --git a/docs/writer.js.html b/docs/writer.js.html deleted file mode 100644 index 444ac45..0000000 --- a/docs/writer.js.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - writer.js - Documentation - - - - - - - - - - - - - - - - - -
- -

writer.js

- - - - - - - -
-
-
import {HeaderChunk} from './header-chunk';
-import {Utils} from './utils';
-
-/**
- * Object that puts together tracks and provides methods for file output.
- * @param {array|Track} tracks - A single {Track} object or an array of {Track} objects.
- * @param {object} options - {middleC: 'C4'}
- * @return {Writer}
- */
-class Writer {
-	constructor(tracks, options = {}) {
-		// Ensure tracks is an array
-		this.tracks = Utils.toArray(tracks);
-		this.options = options;
-	}
-
-	/**
-	 * Builds array of data from chunkschunks.
-	 * @return {array}
-	 */
-	buildData() {
-		const data = [];
-		data.push(new HeaderChunk(this.tracks.length))
-
-		// For each track add final end of track event and build data
-		this.tracks.forEach((track) => {
-			data.push(track.buildData(this.options));
-		});
-
-		return data;
-	}
-
-	/**
-	 * Builds the file into a Uint8Array
-	 * @return {Uint8Array}
-	 */
-	buildFile() {
-		var build = [];
-
-		// Data consists of chunks which consists of data
-		this.buildData().forEach((d) => build = build.concat(d.type, d.size, d.data));
-
-		return new Uint8Array(build);
-	}
-
-	/**
-	 * Convert file buffer to a base64 string.  Different methods depending on if browser or node.
-	 * @return {string}
-	 */
-	base64() {
-		if (typeof btoa === 'function') return btoa(String.fromCharCode.apply(null, this.buildFile()));
-		return Buffer.from(this.buildFile()).toString('base64');
-	}
-
-    /**
-     * Get the data URI.
-     * @return {string}
-     */
-    dataUri() {
-		return 'data:audio/midi;base64,' + this.base64();
-    }
-
-
-	/**
-	 * Set option on instantiated Writer.
-	 * @param {string} key
-	 * @param {any} value
-	 * @return {Writer}
-	 */
-	setOption(key, value) {
-		this.options[key] = value;
-		return this;
-	}
-
-	/**
-	 * Output to stdout
-	 * @return {string}
-	 */
-    stdout() {
-		return process.stdout.write(Buffer.from(this.buildFile()));
-    }
-}
-
-export {Writer};
-
-
-
- - - - -
- -
- -
- Generated by JSDoc 3.6.10 on Wed Dec 07 2022 23:32:46 GMT-0800 (Pacific Standard Time) using the Minami theme. -
- - - - - diff --git a/jsdoc.json b/jsdoc.json new file mode 100644 index 0000000..fac7da8 --- /dev/null +++ b/jsdoc.json @@ -0,0 +1,5 @@ +{ + "opts": { + "template": "node_modules/minami" + } +} diff --git a/package-lock.json b/package-lock.json index 8c42dda..5634478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "midi-writer-js", - "version": "2.1.4", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "midi-writer-js", - "version": "2.1.4", + "version": "3.0.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -35,6 +35,7 @@ "nyc": "^15.0.1", "rollup": "^2.9.0", "tslib": "^2.5.0", + "typedoc": "^0.25.1", "typescript": "^5.0.2", "watch": "^1.0.2" } @@ -1812,28 +1813,28 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz", - "integrity": "sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.11", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", - "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz", - "integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@nodelib/fs.scandir": { @@ -2507,6 +2508,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -4757,6 +4764,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/klaw": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.0.1.tgz", @@ -4929,6 +4942,12 @@ "node": ">=10" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -4986,9 +5005,9 @@ "dev": true }, "node_modules/marked": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.12.tgz", - "integrity": "sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true, "bin": { "marked": "bin/marked.js" @@ -6175,6 +6194,18 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.4.tgz", + "integrity": "sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -6564,6 +6595,51 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typedoc": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.1.tgz", + "integrity": "sha512-c2ye3YUtGIadxN2O6YwPEXgrZcvhlZ6HlhWZ8jQRNzwLPn2ylhdGqdR8HbyDRyALP8J6lmSANILCkkIdNPFxqA==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", @@ -6669,6 +6745,18 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/watch": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/watch/-/watch-1.0.2.tgz", @@ -8147,25 +8235,25 @@ "dev": true }, "@jridgewell/resolve-uri": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz", - "integrity": "sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.11", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", - "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz", - "integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@nodelib/fs.scandir": { @@ -8609,6 +8697,12 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, + "ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -10268,6 +10362,12 @@ "minimist": "^1.2.5" } }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "klaw": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.0.1.tgz", @@ -10403,6 +10503,12 @@ "yallist": "^4.0.0" } }, + "lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -10450,9 +10556,9 @@ "requires": {} }, "marked": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.12.tgz", - "integrity": "sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true }, "mdurl": { @@ -11322,6 +11428,18 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "shiki": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.4.tgz", + "integrity": "sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==", + "dev": true, + "requires": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -11628,6 +11746,38 @@ "is-typedarray": "^1.0.0" } }, + "typedoc": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.1.tgz", + "integrity": "sha512-c2ye3YUtGIadxN2O6YwPEXgrZcvhlZ6HlhWZ8jQRNzwLPn2ylhdGqdR8HbyDRyALP8J6lmSANILCkkIdNPFxqA==", + "dev": true, + "requires": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "typescript": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", @@ -11707,6 +11857,18 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "watch": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/watch/-/watch-1.0.2.tgz", diff --git a/package.json b/package.json index e8b00e3..9ea4b71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "midi-writer-js", - "version": "2.1.4", + "version": "3.0.0", "description": "A library providing an API for generating MIDI files.", "main": "build/index.js", "types": "types.d.ts", @@ -30,6 +30,7 @@ "nyc": "^15.0.1", "rollup": "^2.9.0", "tslib": "^2.5.0", + "typedoc": "^0.25.1", "typescript": "^5.0.2", "watch": "^1.0.2" }, @@ -40,7 +41,7 @@ }, "scripts": { "build": "mkdir -p build && rollup -c", - "docs": "./node_modules/.bin/jsdoc -r src README.md -d ./docs -t ./node_modules/minami", + "docs": "npx typedoc --options typedoc.json", "lint:js": "eslint 'src/**/**.ts'", "prepublishOnly": "npm test", "pretest": "npm run build", diff --git a/rollup.config.js b/rollup.config.js index 0e880fb..497a4d8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -31,7 +31,7 @@ export default [ output: { file: 'build/index.js', format: 'cjs', - exports: 'default', + exports: 'named', }, external: ['tonal-midi', 'fs'], plugins: [ diff --git a/src/constants.ts b/src/constants.ts index 24ae6e6..e27ccd6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,7 +4,7 @@ */ const Constants = { - VERSION : '2.1.4', + VERSION : '3.0.0', HEADER_CHUNK_TYPE : [0x4d, 0x54, 0x68, 0x64], // Mthd HEADER_CHUNK_LENGTH : [0x00, 0x00, 0x00, 0x06], // Header size for SMF HEADER_CHUNK_FORMAT0 : [0x00, 0x00], // Midi Type 0 id diff --git a/src/main.ts b/src/main.ts index 4de4418..d3a2f35 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,4 @@ + import {Constants} from './constants'; import {ControllerChangeEvent} from './midi-events/controller-change-event'; import {CopyrightEvent} from './meta-events/copyright-event'; @@ -21,7 +22,7 @@ import {Utils} from './utils'; import {VexFlow} from './vexflow'; import {Writer} from './writer'; -export default { +export { Constants, ControllerChangeEvent, CopyrightEvent, diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 0000000..91c3628 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/main.ts"], + "out": "docs" +}