Skip to content

Commit

Permalink
FIx for audio bug when TTS speed > 150%
Browse files Browse the repository at this point in the history
  • Loading branch information
nimroddolev committed Oct 8, 2023
1 parent 8e970a5 commit 7eb9216
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/chime_tts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,10 @@ async def async_request_tts_audio(hass: HomeAssistant,
_LOGGER.debug(" - ...changing TTS playback speed to %s percent",
str(tts_playback_speed))
playback_speed = float(tts_playback_speed / 100)
audio = audio.speedup(playback_speed=playback_speed, chunk_size=50)
if tts_playback_speed > 150:
audio = audio.speedup(playback_speed=playback_speed, chunk_size=50)
else:
audio = audio.speedup(playback_speed=playback_speed)
end_time = datetime.now()
_LOGGER.debug(" - ...TTS audio completed in %s ms",
str((end_time - start_time).total_seconds() * 1000))
Expand Down

0 comments on commit 7eb9216

Please sign in to comment.