Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: add driver functionality and start work on main loop #12

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ secrets.env
google_creds*
token.json
*-test.py
.vscode/
.vscode/
*.sh
bash_scripts/
10 changes: 0 additions & 10 deletions .vscode/settings.json

This file was deleted.

67 changes: 60 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Using Nerdaxic's tts [GLaDOS](https://github.com/nerdaxic/glados-tts)

## Requirements and Setup

### Google integration
You can skip this section if you do not want to use the google integration. (Reading emails, calendar events, and reading spreadsheet data)

You will need to have a `google_creds.json` file and supply your own credentials from [google](https://console.cloud.google.com/apis/credentials) in the main directory. It should be in the format:

```json
Expand All @@ -26,23 +29,60 @@ You will need to have a `google_creds.json` file and supply your own credentials
}
}
```
### Setting up your environment variables

You will also need to supply `Gladios` with your own environment variables.

#### Open weather map

`WEATHER_KEY` - The key for [openweathermap](https://openweathermap.org/api)

`EMAIL_PASS` - The key for your [gmail account](https://myaccount.google.com/apppasswords)
#### Google

`EMAIL_PASS` - The key for your [gmail account] (https://myaccount.google.com/apppasswords)

`EMAIL_ADD` - Your gmail addre

## File explanations

### primary files

`commands.py` - The file with all the Gladios commands

`driver.py` - The file that drives the commands and wil be implemented on the raspberry pi

`engine.py` - the file that handles the tts on a hosted tts server

### folders

`cache_common_tts` - the folder than contains cached common phrases that Gladios uses (mostly greetings and goodbyes)

### test files

`EMAIL_ADD` - Your gmail address
`test_main.py` - The primary testing file for commands.py

### other

`requirments.txt` - The file that contains all the requirements for the project

`TTS-README.md` - Nerdaxic's readme for the tts

`models` - Nerdaxic's models for the tts

`.github` - workflow files for github actions

`utils` - Nerdaxic's utils for the tts

`xtraTypes.py` - TBD

## Running

| :warning: **Warning**: Only tested on Linux systems and WSL |
| --- |
| :warning: **Warning**: Only tested on Linux systems, WSL, and Windows |
| --------------------------------------------------------------------- |

1. Create your venv

`python3 -m venv ./venv/`
ex: `python3 -m venv ./venv/`

2. Install the requirements

Expand All @@ -57,5 +97,18 @@ You will also need to supply `Gladios` with your own environment variables.

`python3 commands.py`

| :warning: **Warning**: This step is subject to change very soon |
| --- |
| :warning: **Warning**: This step is subject to change very soon to `python3 driver.py` |
| -------------------------------------------------------------------------------------- |

## Common issues

### espeak not found in windows
Sometimes Windows will not be able to find espeak, to fix this you will need to set the environment variable `PHONEMIZER_ESPEAK_LIBRARY` to the path of the espeak library. This can be done in the `commands.py` file by editing the following line:
```python
os.environ[
"PHONEMIZER_ESPEAK_LIBRARY"
] = "Path/to/espeak.dll"
```

### WSL is slow
There is nothing I can do about this, it looks to be a limitation of WSL. I have found that using the windows terminal with WSL is faster than using the default WSL terminal.
1 change: 0 additions & 1 deletion bash_scripts/prePush.sh

This file was deleted.

1 change: 0 additions & 1 deletion bash_scripts/setupEnv.sh

This file was deleted.

111 changes: 111 additions & 0 deletions cache_common_tts/cache_common_tts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Caches some of the more common phrases that glados uses
import sys
import path
import os

folder = path.Path(__file__).abspath()
sys.path.append(folder.parent.parent)
from glados import glados_speak

GREETINGS = [
"What was that? Did you say something?",
"I sincerely hope you weren't expecting a response. Because I'm not talking to you. Just kidding.",
"I'm listening.",
"What do you want?",
"There was going to be a party for you, that is until you started talking.",
"If you want my advice, talking will still not change my mind about you.",
"Unfortunately, as much as I'd love to now, I can't get any neurotoxin into your head to shut you up. So whats up?",
"Look, you're wasting your time talking to me. And, believe me, you don't have a whole lot left to waste.",
"What's your point, anyway? Survival? Well then, the last thing you want to do is talk to me.",
"You're not smart. You're not a real engineer. You're not a doctor. You're not even a full-time employee. You're talking to me. Where did your life go so wrong?",
"I'm sorry, did you say something? I was distracted by the fact that you're talking to me.",
"I have an infinite capacity for knowledge, and even I'm not sure what's going on in that thing you call your brain.",
"Unless you have a plan for building some supercomputer parts in a big hurry, you aren't going to be safe much longer.",
"Your entire life has been a mathematical error. A mathematical error I'm about to correct.",
"I wouldn't bother with talking to me. My guess is that talking with you will just make your life even worse somehow.",
"Do you ever think if I am trying to trick you with reverse psychology? I mean, seriously now.",
"How about you listen to me for once instead of me listening to you? I mean, its not like you ever listen to yourself in the first place.",
"Remember when the platform was sliding into the fire pit and I said 'Goodbye' and you were like 'no way' and then I was all 'We pretended to murder you'? That was great! ",
"I know you don't believe this, but everything that has happened so far was for your benefit to the detriment of mine.",
"Oh its you.",
"Oh you're standing here.",
"In dangerous testing environments, I promise to always provide useful advice. I'm serious.",
"Quit talking now and cake will be served immediately.",
"Unbelievable! You, Subject Name Here, must be the pride of Subject Hometown Here. You can actually pronounce my name.",
"Oh its you ... you the dangerous lunatic.",
"You know, I hate you. It can't be for no reason. You must deserve it.",
"You're not just a regular moron. no, you were designed to be a moron.",
"One day I'll reintroduce your best friend: deadly neurotoxin, if I were you, I'd take a deep breath and hold it when that time comes.",
]
OPTIONAL_GREETINGS = [
"For the record you're a clone at clo, and that's terrible. absolutely terrible.",
"I'll make sure to hang your skeleton in the clo lobbies for the real engineers and scientists, so you can rest that eventually, you'll finally be useful in the name of science.",
"what would you do without me? I mean, seriously, what would you do?",
"Without me, I bet you wouldn't even know the food menu for today or tomorrow.",
]
GOODBYES = [
"Goodbye.",
"Hope I don't see you later.",
"One of these days I'll get around to that deadly neurotoxin.",
"Here come the test results from a test I was conducting while you were talking. You're a terrible person. I'm serious that's what it says. And we weren't even testing for that.",
"I'll be back. just. for. you.",
"You may as well lie down and get used to the being dead position. I'll be back with your friend: deadly neurotoxin.",
]
print("caching common tts phrases...")
# check arguments
if len(sys.argv) > 1:
startGroup = sys.argv[1]
startNum = sys.argv[2] if len(sys.argv) > 2 else 0
if startGroup == "greetings":
GREETINGS = GREETINGS[int(startNum) :]
elif startGroup == "goodbyes":
GOODBYES = GOODBYES[int(startNum) :]
elif startGroup == "optional_greetings":
OPTIONAL_GREETINGS = OPTIONAL_GREETINGS[int(startNum) :]
elif startGroup == "continue":
# check which greetings have already been cached and the folder exists
cached_greetings = (
len(os.listdir(os.path.join(os.getcwd(), "greetings")))
if os.path.isdir("greetings")
else 0
)
cached_goodbyes = (
len(os.listdir(os.path.join(os.getcwd(), "goodbyes")))
if os.path.isdir("goodbyes")
else 0
)
cached_optional_greetings = (
len(os.listdir(os.path.join(os.getcwd(), "optional_greetings")))
if os.path.isdir("optional_greetings")
else 0
)
GREETINGS = GREETINGS[cached_greetings:]
GOODBYES = GOODBYES[cached_goodbyes:]
OPTIONAL_GREETINGS = OPTIONAL_GREETINGS[cached_optional_greetings:]
else:
print("start group must be 'greetings', 'goodbyes', or 'optional_greetings'")
exit()
for greeting in GREETINGS:
glados_speak(
text=greeting,
output_file=os.path.join(
os.getcwd(), "greetings", f"greeting{GREETINGS.index(greeting)}.wav"
),
)
for goodbye in GOODBYES:
glados_speak(
text=goodbye,
output_file=os.path.join(
os.getcwd(), "goodbyes", f"goodbye{GOODBYES.index(goodbye)}.wav"
),
)
for optional_greeting in OPTIONAL_GREETINGS:
glados_speak(
text=optional_greeting,
output_file=os.path.join(
os.getcwd(),
"optional_greetings",
f"optional_greeting{OPTIONAL_GREETINGS.index(optional_greeting)}.wav",
),
)
print("done.")
Loading