# Create a G major
g <- Key(1, to = 1)
g
# Add it only to some part of a `Music`
music <-
Music() +
Meter(4, 4) +
Line(c("C4", "D4")) +
Line("G3") +
g
music
# Generate the music score
if (interactive()) {
show(music)
}
Run the code above in your browser using DataLab