summaryrefslogtreecommitdiff
path: root/web/src
diff options
context:
space:
mode:
authorJosh Kingsley <josh@joshkingsley.me>2025-10-29 01:54:25 +0200
committerJosh Kingsley <josh@joshkingsley.me>2025-10-29 01:54:25 +0200
commit95069f13d908bfd3c0f3b33f8fad7d8464fd192e (patch)
tree7736f00b4f422e803f3110b7e3ebbcd8a3264ddc /web/src
parent41b9d5840ddb6b484fc9f309a95d80f62832cfeb (diff)
feat(web): add dummy tone example
Diffstat (limited to 'web/src')
-rw-r--r--web/src/components/toolbar/index.ts35
1 files changed, 30 insertions, 5 deletions
diff --git a/web/src/components/toolbar/index.ts b/web/src/components/toolbar/index.ts
index 666114b..1400174 100644
--- a/web/src/components/toolbar/index.ts
+++ b/web/src/components/toolbar/index.ts
@@ -62,11 +62,6 @@ class NotiveToolbarElement extends HTMLElement {
#render() {
this.append(
h.section(
- h.button({ dataset: { variant: "menu" } }, "File"),
- h.button({ dataset: { variant: "menu" } }, "Edit"),
- h.button({ dataset: { variant: "menu" } }, "Format"),
- ),
- h.section(
h.button(
{
dataset: { variant: "icon" },
@@ -98,8 +93,38 @@ class NotiveToolbarElement extends HTMLElement {
"+",
),
),
+ h.section(
+ h.button(
+ {
+ dataset: { variant: "menu" },
+ onclick: () => {
+ this.#play();
+ },
+ },
+ "Play",
+ ),
+ ),
);
}
+
+ async #play() {
+ const Tone = await import("tone");
+ await Tone.start();
+ const transport = Tone.getTransport();
+ transport.stop();
+ transport.position = 0;
+ transport.cancel();
+ const synth = new Tone.Synth().toDestination();
+ const seq = new Tone.Sequence(
+ (time, note) => {
+ synth.triggerAttackRelease(note, 0.1, time);
+ },
+ ["C4", "D4", "E4"],
+ "1m",
+ ).start(0);
+ seq.loop = false;
+ transport.start();
+ }
}
customElements.define("ntv-toolbar", NotiveToolbarElement);