Create a Tempo object to represent a tempo marking.

Tempo(tempo, unit = NULL, bar = NULL, offset = NULL, marking = NULL)

Arguments

tempo

A positive number, which indicates the number of quarter notes per minute.

unit

Deprecated. Was used to specify the beat unit. Please use marking instead.

bar

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

offset

Optional. A non-negative number, which indicates the tempo's position in a measure. The default value is 0.

marking

Optional. A single character, which represents the marking that appears on the score. See the Details section.

Value

A list of class Tempo.

Details

The parameter tempo is used to specify the actual playback speed, while marking to represent the marking that appears on the score.

Some examples:

  • Tempo(50): the playback speed is 50 quarter notes per minute. A marking of "quarter = 50" will be added to the score.

  • Tempo(50, marking = "Adagio"): the playback speed is 50 quarter notes per minute, while the marking on the score is "Adagio".

  • Tempo(50, marking = "Adagio half. = 20"): the playback speed is 50 quarter notes per minute, while the marking on the score is "Adagio half. = 20".

  • Tempo(50, marking = "Adagio (quarter = 45-80)"): you can add a speed range and parentheses to the marking.

  • Tempo(50, marking = "quarter. = quarter"): you can also indicate metric modulations with marking.

See also

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

Examples

# Create a tempo
tempo <- Tempo(50, marking = "Adagio (half = 25)")
tempo
#> Tempo Adagio (half = 25)
#> 
#> * 50 quarter notes per minute 

# Add it to a `Music`
music <- Music() + Meter(4, 4) + Line(c("C4", "D4", "E4", "F4")) + tempo
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: 4 × 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
#> 4     1     4    NA F4       65 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   
#> 
#> $tempos
#> # A tibble: 1 × 4
#>     bar offset tempo marking           
#>   <int>  <dbl> <dbl> <chr>             
#> 1     1      0    50 Adagio (half = 25)
#> 

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