Repository navigation
v0.3.0 - Valhalla: Voice Engine
Pre-release
Pre-release
Discord Voice Engine
Release v0.3.0 implements the full Discord Voice Gateway and audio pipeline for Dusk, developed strictly following the Asgard Protocol (10 Stage-Gates, Fail-First testing).
New Modules
| Module | Responsibility |
|---|---|
Dusk::Voice::Gateway |
Voice WebSocket handshake (OP 0→2→3→4→5→6), heartbeat, SELECT_PROTOCOL |
Dusk::Voice::UDP |
74-byte IP Discovery, public IP/port parsing, RTP frame dispatch |
Dusk::Voice::Audio |
PCM→Opus pipeline via ffmpeg (Proc::Async), 20ms Supply of Buf frames |
Dusk::Voice::Crypto |
xsalsa20_poly1305 encryption via libsodium (NativeCall), correct RTP header |
Dusk::Voice::Client |
Full facade: connect(), play(Str), stop(), disconnect() |
New Error Types
Dusk::Error::LibsodiumNotFound— withapt install libsodium-devhintDusk::Error::FfmpegNotFound— withapt install ffmpeghintDusk::Error::VoiceUDPDiscoveryFailed— UDP timeout with clear messageDusk::Error::VoiceSessionTimeout— Voice WS session expired (codes 4006/4014)
Tests (Asgard Gate 05 — Fail-First)
t/14-voice-gateway.t— 6 subtests (OP sequence, heartbeat, error handling)t/15-voice-udp.t— 5 subtests (IP Discovery packet structure, timeout)t/16-voice-audio.t— 5 subtests, ffmpeg-guarded (skips gracefully if absent)t/17-voice-crypto.t— 6 subtests, libsodium-guarded (RTP header, encryption)
System Requirements
# Debian/Ubuntu
apt install libsodium-dev ffmpeg
# macOS
brew install libsodium ffmpeg
Quick Start
use Dusk::Voice::Client;
my $voice = Dusk::Voice::Client.new(
guild-id => $guild-id,
channel-id => $channel-id,
user-id => $bot-user-id,
session-id => $state.session-id,
token => $server.token,
endpoint => $server.endpoint,
);
await $voice.connect();
await $voice.play('/path/to/audio.mp3');
$voice.disconnect();