UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

27 lines (26 loc) 810 B
/** * The `<bend>` element is used in guitar notation and tablature. A single note with a bend and release will contain two * `<bend>` elements: the first to represent the bend and the second to represent the release. * * See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/bend/ */ export class Bend { element; constructor(element) { this.element = element; } /** Returns the number of semitones to bend. */ getAlter() { return this.element.first('bend-alter')?.content().float() ?? 1; } /** Returns the type of bend. */ getType() { if (this.element.first('pre-bend')) { return 'pre-bend'; } if (this.element.first('release')) { return 'release'; } return 'normal'; } }