You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.6 KiB
Markdown

# Go Say
You write it, we say it.
## Learning goals
- Use of "os/exec" to both run and manage an external Text to Speech program and to play the output from the host's audio card
- Use of os.Pipe
- Use of https://github.com/spf13/viper and https://github.com/spf13/cobra
- Queue structure for TTS
- Cancel context for os.CommandCtx operations
- Packaging a golang binary into a .deb archive for amd64 and arm64
## Resources
- https://www.dolthub.com/blog/2022-11-28-go-os-exec-patterns/
- https://github.com/spf13/cobra/blob/v1.7.0/user_guide.md#user-guide
- Piper
- Aplay
## CLI API design
- `gosay "will say this text"`: Uses Piper TTS and aplay to read the argument aloud
- arg `-m` || `-model`: use provided model by name or path. Assumed model config resides next to model
- `echo "Will also say this text" | gosay`: Same as above but reading from stdin
- `gosay list models`: Prints a list of available models sourced from piper project. Should print an * for models already present in model directory
- `gosay list models --installed`: Prints a list of models present in the user's `GOSAY_MODELS` directory. Defaults to `${HOME}/.config/gosay/model`
`gosay download model <model name>`: Downloads the piper model and .config file from piper to `GOSAY_MODELS` directroy
`gosay set-default <model name>`: Sets model as default model and persists setting to `${HOME}/.config/gosay/config.json`
`gosay server -port 6543`: Starts an HTTP server on port (default 6543)
`gosay check`: Checks that all dependencies and configuration are setup. If an error occurs a helpful message is printed to the console for the user.