Add a component to a Music object.

# S3 method for Music
+(music, term)

Arguments

music

A Music object.

term

A Line, Meter, Key, Clef or Tempo object.

Value

A list with class Music.

See also

Music() for initializing a Music object.

Line(), Meter(), Key(), Clef() and Tempo() for creating objects of corresponding classes.

Examples

# initialize a Music object
m <- Music()

# add a Line object
m <- m + Line(list("C4"), list(1))
m
#> Music
#> 
#> Line 1
#> 
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1 

# add a Meter object
m <- m + Meter(4, 4)
m
#> Music
#> 
#> Line 1
#> 
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> 
#> Meter 4/4 

# add a Key object
m <- m + Key(1)
m
#> Music
#> 
#> Line 1
#> 
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> 
#> Meter 4/4
#> 
#> Key G major (E minor) 

# add a Clef object
m <- m + Clef("G", to = 1)
m
#> Music
#> 
#> Line 1
#> 
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> 
#> Meter 4/4
#> 
#> Key G major (E minor)
#> 
#> treble Clef for part 1 staff 1 

# add a Tempo object
m <- m + Tempo(120)
m
#> Music
#> 
#> Line 1
#> 
#> * as part 1 staff 1 voice 1
#> * of length 1
#> * of pitch C4
#> * of duration 1
#> 
#> Meter 4/4
#> 
#> Key G major (E minor)
#> 
#> treble Clef for part 1 staff 1
#> 
#> Tempo quarter = 120