summaryrefslogtreecommitdiff
path: root/tran/tone.alg
diff options
context:
space:
mode:
Diffstat (limited to 'tran/tone.alg')
-rw-r--r--tran/tone.alg15
1 files changed, 15 insertions, 0 deletions
diff --git a/tran/tone.alg b/tran/tone.alg
new file mode 100644
index 0000000..9a8e1a5
--- /dev/null
+++ b/tran/tone.alg
@@ -0,0 +1,15 @@
+(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)")
+)
+