Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbta/watts
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mbta/watts
- Owner: mbta
- License: mit
- Created: 2024-03-04T18:05:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-26T00:49:16.000Z (about 1 month ago)
- Last Synced: 2024-11-26T01:28:52.134Z (about 1 month ago)
- Language: Elixir
- Size: 71.3 KB
- Stars: 1
- Watchers: 10
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Watts
MBTA text-to-speech service
## Prerequisites
* [asdf](https://asdf-vm.com/)
* [direnv](https://direnv.net/)## Development
* Run `asdf install` from the repository root.
* `mix deps.get` to fetch dependencies.
* Copy `.envrc.template` to `.envrc`, then edit `.envrc` and make sure all
required environment variables are set. When finished, run `direnv allow` to
activate them.
* To start the server, run `iex -S mix`.**Note:** There is no automatic code reloading in development. To pick up code
changes while the server is running, use the `recompile` command in IEx.## API
The main API endpoint is `/tts`, which accepts JSON POST requests containing
`voice_id` and `text` fields. An `x-api-key` HTTP header must also be set to
the value specified in the `WATTS_API_KEY` environment variable.Example request, using `curl` and a local development instance of the app:
curl localhost:4000/tts \
--output voice.mp3 \
--header "x-api-key: your_api_key_here" \
--json '{"voice_id": "Matthew", "text": "Your text here."}'Note to synthesize new (uncached) voice lines, the `WATTS_ENABLE_POLLY`
environment variable must be `true`. **This incurs a cost per character of
text**, so avoid large amounts of text or a large number of unique lines.