fadeInOut: Fade-in and fade-out

Description Usage Arguments Details Value Examples

View source: R/utilities_soundgen.R

Description

Internal soundgen function.

Usage

1
fadeInOut(ampl, do_fadeIn = TRUE, do_fadeOut = TRUE, length_fade = 1000)

Arguments

ampl

numeric vector such as a waveform

do_fadeIn, do_fadeOut

(logical) perform linear fade-in / fade-out?

length_fade

the length of affected region, in points (expects an integer > 1, otherwise just returns the original vector with no modifications)

Details

Applies linear fade-in and fade-out of length 'length_fade' points to one or both ends of input vector.

Value

Returns a numeric vector of the same length as input

Examples

1
2
3
4
5
6
7
ampl = sin(1:1000)
plot(soundgen:::fadeInOut(ampl, length_fade = 100), type = 'l')
plot(soundgen:::fadeInOut(ampl, length_fade = 300,
  do_fadeOut = FALSE), type = 'l')
# if the vector is shorter than twice the specified length_fade,
# fade-in/out regions overlap
plot(soundgen:::fadeInOut(ampl, length_fade = 700), type = 'l')

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