# Voice input

With voice input on, the web app's message box gets a microphone button: speak, and the text appears in the
box to edit before sending. emma has no speech recognition of its own; it relays the recording to a
speech-to-text API you choose.

## Turn it on

Add an `[stt]` section to the server's `~/.emma/config.toml` and restart `emma serve`:

```toml
[stt]
base_url = "https://api.openai.com/v1"
model = "whisper-1"
api_key = "sk-..."
```

Any OpenAI-compatible transcription API works (`POST <base_url>/audio/transcriptions`):

| Service | `base_url` | `model` |
|---|---|---|
| OpenAI | `https://api.openai.com/v1` | `whisper-1`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe` |
| Groq | `https://api.groq.com/openai/v1` | `whisper-large-v3-turbo` |
| Your own server (e.g. a Whisper server with an OpenAI-compatible API) | `http://<host>:<port>/v1` | what that server expects |

The same settings can come from the environment (`EMMA_STT_BASE_URL`, `EMMA_STT_MODEL`, `EMMA_STT_API_KEY`)
or options (`emma serve --stt-base-url … --stt-model …`). The API key is read only from the file or
`EMMA_STT_API_KEY`, never from an option.

## Requirements

- **HTTPS.** Browsers give the microphone only to pages opened over HTTPS (or `localhost`), so over plain
  HTTP the button stays hidden. See [Server setup](server.md#address-and-https).
- **The address is needed.** With `[stt]` present but no `base_url`, `emma serve` stops with an error instead of
  quietly hiding the button. Leave out the whole section to keep voice input off.

## How it works

- The browser sends the recording to your emma server, which forwards it to the API with the key. The key
  never reaches browsers.
- Recordings go to the API one at a time, in order; the web app shows where yours is in the line. A recording
  can be up to 25 MB.
- The names of the room's members go along as hints, so `@names` come out right.
- The audio and those names go to the API you configured, under that service's terms.

## Engine

`engine` is `openai` by default and covers every service above. `engine = "dudley"` is for a dudley server,
which adds learning from your corrections and a review screen (linked from the web app's Settings → General).
