node-audio-mixer
v2.0.0
Published
PCM audio mixer with customizable parameters
Downloads
272
Readme
Node.js Audio Mixer
About
Audio mixer that allows mixing PCM audio streams with customizable parameters.
Installation
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
Example usage
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
API Documentation
You can find it here
Changelog
You can view the changelogs on GitHub releases