Open asrguru20 opened 6 days ago
I found a similar issue related to audio lag when using the Text To Speech feature with auto play enabled in a self-hosted Dify version 0.10.2 chat bot. To resolve this, you can adjust the TTS_AUTO_PLAY_TIMEOUT
and TTS_AUTO_PLAY_YIELD_CPU_TIME
settings in the api/constants/tts_auto_play_timeout.py
file.
The current settings are:
TTS_AUTO_PLAY_TIMEOUT = 5
TTS_AUTO_PLAY_YIELD_CPU_TIME = 0.02
Consider reducing the TTS_AUTO_PLAY_TIMEOUT
value to decrease the delay before the audio starts playing. Additionally, you might want to experiment with the TTS_AUTO_PLAY_YIELD_CPU_TIME
to optimize CPU yield time for smoother playback. Adjust these values incrementally and test the performance to find the optimal configuration for your setup [1].
To continue talking to Dosu, mention @dosu.
what is suggested values for those two variables ? should I increase the TTS_AUTO_PLAY_TIMEOUT and TTS_AUTO_PLAY_YIELD_CPU_TIME ?
The suggested values for the variables are:
TTS_AUTO_PLAY_TIMEOUT
: 5TTS_AUTO_PLAY_YIELD_CPU_TIME
: 0.02There is no specific information provided on whether you should increase them. It might be beneficial to experiment with these values to see how they affect performance in your specific environment. Adjust them incrementally and test the results to find the optimal configuration for your setup [1].
To continue talking to Dosu, mention @dosu.
is the TTS_AUTO_PLAY_TIMEOUT for delay time before auto play TTS ?
Self Checks
Dify version
0.10.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
enable the TTS with auto play enabled feature in a agent chat bot
✔️ Expected Behavior
When You ask the chat bot which has TTS feature enabled with auto play it should automatically start to play the audio smoothly
❌ Actual Behavior
while generating text in chat bot it starts to generate audio of that text simultaneously most of the case it has at least one delay or lag but mostly two lags at the beginning of the audio