Audio mixer that allows mixing PCM audio streams with customizable parameters.
Node.js 18.0.0 or newer is required.
npm:
npm install node-audio-mixer
pnpm:
pnpm install node-audio-mixer
yarn:
yarn install node-audio-mixer
import {createReadStream, createWriteStream} from "fs";
import {AudioMixer} from "node-audio-mixer";
const mixer = new AudioMixer({
sampleRate: 48000,
bitDepth: 16,
channels: 1,
autoClose: true,
});
const firstInput = mixer.createAudioInput({
sampleRate: 48000,
bitDepth: 16,
channels: 1,
});
const secondInput = mixer.createAudioInput({
sampleRate: 48000,
bitDepth: 16,
channels: 1,
});
const outputAudio = createWriteStream("mixed.pcm");
const firstAudio = createReadStream("firstAudio.pcm");
const secondAudio = createReadStream("secondAudio.pcm");
mixer.pipe(outputAudio);
firstAudio.pipe(firstInput);
secondAudio.pipe(secondInput);
More examples you can find here
You can find it here
You can view the changelogs on GitHub releases