1# @strudel/webaudio 2 3This package contains helpers to make music with strudel and the Web Audio API. 4It is a thin binding to [superdough](https://www.npmjs.com/package/superdough). 5 6## Install 7 8```sh 9npm i @strudel/webaudio --save 10``` 11 12## Example 13 14```js 15import { repl, note } from "@strudel/core"; 16import { initAudioOnFirstClick, getAudioContext, webaudioOutput } from "@strudel/webaudio"; 17 18initAudioOnFirstClick(); 19const ctx = getAudioContext(); 20 21const { scheduler } = repl({ 22 defaultOutput: webaudioOutput, 23 getTime: () => ctx.currentTime 24}); 25 26const pattern = note("c3", ["eb3", "g3"]).s("sawtooth"); 27 28scheduler.setPattern(pattern); 29document.getElementById("start").addEventListener("click", () => scheduler.start()); 30document.getElementById("stop").addEventListener("click", () => scheduler.stop()); 31``` 32 33[Play with the example codesandbox](https://codesandbox.io/s/amazing-dawn-gclfwg?file=/src/index.js). 34 35Read more in the docs about [samples](https://strudel.cc/learn/samples/), [synths](https://strudel.cc/learn/synths/) and [effects](https://strudel.cc/learn/effects/).