Felix Roos de9a52366f Publish
- @strudel/codemirror@0.9.0
 - @strudel.cycles/core@0.9.0
 - @strudel.cycles/csound@0.9.0
 - @strudel.cycles/midi@0.9.0
 - @strudel.cycles/mini@0.9.0
 - @strudel.cycles/osc@0.9.0
 - @strudel.cycles/react@0.9.0
 - @strudel.cycles/serial@0.9.0
 - @strudel.cycles/soundfonts@0.9.0
 - superdough@0.9.8
 - @strudel.cycles/tonal@0.9.0
 - @strudel.cycles/transpiler@0.9.0
 - @strudel/web@0.9.0
 - @strudel.cycles/webaudio@0.9.0
 - @strudel.cycles/xen@0.9.0
2023-09-17 12:35:03 +02:00
..
2023-08-26 21:11:24 +02:00
2023-09-17 12:35:03 +02:00
2023-08-11 12:13:24 +02:00
2023-08-26 21:12:02 +02:00
2023-01-28 23:14:56 +01:00
2023-08-17 10:08:55 +02:00

@strudel.cycles/webaudio

This package contains helpers to make music with strudel and the Web Audio API. It is a thin binding to superdough.

Install

npm i @strudel.cycles/webaudio --save

Example

import { repl, controls } from "@strudel.cycles/core";
import { initAudioOnFirstClick, getAudioContext, webaudioOutput } from "@strudel.cycles/webaudio";
const { note } = controls;

initAudioOnFirstClick();
const ctx = getAudioContext();

const { scheduler } = repl({
  defaultOutput: webaudioOutput,
  getTime: () => ctx.currentTime
});

const pattern = note("c3", ["eb3", "g3"]).s("sawtooth");

scheduler.setPattern(pattern);
document.getElementById("start").addEventListener("click", () => scheduler.start());
document.getElementById("stop").addEventListener("click", () => scheduler.stop());

Play with the example codesandbox.

Read more in the docs about samples, synths and effects.