Open mm3509 opened 5 months ago
Hello @emonigma , just to double-check: What you would need is that homr takes e.g. image1.jpg, image2.jpg, image3.jpg and gives you a single musicxml file with the contents of all three images?
Yes, exactly. I could learn about the XML format of MusicXML, or how to concatenate them in MuseScore, but I think it would be a nice use case of getting several images into a single XML file. Thanks for considering it!
I was thinking about this: homr
detection isn't perfect and likely never will be. The transformer at its core has some randomness, which can yield slightly different results for the same input. So, if you have several pages of sheet music, a good workflow might be:
This approach allows you to select the best result for each page, rather than hoping the processing of all files gives you a good result.
From this perspective, a separate script to concatenate musicxml files might be a better solution. I might add one in the future if I find the time—right now, my focus is still on improving detection in homr
. However, if you'd like to contribute such a script, I'd be happy to accept a PR!
The script itself shouldn't be hard to write:
There is also this file https://github.com/liebharc/homr/blob/main/training/music_xml.py which parses musicxml files during training. However, I regret using xmltodict for it. For xml generation in homr
(https://github.com/liebharc/homr/blob/main/homr/xml_generator.py) I switched to musicxml
which works much better. Both scripts might help in writing a concatenation script.
Hi! That's a good idea and I tested it on a melody that had two pages, then joined them in MuseScore. It works! But fixing the piano chords to coincide with the original ended up being a lot of work, so for my use case, I decided to simply hire a musician to record my scores. I'm sorry I won't be using HOMR in the immediate future, but it's good to know that this technology exists and provides good results in case I want to publish these scores.
Feel free to close the issue. Thanks!
Hi @emonigma, makes sense! I'll leave the issue open in case someone else wants to add something to it.
However, I regret using xmltodict for it.
Do you mean that you would have preferred to use this lib instead of xml.etree.ElementTree?
@papoteur-mga , I meant that using xmltodict for this task felt like a poor choice by me. A few weeks after I wrote that comment, I've updated the code to use musicxml instead. That made it a lot clearer I believe.
@liebharc thanks for the clarification. I'm trying to implement this. For the interface, I foresee to add an option --concat on the CLI taking at least one parameter. If more than one, this is the list of files to merge, in the order. If only one, this is a radical and we take all files named radical*.musicxml, odering them by name. For the merging operation, I'm not yet fixed on how to do.
@papoteur-mga , nice! First of all big thanks for taking a look at this.
As I thought about this, I came to wonder if such a tool wouldn't be best implemented as its own command (in its own repo). In the end it could be a very general thing, like the cat
Unix command just for MusicXML. That would allow users to to use it in different scenarios and e.g. also for different OMR tools than homr
. We can of course link to the new tool from the homr
README so that people are aware of it.
For the use case mentioned in this issue, one could first transform all the images to MusicXML, repeat the processing of images where the results haven't been good and as soon as everything looks okay run the new command to combine the MusicXML files.
Let me know what you think about this.
For the arguments: I think accepting a list of either files or glob patterns (or a mix of it) would be good as this is something you can do with Unix cat
as well. E.g. one could say newcommand.py output1.musicxml goodresults/*.musicxml finaloutput.musicxml
.
Hello,
I have done relieur
that is available here: https://github.com/papoteur-mga/relieur
It is not yet widely tested, but it works on a few files that I have obtained from homr
and for the tests I have added.
Feedback is welcome.
relieur
is the name in French for bookbinder.
I have sheet music on multiple pages. I could append the several files horizontally or vertically, but doing so over multiple files is tedious. Could HOMR provide a way to combine or concatenate the several pages at the output instead of the input?