hwin <-
function(sig = rep(1, 512), const = 0.54, A = 0.46)
{
# sig: any signal. const and A are set for a Hamming window
# for a von Hann (Hanning) window, set const = A = 0.5
# the output is the signal mutliplied by the window
# defaults to a 512 point Hann window
N = length(sig)
n <- 0:(N - 1)
sig  *  (const - A * cos((2 * pi * n)/(N - 1)))
}
