diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dde0bae5..9386e280e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue with `ElevenLabsTTSService` where changing the model or voice + while the service is running wasn't working. + - Fixed an issue that would cause multiple instances of the same class to behave incorrectly if any of the given constructor arguments defaulted to a mutable value (e.g. lists, dictionaries, objects). diff --git a/src/pipecat/services/elevenlabs/tts.py b/src/pipecat/services/elevenlabs/tts.py index 6f6584894..aeab4e787 100644 --- a/src/pipecat/services/elevenlabs/tts.py +++ b/src/pipecat/services/elevenlabs/tts.py @@ -254,14 +254,16 @@ class ElevenLabsTTSService(AudioContextWordTTSService): async def set_model(self, model: str): await super().set_model(model) logger.info(f"Switching TTS model to: [{model}]") - # No need to disconnect/reconnect for model changes with multi-context API + await self._disconnect() + await self._connect() async def _update_settings(self, settings: Mapping[str, Any]): prev_voice = self._voice_id await super()._update_settings(settings) - # If voice changes, we don't need to reconnect, just use a new context if not prev_voice == self._voice_id: logger.info(f"Switching TTS voice to: [{self._voice_id}]") + await self._disconnect() + await self._connect() async def start(self, frame: StartFrame): await super().start(frame)