# \donttest{
# Save example files into temporary working directory
data("lbh1", "lbh2", "lbh_reference")
tuneR::writeWave(lbh1, file.path(tempdir(), "lbh1.wav"))
tuneR::writeWave(lbh2, file.path(tempdir(), "lbh2.wav"))
# using smoothing and minimum duration
optimize_energy_detector(
reference = lbh_reference, path = tempdir(),
threshold = c(6, 10), smooth = 6.8, bp = c(2, 9), hop.size = 6.8,
min.duration = 90
)
# with thinning and smoothing
optimize_energy_detector(
reference = lbh_reference, path = tempdir(),
threshold = c(6, 10, 15), smooth = c(7, 10), thinning = c(0.1, 0.01),
bp = c(2, 9), hop.size = 6.8, min.duration = 90
)
# by sound file
(opt_ed <- optimize_energy_detector(
reference = lbh_reference,
path = tempdir(), threshold = c(6, 10, 15), smooth = 6.8, bp = c(2, 9),
hop.size = 6.8, min.duration = 90, by.sound.file = TRUE
))
# summarize
summarize_diagnostic(opt_ed)
# using hold time
(op_ed <- optimize_energy_detector(
reference = lbh_reference,
threshold = 10, hold.time = c(100, 150), bp = c(2, 9), hop.size = 6.8,
path = tempdir()
))
# including previous output in new call
optimize_energy_detector(
reference = lbh_reference, threshold = 10,
hold.time = c(50, 200), previous.output = op_ed, smooth = 6.8,
bp = c(2, 9), hop.size = 7, path = tempdir()
)
# having and extra file in files (simulating a file that should have no detetions)
sub_reference <- lbh_reference[lbh_reference$sound.files != "lbh1.wav", ]
optimize_energy_detector(
reference = sub_reference, files = unique(lbh_reference$sound.files),
threshold = 10, hold.time = c(1, 150), bp = c(2, 9), smooth = 6.8,
hop.size = 7, path = tempdir()
)
# }
Run the code above in your browser using DataLab