mnxconverter
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mnxconverter

A Javascript/Typescript package for converting between MusicXML and the new MNX format. Works in Browser and Node.js.

Disclaimer

This converter is initially ported from Python Package https://github.com/w3c/mnxconverter and very limited in scope at the moment. So far, it only reliably converts the types of notations described in Comparing MNX and MusicXML.

Installation

First, make sure you have package installed:

npm install mnxconverter

or

yarn add mnxconverter

To convert a MusicXML file, outputting the MNX score object:

import { getScoreFromMusicXml, getMNXScore } from 'mnxconverter';
const score = getScoreFromMusicXml('<?xml your music xml goes here....>'); // get internal model
const mnxScore = getMNXScore(score); // encode model as mnx score object

// {
//   "global": {...},
//   "mnx": {...},
//   "parts": {...}
// }

Usage in Node.js

Install jsdom or any browser compatible DomParser

npm install jsdom

Set global variables

const jsdom = require('jsdom');
const { JSDOM } = jsdom;
const { DOMParser, XPathResult } = new JSDOM().window;
global.DOMParser = DOMParser;
global.XPathResult = XPathResult;
// conversion code like above...

Credits

Highly inspired by converter developed by Adrian Holovaty

Links

MNX documentation. W3C Music Notation Community Group.

Readme

Keywords

Package Sidebar

Install

npm i mnxconverter

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

155 kB

Total Files

23

Last publish

Collaborators

  • deemaagog