func-midi-parser
v2.1.3
Published
A functional-based midi parsing library
Downloads
20
Maintainers
Readme
func-midi-parser
A simple, functional-based midi parsing library
API Reference
midiParser
midiParser~parse(midiBytes) ⇒ Midi
parses given array of unsigned 8-bit integers into Midi data type
Kind: inner method of midiParser
| Param | Type | Description | | --- | --- | --- | | midiBytes | array | array of unsinged 8-bit integers representing raw midi data |
MidiConstants
- MidiConstants
- ~BYTE_MASK : number
- ~HIGHBIT_MASK : number
- ~SYSEX_EVENT_MASK : number
- ~NOTE_ON_MASK : number
- ~NOTE_OFF_MASK : number
- ~PROGRAM_MASK : number
- ~CHANNEL_MASK : number
- ~CONTROL_MASK : number
- ~META_EVENT : number
- ~SEQUENCE_META_EVENT : number
- ~TEXT_META_EVENT : number
- ~COPYRIGHT_META_EVENT : number
- ~TRACK_NAME_META_EVENT : number
- ~INST_NAME_META_EVENT : number
- ~LYRIC_TEXT_META_EVENT : number
- ~MARKER_TEXT_META_EVENT : number
- ~CUE_POINT_META_EVENT : number
- ~CHANNEL_PREFIX_ASSIGNMENT_META_EVENT : number
- ~END_OF_TRACK_META_EVENT : number
- ~TEMPO_META_EVENT : number
- ~SMPTE_OFFSET_META_EVENT : number
- ~TIME_SIG_META_EVENT : number
- ~KEY_SIGNATURE_META_EVENT : number
- ~SEQUENCER_SPECIFIC_META_EVENT : number
MidiConstants~BYTE_MASK : number
Kind: inner constant of MidiConstants
Default: 128
MidiConstants~HIGHBIT_MASK : number
Kind: inner constant of MidiConstants
Default: 127
MidiConstants~SYSEX_EVENT_MASK : number
Kind: inner constant of MidiConstants
Default: 240
MidiConstants~NOTE_ON_MASK : number
Kind: inner constant of MidiConstants
Default: 144
MidiConstants~NOTE_OFF_MASK : number
Kind: inner constant of MidiConstants
Default: 128
MidiConstants~PROGRAM_MASK : number
Kind: inner constant of MidiConstants
Default: 192
MidiConstants~CHANNEL_MASK : number
Kind: inner constant of MidiConstants
Default: 208
MidiConstants~CONTROL_MASK : number
Kind: inner constant of MidiConstants
Default: 176
MidiConstants~META_EVENT : number
Kind: inner constant of MidiConstants
Default: 255
MidiConstants~SEQUENCE_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 0
MidiConstants~TEXT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 1
MidiConstants~COPYRIGHT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 2
MidiConstants~TRACK_NAME_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 3
MidiConstants~INST_NAME_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 4
MidiConstants~LYRIC_TEXT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 5
MidiConstants~MARKER_TEXT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 6
MidiConstants~CUE_POINT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 7
MidiConstants~CHANNEL_PREFIX_ASSIGNMENT_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 32
MidiConstants~END_OF_TRACK_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 47
MidiConstants~TEMPO_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 81
MidiConstants~SMPTE_OFFSET_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 84
MidiConstants~TIME_SIG_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 88
MidiConstants~KEY_SIGNATURE_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 89
MidiConstants~SEQUENCER_SPECIFIC_META_EVENT : number
Kind: inner constant of MidiConstants
Default: 127
MidiTypes
- MidiTypes
- ~Midi
- ~MidiHeader
- ~MidiTrack
- ~MidiEvent
- ~MidiMetaEvent
- ~MidiMetaTempoEvent
- ~MidiMetaTimeSignatureEvent
- ~MidiMetaInstrumentNameEvent
- ~MidiMetaKeySignatureEvent
- ~MidiMetaSmptOffsetEvent
- ~MidiMetaTrackNameEvent
- ~MidiMetaEndOfTrack
- ~MidiSystemEvent
- ~MidiChannelEvent
- ~MidiPolyphonicAftertouchEvent
- ~MidiControlChangeEvent
- ~MidiProgramChangeEvent
- ~MidiChannelAftertouchEvent
- ~MidiPitchWheelEvent
- ~MidiNoteEvent
- ~MidiNoteOnEvent
- ~MidiNoteOffEvent
MidiTypes~Midi
Kind: inner class of MidiTypes
new Midi(params)
top-level data type representing entire Midi song
Returns: Midi
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.header | MidiHeader | header data | | params.tracks | Array.<MidiTrack> | array of MidiTracks |
MidiTypes~MidiHeader
Kind: inner class of MidiTypes
new MidiHeader(params)
header information for Midi song
Returns: MidiHeader
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.format | number | (0: single-track, 1: multi-track, simultaneous, 2: multi-track, independent) | | params.trackCount | number | number of tracks (if multi-track) | | params.timeDivision | timeDivision | the default unit of delta-time for this MIDI file |
MidiTypes~MidiTrack
Kind: inner class of MidiTypes
new MidiTrack(params)
information for a given track
Returns: MidiTrack
| Param | Type | Default | Description | | --- | --- | --- | --- | | params | object | | properties to set | | [params.name] | string | "''" | label for the track | | [params.events] | Array.<MidiEvent> | [] | array of MidiEvents |
MidiTypes~MidiEvent
Kind: inner class of MidiTypes
new MidiEvent(params)
Abstract midi event class
Returns: MidiEvent
| Param | Type | Default | Description | | --- | --- | --- | --- | | params | object | | properties to set | | params.code | number | | 0x80-0xFF code for the event | | params.type | string | | string label for the top-level "type" of event | | params.subtype | string | | string label for the second-level "type" of event | | params.track | number | | the index for the track this event belongs to | | [params.delta] | number | 0 | delta offset in ??? (microseconds or milliseconds) from previous event |
MidiTypes~MidiMetaEvent
Kind: inner class of MidiTypes
new MidiMetaEvent(params)
Abstract Midi meta event
Returns: MidiMetaEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.subtype | string | the type of meta event (i.e. "tempo", "time_signature", etc.) |
MidiTypes~MidiMetaTempoEvent
Kind: inner class of MidiTypes
new MidiMetaTempoEvent(params)
Meta tempo event
Returns: MidiMetaTempoEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.microsecPerQn | number | microseconds per quarter note |
MidiTypes~MidiMetaTimeSignatureEvent
Kind: inner class of MidiTypes
new MidiMetaTimeSignatureEvent(params)
Meta time signature event. Expects time signature to be represented by two numbers that take the form: nn/2^dd
Returns: MidiMetaTimeSignature
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.numerator | number | numerator for time signature | | params.denominator | number | exponent for denominator of time signature | | params.metronomeClicksPerTick | number | number of metronome clicks per midi tick | | params.thirtySecondNotesPerBeat | number | number of 1/32 notes per beat |
MidiTypes~MidiMetaInstrumentNameEvent
Kind: inner class of MidiTypes
new MidiMetaInstrumentNameEvent(params)
Midi meta instrument name event
Returns: MidiMetaInstrumentNameEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set | | params.name | string | name of instrument used |
MidiTypes~MidiMetaKeySignatureEvent
Kind: inner class of MidiTypes
new MidiMetaKeySignatureEvent(params)
Midi meta key signature event
Returns: MidiMetaKeySignatureEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.sf | number | number of sharps/flats (-7 <= sf <= 7) | | params.mi | number | major (0) or minor (1) |
MidiTypes~MidiMetaSmptOffsetEvent
Kind: inner class of MidiTypes
new MidiMetaSmptOffsetEvent(params)
Midi meta smpte offset event
Returns: MidiMeatSmpteOffsetEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.frameRate | number | top two bits define the frame rate in frames per second. If those bits are "00" (0 decimal), the frame rate is 24 frames per second. If those bits are "01" (1 decimal), the frame rate is 25 frames per second. If the bits are "10" (2 decimal), the frame rate is "drop 30" or 29.97 frames per second. If the top two bits are "11", then the frame rate is 30 frames per second. The six remaining bits define the hours of the SMPTE time (0-23). | | params.min | number | minutes in offset (0-59) | | params.sec | number | seconds in offset (0-59) | | params.frames | number | depends upon framerate | | params.subframes | number | 0-99 |
MidiTypes~MidiMetaTrackNameEvent
Kind: inner class of MidiTypes
new MidiMetaTrackNameEvent(params)
Midi meta track name event
Returns: MidiMetaTrackNameEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.name | string | name of the track |
MidiTypes~MidiMetaEndOfTrack
Kind: inner class of MidiTypes
new MidiMetaEndOfTrack()
Midi meta end of track event
Returns: MidiMetaEndOfTrackEvent
MidiTypes~MidiSystemEvent
Kind: inner class of MidiTypes
new MidiSystemEvent()
Abstract Midi system event
Returns: MidiSystemEvent
MidiTypes~MidiChannelEvent
Kind: inner class of MidiTypes
new MidiChannelEvent(params)
Abstract Midi channel event
Returns: MidiChannelEvent
| Param | Type | Description | | --- | --- | --- | | params | object | properties to set | | params.eventCode | number | hex value for the event code (0x80-0xEF) |
MidiTypes~MidiPolyphonicAftertouchEvent
Kind: inner class of MidiTypes
new MidiPolyphonicAftertouchEvent(params)
polyphonic aftertouch event
Returns: MidiPolyphonicAftertouchEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set |
MidiTypes~MidiControlChangeEvent
Kind: inner class of MidiTypes
new MidiControlChangeEvent(params)
control change event
Returns: MidiControlChangeEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set |
MidiTypes~MidiProgramChangeEvent
Kind: inner class of MidiTypes
new MidiProgramChangeEvent(params)
NOT YET IMPLEMENTED
Returns: MidiProgramChangeEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set |
MidiTypes~MidiChannelAftertouchEvent
Kind: inner class of MidiTypes
new MidiChannelAftertouchEvent(params)
NOT YET IMPLEMENTED
Returns: MidiChannelAftertouchEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set |
MidiTypes~MidiPitchWheelEvent
Kind: inner class of MidiTypes
new MidiPitchWheelEvent(params)
NOT YET IMPLEMENTED
Returns: MidiPitchWheelEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set |
MidiTypes~MidiNoteEvent
Kind: inner class of MidiTypes
new MidiNoteEvent(params)
Abstract note event
Returns: MidiNoteEvent
| Param | Type | Description | | --- | --- | --- | | params | object | proprties to set | | params.note | number | note (0-255) | | params.velocity | number | velocity (0-127) | | params.length | number | length in ms |
MidiTypes~MidiNoteOnEvent
Kind: inner class of MidiTypes
new MidiNoteOnEvent()
note on event
Returns: MidiNoteOnEvent
MidiTypes~MidiNoteOffEvent
Kind: inner class of MidiTypes
new MidiNoteOffEvent()
note off event
Returns: MidiNoteOffEvent