summaryrefslogtreecommitdiff
path: root/src/relabi
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2023-05-09 23:22:32 +0200
committerjulian laplace <julescarbon@gmail.com>2023-05-09 23:22:32 +0200
commit5f49444cf7a681569823e0633551a56683636dd5 (patch)
treef88bc21d3a2db192ef851fa3d6d2e3a7a6a3382d /src/relabi
parentdb7917f9f10b442b98d6cfc8e9231e1f66f1dd75 (diff)
improving chaos
Diffstat (limited to 'src/relabi')
-rw-r--r--src/relabi/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/relabi/index.js b/src/relabi/index.js
index 9e649f2..b77a83f 100644
--- a/src/relabi/index.js
+++ b/src/relabi/index.js
@@ -22,6 +22,7 @@ const WAVE_SHAPES = {
square: (time) => (time % TWO_PI < Math.PI ? 1 : -1),
saw: (time) => (time % TWO_PI) / Math.PI - 1,
reverse_saw: (time) => 1 - (time % TWO_PI) / Math.PI,
+ noise: (time) => Math.random() * Math.random() * 2 - 1,
};
/**
@@ -94,7 +95,7 @@ export default class Relabi {
const waveOffset =
(wave.offset || 0) +
(wave.frequency * this.settings.speed) / this.steps +
- previousWaveValue * this.settings.feedback;
+ previousWaveValue * this.settings.chaos;
const waveValue = WAVE_SHAPES[wave.shape](waveOffset);
value += waveValue * wave.weight;