musicjson2abc
A command-line tool to convert musicJSON to abc notation.
Last updated 3 years ago by freakimkaefig .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install musicjson2abc 
SYNC missed versions from official npm registry.

musicjson2abc

Build Status npm version

A command-line tool to convert musicJSON to abc notation An example of the used format of json is in example.json.

This project is still under development. Feel free to use it and submit issues here.

Getting started

Install the module with:

npm install -g musicjson2abc

Example

var musicjson2abc = require('musicjson2abc');

var abc = musicjson2abc.convert2Abc('{"id":"123456","attributes":{"divisions":4,"clef":{"sign":"G","line":2},"key":{"fifths":-1},"time":{"beats":3,"beat-type":4}},"measures":[{"attributes":{"repeat":{"left":false,"right":false}},"notes":[{"type":"quarter","duration": 4,"rest": false,"pitch": {"step":"C","octave":4,"alter":0,"accidental": "flat"},"$$hashKey":"object:1255"}]}]}');

console.log(abc);
// output:
//   X:123456
//   T:123456
//   M:3/4
//   L:1/16
//   K:F
//    _C4|


var json = musicjson2abc.convert2JSON(abc);
console.log(json);
// output:
// {"id":"123456","attributes":{"divisions":4,"clef":{"sign":"G","line":2},"key":{"fifths":-1},"time":{"beats":3,"beat-type":4}},"measures":[{"attributes":{"repeat":{"left":false,"right":false}},"notes":[{"type":"quarter","duration": 4,"rest": false,"pitch": {"step":"C","octave":4,"alter":0,"accidental": "flat"}}]}]}

Command line tool

The command musicjson2abc accepts filepaths for input and output files.

$ musicjson2abc --help

  Usage: musicjson2abc [options] <input> [output]

  Options:

    -h, --help     output usage information
    -r, --reverse  convert abc to json instead
    -d, --debug    outputs debug information on stdout
    -V, --version  output the version number

  Examples:

    $ musicjson2abc input.json output.abc
    $ musicjson2abc input.json output.abc -d
    $ musicjson2abc example.abc example.json -r

  Hint:

    The input file should be a valid json / abc file.
    No syntax checks performed.
    The output file will become a valid abc / json file.
    May overwrite existing files.

Documentation

For full API documentation have a look at API.md.

License

Licensed under the MIT License. See LICENSE for further information.

Current Tags

  • 0.6.0                                ...           latest (3 years ago)

19 Versions

  • 0.6.0                                ...           3 years ago
  • 0.5.5                                ...           3 years ago
  • 0.5.4                                ...           3 years ago
  • 0.5.3                                ...           3 years ago
  • 0.5.2                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 2
Last Month 19
Dependencies (6)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |