Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,23 @@ const context = new StandardizedAudioContext() as unknown as AudioContext;
const marimba = new Soundfont(context, { instrument: "marimba" });
```

In case you need to use the `Reverb` module (or any other module that needs `AudioWorkletNode`) you need to enforce to use the one from `standardized-audio-context` package. Here is how:

```ts
import {
AudioWorkletNode,
IAudioContext,
AudioContext as StandardizedAudioContext,
} from "standardized-audio-context";

window.AudioWorkletNode = AudioWorkletNode as any;
const context = new StandardizedAudioContext() as unknown AudioContext;

// ... rest of the code
```

You can read more about this issue [here](https://github.com/chrisguttandin/standardized-audio-context/issues/897)

### Play

#### Start and stop notes
Expand Down
9 changes: 7 additions & 2 deletions examples/standardized-audio-context-test/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Soundfont } from "smplr";
import { AudioContext as StandardizedAudioContext } from "standardized-audio-context";
import { Reverb, Soundfont } from "smplr";
import {
AudioWorkletNode,
AudioContext as StandardizedAudioContext,
} from "standardized-audio-context";

function main() {
window.AudioWorkletNode = AudioWorkletNode as any;
const context = new StandardizedAudioContext() as unknown as AudioContext;
const instrument = new Soundfont(context, { instrument: "marimba" });
instrument.output.addEffect("reverb", new Reverb(context), 0.9);

const $button = document.getElementById("btn-test") as HTMLButtonElement;

Expand Down
Loading