fix(neuphonic,resemble): don't drop TTS frames between WebSocket listener re-registrations#1470
Open
u9g wants to merge 1 commit into
Open
fix(neuphonic,resemble): don't drop TTS frames between WebSocket listener re-registrations#1470u9g wants to merge 1 commit into
u9g wants to merge 1 commit into
Conversation
…ocket listener re-registrations
SynthesizeStream.recvTask wrapped each message read in a fresh Promise that called
ws.removeAllListeners() and re-attached message/error/close handlers per iteration.
Frames arriving between resolve() and the next on('message') registration were
silently dropped by the ws library (no buffer in that window), producing audible
gaps in the rendered output.
Mirror the Cartesia plugin's fix: attach listeners once before the consume loop,
pipe incoming frames through stream.createStreamChannel<RawData>(), and detach via
scoped ws.off() in finally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes audio frame loss in Neuphonic and Resemble TTS streaming.
SynthesizeStream.recvTaskwas re-registering WebSocket listeners per iteration, dropping frames in the gap; mirrors the Cartesia plugin's fix.Changes Made
plugins/neuphonic/src/tts.ts: attachmessage/close/errorlisteners once, buffer viastream.createStreamChannel<RawData>(), detach via scopedws.off()infinally.plugins/resemble/src/tts.ts: same fix (had identical pattern, comment even pointed at the now-fixed ElevenLabs).Pre-Review Checklist
Testing
restaurant_agent.tsandrealtime_agent.tswork properly (for major changes)Manually exercised by swapping
basic_agent.tstonew neuphonic.TTS()and verifying continuous playback (no committed example change).