Key
ObjectCreate a Key
object to represent a key signature.
Key(key, bar = NULL, to = NULL, scope = NULL)
A list of class Key
.
A single integer between -7 and 7, which indicates the number of flat or sharp symbols in the key signature.
Optional. A positive integer, which indicates the number of the measure where to add the key signature. By default, the key signature will be added at the first measure.
Optional. A single character or a single positive integer, which indicates the musical line where to add the key signature. By default, the key signature will be added to the whole music rather than some specific musical line.
Optional. A single character of "part"
or "staff"
,
which indicates whether to add the key signature to a whole part or
only some staff of the part. Only when to
is specified, can this
argument be specified. The default value is "part"
.
+.Music()
for adding a key signature to a Music
object.
# 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