An open API service indexing awesome lists of open source software.

https://github.com/GoogleChromeLabs/audioworklet-polyfill

🔊 Polyfill AudioWorklet using the legacy ScriptProcessor API.
https://github.com/GoogleChromeLabs/audioworklet-polyfill

audio-processing audio-worklet web-audio web-audio-api web-audio-module web-audio-worklet webaudio webaudio-api

Last synced: 14 days ago
JSON representation

🔊 Polyfill AudioWorklet using the legacy ScriptProcessor API.

Awesome Lists containing this project

README

        


AudioWorklet Polyfill


AudioWorklet Polyfill
npm


1kB polyfill for AudioWorklet.

`audioworklet-polyfill` is a tiny JavaScript library that brings AudioWorklet support to all major browsers: Chrome, Firefox, Safari and Edge. It uses ScriptProcessorNode under the hood, and runs your Worklet code in an isolated scope on the main thread ([read why](#why-are-worklets-emulated-on-the-main-thread)).

| [Basic Demo](https://googlechromelabs.github.io/audioworklet-polyfill/) | [DSP Playground Demo](https://audio-dsp-playground-polyfilled.surge.sh) |
|-|-|

> **New to AudioWorklet?** Check out this great [Introduction and Demos](https://developers.google.com/web/updates/2017/12/audio-worklet) or the [AudioWorklet Examples].

## Usage

```html

```

Or with a bundler:

```js
import 'audioworklet-polyfill';
```

... or with ES Modules on the web:

```js
import('https://unpkg.com/audioworklet-polyfill/dist/audioworklet-polyfill.js');
```

## Roadmap

- Improve support for custom parameters

## Why are Worklets emulated on the main thread?

This polyfill is intended to be a bridging solution until AudioWorklet is implemented across all browsers. It's an improvement over ScriptProcessorNode even though that's what it uses under the hood, because code written using this polyfill is forwards-compatible: as native support improves, your application improves. This polyfill offers a simple, future-proof alternative to ScriptProcessorNode without introducing Workers or relying on shared memory.

## Similar Libraries

[@jariseon](https://github.com/jariseon) has implemented [a similar polyfill](https://github.com/jariseon/audioworklet-polyfill) that uses Web Workers for audio processing.

## License

[Apache 2.0](LICENSE)

[AudioWorklet]: https://webaudio.github.io/web-audio-api/#AudioWorklet
[AudioWorklet Examples]: https://googlechromelabs.github.io/web-audio-samples/audio-worklet/