From 567e14b55dc3e7be4920adbad3538dc19e8e1209 Mon Sep 17 00:00:00 2001 From: Nick Thompson Date: Tue, 10 Oct 2023 09:07:26 -0400 Subject: [PATCH] Update package readmes --- js/packages/core/README.md | 3 +-- js/packages/offline-renderer/README.md | 2 -- js/packages/web-renderer/README.md | 16 ++++++++-------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/js/packages/core/README.md b/js/packages/core/README.md index 6a82f3e..77730e6 100644 --- a/js/packages/core/README.md +++ b/js/packages/core/README.md @@ -22,8 +22,7 @@ import { el, Renderer } from '@elemaudio/core'; // Here we're using a default Renderer instance, so it's our responsibility to // send the instruction batches to the underlying engine -let sampleRate = 44100; -let core = new Renderer(sampleRate, (batch) => { +let core = new Renderer((batch) => { // Send the instruction batch somewhere: you can set up whatever message // passing channel you want! console.log(batch); diff --git a/js/packages/offline-renderer/README.md b/js/packages/offline-renderer/README.md index 2e77a6e..9e0b19f 100644 --- a/js/packages/offline-renderer/README.md +++ b/js/packages/offline-renderer/README.md @@ -17,8 +17,6 @@ Please see the full documentation at [https://www.elementary.audio/](https://www npm install --save @elemaudio/offline-renderer ``` -**Note**: the offline renderer requires Node v18, or Node v16+ with the `--experimental-wasm-eh` flag set. - ## Usage ```js diff --git a/js/packages/web-renderer/README.md b/js/packages/web-renderer/README.md index 593ba43..c1833a7 100644 --- a/js/packages/web-renderer/README.md +++ b/js/packages/web-renderer/README.md @@ -23,25 +23,25 @@ import WebRenderer from '@elemaudio/web-renderer'; // Note that many browsers won't let you start an AudioContext before // some corresponding user gesture. We're ignoring that in this example for brevity, -// but typically you would add a click event callback to make or resume your -// AudioContext instance to start making noise. +// but typically you would add an event callback to make or resume your +// AudioContext instance in order to start making noise. const ctx = new AudioContext(); const core = new WebRenderer(); -core.on('load', function() { - core.render(el.cycle(440), el.cycle(441)); -}); - (async function main() { - // Here we initialize our WebRenderer instance and connect the resulting - // Web Audio node to our AudioContext destination. + // Here we initialize our WebRenderer instance, returning a promise which resolves + // to the WebAudio node containing the runtime let node = await core.initialize(ctx, { numberOfInputs: 0, numberOfOutputs: 1, outputChannelCount: [2], }); + // And connect the resolved node to the AudioContext destination node.connect(ctx.destination); + + // Then finally we can render + core.render(el.cycle(440), el.cycle(441)); })(); ```