Skip to main content

Build Document

Scores ar created with DocumentBuilder.

import * as Score from "web-music-score-v6/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 and forward builder is used as known thing.

Live Example​