Skip to content

Adding dynamics to the score #1640

Answered by AaronDavidNewman
XenonApps asked this question in Q&A
Discussion options

You must be logged in to vote

You have to render the note first to get the absolute X. This is what I do in Smoosic:

Here is an a abridged version. This is vex4. Vex5 might have slightly different syntax.

var x = stemmableNote.getAbsoluteX();
var y = stave!.getYForLine(11); // assuming you want it on the bottom, stave is the vexflow Stave object
var code= 'dynamicForte';  // e.g. dynamicMezzo
var fontSize = 30;
const glyph = new VF.Glyph(text, fontSize);
glyph.render(context, x, y);  // context is SVG context

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@XenonApps
Comment options

Answer selected by XenonApps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants