soundgen (version 1.5.0)

getDiscreteContour: 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

the method of smoothing envelopes based on provided anchors: 'approx' = linear interpolation, 'spline' = cubic spline, 'loess' (default) = polynomial local smoothing function. NB: this does not affect contours for "noise", "glottal", and the smoothing of formants

valueFloor

lower/upper bounds for the contour

valueCeiling

lower/upper bounds for the contour

ylim

ylim for plotting

plot

(boolean) produce a plot?

...

other plotting options passed to plot()

Value

Numeric vector.

Details

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

Examples

Run this code
# NOT RUN {
# 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)))
# }

Run the code above in your browser using DataCamp Workspace