Create a Meter object to represent a time signature.

Meter(
  number,
  unit,
  bar = NULL,
  actual_number = NULL,
  actual_unit = NULL,
  invisible = NULL
)

Arguments

number

A positive integer to represent the upper numeral of the time signature, which indicates how many beats each measure has.

unit

A single integer which can be 1, 2, 4, 8, 16, 32 or 64. It represents the lower numeral of the time signature, which indicates the duration of one single beat.

bar

Optional. A positive integer, which indicates the number of the measure where to add the time signature. By default, the time signature will be added at the first measure.

actual_number, actual_unit

Optional. They define the actual time signature rather than the one that appears on the score. Usually used to create a pickup measure. By default, they are the same as number and unit.

invisible

Optional. A single logical, which indicates whether to show the time signature on the score. Usually used to create a pickup measure. The default value is FALSE.

Value

A list of class Meter.

See also

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

Examples

# Create a 3/4 time signature
meter <- Meter(3, 4)

# Add it to a `Music`
music <- Music() + Line(c("C4", "D4", "E4")) + meter
music
#> Music 
#> 
#> $notes
#> # A tibble: 3 × 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
#> 3     1     3    NA E4       64 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      3     4             3           4 FALSE    
#> 

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