{
# save wav file examples
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "lbh_selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav"))
# get vocal activity by second
va <- acoustic_activity(X = lbh_selec_table, path = tempdir(), time.window = 1,
hop.size = 1)
# get the row with the highest rate per sound file
do.call(rbind, lapply(split(va, va$sound.files), function(x)
x[which.max(x$rate), ]))
#including a file with no annotations
writeWave(Phae.long1, file.path(tempdir(), "no_anns.wav"))
va <- acoustic_activity(X = lbh_selec_table, path = tempdir(), time.window = 1,
hop.size = 1, files = list.files(tempdir(), pattern = ".wav$"))
}
Run the code above in your browser using DataLab