I would like to investigate the musical intervals between consecutive notes in various classical excerpts. For example, which composers make their music using relatively larger intervals, etc.

I think a good starting point is using musicXML files. However, the file itself contains too much information such as page margins and stem direction of notes.

Is there any way I can analyze the notes and intervals with MATLAB or Python (programming)?

I don't know whether this question is most suitable for this or another stackexchange website.

  • 1
    Interesting, but I doubt any useful revelations will be uncovered. – Tim Mar 12 '19 at 11:44
  • 4
    I'm voting to close this question as off-topic because it's more about information parsing than about music theory or practice. – Tim H Mar 12 '19 at 12:28
  • 1
    It would be good if those voting to close could explain their thoughts in a little more depth. At its heart, this question seems to be about the content and characteristics of musical file formats - why would that not be on topic here? We answer questions about MIDI and lilypond... – topo Reinstate Monica Mar 12 '19 at 12:57
  • 3
    @topomorto The question seems to be asking for an algorithm. To me it reads, “how do I parse XML?” Doesn’t seem to be about music at all, and parsing XML doesn’t strike me as very different when it’s MusicXML. – Todd Wilcox Mar 12 '19 at 13:04
  • 2
    @topomorto -- I have voted to close as "too broad". As I said in my earlier comment, I think that "Is there any way I can analyze the notes and intervals with MATLAB or Python (programming)?" is just way too broad. It would also be too broad at Stack Overflow. If this is a request for a library recommendation, that would also be off-topic here and at Stack Overflow. – ex nihilo Mar 12 '19 at 13:27

Well if you intend to use programming language then "too much information" in xml file shouldn't be a problem. You can write a script that will pick from xml file only the nodes you're interested in.

If you use python then try libraries like mingus for analysing the intervals:



MusicXML files contain page layout information. To strip it down to just note data use MIDI files. If you have the programming skills to analyse intervals, you shouldn't have any trouble parsing a MIDI file.

Any score editor that reads MusicXML will do the conversion to MIDI for you. Including the free Muse Score.

  • I also think midi files would fit better for this purpose. But the XML files can be transformed into midis aswell. – Albrecht Hügli Mar 12 '19 at 12:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.