splitContour: Split contour

Description Usage Arguments Details Value Examples

View source: R/smoothContours.R

Description

Internal soundgen function

Usage

1
splitContour(anchors, discontThres = 0.05, jumpThres = 0.01)

Arguments

anchors

a dataframe with two columns: time and value (time on any scale)

discontThres

if two anchors are closer in time than discontThres, the contour is broken into segments with a linear transition between these anchors; if anchors are closer than jumpThres, a new section starts with no transition at all (e.g. for adding pitch jumps)

jumpThres

if two anchors are closer in time than discontThres, the contour is broken into segments with a linear transition between these anchors; if anchors are closer than jumpThres, a new section starts with no transition at all (e.g. for adding pitch jumps)

Details

Splits a smooth contour into several segments. A new segments is started if the time step between two anchors is smaller than discontThres.

Value

Returns a dataframe containing the index of anchor rows for start and end of each segment and whether we want a transition or a jump between segments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
soundgen:::splitContour(data.frame(time = c(0, 370, 650, 655, 1050, 1400),
  value = c(360, 316, 345, 550, 610, 590)))
soundgen:::splitContour(data.frame(time = c(0, .2, .205, .8, .81, 1),
  value = c(360, 316, 345, 550, 610, 590)))
soundgen:::splitContour(data.frame(time = c(0, .4, .45, .6, .8, 1),
  value = c(360, 316, 345, 550, 610, 590)))
soundgen:::splitContour(data.frame(time = c(0, .4, .45, .6, .8, 1),
  value = c(360, 316, 345, 550, 610, 590)),
  discontThres = .1)
soundgen:::splitContour(data.frame(time = c(0, 1),
  value = c(360, 590)))

soundgen documentation built on Oct. 4, 2018, 9:04 a.m.