medianSmoother: Median smoothing

Description Usage Arguments Details Value Examples

Description

Internal soundgen function.

Usage

1
medianSmoother(df, smoothing_ww, smoothingThres)

Arguments

df

dataframe (each column is processed separately, so multiple contours can be fed into this function at once to speed things up)

smoothing_ww

width of smoothing window (points)

smoothingThres

tolerated deviance from moving median (semitones)

Details

Internal helper function for smoothing pitch contours or other contours. Only outliers are modified, so it's not like smoothing with a kernel. NB: the expected input is pitch, so deviance is calculated on a log-scale.

Value

Returns a dataframe of the same dimensions as df.

Examples

1
2
3
4
5
df = data.frame(a = rnorm(100, mean = 100, sd = 20),
                b = rnorm(100, mean = 100, sd = 10))
df1 = soundgen:::medianSmoother(df, smoothing_ww = 5, smoothingThres = 1)
plot(df[, 2], type='b')
lines(df1[, 2], type='b', col='blue', pch=3)

tatters/soundgen_beta documentation built on May 14, 2019, 9 a.m.