Key {gm}R Documentation

Create Key Object

Description

Create a Key object to represent a key signature.

Usage

Key(key, bar = NULL, to = NULL, scope = NULL)

Arguments

key

A single integer between -7 and 7, which indicates the number of flat or sharp symbols in the key signature.

bar

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.

to

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.

scope

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".

Value

A list of class Key.

See Also

+.Music() for adding a key signature to a Music object.

Examples

# 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)
}

[Package gm version 2.0.0 Index]