# create a Music object
m <- Music() + Meter(4, 4) + Line(list("C4"), list(8), name = "a")
# create a Line object
l <- Line(
pitches = list("C5", "C5", "C5"),
durations = list(1, 1, 1),
# tie the first two notes
tie = list(1),
# add the Line as a voice
as = "voice",
# with Line "a" as reference
to = "a",
# before Line "a"
after = FALSE,
# insert the Line to bar 2 with offset 1
bar = 2,
offset = 1
)
l
# add the Line object to the Music object
m <- m + l
m
if (interactive()) {
show(m)
}
Run the code above in your browser using DataLab