;; a repeating hann signal of width
;;
;; where a cycle is
;; time 0.0 -> width
;;
;; repeat is:
;; 1.0 - repeat immediately
;; 2.0 - repeat after two cycles
;; 4.0 - repeat after four cycles etc..
;;
(bind-func hann
(lambda (time:i64 width:i64 repeat:i64)
(if (or (< width 1)
(> (% time (* width repeat)) width))
0.0
(* 0.5
(- 1.0
(cos (* STWOPI (/ (convert time)
(convert width)))))))))