Add a component to a Music
object.
# S3 method for Music
+(music, object)
A Music
object.
An object of class Line
, Meter
, Key
, Tempo
, Clef
, Instrument
, Pedal
, Slur
, Hairpin
, Notehead
, Accidental
, Velocity
, Dynamic
, Grace
, Stem
, Lyric
, Tie
, Articulation
, Fermata
, Breath
, Trill
, Turn
, Mordent
, Schleifer
or Tremolo
.
A list of class Music
.
Music()
for initialization of a Music
object.
# Initialize a `Music` object
music <- Music()
# Add a `Line`
music <- music + Line("C4", 1)
music
#> Music
#>
#> $notes
#> # A tibble: 1 × 7
#> line i j pitch midi duration length
#> <int> <int> <int> <chr> <int> <chr> <dbl>
#> 1 1 1 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
#>
# Add a `Meter`
music <- music + Meter(4, 4)
music
#> Music
#>
#> $notes
#> # A tibble: 1 × 7
#> line i j pitch midi duration length
#> <int> <int> <int> <chr> <int> <chr> <dbl>
#> 1 1 1 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
#>
#> $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
#>
# Generate the music score
if (interactive()) {
show(music)
}