0xfe / vexflow

A JavaScript library for rendering music notation and guitar tablature.
http://www.vexflow.com
Other
3.9k stars 662 forks source link

Notes with both custom glyph and microtonal accidental #578

Closed pjcdawkins closed 7 years ago

pjcdawkins commented 7 years ago

I want to use diamond noteheads (available via these glyphs) with microtonal (quarter-tone) accidentals.

The only way I have found to create a note with a diamond notehead is via Flow.keyProperties(), and the way to get to that is by creating a StaveNote with keys.

But Flow.keyProperties() doesn't allow all the accidentals in Flow.accidentalCodes.accidentals. It uses Flow.keyProperties.note_values instead, which only allows chromatic accidentals.

For example:

// Works (G sharp)
new VF.StaveNote({keys: ['G#/4/D0']})

// Doesn't work (G three-quarter flat)
new VF.StaveNote({keys: ['Gdb/4/D0']})

I was able to create notes with the microtonal accidentals via EasyScore.notes(). But that option doesn't accept a glyph code (for the diamond).

So unless I'm missing something, it seems I can't have both.

I'd happily work on a PR, if you can confirm that functionality is missing.

pjcdawkins commented 7 years ago

I've since realised I don't need to set the accidental in the keys - I can add a modifier instead:

let staveNote = new VF.StaveNote({keys: ['G/4/D0']});
staveNote.addAccidental(0, new VF.Accidental('db'));