getDiscreteContour: Discrete smooth contour from anchors

View source: R/smoothContours.R

getDiscreteContourR Documentation

Discrete smooth contour from anchors

Description

Internal soundgen function.

Usage

getDiscreteContour(
  len,
  anchors = data.frame(time = c(0, 1), value = c(1, 1)),
  interpol = c("spline", "loess")[2],
  valueFloor = NULL,
  valueCeiling = NULL,
  ylim = NULL,
  plot = FALSE,
  ...
)

Arguments

len

the number of syllables (equivalently, the length of generated contour)

anchors

a numeric vector of values or a list/dataframe with one column (value) or two columns (time and value). achors$time can be in ms (with len=NULL) or in arbitrary units, eg 0 to 1 (with duration determined by len, which must then be provided in ms). So anchors$time is assumed to be in ms if len=NULL and relative if len is specified. anchors$value can be on any scale.

interpol

method of interpolation between anchors: "approx" = linear with approx, "spline" = cubic splines with spline, "loess" = local polynomial regression with loess

valueFloor, valueCeiling

lowser/upper bounds for the contour

ylim

ylim for plotting

plot

(boolean) produce a plot?

...

other plotting options passed to plot()

Details

A discrete version of getSmoothContour with modified plotting. Intended for plotting variation in parameters across syllables.

Value

Numeric vector.

Examples

# for a bout consisting of 10 syllables
soundgen:::getDiscreteContour(len = 10, interpol = 'spline', plot = TRUE,
  ylab = 'Semitones', anchors = data.frame(time = c(0, .2, .6, 1),
  value = c(0, -3, 1, 0)))

soundgen documentation built on Sept. 29, 2023, 5:09 p.m.