reformatAnchors {soundgen} | R Documentation |
Reformat anchors
Description
Internal soundgen function.
Usage
reformatAnchors(anchors, normalizeTime = TRUE)
Arguments
anchors |
a numeric vector of values or a list/dataframe with one column (value) or two columns (time and value) |
normalizeTime |
if TRUE, normalizes anchors$time values to range from 0 to 1 |
Details
Checks that the anchors are formatted in a valid way and expands them to a standard dataframe with two columns: time and value. NB: works for all anchors except "noise", whose anchors have to be scaled by sylLen and are therefore processed directly in soundgen()
Examples
soundgen:::reformatAnchors(150)
soundgen:::reformatAnchors(c(150, 200, 220))
soundgen:::reformatAnchors(anchors = list(value=c(150, 200, 220)))
soundgen:::reformatAnchors(anchors = list(time = c(0, 10, 100),
value = c(150, 200, 220)))
# returns NA
soundgen:::reformatAnchors('aha')
## Not run:
# returns NA with a warning
soundgen:::reformatAnchors(anchors = list(time = c(0, .1, 1),
freq = c(150, 200, 220)))
# throws a warning and rearranges in order of time stamps
soundgen:::reformatAnchors(anchors = list(time = c(0, .8, .7, 1),
value = c(150, 200, 150, 220)))
## End(Not run)
[Package soundgen version 2.7.3 Index]