library(onsetsync) # to handle onsets
library(dplyr) # to handle summariesCh. 11 – Synchrony
Corpus analysis example of onsets.
Load libraries
Get Cuban Salsa and Son materials
These are build into the onsetsync package and come from IEMP collection. The code runs an analysis of asynchrony across different Cuban Salsa and Son tracks (five in total) and create a table of the Bass asynchronies with Guitar and Tres (in milliseconds).
corpus <- onsetsync::CSS_IEMP # Cuban Salsa & Son
D <- sync_sample_paired(corpus,'Bass','Guitar',0,1,'SD')
RES <-summarise(group_by(D$asynch,name), M = mean(asynch*1000))
D2 <- sync_sample_paired(corpus,'Bass','Tres',0,1,'SD')
RES2 <- summarise(group_by(D2$asynch,name), M = mean(asynch*1000))
names(RES)[2] <- 'Bass - Guitar (in ms)' # rename for clarity
RES$`Bass - Tres (in ms)` <- RES2$M # rename for clarity
print(knitr::kable(RES,digits=1)) # create table| name | Bass - Guitar (in ms) | Bass - Tres (in ms) |
|---|---|---|
| El Cantante | -5.2 | 14.6 |
| Habanera | -11.3 | 6.6 |
| Palo Santo | -16.1 | -3.5 |
| Tumbao Sangreao | -12.0 | 5.2 |
| Yo Naci En Un Sola | -7.1 | -4.4 |