Pace Talk audio over gateway relay

This commit is contained in:
Mikei386 committed 2026-09-03 23:00:56 +02:00
1 parent 0a68df22eb
commit df41175960
4 files changed
+13 -2

No files matched your search

+4
View File
@@ -235,7 +235,11 @@ class AthenaTalkBridge {
return;
const frameBytes = 24000 * 2 / 50;
for (let offset = 0; offset < pcm.length; offset += frameBytes) {
if (controller.signal.aborted || generation !== this.generation || !this.isConnected()) {
return;
}
this.req.onAudio?.(pcm.subarray(offset, Math.min(offset + frameBytes, pcm.length)));
await new Promise((resolve) => setTimeout(resolve, 20));
}
this.req.onResponseDone?.({ status: "completed", responseId });
this.req.onEvent?.({ direction: "server", type: "response.done", responseId });
@@ -243,7 +243,14 @@ class AthenaTalkBridge {
if (generation !== this.generation || !this.isConnected()) return;
const frameBytes = 24000 * 2 / 50;
for (let offset = 0; offset < pcm.length; offset += frameBytes) {
if (controller.signal.aborted || generation !== this.generation || !this.isConnected()) {
return;
}
this.req.onAudio?.(pcm.subarray(offset, Math.min(offset + frameBytes, pcm.length)));
// Gateway relay drops audio frames when its WebSocket queue is full.
// Pace 20 ms PCM frames in realtime instead of flooding the complete
// synthesized response into the socket in a few milliseconds.
await new Promise((resolve) => setTimeout(resolve, 20));
}
this.req.onResponseDone?.({ status: "completed", responseId });
this.req.onEvent?.({ direction: "server", type: "response.done", responseId });
@@ -2,7 +2,7 @@
"id": "athena-talk",
"name": "Athena Local Talk",
"description": "Local German voice conversations through Athena without a public speech provider.",
"version": "0.1.0",
"version": "0.1.1",
"enabledByDefault": true,
"activation": {
"onStartup": true,
@@ -1,6 +1,6 @@
{
"name": "openclaw-plugin-athena-talk",
"version": "0.1.0",
"version": "0.1.1",
"description": "Private realtime Talk bridge for Athena STT, OpenClaw agent consult, and Athena TTS.",
"type": "module",
"private": true,