Create a Key
object.
Key
objects represent key signatures.
Key(key, bar = NULL, to = NULL, scope = NULL)
An 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 into which to insert the Key
object. By default, a Key
object will be inserted into the first measure(s).
Optional. A positive integer or a single character which
indicates the Line
object to which to add the Key
object. By default,
a Key
object will be added to a whole Music
object rather than to
any specific Line
object.
Optional. "part"
or "staff"
, which indicates whether
to add the Key
object to a whole part or only to a staff of a part,
if the argument to
is specified, or this argument will be ignored.
The default value is "part"
.
A list with class Key
.
+.Music()
for adding Key
objects to a Music
object.
# create a Key object
Key(-7)
#> Key C- major (A- minor)
# insert a Key object into a specific measure
Music() + Key(7, bar = 2)
#> Music
#>
#> Key C# major (A# minor) at 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")
#> Music
#>
#> Line 1
#>
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch E5
#> * of duration 1
#> * of name "a"
#>
#> Line 2
#>
#> * as part 1 staff 2 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> * of name "b"
#>
#> Key D major (B minor) for part 1
# add a Key to a staff
m + Key(2, to = "b", scope = "staff")
#> Music
#>
#> Line 1
#>
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch E5
#> * of duration 1
#> * of name "a"
#>
#> Line 2
#>
#> * as part 1 staff 2 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> * of name "b"
#>
#> Key D major (B minor) for part 1 staff 2