Create a Stem object to modify the stem of some note.

Stem(direction, i, to = NULL)

Arguments

direction

A single character, which can be "down", "up", "double", and "none". See the MusicXML specification.

i

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

to

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

Value

A list of class Stem.

See also

+.Music() for adding a Stem to a Music object.

Examples

# Create a `Stem`
stem <- Stem("none", 1)
stem
#> Empty Stem 
#> 
#> * to be added at position 1 

# Add a `Stem` to a `Music`
music <- Music() + Meter(4, 4) + Line(c("C4", "D4")) + stem
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 D4       62 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   
#> 
#> $stems
#> # A tibble: 1 × 3
#>    line     i direction
#>   <int> <int> <chr>    
#> 1     1     1 none     
#> 

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