npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

func-midi-parser

v2.1.3

Published

A functional-based midi parsing library

Downloads

18

Readme

func-midi-parser

Build Status Coverage Status Dependencies Status

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

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

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