Learn R Programming

gm (version 2.0.0)

Accidental: Create Accidental Object

Description

Create an Accidental object to represent an accidental symbol.

Usage

Accidental(name, i, j = NULL, to = NULL, bracket = NULL)

Value

A list of class Accidental.

Arguments

name

A single character, which represents the name of the accidental. "flat" and "sharp" are two common examples. For a complete list of accidentals, please refer to the MusicXML specification. Unfortunately, not all accidentals are supported in MuseScore.

i

A single positive integer, which represents the position of the accidental in a musical line.

j

Optional. A single positive integer, which represents the position of the accidental in a chord.

to

Optional. A single character or a single positive integer, which indicates the musical line where to add the accidental.

bracket

Optional. A single logical, which indicates if the accidental is enclosed in brackets.

See Also

+.Music() for adding an Accidental to a Music object.

Examples

Run this code
# Create an `Accidental`
accidental <- Accidental("natural", 2, bracket = TRUE)
accidental

# Add it to a `Music`
music <- Music() + Meter(4, 4) + Line(c("C4", "C4")) + accidental
music

# Generate the music score
if (interactive()) {
  show(music)
}

Run the code above in your browser using DataLab