openai_tts
openai_tts copied to clipboard
Added a configuration but no audio
I've added a configuration as per instructions, but I can't hear any audio. Is there any setting missing?
Here is what it looks like:
The device:
The service call:
service: tts.speak
data:
cache: true
media_player_entity_id: media_player.vlc_telnet
message: Test
target:
entity_id: tts.openai_tts_nova
When I run it, I hear nothing, but UI shows as it succeeded.
This is the only log I can say it may be related to this, but I'm not 100% sure, because it is related to tags and this shouldn't stop it from playing.
2024-06-19 09:09:58.141 ERROR (MainThread) [homeassistant.components.tts] ID3 tag error: can't sync to MPEG frame
The media_player seems to be working normally, as I can use other tts services (like google translator google_say service) and I can hear it.
Thanks for your help.
That's strange. I've connected my VLC (Windows, 3.0.20) using the Telnet interface and the integration works fine.
Integration provides just a plain MP3 file with TTS content. Check your /config/tts folder, and normally you'll find the cached MP3 file there from the TTS engine. Can you play it?
Same issue for me, can't get it to work. I see the MP3, but only very small file size and when I try to play VLC says it's corrupted.
I think I'm seeing the same problem. I see this in the log file:
Logger: aiohttp.server Source: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:451 First occurred: 3:06:26 PM (2 occurrences) Last logged: 3:11:21 PM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 480, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tts/init.py", line 1099, in get
content, data = await self.tts.async_read_tts(filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tts/init.py", line 953, in async_read_tts
await pending
File "/usr/src/homeassistant/homeassistant/components/tts/init.py", line 806, in get_tts_data
data = await async_convert_audio(
^^^^^^^^^^^^^^^^^^^^^^^^^^
...<7 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/components/tts/init.py", line 227, in async_convert_audio
return await hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/tts/init.py", line 228, in
Not sure if this is related, but the new voice assistant doesn't work with this. The "Test" in the browser works fine, but when I set the voice assistant to use this I get no audio.
Seeing this exception in the HASS logs:
Error doing job: Exception in callback SpeechManager._async_get_tts_audio.<locals>.handle_error() at /usr/src/homeassistant/homeassistant/components/tts/__init__.py:844 (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 846, in handle_error
if audio_task.exception():
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 786, in get_tts_data
extension, data = await engine_instance.internal_async_get_tts_audio(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
message, language, options
^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 492, in internal_async_get_tts_audio
return await self.async_get_tts_audio(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
message=message, language=language, options=options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 509, in async_get_tts_audio
return await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
partial(self.get_tts_audio, message, language, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
asyncio.exceptions.CancelledError
I think I figured out my issue from
tts_output:
media_id: >-
media-source://tts/tts.openai_tts_shimmer?message=Yes,+I+can+hear+you.&language=en&tts_options=%7B%22preferred_format%22:%22flac%22,%22preferred_sample_rate%22:48000,%22preferred_sample_channels%22:1,%22preferred_sample_bytes%22:2%7D
url: /api/tts_proxy/hI-ISQ9cv_qmlWRy4JWUfA.flac
mime_type: audio/flac
Note the mime_type and preferred_format are flac, but it looks like openai_tts is hard-coded to wav.
In both my dev and normal home environments, I've never seen a FLAC file entered through the TTS proxy. Check the latest release, though.
If you enable debugging in voice assistants, in the end, you should see something like this:
tts_output:
media_id: >-
media-source://tts/tts.openai_tts_shimmer?message=Hello
url: /api/tts_proxy/iCqU34DjyOwvaQEMNCaKHg.mp3
mime_type: audio/mpeg