-
Notifications
You must be signed in to change notification settings - Fork 884
Open
Description
Hi, I have a simple program that directly parses Opus packets from a file and transmits them with the "OpusSend" channel, but the audio through Discord sounds as if it's been slowed down and comes out extremely warbly. Any idea on what the issue could be? Issue happens even when using PR #1593 or #1677.
package main
import (
"os"
"io"
"time"
"github.com/bwmarrin/discordgo"
)
...
func main() {
s, err := discordgo.New(BOT_TOKEN)
...
s.Identify.Intents = 1 << 7 | 1 << 20 | 1 << 21 // Guild voice states | Connect | Speak
...
err = s.Open()
...
vc, err := s.ChannelVoiceJoin(GUILD_ID, VOICE_CHNL_ID, false, true)
...
f, err := os.Open(OPUS_PATH)
...
time.Sleep(1000 * time.Millisecond)
vc.Speaking(true)
time.Sleep(1000 * time.Millisecond)
...
// Parse Opus pages
for {
// Parse page header
n, err := io.ReadFull(f, headerBuf[:])
...
// Discard first two pages since these
// contain metadata
if discard < 2 {
...
discard += 1
continue
}
// Parse packets
for i := 0; i < tableLen; i++ {
...
_, err = io.ReadFull(f, packetBuf[pEnd:pEnd+segLen])
...
vc.OpusSend <- packetBuf[:pEnd]
...
}
}
vc.Disconnect()
}Full code here: music.go
Sample song here: VcOSUOpACq0.opus
To verify that the Opus packets are correct, I made a small Go program which replicates my parsing implementation and pipes packets to a discord.py script which connects to a voice channel and transmits the audio packets. The discord.py implementation works fine.
Metadata
Metadata
Assignees
Labels
No labels