summaryrefslogtreecommitdiff
path: root/client/lib/organ.js
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2025-07-05 00:25:43 +0200
committerjulian laplace <julescarbon@gmail.com>2025-07-05 00:25:43 +0200
commit60fd4cf67dfbe3fd223791e77d4e2fe1c67c613f (patch)
tree706513f9d7f58b6f0d38886e45f851121061d215 /client/lib/organ.js
parente5ec8893d18aa21f771ab56fc5ded42602125f94 (diff)
sine
Diffstat (limited to 'client/lib/organ.js')
-rw-r--r--client/lib/organ.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/lib/organ.js b/client/lib/organ.js
index 1e45e68..30972ba 100644
--- a/client/lib/organ.js
+++ b/client/lib/organ.js
@@ -1,10 +1,17 @@
import Tone from "tone";
-import output from "./output";
const oscillators = {};
+let output;
let lastPlayed;
+
+function load(out) {
+ output = out;
+}
function play(freq) {
+ if (!output) {
+ return;
+ }
const osc = (oscillators[freq] = oscillators[freq] || {});
if (!osc.el) {
osc.el = new Tone.Oscillator(freq, "sine");
@@ -15,6 +22,7 @@ function play(freq) {
lastPlayed = osc;
return osc;
}
+
function pause(freq) {
if (!oscillators[freq]) return;
const osc = (oscillators[freq] = oscillators[freq] || {});