Display notes of a same voice on different vertical staves

44 views
Skip to first unread message

Julien R.

unread,
Jun 28, 2016, 1:58:31 PM6/28/16
to vexflow
Hi,

I can’t figure out how to display a voice on several staves. More precisely, I’d like to spread several “keys” of a same StaveNote on different staves, like the following:

It seems that a Formatter takes a Stave and an array of StaveNotes, where each StaveNote contains several keys. In my example, I’d like to show the first key of the second StaveNote on the upper stave, and the second key of the second StaveNote on the bottom stave. I’m not sure I’m clear… :)


How can I achieve this? I tried to look at the API but wasn’t able to find a way to do it, so I think I have to re-implement my own logic to display the notes vertically (I can still let the Formatter to compute the x values)?

Julien R.

unread,
Aug 1, 2016, 1:30:21 PM8/1/16
to vexflow
Hi,

Can anybody help me?

I’m thinking of implementing my own MultiStaveNote, which would extend Note and, in contrast to StaveNote, would support several Staves for a given array of keys. Do you think that’s the right approach? Or is there a better way?

Cheers

Mohit Muthanna Cheppudira

unread,
Aug 1, 2016, 3:52:59 PM8/1/16
to vexflow
I'm not sure I understand why you want to spread a single voice across staves, but it will be simpler to have two voices and have the formatter align them across the staves.

Mohit.

--
--
You received this message because you are subscribed to the Google
Groups "vexflow" group.
To post to this group, send email to vex...@googlegroups.com
To unsubscribe from this group, send email to
vexflow+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vexflow?hl=en

---
You received this message because you are subscribed to the Google Groups "vexflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vexflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



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

Julien R.

unread,
Aug 1, 2016, 4:59:53 PM8/1/16
to vexflow, mo...@muthanna.com
Hi,

Thanks for replying!

Conceptually, I only have one voice, and I want to display its notes either on the G stave or on the F4 stave, according to their pitch.
I can manage to do that excepted when I have several notes (at the same time) where some of them should go on the G stave and some others on the F4 stave. In such a case I have to choose either one or the other, but for all notes, which is not what I want.

If I understand correctly, if I use distinct voices for the G stave and the F4 stave, the notes will not be displayed correctly on the horizontal axis: the formatter will consider that within a voice the notes are consecutives and independent of the notes of other voices. Thus, I won’t be able to display the picture I posted in my first post (for instance).

Mohit Muthanna Cheppudira

unread,
Aug 1, 2016, 5:03:10 PM8/1/16
to Julien R., vexflow
Yes, so when you add a note to a voice, just add a rest (or a GhostNote) of the same duration to the other voice. (The rest will get rendered but GhostNotes will be blank, giving you the same result as your example.)

Julien R.

unread,
Aug 1, 2016, 5:07:12 PM8/1/16
to vexflow, jul...@richard-foy.fr, mo...@muthanna.com
Great, I’ll try that, thanks!
Reply all
Reply to author
Forward
0 new messages