Skip to content

Commit

Permalink
Augmented Second Chord Stems
Browse files Browse the repository at this point in the history
Temporarily work around a Vexflow bug where chords with augmented seconds and stems down do not draw properly.
  • Loading branch information
mscuthbert committed Jun 22, 2024
1 parent 6ab57ab commit a46f5e7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/stream/makeNotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ export function setStemDirectionForUnspecified(
}

for (const n of s.rc(note.NotRest)) {
if (n.pitches.length > 1) {
const pitchSet = new Set(n.pitches.map(p => p.diatonicNoteNum));
if (pitchSet.size < n.pitches.length) {
// bug in Vexflow v4 at least -- chords with augmented seconds
// and down stems do no render properly.
// set their stems to 'unspecified' which Vexflow will currently
// render as upstems.
n.stemDirection = 'unspecified';
continue;
}
}

if (n.stemDirection !== 'unspecified') {
continue;
}
Expand All @@ -202,6 +214,9 @@ export function setStemDirectionForUnspecified(
const _up_down: readonly string[] = ['up', 'down'];
const _up_down_unspecified: readonly string[] = ['up', 'down', 'unspecified'];

/**
* Set stem directions for all notes in a beam group.
*/
export function setStemDirectionOneGroup(
group: note.NotRest[],
{
Expand Down

0 comments on commit a46f5e7

Please sign in to comment.