@sebastianhaas
Please could you explain me how can I change the color of note from musicXML. If it is possible to add some tag into it or some function from OSMD ? How to use OSMDcolor ? I think usin vexFlow it is possible to make color of note different. It was something like :
StaveNote.setKeyStyle(index, style)
Hey @vadymVolkov! Thanks for bringing this up. Unfortunately I believe (don't pin me down to this, I haven't been included in most of the codebase's development) that this is not possible at the moment, however, as you've already pointed out, it is probably very easy to add.
Would you be willing to tell me about your specific use case? What would be an ideal way for you to control a note's color? Since OSMD is designed primarily to display MusicXML-based sheet music, rather than creating notes via code, I wonder how this would work? Is there a color flag in the MusicXML standard?
Re your question on OSMDColor, it's just a simple representation of an RGBA set with a few predefined colors.
Thank you for your input!
Hi @sebastianhaas
Thanks for your answer. We have a small startup. Trying to make some kind of GitHub for musicians.
Each user has his own project, uploading his music XML from guitar Pro for example. He can check it on his project page. Then he makes some changes to his notes and uploads to his project new version of his music XML. We want to show him the difference between old and new versions with OSMD. But for the new version, we want to highlight the notes that have been changed with a different color. We think about using some additional attribute inside music XML for the notes, that has been changed.
@vadymVolkov cool project,waiting for your url here
Sounds really cool. Would you be willing to create a MusicXML diff viewer as an open-source plugin for OSMD or is this part of your core business model?
As an OSMD plugin, I can see how this could work by just calling OSMD with two MusicXML files and have it highlight the differences.
If you want to do the diff logic as part of your business, and have two OSMD instances side-by-side with colored notes, _or_ one single OSMD instances with a merged MusicXML with the divergent notes colored, we have to think about how to determine the notes to be highlighted.
I took a look at the MusicXML standard, it would be possible to use the color attribute on the note element. ;) http://usermanuals.musicxml.com/MusicXML/MusicXML.htm#CT-MusicXML-note.htm?Highlight=color
What do you think?
Sory @dongnaebi our repository is private.
@sebastianhaas So we just start our project and we are trying to make it with a different way. And I am only backend developer in our team.
Our main core is finding diff for MusicXML and make some merging. At the current moment, I parsing muxicXML and get some necessary tags values from it and I send it as JSON to frontend and they are using Vexflow to show it in the browser. I send them some flags in JSON so they now which note to highlight.
Yes coloring will be possible - i made already a little test on that in the past. See VexFlowMeasure.finalizeBeams():
// for (let note of notes) {
// (<Vex.Flow.StaveNote> note).setStyle({fillStyle: "green", strokeStyle: "green"});
We will add a method for the GraphicalNote to color it with predefined colors (as we have already used in the past) and also with user-defined colors. So once you have the object model of the score in memory, you can change colors as desired. But also reading out the color attribute from xml as proposed by @sebastianhaas makes totally sense and sounds also perfect for your needs.
@vadymVolkov noteheads and stems are colored via XML now, merged into develop.
See #434