nimroddolev / chime_tts

A custom Home Assistant integration to play combined audio files before and/or after text-to-speech (TTS) messages
https://nimroddolev.github.io/chime_tts/
MIT License
196 stars 14 forks source link

Specify name of MP3 output file #185

Closed cregeland closed 1 month ago

cregeland commented 2 months ago

Checklist

Is your feature request related to a problem? Please describe.

Trying to get ChimeTTS output to play on LMS server using LMSannounce plugin

Describe the solution you'd like

Is is possible to specify the name of the mp3 file generated?

Use case:

There might be a better way to handle this. The LMS plugin for announcement is triggered by sending this command to play a local playlist: http://lmsserver:9000/plugins/LMSannounce/js.html?cmd=announcePlaylist&playlist=somepls&playerid=00%3A00%3A00%3A00%3A00%3A00

or by this command to play a specific file:

http://lmsserver:9000/plugins/LMSannounce/js.html?cmd=announceFile&file=%2Fdata%2Fmusic%2Fsoundeffects%2Fring.mp3&playerid=00%3A00%3A00%3A00%3A00%3A00

I am using shell commands in HA to send these commands: play_notify_stue: 'curl -G "http://192.168.1.20:9000/plugins/LMSannounce/js.html" --data-urlencode "cmd=announcePlaylist" --data-urlencode "playlist=nameofplaylist" --data-urlencode "playerid=00:05:30:18:35:3e"'

Maybe a different approach would be to include the generated name of the mp3 file directly in the shell command - instead of using playlist.

Commands accepted by LMSannounce plugin: https://nexus0.net/pub/sw/lmsannounce/

Thank you :)

Describe alternatives you've considered

Using ChimeTTS to play directly to the speaker would be best - but that does not allow for resuming playback after announcement completed.

Additional context

No response

nimroddolev commented 2 months ago

Hi @cregeland,

Thank you for the feature request, however I believe you can already achieve this with the current implementation of Chime TTS.

Seeing as you are able to supply Lyrion with the filepath to an MP3 file, you should be able to use the chime_tts.say_url action, which returns a dictionary response object that includes a url key with the generated MP3 file path as the value.

nimroddolev commented 1 month ago

I am closing this issue, but please reopen it if the my solution is unacceptable.