-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tts): use
bitbots_tts
consistently (#529)
- Loading branch information
Showing
6 changed files
with
66 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -eEuo pipefail | ||
|
||
ROBOT_NAME="${ROBOT_NAME:-}" | ||
|
||
# Mapping robot name to voice and speed | ||
case "$ROBOT_NAME" in | ||
"jack"|"rory") | ||
voice="en_UK/apope_low" | ||
speed=1.0 | ||
;; | ||
"amy"|"donna"|"melody"|"rose") | ||
voice="en_US/vctk_low" | ||
speed=1.7 | ||
;; | ||
*) | ||
echo "Unknown robot: '$ROBOT_NAME', using default female voice" | ||
voice="en_US/vctk_low" | ||
speed=1.7 | ||
;; | ||
esac | ||
|
||
text="$1" | ||
if [ -z "$text" ]; then | ||
echo "No text provided!" | ||
exit 1 | ||
fi | ||
|
||
# Generate the speech with mimic and play it with alsa | ||
mimic3 --remote --voice "$voice" --length-scale "$speed" "$text" | aplay -q - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
from socket import gethostname | ||
|
||
from bitbots_tts.tts import say | ||
from netifaces import AF_INET, ifaddresses, interfaces | ||
|
||
ip_address = "not set" | ||
|
||
wifi_interface = next(filter(lambda i: i.startswith("wlp"), interfaces()), None) | ||
if wifi_interface and AF_INET in ifaddresses(wifi_interface): | ||
ip_address = ifaddresses(wifi_interface)[AF_INET][0]["addr"] | ||
|
||
ip = " dot ".join(ip_address.split(".")) | ||
|
||
robot_name = os.getenv("ROBOT_NAME") or gethostname() | ||
msg = f"Startup complete: {robot_name}. My wifi IP is {ip}." | ||
say(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.