Previous Up Next

19.3.3  Apply a moving average filter to a signal

The moving_average command applies a moving average to a signal.

Moving average filters are fast and useful for smoothing time-encoded signals.

Example

snd:=soundsec(2):; noise:=randvector(length(snd),normald,0,0.05):; data:=0.5*threshold(3*sin(2*pi*220*snd),[-1.0,1.0])+noise:;
plotwav(createwav(data),range=[1000,1500])
fdata:=moving_average(data,25):; plotwav(createwav(fdata),range=[1000,1500])

Previous Up Next