getSigmoid: Get sigmoid filter

View source: R/math.R

getSigmoidR Documentation

Get sigmoid filter

Description

Internal soundgen function.

Usage

getSigmoid(len, samplingRate = 16000, freq = 5, shape = 0, spikiness = 1)

Arguments

len

the length of output vector

samplingRate

the sampling rate of the output vector, Hz

freq

the frequency of amplitude modulation, Hz (numeric vector)

shape

0 = ~sine, -1 = clicks, +1 = notches (NB: vice versa in soundgen!); numeric vector of length 1 or the same length as freq

spikiness

amplifies the effect of the "shape" parameter; numeric vector of length 1 or the same length as freq

Details

Produces a filter for amplitude modulation ranging from clicks to approximately a sine wave to reversed clicks (small episodes of silence). The filter is made from concatenated sigmoids and their mirror reflections.

Value

Returns a vector of length len and range from 0 to 1

Examples

for (shape in c(0, -.1, .1, -1, 1)) {
  s = soundgen:::getSigmoid(shape = shape, len = 1000, samplingRate = 500, freq = 2)
  plot(s, type = 'l', main = paste('shape =', shape), xlab = '', ylab = '')
}

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