All Projects → nfroidure → Midifile

nfroidure / Midifile

Licence: mit
A MIDI file parser/writer using ArrayBuffers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Midifile

Score
ossia score, an interactive sequencer for the intermedia arts.
Stars: ✭ 808 (+356.5%)
Mutual labels:  hacktoberfest, midi
Externalsecret Operator
An operator to fetch secrets from cloud services and inject them in Kubernetes
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest
Image
Encoding and decoding images in Rust
Stars: ✭ 2,534 (+1331.64%)
Mutual labels:  hacktoberfest
Availity Reactstrap Validation
Easy to use React validation components compatible for reactstrap.
Stars: ✭ 176 (-0.56%)
Mutual labels:  hacktoberfest
Gino
GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
Stars: ✭ 2,299 (+1198.87%)
Mutual labels:  hacktoberfest
Mattermost Android Classic
Mattermost app for Android phones and tablets
Stars: ✭ 176 (-0.56%)
Mutual labels:  hacktoberfest
Shaden
🎧 A modular audio synthesizer.
Stars: ✭ 175 (-1.13%)
Mutual labels:  midi
Otoroshi
Lightweight api management on top of a modern http reverse proxy
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest
Tamburetei
Fazendo de tamburete as cadeiras de [email protected]
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest
Command Block Assembly
Compile high-level code into Minecraft commands
Stars: ✭ 175 (-1.13%)
Mutual labels:  hacktoberfest
Antminer Monitor
Cryptocurrency ASIC mining hardware monitor using a simple web interface
Stars: ✭ 176 (-0.56%)
Mutual labels:  hacktoberfest
Protoplug
Create audio plugins on-the-fly with LuaJIT.
Stars: ✭ 175 (-1.13%)
Mutual labels:  midi
Slack Scala Client
A scala library for interacting with the slack api and real time messaging interface
Stars: ✭ 176 (-0.56%)
Mutual labels:  hacktoberfest
Ivre
Network recon framework, published by @cea-sec & @ANSSI-FR. Build your own, self-hosted and fully-controlled alternatives to Shodan / ZoomEye / Censys and GreyNoise, run your Passive DNS service, collect and analyse network intelligence from your sensors, and much more!
Stars: ✭ 2,331 (+1216.95%)
Mutual labels:  hacktoberfest
React Otp Input
✔️ OTP Input Component for React
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest
Pact Ruby
Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
Stars: ✭ 2,075 (+1072.32%)
Mutual labels:  hacktoberfest
Data Structures And Algorithms In Cpp
This repository is in development phase and will soon provide you with c++ code of various data structures and algorithms
Stars: ✭ 176 (-0.56%)
Mutual labels:  hacktoberfest
Netflix Migrate
A command-line tool to migrate data to and from Netflix profiles
Stars: ✭ 175 (-1.13%)
Mutual labels:  hacktoberfest
Yii2 Bootstrap
Yii 2 Bootstrap 3 Extension
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest
Yarnhook
Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
Stars: ✭ 177 (+0%)
Mutual labels:  hacktoberfest

midifile

Read/write standard MIDI files.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate Dependency Status

MIDIFile uses the MIDIEvents project and is part of the MIDIPlayer one. You can also check this Karaoke Player built on top of those libraries.

What it does

  • Read MIDI files
  • Check MIDI file structure (using strictMode)
  • Write MIDI files (still experimental)

What it doesn't do

Usage

// Your variable with your MIDI file as an ArrayBuffer or UInt8Array instance
var anyBuffer;

// Creating the MIDIFile instance
var midiFile = new MIDIFile(anyBuffer);

// Reading headers
midiFile.header.getFormat(); // 0, 1 or 2
midiFile.header.getTracksCount(); // n
// Time division
if(midiFile.header.getTimeDivision() === MIDIFile.Header.TICKS_PER_BEAT) {
	midiFile.header.getTicksPerBeat();
} else {
	midiFile.header.getSMPTEFrames();
	midiFile.header.getTicksPerFrame();
}

// MIDI events retriever
var events = midiFile.getMidiEvents();
events[0].subtype; // type of [MIDI event](https://github.com/nfroidure/MIDIFile/blob/master/src/MIDIFile.js#L34)
events[0].playTime; // time in ms at wich the event must be played
events[0].param1; // first parameter
events[0].param2; // second one

// Lyrics retriever
var lyrics = midiFile.getLyrics();
if ( lyrics.length ) {
	lyrics[0].playTime; // Time at wich the text must be displayed
	lyrics[0].text; // The text content to be displayed
}

// Reading whole track events and filtering them yourself
var events = midiFile.getTrackEvents(0);

events.forEach(console.log.bind(console));

// Or for a single track
var trackEventsChunk = midiFile.tracks[0].getTrackContent();
var events = MIDIEvents.createParser(trackEventsChunk);

var event;
while(event = events.next()) {
	// Printing meta events containing text only
	if(event.type === MIDIEvents.EVENT_META && event.text) {
		console.log('Text meta: '+event.text);
	}
}

Testing

Unit tests are using mocha and NodeJS. Install them and run the following command:

mocha tests/*.mocha.js

Why ArrayBuffers ?

ArrayBuffer instances are the best way to manage binary data like MIDI files.

Why not streams ?

The Standard MIDI files format isn't streamable by nature. If you want to stream MIDI file contents, you should consider transforming your files in another format (plain linearized MIDI events should do the job).

Requirements

  • ArrayBuffer, DataView or their polyfills

Contributing

  • Feel free to PR
  • If you find a MIDI File the library can't read an if it's under a free, PR the file in the sounds folder and add tests for him. I'll work on it asap.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].