samawaat
samawaat

Reputation: 430

Convert PCM S32LE stream to Opus stream in Node.js for Browser Playback

I've been struggling to encode a S32LE PCM stream to Opus in nodejs, I've tried any library I could find on the internet, none of them helped.

I'm getting this stream from pulseaudio/pipewire, and I need to stream it using Websockets.

Help! anyone...?

let context = new PulseAudio({
    client: "my-awesome-app",
});

context.on('connection', async function ( ...args ) {
    let stream = context.createRecordStream({
        stream: "my-awesome-stream",
        device: chosen.name,
        format: chosen.format,
        rate: chosen.rate,
        channels: chosen.channels,
        latency: chosen.latency,
    });
    stream.on('data', async (chunk) => {
        // how do I encode this data to Opus for playback in browser?
    });
});

What happened to Opus Stream Encoding libraries? I couldn't find any... :(

Upvotes: 0

Views: 19

Answers (0)

Related Questions