I don’t use my Pi frequently, but when I use it, mostly I use it through SSH. Whenever I wanted to use through SSH, I find the Pi’s new IP address either using my router connected devices page or netsh related commands. I don’t want to lock the IP address for Pi.
In AIY Voice kit, Google has provided a sample program using their aiy.voice.tts API. It uses Pico TTS pico2wave command. Code here shows the API definition and how they are using pico2wave. Example here shows how to use the API using Python. I have used this method earlier, created a simple Python program using only the IP address command and called the python script upon reboot with 30 seconds sleep in crontab file. It is working fine.
In my new RPi, I wanted to test the latest Raspbian OS but I want to try a different method for saying the IP address without voice hat through a simple speaker connected to headphone jack. So, explored the options. Came across this article of comparing available TTS. OpenHAB has good details as well in their website for TTS (here). Went with the simple espeak TTS. New OS is using pulseaudio and I couldn’t figure out a way to make mplayer / ffplay / cvlc / aplay work (omxplayer worked). Finally purged pulseaudio and went with alsa. After that, sound has started coming in the tiny speaker connected to audio jack using aplay.
Created a simple bash script with 2 lines and invoked in crontab @reboot sleep 30 && sh /…./filename.sh. Called espeak as an execute command otherwise aplay was throwing some error and didn’t spend time to resolve it.
ipaddress=$(hostname -I | cut -d’ ‘ -f1)
#echo $ipaddress
speak=$(espeak -ven+f2 -k5 -s150 -a 200 -g10 $ipaddress –stdout | aplay)
Now, after system reboot, when this script runs, it speaks the IP address through the tiny speaker. Big relief 🙂
References:
- https://www.raspberrypi.org/products/raspberry-pi-4-model-b/
- https://aiyprojects.withgoogle.com/voice/ (v2)
- TTS Text To Speech
- https://github.com/espeak-ng/espeak-ng/
- https://kalliope-project.github.io/kalliope/settings/tts/pico2wave/
- https://pypi.org/project/ttspico/
- OpenHAB – open Home Automation Bus, open source project for home automation
- https://circuitdigest.com/microcontroller-projects/best-text-to-speech-tts-converter-for-raspberry-pi-espeak-festival-google-tts-pico-and-pyttsx3
- https://www.openhab.org/addons/voice/googletts/
- https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/src/examples/voice/assistant_library_with_local_commands_demo.py
- https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/src/aiy/voice/tts.py
- https://nerdvittles.com/?p=16463