PulseAudio.js is a fully-featured JavaScript (TypeScript) client library for PulseAudio, the sound system used by modern Linux distributions. The client can be used to configure and control the PulseAudio server, play or record audio, and much more. The library is implemented entirely in TypeScript and has no native dependencies. It communicates with the server using the PulseAudio native protocol over a UNIX domain socket.
The library requires PulseAudio 10.0 or higher (PulseAudio native protocol version 32 or higher).
PulseAudio.js is free software licensed under the ISC license.
- Asynchronous Promise-based API with TypeScript type declarations
- Low-latency audio playback and recording integrated with the Node.js stream API
- PulseAudio source, sink, and stream introspection and volume control
- Sample cache management & playback
- Module loading & unloading on the PulseAudio server (can be used to create virtual sources and sinks)
- Support for asynchronous event notifications sent by the PulseAudio server
npm install pulseaudio.js
import { PulseAudio } from 'pulseaudio.js';
const pa = new PulseAudio();
(async function() {
await pa.connect();
console.log(await pa.getServerInfo());
await pa.disconnect();
})();
Please refer to the wiki for documentation and usage examples. API documentation generated with TypeDoc is available here.