The user asked for a faster, real app instead of Electron. The app is now a Rust crate (serenity + songbird); the GUI in M5 will be a Tauri 2 shell on the system WebView2. - Same behaviour as the Electron core: one voice channel, per-speaker PCM to the voice worker, speaking_end and speaker_leave, sentence playback with stop and cancel, transcription notice on join, slash command join/leave/stop (create-or-update), registered chat channels with live events, history and sends that never ping, worker process with a fresh token and restart backoff. - songbird 0.6.1 garbles about a third of received frames under DAVE (its decoder keeps the bytes DAVE decryption leaves at the end of the payload; a 20 ms stepped test tone showed repeats, skips and reordering, while sending was exact). songbird now only decrypts; the core reorders packets in a small window (Opus FEC for the last lost frame) and decodes them with libopus itself. - Live test on real Discord with two bots: five sentences heard (CER 0/0/0/5/12.5%), 0.71-0.90 s from end of speech to final, speech read back at 3.4%, sound gone 0.08 s after stop. The release binary uses about 16 MB of memory; a Windows build (MinGW) logs in under Wine. - Spec moved to app/src/discord_core.spec.md; architecture, decisions, roadmap and pc-features updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""The real voice worker server with fake engines, for the app's protocol tests (no GPU, no models).
|
|
|
|
The fake VAD reads speech probability off the amplitude; the fake transcriber names a clip by its
|
|
pitch ("level 0.9" for a 900 Hz tone); the fake TTS makes 10 samples per character.
|
|
Run with the repo's src/ on PYTHONPATH: python fake_engine_worker.py <port>
|
|
"""
|
|
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
import numpy as np
|
|
|
|
from voice_worker.server import VoiceWorker
|
|
|
|
|
|
class AmplitudeVad:
|
|
def prob(self, window):
|
|
return float(np.max(np.abs(window)))
|
|
|
|
|
|
class LevelTranscriber:
|
|
def transcribe(self, clips, opts):
|
|
return [f"level {np.argmax(np.abs(np.fft.rfft(c))) * 16000 / len(c) / 1000:.1f}" for c in clips]
|
|
|
|
|
|
class FakeTts:
|
|
def synthesize(self, text, rate):
|
|
return np.full(len(text) * 10, 1000, dtype=np.int16)
|
|
|
|
|
|
async def main(port: int) -> None:
|
|
worker = VoiceWorker(os.environ["JARVIS_VOICE_TOKEN"], LevelTranscriber(), AmplitudeVad, FakeTts())
|
|
server = await worker.serve("127.0.0.1", port)
|
|
print(f"READY 127.0.0.1:{port}", flush=True)
|
|
await server.serve_forever()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main(int(sys.argv[1])))
|