{
# load example data
data("lbh1", "lbh2", "lbh_reference")
# save sound files
tuneR::writeWave(lbh1, file.path(tempdir(), "lbh1.wav"))
tuneR::writeWave(lbh2, file.path(tempdir(), "lbh2.wav"))
# template for the first sound file in 'lbh_reference'
templ1 <- lbh_reference[1, ]
# generate template correlations
tc <- template_correlator(templates = templ1, path = tempdir(), files = "lbh1.wav")
# template detection
td <- template_detector(template.correlations = tc, threshold = 0.4)
# diagnose detection
diagnose_detection(
reference =
lbh_reference[lbh_reference$sound.files == "lbh1.wav", ],
detection = td
)
# template for the second and third sound file in 'lbh_reference'
# which have similar song types
templ2 <- lbh_reference[4, ]
# generate template correlations
tc <- template_correlator(
templates = templ2, path = tempdir(),
files = c("lbh1.wav", "lbh2.wav")
)
# template detection
td <- template_detector(template.correlations = tc, threshold = 0.3)
# diagnose detection
diagnose_detection(reference = lbh_reference, detection = td)
}
Run the code above in your browser using DataLab