optimized createHanningWindow