summaryrefslogtreecommitdiff
path: root/src/index.jsx
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2023-05-09 01:37:02 +0200
committerjulian laplace <julescarbon@gmail.com>2023-05-09 01:37:02 +0200
commit86a1fbe06907ed79d7890376bb14993c1b94473e (patch)
treedf48297fb83dab7438226ed1017f5764818e57ce /src/index.jsx
parentb9dc2f677e7c3021aeeea6b1ab609a9b40806b48 (diff)
refactor boundary conditions
Diffstat (limited to 'src/index.jsx')
-rw-r--r--src/index.jsx43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/index.jsx b/src/index.jsx
index e752c5a..8c07739 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -1,14 +1,53 @@
import * as React from "react";
import { createRoot } from "react-dom/client";
-import { requestAudioContext } from "./lib/util";
+import { requestAudioContext, randrange } from "./lib/util";
import Relabi from "./relabi";
+import { Kalimba, Drums } from "./lib/instruments";
document.body.style.backgroundColor = "#111";
document.body.style.color = "#fff";
requestAudioContext(() => {
document.body.innerHTML = '<div id="app"></div>';
- const relabi = new Relabi();
+
+ const relabi = new Relabi({
+ waves: [
+ { type: "sine", frequency: 0.75 },
+ { type: "sine", frequency: 1.0 },
+ { type: "sine", frequency: 1.617 },
+ { type: "sine", frequency: 3.141 },
+ ],
+ bounds: [
+ {
+ level: -0.5,
+ sounds: [
+ { instrument: Drums, index: 0 },
+ { instrument: Drums, index: 1 },
+ ],
+ },
+ {
+ level: 0.5,
+ sounds: [
+ { instrument: Drums, index: 2 },
+ { instrument: Drums, index: 3 },
+ ],
+ },
+ {
+ level: -0.25,
+ sounds: [
+ { instrument: Kalimba, frequency: 440 },
+ { instrument: Kalimba, frequency: (440 * 3) / 2 },
+ ],
+ },
+ {
+ level: 0.25,
+ sounds: [
+ { instrument: Kalimba, frequency: (440 * 6) / 5 },
+ { instrument: Kalimba, frequency: (440 * 6) / 7 },
+ ],
+ },
+ ],
+ });
relabi.start();
const root = createRoot(document.getElementById("app"));