(define-macro (tri-wave x) `(let* ((xx (+ ,x 0.000000001)) (xmod2pi (- xx (* TWOPI (floor (/ xx TWOPI)))))) (* (/ 1.0 PI) (if (< xmod2pi PI) xmod2pi (- TWOPI xmod2pi)))))