summaryrefslogtreecommitdiff
path: root/tran/slope.alg
diff options
context:
space:
mode:
Diffstat (limited to 'tran/slope.alg')
-rw-r--r--tran/slope.alg15
1 files changed, 15 insertions, 0 deletions
diff --git a/tran/slope.alg b/tran/slope.alg
new file mode 100644
index 0000000..7b0cb2b
--- /dev/null
+++ b/tran/slope.alg
@@ -0,0 +1,15 @@
+(SLOPE-ALG
+ (NAME "slope")
+ (ARGUMENTS ("sound_type" "input"))
+ (STATE ("sample_type" "prev" "0.0F")
+ ("double" "scale" "input->sr * input->scale"))
+ (INTERNAL-SCALING input)
+ (CONSTANT "scale")
+ (DELAY 1)
+ (START (MIN input))
+ (INNER-LOOP "{ register sample_type x = input;
+output = (sample_type) ((x - prev) * scale);
+prev = x;}")
+ (TERMINATE (MIN input))
+ (LOGICAL-STOP (MIN input))
+)