# create a Key object
Key(-7)
# insert a Key object into a specific measure
Music() + Key(7, bar = 2)
m <- Music() +
Line(list("E5"), list(1), name = "a") +
Line(list("C4"), list(1), name = "b", as = "staff")
# add a Key to a part
m + Key(2, to = "b")
# add a Key to a staff
m + Key(2, to = "b", scope = "staff")
Run the code above in your browser using DataLab