UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

30 lines (29 loc) 1.04 kB
import { ABOVE_BELOW, START_STOP, SHOW_TUPLET } from './enums'; /** * A <tuplet> element is present when a tuplet is to be displayed graphically, in addition to the sound data provided by * the <time-modification> elements. * * See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/tuplet/. */ export class Tuplet { element; constructor(element) { this.element = element; } /** Returns the type of tuplet. */ getType() { return this.element.attr('type').enum(START_STOP); } /** Returns the placement of the tuplet. Defaults to 'below'. */ getPlacement() { return this.element.attr('placement').enum(ABOVE_BELOW) ?? 'below'; } /** Returns the number of the tuplet. Defaults to 1. */ getNumber() { return this.element.attr('number').withDefault(1).int(); } /** Returns how the tuplet number should be displayed. */ getShowNumber() { return this.element.attr('show-number').withDefault('actual').enum(SHOW_TUPLET); } }