-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Support streaming TTS in wyoming #147392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support streaming TTS in wyoming #147392
Conversation
Hey there @balloob, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
elif AudioStart.is_type(event.type): | ||
yield AudioStart.from_event(event) | ||
|
||
read_task = self.config_entry.async_create_background_task( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this event happens a lot, is it possible to write this directly to the asyncio queue instead of a background task per event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to avoid repeated task creation
d4e8972
to
bbb3929
Compare
async def data_gen(): | ||
async with AsyncTcpClient(self.service.host, self.service.port) as client: | ||
# Stream text chunks to client | ||
self.config_entry.async_create_background_task( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this outside of data_gen
. You want it to start asap and not just when someone starts consuming the audio (which might not happen if it never received the text!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, manually managing the client 👍
Breaking change
Proposed change
Adds streaming support to
wyoming
text-to-speech entities. If supported, text is streamed to the TTS endpoint and audio is streamed back into Home Assistant.Text chunks are not guaranteed to be on a sentence or even a word boundary, so it is up to the TTS endpoint to store and combine/split them appropriately for the underlying models.
Requires #147385
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: