Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

gm (version 2.0.0)

Key: Create Key Object

Description

Create a Key object to represent a key signature.

Usage

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

Value

A list of class Key.

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

See Also

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

Examples

Run this code
# 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