1 // Root Mean Square of n consecutive samples
2 RMS(n) = square : mean(n) : sqrt ;
4 // the square of a signal
7 // the mean of n consecutive samples of a signal
8 // uses fixpoint to avoid the accumulation of
10 mean(n) = float2fix : integrate(n) : fix2float : /(n);
12 // the sliding sum of n consecutive samples of a signal
13 integrate(n,x) = x - x@n : +~_ ;
15 // convertion between float and fix point
16 float2fix(x) = int(x*(1<<20));
17 fix2float(x) = float(x)/(1<<20);
19 // Root Mean Square of 1000 consecutive samples