View source: R/utilities_math.R

getSigmoid | R Documentation |

Internal soundgen function.

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

`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 |

`spikiness` |
amplifies the effect of the "shape" parameter;
numeric vector of length 1 or the same length as |

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.

Returns a vector of length `len`

and range from 0 to 1

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 = '') }

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.