Skip to contents

Calculates the difference in onset times for each instrument pair in milli-seconds.

Usage

difference_onsets(onset_obj, instruments, expr = NULL, splicing_dfr = NULL)

Arguments

onset_obj

OnsetsSelected object.

instruments

character vector of instrument names.

expr

R expression to subset onsets (not required).

splicing_dfr

Splice object (not required).

Value

OnsetsDifference object.

Examples

r1 <- get_sample_recording()
o1 <- get_onsets_selected_data(r1)
head(difference_onsets(o1, instruments = c('Inst', 'Tabla')))
#>         Metre Ref_Beat_Time Inst-Tabla Segment
#> 1 DrutTeental      2395.808     15.159     All
#> 2 DrutTeental           NaN         NA     All
#> 3 DrutTeental      2396.261         NA     All
#> 4 DrutTeental      2396.502         NA     All
#> 5 DrutTeental      2396.753         NA     All
#> 6 DrutTeental      2397.003         NA     All
head(difference_onsets(o1, instruments = c('Inst', 'Tabla'), expr = 'Matra == 3'))
#>         Metre Ref_Beat_Time Inst-Tabla    Segment
#> 1 DrutTeental      2396.261         NA Matra == 3
#> 2 DrutTeental      2400.210         NA Matra == 3
#> 3 DrutTeental      2404.247         NA Matra == 3
#> 4 DrutTeental           NaN         NA Matra == 3
#> 5 DrutTeental      2411.947         NA Matra == 3
#> 6 DrutTeental      2415.839     20.244 Matra == 3