{
# set temporary directory
td <- tempdir()
# load example data
data("test_sounds_est")
########## save acoustic data (This doesn't have to be done
# with your own data as you will have them as sound files already.)
# save example files in working director
for (i in unique(test_sounds_est$sound.files)[1:2]) {
writeWave(object = attr(test_sounds_est, "wave.objects")[[i]],
file.path(tempdir(), i))
}
test_sounds_df <- as.data.frame(test_sounds_est)
test_sounds_df <- test_sounds_df[test_sounds_df$sound.id != "ambient", ]
test_sounds_df <-
test_sounds_df[test_sounds_df$sound.files %in%
unique(test_sounds_est$sound.files)[1:2], ]
####
# closest to mean (default)
spot_ambient_noise(X = test_sounds_df, path = td, length = 0.12, ovlp = 20)
# min peak
spot_ambient_noise(X = test_sounds_df, path = td, length = 0.12, ovlp = 20, fun = which.min)
}
Run the code above in your browser using DataLab