Page 2 of 7

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Saturday 30 April 2016 11:14
by jmleglise
jin wrote:
jmleglise wrote:Hi,

Another feedback : I would appreciate in a future version an option to don't keep the audio file after the playback. Indeed, some sentences will never come again. (like reading news).
(for saving some disk space)

Code: Select all

jin@jlt:~$ izsynth -h | grep keep
  -w                         Overwrite the synthesized file, otherwise keep it (current: no)
otherwise you can change the default behavior via izsynth.conf file:

set:

Code: Select all

PLAYBACK_RESYNTH="yes"
Read the domoticz wiki page to discover:

http://www.domoticz.com/wiki/IzSynth

With kind regards
Hi jin,

1/ That's not what I am meaning. I ask for an option to automatically remove the .wav in dev/shm after the playback. something like "-nocache"
It's not the purpose of -w => overwrite the file if the same sentence come again.
As my RPi never reboots, what will happen when the /dev/shm will become full ?

2/ And another feedback :
Your system can't handle sentences longer than the limit of file name length. (255). This is too short. As my system synthetizes news in the morning, I frequently need >400 chars.
So , for this kind of use, you may have an option, that use a short file name, and then delete it.

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Saturday 30 April 2016 18:20
by jin
jmleglise wrote: Hi jin,

1/ That's not what I am meaning. I ask for an option to automatically remove the .wav in dev/shm after the playback. something like "-nocache"
It's not the purpose of -w => overwrite the file if the same sentence come again.
As my RPi never reboots, what will happen when the /dev/shm will become full ?

2/ And another feedback :
Your system can't handle sentences longer than the limit of file name length. (255). This is too short. As my system synthetizes news in the morning, I frequently need >400 chars.
So , for this kind of use, you may have an option, that use a short file name, and then delete it.
Ok thanks now understand your request :)

1) izsynth is thought to generate reusable over the time audio files.
anyway your request is useful and easy to implement, so I just pushed to github an update implementing this feature:

Code: Select all

jin@jlt:~$ izsynth | grep Remove
  -r                         Remove synthesized file after playback
ps. if we must remove the synthesized file, of course we can't remove it if PLAYBACK_BACKGROUND=yes


2) If you need to synthesize phrases longer than 255 chars, then use as input file a txt file (anyway the limit of synthesized chars depend on engine used, so you must try some engines to find what offer the longer output)... you can accomplish that using a script that make a txt file with your news in the same path, for example:

Code: Select all

curl -s http://yournewssite.com | sed 's|</b>|-|g' | sed 's|<[^>]*>||g' > /dev/shm/news.txt
izsynth -i /dev/shm/news.txt
Thank you for the feedback

With kind regards

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Sunday 01 May 2016 0:04
by jmleglise
Hi,

1/ Thank you for the "-r" . Great reactivity ! :D

2/ For my second point (long sentence), using an intermediate file.txt is not convenient. In my Lua script, I am used to launch the TTS in a single command . For example, you can see my use here : http://www.domoticz.com/forum/viewtopic ... 23&t=10923

So, can you advise me something to avoid this file.txt ? (ie : is it possible in linux to redirect the stdin to your -i parameter ?)

Or here is another idea as my 2 points are linked :
Short sentences : it 's usefull to cache them (good chance to get it again)
Very Long sentence : no need to cache. (and no need to use the sentence as the filename. This will remove the length limit).
So you may code a : if length(sentence)>255 then use filename "tmp.wav" and then remove it at the end ?

You see my idea ?

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Sunday 01 May 2016 23:29
by jin
jmleglise wrote:Hi,

1/ Thank you for the "-r" . Great reactivity ! :D

2/ For my second point (long sentence), using an intermediate file.txt is not convenient. In my Lua script, I am used to launch the TTS in a single command . For example, you can see my use here : http://www.domoticz.com/forum/viewtopic ... 23&t=10923

So, can you advise me something to avoid this file.txt ? (ie : is it possible in linux to redirect the stdin to your -i parameter ?)

Or here is another idea as my 2 points are linked :
Short sentences : it 's usefull to cache them (good chance to get it again)
Very Long sentence : no need to cache. (and no need to use the sentence as the filename. This will remove the length limit).
So you may code a : if length(sentence)>255 then use filename "tmp.wav" and then remove it at the end ?

You see my idea ?

jmleglise nice ideas, I'm working on :)

download the new version from github, this is the changelog:

Code: Select all

# - restored google tts support (limited to 160 chars max)
# - added -r option for removing synthesized file after playback
# - added support for stdin as input stream, example:
#   echo this is only a test | izsynth -
so you can pipe in three ways:

echo "Good morning" | izsynth -
echo "Good morning" | izsynth -i -
echo "Good morning" | izsynth -t -

I suggest the first because is shortest :)

anyway right now the limit is 255 chars

TODO:
- add support for automatically no keep long synthesized sentence (>= 255 chars)
- find a way to split and synthesize sentence longer than the supported engine chars (splitting them and making more request to the online engine)

Kind regards

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 0:40
by korniza
You are my hero! I know that it looks so easy but I know that it is hard to get all these tts engines inside a script.
IMHO, it can be a nice app for mydomoticz, where can be a databse of common phrases which will be updated by domoticz users and shared to all.
As you may have some requests please add another one: ispeech! voices are not so natural but they have a variety of languages.

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 1:13
by jin
korniza wrote:You are my hero! I know that it looks so easy but I know that it is hard to get all these tts engines inside a script.
IMHO, it can be a nice app for mydomoticz, where can be a databse of common phrases which will be updated by domoticz users and shared to all.
As you may have some requests please add another one: ispeech! voices are not so natural but they have a variety of languages.
Hi korniza,

thank you for your positive post :)

check the latest github commit ;)

Code: Select all

[jin@jlt ~]$ izsynth -e ispeech -l
Voice                Country     Language    Gender
-------------------- ----------- ----------- ------
usenglishfemale      US          English     Female
usenglishmale        US          English     Male
ukenglishfemale      UK          English     Female
ukenglishmale        UK          English     Male
auenglishfemale      Australian  English     Female
usspanishfemale      US          Spanish     Female
usspanishmale        US          Spanish     Male
chchinesefemale      China       Chinese     Female
hkchinesefemale      HongKong    Catonese    Female
twchinesefemale      Taiwan      Chinese     Female
jpjapanesefemale     Japan       Japanese    Female
krkoreanfemale       Korea       Korean      Female
caenglishfemale      Canadian    English     Female
huhungarianfemale    Hungary     Hungarian   Female
brportuguesefemale   Brazilian   Portuguese  Female
eurportuguesefemale  European    Portuguese  Female
eurportuguesemale    European    Portuguese  Male
eurspanishfemale     European    Spanish     Female
eurspanishmale       European    Spanish     Male
eurcatalanfemale     European    Catalan     Female
eurczechfemale       European    Czech       Female
eurdanishfemale      European    Danish      Female
eurfinnishfemale     European    Finnish     Female
eurfrenchfemale      European    French      Female
eurfrenchmale        European    French      Male
eurnorwegianfemale   European    Norweigian  Female
eurdutchfemale       European    Dutch       Female
eurpolishfemale      European    Polish      Female
euritalianfemale     European    Italian     Female
euritalianmale       European    Italian     Male
eurturkishfemale     European    Turkish     Female
eurturkishmale       European    Turkish     Male
eurgreekfemale       European    Greek       Female
eurgermanfemale      European    German      Female
eurgermanmale        European    German      Male
rurussianfemale      Russia      Russian     Female
rurussianmale        Russia      Russian     Male
swswedishfemale      Sweden      Swedish     Female
cafrenchfemale       Canadian    French      Female
cafrenchmale         Canadian    French      Male
arabicmale           Dubai       Arabic      Male
Kind regards

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 2:18
by korniza
OMG!!!!!!yes! I'm dreaming! YOU made it once again! jin the great hero of TTS! THE ultimate script for TTS! If in case you find any greek male tts, please add it. :lol: :lol: :D

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 7:46
by woody4165
Ciao jin

this tool is becoming wonderful every day.

One question regarding these warnings:

Code: Select all

mkdir: cannot create directory ‘/home/pi/.config/izsynth’: Permission denied
find: `/home/pi/.config/izsynth/engines/': No such file or directory
find: `/home/pi/.config/izsynth/engines/': No such file or directory
I get them if I execute izsynth without sudo (I followed the github and wiki to install it), is it correct that I need to launch it this way?

Thanks

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 10:10
by jin
woody4165 wrote:Ciao jin

Code: Select all

mkdir: cannot create directory ‘/home/pi/.config/izsynth’: Permission denied
find: `/home/pi/.config/izsynth/engines/': No such file or directory
find: `/home/pi/.config/izsynth/engines/': No such file or directory
I get them if I execute izsynth without sudo (I followed the github and wiki to install it), is it correct that I need to launch it this way?

Thanks
Ciao woody! :)

can you run this command and paste here the output?

Code: Select all

ls -al /home/pi/.config/
and after:

Code: Select all

chown pi:pi /home/pi/.config/
chown pi:pi /home/pi/.config/izsynth
let's me know if this fix

Kind regards

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 10:14
by jin
korniza wrote:OMG!!!!!!yes! I'm dreaming! YOU made it once again! jin the great hero of TTS! THE ultimate script for TTS! If in case you find any greek male tts, please add it. :lol: :lol: :D
Thank you! ;)

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 11:15
by korniza
Feedback report: I face an issue with non-english prompt. I tried to insert the following on Action
script://izsynth -e ispeech -v eurgreekfemale -t "Καλημέρα!"
Domoticz refuse to save it (pressing save, don't do anything). It is related with domoticz by itself as izsynth is working when using the same prompt on console.
Jin is there any workaround that can be used to your script? Also I may missing something: can I get big texts played (for example a web page feed) breaking into smaller files and putting together?

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 11:54
by toreandre
jin wrote:

Code: Select all

pi@raspberrypi ~ $ which file
/usr/bin/file
pi@raspberrypi ~ $ dpkg -S /usr/bin/file
file: /usr/bin/file
can you run:

Code: Select all

sudo apt-get install file
izsynth is a bash script and it use many system commands to do the job, so these commands must be installed :)

just updated wiki, thanks!

let's me know is something is still missing.

kind regards
Worked like a charm! Now i can use this to play sound " /home/osmc/domoticz/scripts/izsynth -e voicerss -v nb-no -t "Hei, jeg heter test""

But i have some trouble using it with a switch.
All of the actions on this selector gives error in domoticz.

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 11:59
by woody4165
What is the permission of the file /home/osmc/domoticz/scripts/izsynth?

try to change to 755

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 12:27
by toreandre
Thank you for the suggestion Woody, seems like the fix was to add "&" at the end of the action.

seems like the script is executing (no error in log) but no sound from the speakers, so i need to check the soundcard output in config.

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 13:12
by jin
korniza wrote: Also I may missing something: can I get big texts played (for example a web page feed) breaking into smaller files and putting together?
This is in the TODO list :)

about the non english test, this is a Domoticz problem I think :( open a bug report.

Kind regards

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 14:07
by micbou
Adding a '&' right after the action fixed the return 256 error for me, but now I'm not getting any audio from the action. Same as someone mentioned above me. FYI, audio is working when executing the script from the command prompt.

Any advice?
snip_20160503140701.png
snip_20160503140701.png (186.4 KiB) Viewed 4440 times

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 19:43
by jin
micbou wrote:Adding a '&' right after the action fixed the return 256 error for me, but now I'm not getting any audio from the action. Same as someone mentioned above me. FYI, audio is working when executing the script from the command prompt.
Any advice?
Yuo must add '&' at the end?
This is very strange... my domoticz installation works out of the box simply using

script://izsynth test message

from you domoticz directory, can you paste the output of:

Code: Select all

ls -al scripts/izsynth 

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 21:48
by toreandre
jin wrote:
micbou wrote:Adding a '&' right after the action fixed the return 256 error for me, but now I'm not getting any audio from the action. Same as someone mentioned above me. FYI, audio is working when executing the script from the command prompt.
Any advice?
Yuo must add '&' at the end?
This is very strange... my domoticz installation works out of the box simply using

script://izsynth test message

from you domoticz directory, can you paste the output of:

Code: Select all

ls -al scripts/izsynth 

Code: Select all

osmc@osmcsoverom:~/domoticz$ ls -al scripts/izsynth
-rwxrwxrwx 1 osmc osmc 41084 Apr 28 19:03 scripts/izsynth
Domoticz is also running under the user "osmc"

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 23:11
by micbou

Code: Select all

root@raspberrypi:/home/pi/domoticz# ls -al scripts/izsynth
-rwxrwxr-x 1 pi pi 50041 May  3 14:05 scripts/izsynth

Re: izSynth: make domoticz talk with many TTS engines in a easy way

Posted: Tuesday 03 May 2016 23:50
by jin
toreandre wrote:

Code: Select all

osmc@osmcsoverom:~/domoticz$ ls -al scripts/izsynth
-rwxrwxrwx 1 osmc osmc 41084 Apr 28 19:03 scripts/izsynth
Domoticz is also running under the user "osmc"
mmmm.... your config is right...

I tested creating a "Virtual Button" of type "Selector Switch" and adding the following example:
domoticz02.png
domoticz02.png (38.28 KiB) Viewed 4393 times
and the logs show this:

Code: Select all

2016-05-03 23:30:43.958 User: Admin initiated a switch command
2016-05-03 23:30:43.959 (Dummy) Light/Switch (Selector)
2016-05-03 23:30:44.348 Executing script: /home/pi/domoticz/scripts/izsynth
2016-05-03 23:30:47.443 User: Admin initiated a switch command
2016-05-03 23:30:47.444 (Dummy) Light/Switch (Selector)
2016-05-03 23:30:47.833 Executing script: /home/pi/domoticz/scripts/izsynth
2016-05-03 23:30:50.828 User: Admin initiated a switch command
2016-05-03 23:30:50.830 (Dummy) Light/Switch (Selector)
2016-05-03 23:30:51.326 Executing script: /home/pi/domoticz/scripts/izsynth
2016-05-03 23:30:54.643 User: Admin initiated a switch command
2016-05-03 23:30:54.645 (Dummy) Light/Switch (Selector)
2016-05-03 23:30:55.569 Executing script: /home/pi/domoticz/scripts/izsynth
But the script works perfectly and I can hear the voice when I activate the button...

can you try putting the full path of the script? like:

Code: Select all

script:///home/osmc/domoticz/scripts/izsynth test