Announcement
Collapse
No announcement yet.
Annonuncements using AWS Polly and Sonos
Collapse
X
-
Guest repliedok got it i think https://forums.homeseer.com/forum/ho...g-amazon-polly
-
Guest repliedcan't access it Timon & Pumbaa.
Do you think It'll works with Squeezebox since it needs and mp3 files for tts?
Leave a comment:
-
BTW the thread I wrote for PollyC is located below
https://forums.homeseer.com/forum/ho...g-amazon-pollyLast edited by Timon; September 5, 2018, 10:57 AM.
Leave a comment:
-
So I came into this thread about 15 months later and hit the exact same problem. I found the quickest solution was to modify my speak_to_file.sh to:
#!/bin/sh
# For Python2 change ./PollyC.py3 to ./PollyC.py
./PollyC.py -o "$1.tmp" -t "$2" -c "./pollycache/" -k "1F5Q1JW3JNZEC9HMX5G2" -a "l//b6T4gzjCk3QxJa+JWBIRmpXb2vw89adURFOEu"
mpg123 -w "$1" "$1.tmp"
rm "$1.tmp"
So now the PollyC script writes out the translated or cached file to $1.tmp That is converted to a wave file (the file name provided by HomeSeer) then I delete the tmp file. Extra processing (may cache that at some point) but no noticeable delay is added in my tests for far.
Leave a comment:
-
Originally posted by dcorsus View PostI looked at the code and we have a bit of a challenge. My PI calls HS which in terms calls some TTS engine. The HS call has no parameter to tell the PI that the returned file is not .wav, so I have no way to know what format I received. Clearly Sonos is not forgiving enough if I present it with a .wav extension and/or meta data indicating a wave format file. SO, why don't you try and have the AWS-service return an audio/pcm format, see if Sonos doesn't choke on it.
Dirk
Sent from my E5823 using Tapatalk
Leave a comment:
-
Originally posted by sigbjorn View PostThank you Dirk!
I have already done some testing, and the AWS-service can in fact return files in wav-format. But the format isn't compatible with either Windows or Linux. The content-type is audio/pcm and not audio/wav. I'll do some more digging and try to find a solution.
But, it works in regular speaker clients. ;-)
Sigbjorn
Dirk
Leave a comment:
-
Originally posted by dcorsus View PostWill have to look at the code. I'm so used to have this run under Windows whereas the output was a wav file and I'm pretty sure I might be adding the file extension myself.
Having that said and you being dependent on me finding time to look at this, I would be surprised if there isn't a parameter somewhere in all the scripts you run, to have a .wav file produced instead of an .mp3. So google a little on the parameters you are using left and right, I'd be surprised if with a simple change all of this can't be made to work with existing PI functions.
Dirk
response = polly.synthesize_speech(OutputFormat='mp3', Text=text, VoiceId='Joanna')
However a quick search results that the only Outputformats supported are:
Valid Values: mp3 | ogg_vorbis | pcm
I guess I'll have to look at my code .....
Dirk
Leave a comment:
-
Thank you Dirk!
I have already done some testing, and the AWS-service can in fact return files in wav-format. But the format isn't compatible with either Windows or Linux. The content-type is audio/pcm and not audio/wav. I'll do some more digging and try to find a solution.
But, it works in regular speaker clients. ;-)
Sigbjorn
Leave a comment:
-
Originally posted by sigbjorn View PostOK!
A step further, thanks to your tips on looking at the Sonos app. It states "SonosController Announcement" and an error message saying
"Unable to play HomeSeer Announcement. The song is not encoded correctly."
As I said in the first post, it plays well on a speaker client, so what can be wrong with the encoding?
I accessed http://10.0.0.100/Sonos/Announcements/Ann_TTS_ALL_0.wav in my browser, and everything sounds good.
Update:
I looked at the Python script, generating the file from Amazon, and it is in the format of mp3. But the file saved i Ann_TTS_ALL_0.wav. I renamed the file-extension to mp3, and now the file is played over my Sonos speakers.
Final question is then: How can I always assure the announcement file is saved as .mp3 and not .wav?
Sigbjorn
Having that said and you being dependent on me finding time to look at this, I would be surprised if there isn't a parameter somewhere in all the scripts you run, to have a .wav file produced instead of an .mp3. So google a little on the parameters you are using left and right, I'd be surprised if with a simple change all of this can't be made to work with existing PI functions.
Dirk
Leave a comment:
-
OK!
A step further, thanks to your tips on looking at the Sonos app. It states "SonosController Announcement" and an error message saying
"Unable to play HomeSeer Announcement. The song is not encoded correctly."
As I said in the first post, it plays well on a speaker client, so what can be wrong with the encoding?
I accessed http://10.0.0.100/Sonos/Announcements/Ann_TTS_ALL_0.wav in my browser, and everything sounds good.
Update:
I looked at the Python script, generating the file from Amazon, and it is in the format of mp3. But the file saved i Ann_TTS_ALL_0.wav. I renamed the file-extension to mp3, and now the file is played over my Sonos speakers.
Final question is then: How can I always assure the announcement file is saved as .mp3 and not .wav?
SigbjornLast edited by sigbjorn; March 15, 2017, 11:59 AM.
Leave a comment:
-
Originally posted by sigbjorn View PostThank you for your quick response!!
I'm not running any scripts, only a test event.
[ATTACH]60084[/ATTACH]
This is my speak_to_file.sh:
Code:#!/bin/sh #flite -voice slt -o "$1" -t "$2" ./polly.py -o "$1" -t "$2"
I did a second attempt, running &hs.speak("hello") from the command window, and I got output on the Android client, but not on Sonos. I activated the debug flag before the test and here's my log file:
[ATTACH]60082[/ATTACH]
Regards
Sigbjorn
You need to activate the event and trace that with the Sonos PI debug flag on. Even before you go there, have you looked at the Sonos controller APP what it shows when you activate the event?
Could you also post your linkgroup table?
I'm miles away from being a Linux expert but what is the content of the speak_to_file.sh content when it works with the sonos PI?
Dirk
Leave a comment:
-
Thank you for your quick response!!
I'm not running any scripts, only a test event.
This is my speak_to_file.sh:
Code:#!/bin/sh #flite -voice slt -o "$1" -t "$2" ./polly.py -o "$1" -t "$2"
I did a second attempt, running &hs.speak("hello") from the command window, and I got output on the Android client, but not on Sonos. I activated the debug flag before the test and here's my log file:
Regards
Sigbjorn
Leave a comment:
-
Originally posted by sigbjorn View PostHi!
I have read this thread https://forums.homeseer.com/showthread.php?t=186070 and implemented the script the way it was suggested.
When I now try to speak through a speaker client (Android), everything is well. I get the expected announcement with the exceptional AWS voices from Amazon.
If I try to route the announcement to my Sonos link group, $SONOS$TTS_ALL$, nothing happens. In the log I can see the error message: Error in DoCheckAnnouncementQueue. 100 seconds expired since the announcement started and no end was received.
If I use the default setup in speak_to_file.sh, without running this through the AWS script, I get the announcement over my Sonos speakers.
Any ideas, what could be wrong?
Dirk
Leave a comment:
-
Annonuncements using AWS Polly and Sonos
Hi!
I have read this thread https://forums.homeseer.com/showthread.php?t=186070 and implemented the script the way it was suggested.
When I now try to speak through a speaker client (Android), everything is well. I get the expected announcement with the exceptional AWS voices from Amazon.
If I try to route the announcement to my Sonos link group, $SONOS$TTS_ALL$, nothing happens. In the log I can see the error message: Error in DoCheckAnnouncementQueue. 100 seconds expired since the announcement started and no end was received.
If I use the default setup in speak_to_file.sh, without running this through the AWS script, I get the announcement over my Sonos speakers.
Any ideas, what could be wrong?Tags: None
Leave a comment: