# we generate a new kind of noise by averaging consecutive samples of white noise
# now samples are correlated or related to each other.
# note difference in sound and FFT
library(tuneR)
secs = 3
sr = 8000
bits = 16
N = 8192
avenum = 100
y = runif(secs*sr,min = -.5, max=.5)
z = rep(0,sr*secs)
for (i in 1:((secs*sr)-avenum)) z[i] = mean(y[i:(i+avenum)])
z = z/max(z)
u = Wave(round(2^(bits-5)*z), samp.rate = sr, bit=16)
play(u,"play")
Z = fft(z[1:N])
plot(Mod(Z[1:(N/2)]))