Building Documents
Scores ar created with DocumentBuilder.
import * as Score from "web-music-score/score";
const builder = new Score.DocumentBuilder();
Then build the music document. Here are some functions just as an example.
builder.addMeasure();
builder.addNote(1, "C4", "2n");
builder.addRest(1, "2n");
Finally get the music document.
const doc = builder.getDocument();
Everything can be chained together because all operations return the builder itself.
const doc = new Score.DocumentBuilder()
.addMeasure()
.addNote(1, "C4", "2n")
.addRest(1, "2n")
.getDocument();
💡 From now on in this tutorial builder is used as known thing.