Skip to content

jgab3103/Music-Score-Metadata-Builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Score Metadata Builder


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.

Sample output

    {
      "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"
        ]
      }
    },

Usage

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 file
node convertMusicXML2MusicJSON -f "<YOUR MUSICXML FILE>" -m "<YOUR METADATA FILE>" -o "<YOUR OUTPUT FILE>" // OPTION 2 - pass file path names on command lines

Testing, docs and visualization

Code 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.

Figure 1.

Attributes description

Instrument
String with intrument name
Voice
Integer as current voice number of note or rest
Midi number
Integer between 0 and 127 where 60 = Middle C = C4
Duration
Integer indicating duration of a note or rest, where a quarter note = 256
Duration due to tied notes
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
Harmony note flag
Boolean value indicating note is part of a chord
Measure
Integer representing current measure
Absolute Location
Integer representing location of a beginning of a note of rest, where a quarter note = 256
Measure location
Integer representing location of a the beginning of a measure, where a quarter note = 256
Location in measure
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
Time signature numerator
Integer representing number of beats in a measure
Time signature denominator
Integer representing type of beats in a measure
Quarter beats per minute
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
Timestamp
Time in milliseconds of a note or rest relative to beginning of music, calculated from the Absolute Location and Quarter Beats Per Minute attributes

Issues and Future work

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

About

PhD dissertation software to create music score metadata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors