@tmigone/pulseaudio
is a TypeScript based client library for PulseAudio, the most popular sound server for Linux. This library allows you to easily build clients or applications that interact with a PulseAudio server over it's native protocol, for example media players/recorders, volume control applications, etc.
Install the library using npm:
npm install @tmigone/pulseaudio
import PulseAudio, { Sink } from '@tmigone/pulseaudio'
(async () => {
// Connect using tcp or unix socket
// const client: PulseAudio = new PulseAudio('unix:/run/pulse/pulseaudio.socket')
const client: PulseAudio = new PulseAudio('tcp:192.168.1.10:4317')
await client.connect()
// Set volume of all sinks to 50%
const sinks: Sink[] = await client.getSinkList()
for (const sink of sinks) {
await client.setSinkVolume(sink.index, 50)
}
// Close connection
client.disconnect()
})()
Visit the docs site for in depth documentation on the library API's.
Generated using TypeDoc