Has anyone faced an issue where the audio of a sin...
# agents
p
Has anyone faced an issue where the audio of a single word is split and audio gets distorted in the middle of audio generation? For example - if the LLM streams text normally - "Thank you for your consent. Since you...". The audio generation for
consent
is said over a long silence in between (example audio attached) This is happening for 11labs. @jolly-air-155 - any advice on how to debug this or why this could have happened? I am on the livekit-agents=1.2.6 and plugins are also on the same version
👀 1
Example audio of the above issue.
@jolly-air-155 - any help would be appreciated here. This is happening for more cases where there is a glitch and long pause in middle of word. Any ideas on why this could occur?
j
we introduced a speech pause/resume when false interruption happens since agents 1.2.7, but it shouldn’t happen in agents 1.2.6
if you can confirm it’s from agents 1.2.6, it’s more like a delay of the audio streaming from the TTS, if it’s from a later version, then probably it’s a false interruption that the agent paused the audio output and there was no new user transcript so the speech got resumed after a timeout, you should be able to see the logs when this happened
p
Thanks for responding. We are still on livekit-agents 1.2.6. So this could be stemming from TTS side? This is happening multiple times now and have only observed this for 11labs and NOT for cartesia
j
I see, we made some major updates for 11labs plugin in 1.2.8, maybe you can give it a try
p
Have raised an issue with minimal reproducible steps - https://github.com/livekit/agents/issues/3433
j
oh just replied, I didn’t see an issue when using webrtc with your example
p
I am able to replicate this with telephony too
j
p
Thanks for checking this - but I can reproduce this in both telephony and console too. See Screen recording below for console and telephony recording along with egress. Possible to check why that is happening there? I will get a reproducable version for webrtc too
@jolly-air-155 - got this replicated in webrtc too Wanted to check if you are using the
livekit-agents
sdk version 1.2.6 to replicate this along with all other plugins being 1.2.6 to replicate this issue.
j
sounds like it’s consistent across your tests, it paused after reference?
p
Yes - the word breaks exactly for
reference
. And I am able to reproduce this for
1.2.6
for any agent and using the text I provided
j
ok I see it on my end as well
🙏 1
I would suspect it’s an issue of 11labs or the connection to it
p
I confirmed that this is not issue from 11labs by dumping the audio of 11labs and logging the base64 audio from 11labs - https://github.com/livekit/agents/issues/3433#issuecomment-3298682813 The audio is smooth and does not have any jitter
j
ok… after removing the simulation delay in your example, it fixed
and it paused at reference because there is a 0.1s pause in the simulation llm
Copy code
you 0.002
 for 0
 providing 0.001
 the 0
 reference 0.101
 number 0.001
let me do more tests…
🙏 1
p
For other words too there is a delay of 0.2 secs for example at
Just
but that doesn't get surfaced with this issue. The latency simulation is from LLM - sometimes llm sends the tokens with this latencies
j
yeah the pause in llm is not the issue, the text was sent as sentences, so the first sentence sent is
Thank you for providing the reference number.
but it’s related to the pause somehow, if I sent the full text at once or with a smaller delay like 0.5*delay, the issue fixed
if I increase the delay by 2 times, the audio after reference also paused longer
I will investigate the root cause, it’s interesting the audio has an issue with the llm pause
p
From the
LK_DUMP_TTS=1
- I was able to notice that the audio from 11labs is being correctly generated but the publishing of audio is where the issue lies I think. Been debugging this whole day to get this reproduced 😢. Really appreciate you noting this and help here 🙏
j
but it’s related to the pause somehow, if I sent the full text at once or with a smaller delay like 0.5*delay, the issue fixed
if I increase the delay by 2 times, the audio after reference also paused longer
can you reproduce what I observed here?
p
Yes I am able to replicate that
j
From the
LK_DUMP_TTS=1
- I was able to notice that the audio from 11labs is being correctly generated but the publishing of audio is where the issue lies I think.
actually the dumped audio is fine doesn’t mean it’s not possible an issue of 11labs, it might stream the audio late, when you dump to a file, it sounds right
👍 1
p
Is it possible to update on github that this is being investigated? I went through the
AudioEmitter
class code and wasn't able to exactly pinpoint where the issue lies. Also - I am not just relying on the dumping of audio from
LK_DUMP_TTS
var. I realized that there might issue due to stream. I am able to confirm the issue is not from 11labs because I logged the binary audio received from 11labs websocket and wrote it to a file. As we are passing the sentences to 11labs in
auto_mode
- the audio of complete sentence is generated by
11labs
. I have pasted here in GH to share if that helps too
j
I think it’s indeed an issue of 11labs, it stopped audio streaming when we not sending the next sentence
I added a print after getting audio from the ws connection
the audio playout paused, then continued after new audio chunks received.
p
I think it’s indeed an issue of 11labs
But as we are generating the audio using
sentences
to 11labs - the audio from 11labs has the audio of complete sentence as I have shared here. So the question is why the pause at
reference
word and not after the audio is completely flushed to the underlying transport?
j
I guess it’s because they need the follow up text for the end of previous sentence for better audio quality.
so you can use non-streaming mode in your case
it then will generate audio sentence by sentence
p
No I meant the audio for the
reference
word is present completely in a single response from 11labs. It is not cutoff into multiple respones
Copy code
import base64, hashlib, pathlib

b64 = """SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYwLjE2LjEwMAAAAAAAAAAAAAAA//NAxAAP+GI4DDBGQEtIT1gRAtNkHHEhOdP6HAkTvDCgtL5d6nLPwxohgEKncP/EZ8MeIJQoGP5Q5ieH1n3qcfiApBN8pcf5PE/KOD4K1UglQID2iUVLdBI+i4bs2Zh2Zk7us7NXxpb/80LEGxQx0lA0MEdErL6GEVpQk95uzzCzpoVL6P3lMk5DouZw17mdc/GpNiw2ctip82Na0AWGhU4Ta69LZ9Vua9gyCy0oa5YrbtOWvmMj/SmhzEkA8kGnMrGcAjSzMhzwjUdIU3FI1OT/80DEJhGJzlA0MEbc1HYJSWn10ySkdrQEhpNTA4gLhQqKrL4orH/tIZBOMvXVG+I2RsMNDjZDiqU0bM3XmxxJlKKj6bywjAi4glMTLUiaK4jGUnRdY5QHXllJQawEUDhZU+0oZii2Vv/zQsQ6E8F2SAhIRxBdY2LxZNfrrD+rFNfUdFFHC2ojFBV3GDwCcxkdUEmtEQnNkHFBycs3QikOrjVyskby6U3LzrIxg380z89Cin7sDsE0sVoizySiItfgkFYwKMYKhhRsir7u9SVb6v/zQMRHE0leTAoaRgRCxTaklqWqZaUG+D0yBNg4pbnvXa1PybzKYnOLn2HkcXhQzIirWeV83Y6T7s6Hlk88qUPzBJfyuvvnukzit+DwMKgQisRVtBhwoG1mabKe/bMSHMusrf/FKgAQ//NCxFQUUc5QFUkYAIBAMiAzBhBAfvK/LGt95jpg6AvuOPQVOPUFvipBlwbHqgDgCZgHmtB0W3CghkgB0BxX+uPBPhc4FwgcpV0Xdaq1Q+5FDwy4+hOggH//+I7DlxcoyZFC8TIssUp///NAxF4ks9pptZiQAP//5ZIOLgJUZsdhQIgWCIMYEA/////ycHIIgXyPJMihLmiymbEEJM0L///////6JfUXyLlutFYoFqrV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2UBNUYMJOlP1IQjNV85n//7ZnXmf/26vMeDI9gHPQXcG//NCxEoUWhKCPsGEXGj///82rlV1AckSrjn+3AH0QQBS9LsUcUktr9Py5OIwiit3za/bM6aHZ4EBYxbVyhsd3CLFa6aIilJv97wu9p0zPxLCpWNVL+///9JvBCkiFwjcNc2r+VUw/WB+//NAxFQT4gqKXlmGXGgAQaHDD2fpK1iYWTw7CAVFBpa8jnGpHPVtMSasJwS5xmXewtGQdnBRxwFDQr40/MtH0kM/ZjoNBXjRi9O0asYDbg8h4aB4DWsympUGKfv/AOVUN2PfX3JpSTH/80LEXxPRsmA0QYbolInEyBEGK9bFZFqKk0ZSxA8yeQdTR0mIjB8RNIphYCgQuGBeDoK5cJsBIXSaXWkUVDYMnhRVi7793QwshM/X0Aj398GFFafs6beE1GFCyVGgoFY+W2ZG1tKoyyj/80DEaxO47mT0AYYcNMKpym5IUc3C0UKLvMxI0lLlECnJlgBvjV+evxqiflmQ7e/k1GQYv4ZzU9MZzbf+fz//r+f2Am6agZiSGVAXBp7TSorleGZNNocGECFFgzmcysalHaSZykKNt//zQsR3FHEOXNQRhg0kn/dlvyBF7pE1U/ee73+2xrVvZ2grOtRzObmjN/3uJnLP+XKq5N/d+dxX5iqr/ckkjAdwMlE6wwX3RaYcmiBTbKR9o1PjE3JlMnPzNuUSKOHUVypg5OO1BrWOE//zQMSBFEECWFQJhgnoW4h4USZpLlsSsRveIdTpTPapqu7eTmebEsqBVc6+rVLVE02NgcGIvQCu6qWXUXZyEIRuS/dmE4wlxWhmVVTKbzn2eTq/sZkdctioxPGAgShFZ0DQ8RQpgRDp"""
b = base64.b64decode(b64)

# Quick sanity checks
print("first 8 bytes:", b[:8].hex(" "), "| ascii:", b[:3])
assert b.startswith(b"ID3") or b[:2] in (b"\xff\xfb", b"\xff\xf3", b"\xff\xf2")

out = pathlib.Path("eleven_out.mp3")
out.write_bytes(b)
print(
    "wrote",
    out.resolve(),
    "len:",
    len(b),
    "sha256:",
    hashlib.sha256(b).hexdigest()[:16],
)
The b64 data is of
11labs
response for the first sentence -
Thank you for providing the reference number.
Now this is a complete response from 11labs. The question why is there a cutoff during
reference
word in the audio?
j
I see what you mean, yeah the first chunk seems completed
will double check
🙏 1
ok, found the issue.. it’s the audio decoder has a buffer and the next audio data is slower than realtime so it paused with some frames in the buffer
🙌 1
we can flush the decoder after each chunk but I am worry about if it’s always valid for 11labs (one chunk contains a full sentence)
so perhaps for your case it’s better to just use a non-streaming mode.
p
It is valid for 11labs because automode uses complete sentences itself as there is a sentence tokenizer
j
but it doesn’t have to sent the full audio in a single chunk?
each flush will actually close the decoder and create a new one, if there are too many chunks it may decrease the performance
p
Using the non-streaming TTS increases latency - the reason we are using auto_mode is because the latency is lowest for 11labs there 😓 But can we flush the audio if the next chunk arrives a little late?
j
I’ll check what could be a fix, maybe reduce the buffer or flush it when audio is slower than realtime…
p
Yes - please - I am sure others are also facing this but they might be discarding this as network jitter. That is also what I thought earlier but this seems to be frequent when the LLM responds with a delay in the chunks.
j
I guess for most of case the llm is faster enough… but anyway, it should stream out the audio instead of wait in the middle
p
but anyway, it should stream out the audio instead of wait in the middle
Yes - thank you 🙏 .
j
🙌 1