
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
audio-worklet-loader
Advanced tools
Audio Worklet loader for webpack.
Warning: We do not yet support WEBPACK 4!
To begin, you'll need to install worker-loader:
npm install audio-worklet-loader --save-dev
For use without config in webpack.config.js
import randomNoise from "audio-worklet-loader!./random-noise.worklet.js";
webpack.config.js
module.exports = {
...,
module: {
rules: [
{
test: /\.worklet\.js$/,
loader: "audio-worklet-loader",
},
],
},
...
};
Note that audio-worklet-loader need to be appeared before ts-loader.
webpack.config.js
module.exports = {
...,
module: {
rules: [
{
test: /\.worklet\.ts$/,
loader: "audio-worklet-loader",
},
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/
},
],
},
...
};
To import files without specifying an extension import code from './code' instead of import code from './code.js'
module.exports = {
...,
resolve: {
extensions: ['.ts', '.js'],
},
...
}
For view full of this example, please go to GitHub repository and take a look in the example folder.
index.js
import randomNoise from "./random-noise.worklet.js"
async function main() {
const audioCtx = new AudioContext();
await audioCtx.audioWorklet.addModule(randomNoise);
const audioBufferSource = audioCtx.createBufferSource();
const audioWorkletNode = new AudioWorkletNode(audioCtx, "random-noise");
audioBufferSource.connect(audioWorkletNode);
audioWorkletNode.connect(audioCtx.destination);
audioBufferSource.start();
console.log("Successfuly!!!");
}
main();
random-noise.worklet.js
class RandomNoise extends AudioWorkletProcessor {
constructor() {
super();
}
process(inputs, outputs) {
const output = outputs[0];
for (let channel = 0; channel < output.length; ++channel) {
const outputChannel = output[channel];
for (let i = 0; i < outputChannel.length; ++i) {
// Generate a random number between -1 and 1
// Assign the random value to the output channel
outputChannel[i] = Math.random() * 2 - 1;
}
}
return true;
}
}
// Register the AudioWorklet processor
registerProcessor("random-noise", RandomNoise);
And run webpack via your preferred method.
| Name | Type | Default | Description |
|---|---|---|---|
inline | 'no-fallback'|'fallback' | undefined | Allow to inline the worklet as a BLOB |
inlineType: 'fallback' | 'no-fallback'
Default: undefined
Allow to inline the Audio Worklet as a BLOB.
Inline mode with the fallback still bundle worklet file (although we do not need this file), to disable this behavior
just use no-fallback value.
webpack.config.js
module.exports = {
...,
module: {
rules: [
{
test: /\.worklet\.js/,
loader: path.resolve("loader/loader.js"),
options: {
inline: "no-fallback",
}
}
]
},
...
};
Please take a moment to read our contributing guidelines if you haven't yet done so. CONTRIBUTING
With webpack 4:
package.json
{
"devDependencies": {
"ts-loader": "^5.4.5",
"webpack": "^4.0.0",
"webpack-cli": "^3.3.12"
}
}
With webpack 5:
package.json
{
"devDependencies": {
"ts-loader": "^9.4.4",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
}
}
If you have any issues when using audio-worklet-loader please create an issue in GitHub homepage of a project and show me version of webpack or webpack-cli, ts-loader, ... for me. I will check it as soon as possible.
FAQs
Webpack loader for audio worklet
The npm package audio-worklet-loader receives a total of 1,476 weekly downloads. As such, audio-worklet-loader popularity was classified as popular.
We found that audio-worklet-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.