< Back to IRCAM Forum

Getting information from MusicXML

Hello!
I’ve successfully imported a MusicXml file using the import-musicxml function, into a Voice object. The piece I’m working with is just a melody, no chords. I wanted to extract pitch and duration information into two separate lists, to manipulate then and to create a new melody. Is it possible to do so?

hello punksterbass,

I’m not sure I understand what you’re looking for, but of course you can do this: connect the first outlet (self) of that voice object into the first inlet of a chord-seq. there you are… the 2nd outlet of this last object will give you a list of midicents. given that you’re working with a melody, you’ll need to flatten out this list. use the flat lisp function for this. the 3rd out let will give you a list of onsets, and finally the 4th outlet, a list of durations (use flat again). mind you’‘ll have to deal with onsets and durations and you’'ll have two different lists to manipulate…
hope this helps you,
best,
perti

1 Like

Hi,

As perti states, you have a lot of ways to do so depending on what you want. Here is a small concise example:

The patch:
info.omp (9.7 KB)

anyhow it is not about retreiving info from musicxml file, but from OM’s music classes.

Best
K

2 Likes

Thank you so much!
Is there a way to extract the actual rhythm tree from the object?

Nevermind, I just found it
Thank you!