consider me a super beginner that wants to put a basic music notation (nursery rhymes/music) onto a music notation using vexflow. I know there is vextab, but I am familiar with JavaScript and have a basic example running. My problem is that I want to add multiple chords, then maybe even switch to a new line once the space is taken. Right now my notes appear in the same chord. Can anyone show me a super simple example of how that works?
I know this is a super simple, I apologize for not getting this myself but I am sure anyone here can quickly point me in the right direction...
var canvas = $("#musicCanvas")[0];
var renderer = new Vex.Flow.Renderer(canvas, Vex.Flow.Renderer.Backends.CANVAS);
var ctx = renderer.getContext();
var stave = new Vex.Flow.Stave(10, 0, 500);
stave.addClef("treble").setContext(ctx).draw();
//notes
// Create the notes
var notesA = [
new Vex.Flow.StaveNote({ keys: ["c/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["d/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["e/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["f/4"], duration: "q" }),
];
var notesB = [
new Vex.Flow.StaveNote({ keys: ["g/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["a/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["g/4"], duration: "q" }),
new Vex.Flow.StaveNote({ keys: ["a/4"], duration: "q" })
];
var voiceA = getVoice(notesA);
var voiceB = getVoice(notesB);
// Create a voice in 4/4
// Format and justify the notes to 500 pixels
var formatter = new Vex.Flow.Formatter().
joinVoices([voiceA, voiceB]).format([voiceA, voiceB], 500);
// Render voice
voiceA.draw(ctx, stave);
voiceB.draw(ctx, stave);