(TONE-ALG (NAME "tone") (ARGUMENTS ("sound_type" "input") ("double" "hz")) (START (MIN input)) (TERMINATE (MIN input)) (LOGICAL-STOP (MIN input)) (STATE ("double" "b" "2.0 - cos(hz * PI2 / input->sr)" TEMP) ("double" "c2" "b - sqrt((b * b) - 1.0)") ("double" "c1" "(1.0 - susp->c2) * input->scale") ("double" "prev" "0.0")) (INTERNAL-SCALING input) (CONSTANT "c1" "c2") (INNER-LOOP "output = (sample_type) (prev = c1 * input + c2 * prev)") )