All Projects → grimmdude → Midiwriterjs

grimmdude / Midiwriterjs

Licence: mit
♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON objects.

Programming Languages

javascript
184084 projects - #8 most used programming language
es6
455 projects

Projects that are alternatives of or similar to Midiwriterjs

Webaudiofont
Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
Stars: ✭ 600 (+57.48%)
Mutual labels:  audio, music, midi
Clubber
Application of music theory in audio reactive visualizations
Stars: ✭ 325 (-14.7%)
Mutual labels:  audio, music, midi
Zrythm
a highly automated and intuitive digital audio workstation - official mirror
Stars: ✭ 703 (+84.51%)
Mutual labels:  audio, music, midi
Giada
Your Hardcore Loop Machine.
Stars: ✭ 903 (+137.01%)
Mutual labels:  audio, music, midi
Awesome Music Production
A curated list of software, services and resources to create and distribute music.
Stars: ✭ 340 (-10.76%)
Mutual labels:  audio, music, midi
Romplayer
AudioKit Sample Player (ROM Player) - EXS24, Sound Font, Wave Player
Stars: ✭ 445 (+16.8%)
Mutual labels:  audio, music, midi
Musictheory
🎵 Music theory concepts in Go.
Stars: ✭ 53 (-86.09%)
Mutual labels:  audio, music, midi
Bitmidi.com
🎹 Listen to free MIDI songs, download the best MIDI files, and share the best MIDIs on the web
Stars: ✭ 422 (+10.76%)
Mutual labels:  audio, music, midi
Audiokitsynthone
AudioKit Synth One: Open-Source iOS Synthesizer App
Stars: ✭ 1,258 (+230.18%)
Mutual labels:  audio, music, midi
Minibae
The platform-neutral Beatnik Audio Engine, Mini Edition (miniBAE) is an exceptionally mature, well-rounded, and reliable computer music and sound system specially customized for small-footprint and embedded applications.
Stars: ✭ 82 (-78.48%)
Mutual labels:  audio, music, midi
Audiokit
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Stars: ✭ 8,827 (+2216.8%)
Mutual labels:  audio, music, midi
Mixxx
Mixxx is Free DJ software that gives you everything you need to perform live mixes.
Stars: ✭ 2,510 (+558.79%)
Mutual labels:  audio, music, midi
Webmidikit
Simplest MIDI Swift library
Stars: ✭ 100 (-73.75%)
Mutual labels:  audio, music, midi
Midiplayerjs
♬ Midi parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
Stars: ✭ 199 (-47.77%)
Mutual labels:  audio, midi, javascript-library
Daisysp
A Powerful, Open Source DSP Library in C++
Stars: ✭ 291 (-23.62%)
Mutual labels:  audio, music
Soundspice Mobile
A light-weight and minimalist music player for Android
Stars: ✭ 289 (-24.15%)
Mutual labels:  audio, music
Lms
Lightweight Music Server. Access your self-hosted music using a web interface.
Stars: ✭ 315 (-17.32%)
Mutual labels:  audio, music
Sporth
A small stack-based audio language.
Stars: ✭ 325 (-14.7%)
Mutual labels:  audio, music
Chataigne
Artist-friendly Modular Machine for Art and Technology
Stars: ✭ 251 (-34.12%)
Mutual labels:  audio, midi
Eternal
👾~ music, eternal ~ 👾
Stars: ✭ 323 (-15.22%)
Mutual labels:  music, midi

♬ 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

var MidiWriter = require('midi-writer-js');

// Start with a new track
var track = new MidiWriter.Track();

// Define an instrument (optional):
track.addEvent(new MidiWriter.ProgramChangeEvent({instrument: 1}));

// Add some notes:
var note = new MidiWriter.NoteEvent({pitch: ['C4', 'D4', 'E4'], duration: '4'});
track.addEvent(note);

// Generate a data URI
var 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:

Name Type Description
pitch string or array Each 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.
duration string 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.
wait string or array How long to wait before sounding note (rest). Takes same values as duration.
sequential boolean If true then array of pitches will be played sequentially as opposed to simulatanously. Default: false
velocity number How loud the note should sound, values 1-100. Default: 50
repeat number How many times this event should be repeated. Default: 1
channel number MIDI channel to use. Default: 1
grace string or array Grace note to be applied to note event. Takes same value format as pitch
startTick number Specific 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'.

var MidiWriter = require('midi-writer-js');

var 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};
  }
);

var 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
var voice = create_4_4_voice().addTickables(notes);

var vexWriter = new MidiWriter.VexFlow();
var track = vexWriter.trackFromVoice(voice);
var writer = new MidiWriter.Writer([track]);
console.log(writer.dataUri());
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].