grame-cncm / libmusicxml

A C/C++ library to support the MusicXML format.
Mozilla Public License 2.0
152 stars 33 forks source link

Fix the multi-voice, the overlapping problem of two adjacent voices #58

Closed zhwei8090 closed 2 years ago

zhwei8090 commented 2 years ago

image

But it caused a new problem, which I think is the problem of Guido library:

image test_6.xml.zip

dfober commented 2 years ago

note that with guido you could solve the collision issue using dx with the \acc tag i.e: \noteFormat<dx=2>\acc<dx=-2>( g&1/16) image Don't know if that can be solved at musicxml level in a general way.

arshiacont commented 2 years ago

This is really great! Thanks @zhwei8090 ! @dfober We have a [complicated] way of inferring the dx from multi-voice XMLs in this case. It seems like I have been ignoring this when there is no offset on the element! The correction makes sense for notes but I am wondering if we call this method for other elements (such as wedges) and whether it'd lead to bad positioning. It's however good for merge. If we encounter such cases we should probably use a separate method for that.

arshiacont commented 2 years ago

@dfober my previous message slipped too fast: In @zhwei8090 's fix, we are using the NoteFormat. Are you suggesting that the \acc should follow the same dx as in the associated noteFormat?

zhwei8090 commented 2 years ago

@dfober @arshiacont Yes, mainly to fix multi-voice no offset, missing noteFormat dx issue

dfober commented 2 years ago

Are you suggesting that the \acc should follow the same dx as in the associated noteFormat?

@arshiacont yes, that's one way to solve the collision. But it's probably difficult to solve this issue in a general way, it requires to have a global view on the context (are there other accidentals, etc.). I agree regarding the fact that this is an issue that should be posted to guido (including note collision detection in multi voice context). I'll first try to solve that at guido level.

zhwei8090 commented 2 years ago

@dfober Yes, my idea is to judge based on the context. If there is a test sample, you can try it. Because of the time, we will use this solution for the time being.

dfober commented 2 years ago

ok, I'll leave the merge pending for now. If there is a solution with guido, it will not be necessary. I'll keep you informed (but it may take a bit time).

zhwei8090 commented 2 years ago

ok

dfober commented 2 years ago

I've pushed a new version of the guido engine that can fix the multi-voices collision issue with an example of use. Could you check?

zhwei8090 commented 2 years ago

ok i'll try it now

zhwei8090 commented 2 years ago

@dfober After testing, I found that there is still a problem, this is the test demo: demo.xml.zip

dfober commented 2 years ago

the flag to resolve collisions is not set: on the first staff you should add: \set<resolveMultiVoiceCollisions="on">

zhwei8090 commented 2 years ago

The verification is ok, thank you

dfober commented 2 years ago

can I close you PR?

zhwei8090 commented 2 years ago

Well, I'm closing it now, thanks a lot