1kB polyfill for AudioWorklet.
<script src="audioworklet-polyfill.js"></script> <!-- or: --> <script src="https://unpkg.com/audioworklet-polyfill/dist/audioworklet-polyfill.js"></script>
Or with a bundler:
... or with ES Modules on the web:
- 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.