summaryrefslogtreecommitdiffstats
path: root/src/osc_weird.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2023-07-07 01:09:12 +0300
committergramanas <anastasis.gramm2@gmail.com>2023-07-07 01:09:12 +0300
commitc8cd7f9298de876f2046fddd2e322a63c421a505 (patch)
tree1b764fed928592f8f3465e9ef28552b451efad8a /src/osc_weird.c
parentf170fb058a07175e6e753f2a6d20283dc7200a88 (diff)
downloadsynth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.tar.gz
synth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.tar.bz2
synth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.zip
suppa
Diffstat (limited to 'src/osc_weird.c')
-rw-r--r--src/osc_weird.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/osc_weird.c b/src/osc_weird.c
new file mode 100644
index 0000000..143cc23
--- /dev/null
+++ b/src/osc_weird.c
@@ -0,0 +1,25 @@
+#include "osc.h"
+
+float osc_weird_fun(int index)
+{
+ return ((float)(index * index * index) / (200 * 200 * 200)) * 2 - 1;
+}
+
+osc_t OSC_weird = {
+ .name = "f_weird",
+ .len = 200
+};
+
+float
+osc_weird(float offset)
+{
+ return osc_interpolate(offset,
+ osc_weird_fun((int)offset),
+ osc_weird_fun(osc_next_index(&OSC_weird, offset)));
+}
+
+float
+osc_weird_next(float f, float offset)
+{
+ return osc_next_offset(&OSC_weird, f, offset);
+}