drawContour: Draw contour

View source: R/smoothContours.R

drawContourR Documentation

Draw contour

Description

Internal soundgen function

Usage

drawContour(
  len,
  anchors,
  interpol,
  valueFloor,
  duration_ms = 500,
  loessSpan = NULL
)

Arguments

len

the required length of the output contour. If NULL, it will be calculated based on the maximum time value (in ms) and samplingRate

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

duration_ms

contour duration, ms

loessSpan

controls the amount of smoothing when interpolating between anchors with loess, so only has an effect if interpol = 'loess' (1 = strong, 0.5 = weak smoothing)

Details

The core part of getSmoothContour() that actually performs the interpolation between anchors.


soundgen documentation built on Sept. 12, 2024, 6:29 a.m.