Vexflow: Notes don't adjust to clef change

Created on 11 Nov 2016  路  3Comments  路  Source: 0xfe/vexflow

When I change the clef from "treble" to "bass" in my score, the notes remain on the same line and spaces and are therefore not accurate in the new clef.

question

All 3 comments

Ok, so after googling around I figured out that I need to add the clef key to StaveNote initialization, but it would be nice have that in the documentation somewhere.

You are correct, including Clef elements does not impact the StaveNotes in the voice. You must manually provide the StaveNote with the expected clef on construction.

So to make a note in bass clef:

const noteInBassClef = new Vex.Flow.StaveNote({
  clef: 'bass',
  keys: ['c/4'],
  duration: '4'
});

That's really too bad, it would be AWESOME if the notes were universal, and the staff's clef defined how notes were drawn; ESPECIALLY if you could change the clef dynamically (which you cant, bleh), and the notes updated automatically.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Silverwolf90 picture Silverwolf90  路  4Comments

rowild picture rowild  路  5Comments

sug1no picture sug1no  路  6Comments

dinukadesilva picture dinukadesilva  路  5Comments

CrystalShardz picture CrystalShardz  路  4Comments