a = rnorm(500) * seq(1, 0, length.out = 500)
windowLength_points = 50
scale = max(abs(a))
plot(a, type = 'l', ylim = c(-scale, scale))
points(soundgen:::getEnv(a, windowLength_points, 'rms'),
type = 'l', col = 'red')
points(soundgen:::getEnv(a, windowLength_points, 'peak'),
type = 'l', col = 'green')
points(soundgen:::getEnv(a, windowLength_points, 'hil'),
type = 'l', col = 'blue')
points(soundgen:::getEnv(a, windowLength_points, 'mean'),
type = 'l', lty = 3, lwd = 3)
Run the code above in your browser using DataLab