Skip to main content
Topic: Chord/measure length problem (Read 650 times) previous topic - next topic

Chord/measure length problem

When you compare the extracts of the original pdf_score and the resulting nwc-file (see attachments), you notice that the measure in the second staff of the nwc-file is too long.

What's going wrong?

Code: [Select · Download]
Always look on the bright side of life!

Re: Chord/measure length problem

Reply #1
Because the second chord is effectively 1.5 beats. the eighth will come .5 of a beat  after the next note, not a beat later and so you need to make a rest chord to get this to work properly.

It's up to you if you hide the rest or not.

Code: (nwc) [Select · Download]


Re: Chord/measure length problem

Reply #2
A rest-chord will do the trick very easily.  (The rest can be hidden but I left it unbidden to illustrate what I mean)

Re: Chord/measure length problem

Reply #3
Thanks for your answers, Richard and Melismata.

And I found the explanation in the NWC help file :

Lastly, it is important to understand that only the smaller duration item is actually used in aligning notes on a score. When creating split-stem chords, the notes in the larger duration are ignored when formatting and alignment is performed with respect to other notes above and around this item

So that solved the problem of the reason for the measure misalignment.


That leaves me with another problem, because my example was the result of the user tool I'm working on, to convert MusicXML files to nwctxt.

You find in attachment an extraction of the original musicxml file, i.e. the part that concerns the particular measure.
I' ll try to explain the elements that define the notes and their place in the measure:
- Some elements have a 'voice 1' tag, some have 'voice 2'.
- The voice 1 elements are a 'forward' of a quarter, followed by a quarter dotted B and eighth C. So this adds up to 3 quarters.
- Then there's a 'backup' tag of 3 quarters, which brings us back to the start of the measure.
- Then follow the voice 2 elements: a chord quarter D and quarter F, followed by a quarter F and quarter G. This also ads up to 3 quarters.

This seems totally logical to me: because of the 'forward' tag, the dotted quarter of voice 1 starts at the second beat and the eighth note at the second half of beat 3.
The empty place at the start is then filled with a quarter chord for voice 2.
Now, according to the documentation of MusicXML, a forward tag can repressent an invisible rest, which, if applied here, would result in a restchord at the start of the measure, but it would be a quarter rest to be in accordance to the forward tag. But for NWC a restchord with an eighth rest is needed at the third beat. I don't see how to insert this behaviour in my tool.

So the fact that NWC only conciders the shortest length for chords with 2 different lengts, is in contradiction with the logic of MusicXML(which seems more logical to me).

Conclusion: I know now how it should be done in NWC, but I don't know how to automate it n my tool.
Always look on the bright side of life!

Re: Chord/measure length problem

Reply #4
Well, opagust,

As far as I have understood, NWC always goes forward within a staff.  Going back does never happen. That’s why rest chords are needed. But if you would have more than two notes or rests with different durations, you cannot put them on a single staff (unless you “break” the longer objects into smaller parts and tie them again together). Then it “sounds” well, but “looks” ugly.
In such cases NWC users have solved this by adding additional “layered” staves.

With XMLmusic files being able to go back and NWC always going forward in a staff, you can only know how it should look like in an NWC after you have read all the notes that should appear at a particular position. Buffering them until you are sure to know all the notes is then inevitable.

The alternative is to put  the “backward notes” always in a seperate, layered staff. Probably this will be the easiest way to implement. You just need to keep track of the last position in the current and layered tracks and add (hidden) rests in the layered staff until you reach the position where the back-tag is poiting to. Probably - but this depends on what XMLMusic allows - you can synchronize your layered staff per measure. But when turns out that there are no backward directions at all in your score, you end up with empty layered staves that weren’t needed at all.

I hope this gives you some insight into possible solutions for your implementation.



Re: Chord/measure length problem

Reply #5
Thanks, Bart, for your comment.

After a good night's sleep and a pleasant saturday with my grandchildren, I decided to redesign my tool to create layered staves.

I think the trigger for using layers is  the presence of different 'voice' tags in the xml file. Since I read the file into a graph-like object, I can inspect it to search for these tags and create the layered staves, before starting the actual processing.

So now I'm gonna take a safety copy first and then see how far I will get with this new insight. I may or may not work, and only by trying I will found out...
Always look on the bright side of life!