Create an Accidental
object to represent an accidental symbol.
Accidental(name, i, j = NULL, to = NULL, bracket = NULL)
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.
A single positive integer, which represents the position of the accidental in a musical line.
Optional. A single positive integer, which represents the position of the accidental in a chord.
Optional. A single character or a single positive integer, which indicates the musical line where to add the accidental.
Optional. A single logical, which indicates if the accidental is enclosed in brackets.
A list of class Accidental
.
+.Music()
for adding an Accidental
to a Music
object.
# Create an `Accidental`
accidental <- Accidental("natural", 2, bracket = TRUE)
accidental
#> Accidental
#>
#> * natural
#> * enclosed in brackets
#> * to be added at position 2
# Add it to a `Music`
music <- Music() + Meter(4, 4) + Line(c("C4", "C4")) + accidental
music
#> Music
#>
#> $meters
#> # A tibble: 1 × 6
#> bar number unit actual_number actual_unit invisible
#> <int> <int> <int> <int> <int> <lgl>
#> 1 1 4 4 4 4 FALSE
#>
#> $notes
#> # A tibble: 2 × 7
#> line i j pitch midi duration length
#> <int> <int> <int> <chr> <int> <chr> <dbl>
#> 1 1 1 NA C4 60 NA 1
#> 2 1 2 NA C4 60 NA 1
#>
#> $lines
#> # A tibble: 1 × 7
#> part staff voice segment bar offset name
#> <int> <int> <int> <int> <int> <dbl> <chr>
#> 1 1 1 1 1 1 0 NA
#>
#> $accidentals
#> # A tibble: 1 × 5
#> line i j name bracket
#> <int> <int> <int> <chr> <lgl>
#> 1 1 2 NA natural TRUE
#>
# Generate the music score
if (interactive()) {
show(music)
}