music-macro-language

0.1.0 • Public • Published

music-macro-language

Music macro language parser

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install music-macro-language --save

Usage

js

var fs = require('fs')
var mml = require('music-macro-language')
var ast = mml.parse('CDEFEDCREFGAGFERCRCRCRCRC16C16D16D16E16E16F16F16EDCR;')

=> tree

[ [ { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'D',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'F',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'D',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'F',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'G',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'A',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'G',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'F',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'D',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'D',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'F',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'F',
      accidentals: [],
      length: 16,
      dots: [] },
    { command: 'note',
      tone: 'E',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'D',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'note',
      tone: 'C',
      accidentals: [],
      length: 0,
      dots: [] },
    { command: 'rest', length: 0, dots: [] } ] ]

Dependencies

None

Dev Dependencies

  • pegjs: Parser generator for JavaScript
  • standard-version: replacement for npm version with automatic CHANGELOG generation

License

MIT

Generated by package-json-to-readme

/music-macro-language/

    Package Sidebar

    Install

    npm i music-macro-language

    Weekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • watilde