From 1e2b066cf3e0eada84d2e7370aee09cf5e28e7c1 Mon Sep 17 00:00:00 2001 From: "Azain." <26267920+azain47@users.noreply.github.com> Date: Wed, 30 Jul 2025 13:41:27 +0530 Subject: [PATCH] Fix tts.py Update Piper TTS Service to work with the newer Piper GPL Version, that uses JSON as its payload. --- src/pipecat/services/piper/tts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipecat/services/piper/tts.py b/src/pipecat/services/piper/tts.py index 90176dab8..7892e15fa 100644 --- a/src/pipecat/services/piper/tts.py +++ b/src/pipecat/services/piper/tts.py @@ -22,7 +22,7 @@ from pipecat.services.tts_service import TTSService from pipecat.utils.tracing.service_decorators import traced_tts -# This assumes a running TTS service running: https://github.com/rhasspy/piper/blob/master/src/python_run/README_http.md +# This assumes a running TTS service running: https://github.com/OHF-Voice/piper1-gpl/blob/main/docs/API_HTTP.md class PiperTTSService(TTSService): """Piper TTS service implementation. @@ -79,12 +79,12 @@ class PiperTTSService(TTSService): """ logger.debug(f"{self}: Generating TTS [{text}]") headers = { - "Content-Type": "text/plain", + "Content-Type": "application/json", } try: await self.start_ttfb_metrics() - async with self._session.post(self._base_url, data=text, headers=headers) as response: + async with self._session.post(self._base_url, json=text, headers=headers) as response: if response.status != 200: error = await response.text() logger.error(