Description Usage Arguments Examples
View source: R/bioacoustica.tools.window.R
Function that breaks a waveform into sections (windows). Windows may overlap, be consecutive, or be sparsely arranged. The gap between the start of windows is given by the increment, and the length of a window is given by the interval.
1 | bioacoustica.tools.window(wave, interval, increment, windowFunction)
|
wave |
|
interval |
|
increment |
|
windowFunction |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (wave, interval, increment, windowFunction)
{
window_start <- 0
window_number <- 1
hit_end <- FALSE
f <- wave@samp.rate
results <- data.frame()
while (!isTRUE(hit_end)) {
if (window_start + increment > duration(wave, f = f)) {
interval <- duration(wave, f = f) - window_start
hit_end <- TRUE
}
window <- cutw(wave, f = f, from = window_start, to = window_start +
interval, output = "Wave")
results <- rbind(results, window_function(window_number,
window_start, window_start + interval, window, f))
window_start <- window_start + increment
window_number <- window_number + 1
}
names(results) <- functions(NULL, NULL, NULL, NULL, NULL,
headers = TRUE)
return(results)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.