1 | # musicjson2abc
|
2 |
|
3 | [![Build Status](https://travis-ci.org/freakimkaefig/musicjson2abc.svg?branch=master)](https://travis-ci.org/freakimkaefig/musicjson2abc)
|
4 | [![npm version](https://badge.fury.io/js/musicjson2abc.svg)](https://badge.fury.io/js/musicjson2abc)
|
5 |
|
6 | A command-line tool to convert musicJSON to abc notation
|
7 | An example of the used format of json is in [example.json](https://github.com/freakimkaefig/musicjson2abc/blob/master/example.json).
|
8 |
|
9 | This project is still under development. Feel free to use it and submit issues here.
|
10 |
|
11 | ## Getting started
|
12 | Install the module with:
|
13 | ```sh
|
14 | npm install -g musicjson2abc
|
15 | ```
|
16 |
|
17 | ## Example
|
18 | ```javascript
|
19 | var musicjson2abc = require('musicjson2abc');
|
20 |
|
21 | 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"}]}]}');
|
22 |
|
23 | console.log(abc);
|
24 | // output:
|
25 | // X:123456
|
26 | // T:123456
|
27 | // M:3/4
|
28 | // L:1/16
|
29 | // K:F
|
30 | // _C4|
|
31 |
|
32 |
|
33 | var json = musicjson2abc.convert2JSON(abc);
|
34 | console.log(json);
|
35 | // output:
|
36 | // {"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"}}]}]}
|
37 |
|
38 | ```
|
39 |
|
40 | ## Command line tool
|
41 | The command `musicjson2abc` accepts filepaths for input and output files.
|
42 | ```
|
43 | $ musicjson2abc --help
|
44 |
|
45 | Usage: musicjson2abc [options] <input> [output]
|
46 |
|
47 | Options:
|
48 |
|
49 | -h, --help output usage information
|
50 | -r, --reverse convert abc to json instead
|
51 | -d, --debug outputs debug information on stdout
|
52 | -V, --version output the version number
|
53 |
|
54 | Examples:
|
55 |
|
56 | $ musicjson2abc input.json output.abc
|
57 | $ musicjson2abc input.json output.abc -d
|
58 | $ musicjson2abc example.abc example.json -r
|
59 |
|
60 | Hint:
|
61 |
|
62 | The input file should be a valid json / abc file.
|
63 | No syntax checks performed.
|
64 | The output file will become a valid abc / json file.
|
65 | May overwrite existing files.
|
66 | ```
|
67 |
|
68 | ## License
|
69 | Licensed under the MIT License. See [LICENSE](https://github.com/freakimkaefig/musicjson2abc/blob/master/LICENSE) for further information.
|