{
# Save sound files to temporary working directory
data("lbh1", "lbh2", "lbh_reference")
tuneR::writeWave(lbh1, file.path(tempdir(), "lbh1.wav"))
tuneR::writeWave(lbh2, file.path(tempdir(), "lbh2.wav"))
# template for the second sound file in 'lbh_reference'
templ <- lbh_reference[11, ]
# generate template correlations
tc <- template_correlator(templates = templ, path = tempdir(),
files = "lbh2.wav")
# using 2 threshold
optimize_template_detector(template.correlations = tc, reference =
lbh_reference[lbh_reference$sound.files == "lbh2.wav", ],
threshold = c(0.2, 0.5))
# using several thresholds
optimize_template_detector(template.correlations = tc,
reference = lbh_reference[lbh_reference$sound.files == "lbh2.wav", ],
threshold = seq(0.5, 0.9, by = 0.05))
# template for the first and second sound file in 'lbh_reference'
templ <- lbh_reference[c(1, 11), ]
# generate template correlations
tc <- template_correlator(templates = templ, path = tempdir(),
files = c("lbh1.wav", "lbh2.wav"))
optimize_template_detector(template.correlations = tc, reference =
lbh_reference, threshold = seq(0.5, 0.7, by = 0.1))
# showing diagnostics by sound file
optimize_template_detector(template.correlations = tc, reference =
lbh_reference,
threshold = seq(0.5, 0.7, by = 0.1), by.sound.file = TRUE)
}
Run the code above in your browser using DataLab