This software has been created as part of a disseration at the University of Technology, Sydney. Its purpose if to convert MusicXML files into timestamped JSON files, in order to make this type of data more suited to time-series analysis and data visualization. MusicXML does not explicitly encode time information (in the sense that any particular note or rest can not be interrogated for its temporal position), and its focus is on presentation, rather than analysis.
{
"Midi number": -1,
"Current chord root": "0",
"Current chord root as int": 0,
"Current chord type": 0,
"Harmony note flag": false,
"Current measure": 1,
"Duration": 720,
"Duration due to tied notes": 720,
"Location": 0,
"Location in measure": 0,
"Measure location": 0,
"Time signature numerator": 3,
"Time signature denominator": 8,
"Quarter beats per minute": 60,
"Time stamp": "1685-03-20T13:00:00.000Z",
"Instrument": "Part 0",
"Voice": 1,
"Genre": "Acoustic Jazz",
"Composer name": "Victor Young",
"Composer nationality": "US",
"Lyricist name": "Ned Washington",
"Lyricist nationality": "US",
"Performer name": "Keith Jarrett",
"Performer nationality": "US",
"Title": "Stella By Starlight",
"Composer collection": "The Uninvited",
"Performer collection": "Standards Live",
"Date composed": 1944,
"Date recorded": 1983,
"Recording location": {
"lat": [
48.8566,
"N"
],
"lon": [
2.3522,
"E"
]
}
},After downloading and running npm install, use the MusicXML2MusicJSON module with the followng command. It will output a copy of the musicJSON file into the ./outputData folder and the visualization/data folder. You can place path file names directly in convertMusicXML2JSON.js or send file names as args
node convertMusicXML2MusicJSON.js // OPTION 1 - put file path names directly in this filenode convertMusicXML2MusicJSON -f "<YOUR MUSICXML FILE>" -m "<YOUR METADATA FILE>" -o "<YOUR OUTPUT FILE>" // OPTION 2 - pass file path names on command linesCode docs for the MusicXML2MusicJSON code can be found in the out folder and has been generated with JSDocs
The most convenient way I have found to test this data is by using a pianoroll visualization, so I have included this along the with the usual tests you would expect. This a tiny node/express app, and will look for data where the musicJSON file will be placed. When you run the
node visualizeData.js Runing the visualization command above will make the visualization available from localhost:8080 and will look something like figure 1.
String with intrument name
Integer as current voice number of note or rest
Integer between 0 and 127 where 60 = Middle C = C4
Integer indicating duration of a note or rest, where a quarter note = 256
Modification of the Duration attribute as an integer value. Notes or rests that are tied to a next note will accumulate the duration of the next note. Notes that are tied to a prior note will have 0 value. This is the more accurate representation of duration
Boolean value indicating note is part of a chord
Integer representing current measure
Integer representing location of a beginning of a note of rest, where a quarter note = 256
Integer representing location of a the beginning of a measure, where a quarter note = 256
Integer representing the distance from the beginning of a note or rest to the beginning of the measure which it is in, where a quarter note = 256
Integer representing number of beats in a measure
Integer representing type of beats in a measure
Integer representing a standard bpm metronome measure, however, all values are converted to calculate quarter note beats per minute. If no tempo information is availalbe from the MusicXML, the default value is 60
Time in milliseconds of a note or rest relative to beginning of music, calculated from the Absolute Location and Quarter Beats Per Minute attributes
I have focused on the parts of a MusicXML specification that I need for a particular research project that centers around time, frequency, and location type information. I am also using a variation of this as a back end parser for my music search and analysis software at stelupa.com.
A couple of ommissions to be fixed as soon as possible - encoding of global metadata is needed(things such as composed year etc), some more tests needed and also need to fix some tied note issues. There are also notations, attributes and directions (things like slurs, mordents, directions etc) and I will bring those over too, but still deciding how I want to structure that. Also, I am using Sibelius mostly to generate the MusicXML and I don't know if this will play nicely with MusicXML files generated in other ways. I will get to the bottom of that soon and at least make things compliant to MuseScore. Once I sort that stuff out I will release it into the wild as an npm module. If there is anything you want added let me know, or send a pull request.
Jamie Gabriel
