0xfe / vextab

A VexTab Parser for VexFlow
Other
594 stars 115 forks source link

Tied Notes, Missing Accidentals #8

Closed LarryKu closed 10 years ago

LarryKu commented 11 years ago

Experimenting, I created a simple melody in My Vexflow and uncovered a few VexTab problems. The article is:

http://my.vexflow.com/articles/287?source=enabled

  1. All tied notes are playing as if there was no tie.
  2. In the second measure, the first D on the 2nd string should have a natural sign. After a new barline, all accidentals from the previous measure are canceled.
  3. The strokes at the bottom of the song should cover all notes in both voices. The problem is there is no way of specifying the stroke end note in the second voice.

My VexFlow - 3 over 2

0xfe commented 11 years ago

Thanks for the report.

1) I'm working on a new player implementation that should fix this. (and the other player issues you brought up on G+)

2) This is easy to fix. I can just reset the keymanager whenever I see a barnote.

3) Ouch! I'm not exactly sure how to approach this one. We could attach the stroke to the modifier context, or maybe get the current modifier context of the note during draw() and figure out the extents. I have to think about this.

0xfe commented 11 years ago

BTW, that's a pretty melody.

LarryKu commented 11 years ago

Thanks. It's an excerpt from a song I wrote to to teach people how to play 3 over 2. That rhythmic pattern is very difficult for most people to play as there is no easy way to count the 1/4 note triplets while playing regular 1/4 notes in the other voice. Unfortunately, I can't finish the lesson as the current tuplet implementation does not work for 1/4-1/8 triplet pairs.

LarryKu commented 11 years ago

Since i created the strokes class, I'll see if I can come up with an alternate way to specify how to include all notes in multi voices.

0xfe commented 11 years ago

I'm not sure what 1/4 - 1/8 triplet pairs are, do you have an example?

Also, is it the VexTab representation that doesn't accomodate for 1/4-1/8 pairs, or is the VexFlow tuplet implementation lacking?

Thanks for looking at the strokes class.

LarryKu commented 11 years ago

Here is a sample. It is the VexFlow implementation. I tried modifying the tuplet_tests.js class to see if they could be displayed, and it didn't work either. There is also a brief reference on page 18 of the "Standard Music Notation Practice" PDF you downloaded last week.

I also tried replacing the middle 1/4 note triplet with two 1/8 note triplets and it didn't work either.

Tuplets01

0xfe commented 11 years ago

I guess one way to work around it to tie two of the three eighth notes, right? (while, we figure out a way to render these.)

On Sat, Jan 26, 2013 at 8:49 AM, Larry Kuhns notifications@github.comwrote:

Here is a sample. It is the VexFlow implementation. I tried modifying the tuplet_tests.js class to see if they could be displayed, and it didn't work either. There is also a brief reference on page 18 of the "Standard Music Notation Practice" PDF you downloaded last week.

[image: Tuplets01]https://f.cloud.github.com/assets/1071803/99785/b299aa40-67be-11e2-9f28-b19ccf4c07e2.png

— Reply to this email directly or view it on GitHubhttps://github.com/0xfe/vextab/issues/8#issuecomment-12735539.

Mohit Muthanna [mohit (at) muthanna (uhuh) com]

LarryKu commented 11 years ago

Yes, tying 1/8th notes is the only way to represent this notation. Not the best but workable.

0xfe commented 11 years ago

Okay, I added some changes to render mixed tuplets, along with new VexTab syntax. Take a look at the example:

tabstave notation=true tablature=false key=G time=4/4
notes :q E/5 :8 E/5 ^3,2^ :8 E/5 :q E/5 ^3,2^
notes :8 E-E-E/5 ^3^

Screen Shot 2013-01-26 at 11 26 12 AM

The syntax is ^T,N^ where T is the tuplet type, and N is the number of notes to use. So above we're creating a triplet with two notes. The underlying math figures out the right tick values (also applied to the player).

I also fixed bug 2 (cancel accidentals after a new bar.)

These changes have been pushed to my.vexflow.com so you can try them out.

A handy link to test this is: http://my.vexflow.com/playground.html

LarryKu commented 11 years ago

They look great !! Although it's not critical, the bar over the second example should span the equivalent of two 1/8th triplets, as shown in the example I submitted earlier.

I have some mods to the strokes class that will include all voices. I need to do some more testing if the tablature is includes multiple voices like in the sample song in the article. I'll have to set up a test for this situation.

LarryKu commented 11 years ago

I made changes in strokes.draw() to have the strokes span all voices in the notation, but I can't find a way to access all voices when the tablature is created from multi voices. What I did to fix the notation was grab the modifier context so I could get all stavenotes from the modifiers and set the end note so I could use the existing draw() code. This doesn't work for tabnotes as they are not included in the modifier context.

Any suggestions?

0xfe commented 11 years ago

Are you sure? There should be one modifier context per stave/tick, and all notes on the stave/tick should be part of the same modifier context. This means that stave notes for a tick share one modifier context, and tab notes share a different one. (This is how bends, etc. are formatted.)

This is done inside Formatter.joinVoices, which calls createModifierContexts for all the voices.

LarryKu commented 11 years ago

Yes, I'm sure. I used FireBug debugger and placed a breakpoint in the strokes.draw() class. The modifier context for the tablature has the strokes, but there are no tabnotes or notes of any kind in the modifiers list.

For notation, stavenotes do appear in the modifiers list. That is how I am accessing the second voice and getting it to work as wanted. Maybe I should try to get the stave somehow to see if the tabnotes appear in the modifier context.

I just took a more in depth look using FireBug. From the note in the strokes class, I can drill down to the tickables (i.e note->tickContext->tickables) to access the needed ys[] arrays. I'm fairly certain this will work.

0xfe commented 11 years ago

You're right... I just dug in and found that TabNotes don't get added. Sorry about the mixup.

I just pushed a change to add TabNotes to the modifier context. They're under the category "tabnotes".

LarryKu commented 11 years ago

That did the trick. It made the changes to strokes class so simple. I just need to clean up some things and add a new multi voice tab & notation test.