diff --git a/src/parsing/musicxml/annotation.ts b/src/parsing/musicxml/annotation.ts index a9476cd5a..b6c1de7d9 100644 --- a/src/parsing/musicxml/annotation.ts +++ b/src/parsing/musicxml/annotation.ts @@ -21,6 +21,14 @@ export class Annotation { return new Annotation(config, log, machine.getText(), 'center', 'bottom'); } + static fromFingering(config: Config, log: Logger, musicXML: { fingering: musicxml.Fingering }): Annotation | null { + const number = musicXML.fingering.getNumber(); + if (typeof number === 'number') { + return new Annotation(config, log, `${number}`, 'center', 'top'); + } + return null; + } + parse(): data.Annotation { return { type: 'annotation', diff --git a/src/parsing/musicxml/note.ts b/src/parsing/musicxml/note.ts index ef64c5310..f8faabb3f 100644 --- a/src/parsing/musicxml/note.ts +++ b/src/parsing/musicxml/note.ts @@ -76,7 +76,14 @@ export class Note { } const stem = conversions.fromStemToStemDirection(musicXML.note.getStem()); - const annotations = musicXML.note.getLyrics().map((lyric) => Annotation.fromLyric(config, log, { lyric })); + const lyricAnnotations = musicXML.note.getLyrics().map((lyric) => Annotation.fromLyric(config, log, { lyric })); + const fingeringAnnotations = musicXML.note + .getNotations() + .flatMap((n) => n.getTechnicals()) + .flatMap((t) => t.getFingerings()) + .map((fingering) => Annotation.fromFingering(config, log, { fingering })) + .filter((a) => a !== null); + const annotations = [...lyricAnnotations, ...fingeringAnnotations]; const code = conversions.fromAccidentalTypeToAccidentalCode(musicXML.note.getAccidentalType()) ?? diff --git a/tests/integration/__image_snapshots__/32a-Notations_900px.png b/tests/integration/__image_snapshots__/32a-Notations_900px.png index 1b945216a..515194744 100644 Binary files a/tests/integration/__image_snapshots__/32a-Notations_900px.png and b/tests/integration/__image_snapshots__/32a-Notations_900px.png differ