Oh, just realsized that post was you, I hesitated to do it as its a bit dirty, I was thinking someone might get a better way, hahaha, hopefully the future version will fix this issue.
I have tried Pico using this guide but the sound is too muffled or too much bass. Google TTS sounds much clearer and natural. But honestly I prefer something that works offline and independent from a 3rd party provider. Unfortunately, Google TTS is the best option for me right now. Do you have any other suggestion for offline TTS that is comparable to Google?
sudo su
cd /
wget http://incrediblepbx.com/picotts-raspi.tar.gz
tar zxvf picotts-raspi.tar.gz
rm -f picotts-raspi.tar.gz
cd /root
./picotts-install.sh
Testing PicoTTS
pico2wave --wave sample.wav -l en-US "Here is a sample, using the PICO text to speech engine."
aplay sample.wav
Below is the Shell script will take the “Text” as argument to speech conversion
Shell Command File: TTS_Play.sh
#!/bin/bash
pico2wave -w /tmp/omx.wav "$1"
#below line just to play chime sound to gather attention
aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/chime.wav
aplay -Dplughw:CARD=ALSA,DEV=0 /tmp/omx.wav
HA Configuration yaml:
input_boolean:
motion_livingroom_override:
initial: on
shell_command:
ttsplay: '/home/homeassistant/.homeassistant/TTS_Play.sh "Hareesh, You have a visitor!"'
automation 2:
- alias: Alert Motion
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_3_1
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.motion_livingroom_override
state: 'on'
action:
- service: notify.myhtml5
data:
message: 'Motion Deteted at Main Gate!!'
title: 'Home Assistant Alert'
- service: shell_command.ttsplay
We can configure the shell_command section with what ever text we need to send to the TTS engine.
It says…pico tts (at least on debian systems) can use just german, english, french
, italian and spanish. Maybe you could try to look at the sources of the software to see if there’s a way to add new voices, but I think it would not be an easy task…
I have your example working when I run it as the “pi” user. However when I run it as the “hass” user I get the following error: “X11 connection rejected because of wrong authentication.” looks like I need to grant some permissions to hass. Any suggestions on how I might do this?
I have 36.1 All in One Installer. I have applied the permissions above. When I call the google_say service as posted at the top of this page, the file is recorded and saved but no sound comes out of my attached speakers (3.5mm jack). I have applied permissions for audio as described in this post.
I can play sound via command line with either aplay, omxplayer or vlc.
I am getting a play_media not implemented error. I also receive this error if I use picotts_say. I am not sure what else to do here
17-01-28 13:36:13 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1054, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/media_player/init.py”, line 364, in async_service_handler
yield from getattr(player, method[‘method’])(**params)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/media_player/init.py”, line 644, in play_media
raise NotImplementedError()
NotImplementedError