fix(voice): add OggDemuxer to transmitter for proper Opus streaming

- Add OggDemuxer to unwrap OGG container from Opus encoder output
- Enable inlineVolume for better audio control
- Discord expects raw Opus packets, not OGG-wrapped stream

This should fix the no-audio issue in voice transmit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-08 21:04:57 +07:00
co-authored by Claude Opus 4.8
parent f74252f594
commit e8e95f635c
@@ -36,19 +36,22 @@ export class VoiceTransmitter {
// Upsample 24kHz mono → 48kHz stereo
const upsampledStream = this.upsampleTo48kStereo(this.pcmStream);
// Encode to Opus
// Encode to Opus and wrap in OGG container
this.opusEncoder = new prism.opus.Encoder({
rate: 48000,
channels: 2,
frameSize: 960,
});
const opusStream = upsampledStream.pipe(this.opusEncoder);
const oggDemuxer = new prism.opus.OggDemuxer();
const opusStream = upsampledStream
.pipe(this.opusEncoder)
.pipe(oggDemuxer);
// Play to Discord
// Play to Discord with Opus format (raw Opus packets)
discordPlayer.playStream(opusStream, "browser-bridge", {
inputType: StreamType.Opus,
inlineVolume: false,
inlineVolume: true,
});
// Subscribe to Redis channel for PCM data