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.
- Host: GitHub
- URL: https://github.com/GoogleChromeLabs/audioworklet-polyfill
- Owner: GoogleChromeLabs
- License: apache-2.0
- Created: 2018-05-21T19:29:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-16T00:35:47.000Z (about 4 years ago)
- Last Synced: 2025-05-06T13:59:34.077Z (15 days ago)
- Topics: audio-processing, audio-worklet, web-audio, web-audio-api, web-audio-module, web-audio-worklet, webaudio, webaudio-api
- Language: JavaScript
- Homepage: https://googlechromelabs.github.io/audioworklet-polyfill/
- Size: 37.1 KB
- Stars: 196
- Watchers: 6
- Forks: 20
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - audioworklet-polyfill
README
![]()
AudioWorklet Polyfill
![]()
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/