Home

Awesome

mml-iterator

Build Status NPM Version License

MML(Music Macro Language) Iterator

Installation

$ npm install mml-iterator

API

MMLIterator

Instance methods

Example

import MMLIterator from "mml-iterator";

let iter = new MMLIterator("t200 o6 l8 e g > e c d g");

for (let noteEvent of iter) {
  console.log(noteEvent);
}
{ type: "note", time: 0.00, duration: 0.15, noteNumber:  88, velocity: 100, quantize: 75 }
{ type: "note", time: 0.15, duration: 0.15, noteNumber:  91, velocity: 100, quantize: 75 }
{ type: "note", time: 0.30, duration: 0.15, noteNumber: 100, velocity: 100, quantize: 75 }
{ type: "note", time: 0.45, duration: 0.15, noteNumber:  96, velocity: 100, quantize: 75 }
{ type: "note", time: 0.60, duration: 0.15, noteNumber:  98, velocity: 100, quantize: 75 }
{ type: "note", time: 0.75, duration: 0.15, noteNumber: 103, velocity: 100, quantize: 75 }
{ type: "end", time: 0.9 }

MML Syntax

NoteEvent

NoteLength

NotePitch

Control

License

MIT