# Audio enhancer

Last updated: 2026-11-19

**The problem.** A phone line that hisses, a headset that hums, a cheap microphone: the noise around the voice
makes words harder to hear, for a person and for the model. The audio enhancer reduces that noise before the audio
is transcribed.

**Where it works.** Live sessions, on platforms whose operator turned it on (it is off on Gladia's managed clusters
today). It is Gladia's own option, `pre_processing.audio_enhancer`: the same body works on Gladia's cloud API.
Pre-recorded jobs do not take it (see [Limits and gotchas](#limits-and-gotchas)).

## At a glance

| | |
|---|---|
| Live API | `pre_processing.audio_enhancer` |
| Pre-recorded (batch) | Live only |
| Live models | `solaria-3`, `trantoria-1` (every live model) |
| Languages | Every language of the model ([supported languages](/languages/supported-languages/)) |

## Step by step

### 1. Check that your platform runs it

`GET /v2/live/capabilities` lists, per model, the add-ons a session may ask for with your key right now. The audio
enhancer is there as `audio_enhancer` when the model's hosts run it:

```bash
curl https://eu1.api.gladia.io/v2/live/capabilities \
  -H "x-gladia-key: $GLADIA_API_KEY"
```

### 2. Turn it on

```json
{
  "encoding": "wav/pcm",
  "sample_rate": 16000,
  "bit_depth": 16,
  "channels": 1,
  "model": "solaria-3",
  "pre_processing": { "audio_enhancer": true }
}
```

In a session, with the SDKs or over HTTP. Each program streams a 16-bit WAV file with the enhancer on and prints the
final transcripts. Put your API key in the `GLADIA_API_KEY` environment variable, then run
`python audio_enhancer.py call.wav`.

**Python SDK**

```python title="audio_enhancer.py"
# pip install -U "gladiaio-sdk>=2.2"
import os
import sys
import threading
import wave

from gladiaio_sdk import GladiaClient

API_URL = os.environ.get("GLADIA_API_URL", "https://eu1.api.gladia.io")
API_KEY = os.environ["GLADIA_API_KEY"]

with wave.open(sys.argv[1]) as wav:  # a 16-bit PCM WAV file
    rate, channels = wav.getframerate(), wav.getnchannels()
    audio = wav.readframes(wav.getnframes())

config = {
    "encoding": "wav/pcm",
    "sample_rate": rate,
    "bit_depth": 16,
    "channels": channels,
    "model": "solaria-3",
    "language_config": {"languages": ["en"]},
    "pre_processing": {"audio_enhancer": True},
}

client = GladiaClient(api_key=API_KEY, api_url=API_URL)
# a dict is sent as is: the Gladia Enterprise options included
session = client.live_v2().start_session(config)
ended, errors = threading.Event(), []

@session.on("message")
def on_message(message):
    if message.type == "transcript" and message.data.is_final:
        print(message.data.utterance.text)

session.on("error", errors.append)
session.once("ended", lambda _: ended.set())

# Stream once the socket is open: a stop sent while it opens can pass the audio queued until then.
connected = threading.Event()
session.once("connected", lambda _: connected.set())
session.once("ended", lambda _: connected.set())  # a session that never connects ends
session.on("error", lambda _: connected.set())
if session.status == "connected":  # it opened before the listener above
    connected.set()
if not connected.wait(timeout=30) or errors or ended.is_set():
    sys.exit(1)  # no open session to stream to

step = rate * channels * 2 // 10  # 100 ms of audio per chunk
for start in range(0, len(audio), step):
    session.send_audio(audio[start : start + step])  # live audio: send each chunk as it is captured
session.stop_recording()

ended.wait(timeout=60)
sys.exit(1 if errors or not ended.is_set() else 0)
```

**JavaScript SDK**

```js title="audio_enhancer.mjs"
// npm install @gladiaio/sdk
import { readFileSync } from "node:fs";
import { GladiaClient } from "@gladiaio/sdk";

const { sampleRate, channels, pcm } = readWav(process.argv[2]); // a 16-bit PCM WAV file

const config = {
  encoding: "wav/pcm",
  sample_rate: sampleRate,
  bit_depth: 16,
  channels,
  model: "solaria-3",
  language_config: { languages: ["en"] },
  pre_processing: { audio_enhancer: true },
};

const client = new GladiaClient({
  apiKey: process.env.GLADIA_API_KEY,
  apiUrl: process.env.GLADIA_API_URL ?? "https://eu1.api.gladia.io",
});
const session = client.liveV2().startSession(config);

session.on("message", (message) => {
  if (message.type === "transcript" && message.data.is_final) console.log(message.data.utterance.text);
});
session.on("error", (error) => {
  console.error(error);
  process.exitCode = 1;
});
session.once("ended", () => process.exit());

const step = (sampleRate * channels * 2) / 10; // 100 ms of audio per chunk
for (let start = 0; start < pcm.length; start += step) {
  session.sendAudio(pcm.subarray(start, start + step)); // live audio: send each chunk as it is captured
}
session.stopRecording();

function readWav(path) {
  const file = readFileSync(path);
  let fmt, pcm;
  for (let pos = 12; pos < file.length; ) {
    const id = file.toString("ascii", pos, pos + 4);
    const size = file.readUInt32LE(pos + 4);
    if (id === "fmt ") fmt = { channels: file.readUInt16LE(pos + 10), sampleRate: file.readUInt32LE(pos + 12) };
    if (id === "data") pcm = file.subarray(pos + 8, pos + 8 + size);
    pos += 8 + size + (size % 2);
  }
  return { ...fmt, pcm };
}
```

**HTTP**

Create the session, then stream its audio to the returned `url` ([Live WebSocket](/api-reference/v2/live/websocket/)):

```bash
curl -X POST https://eu1.api.gladia.io/v2/live \
  -H "x-gladia-key: $GLADIA_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "encoding": "wav/pcm",
    "sample_rate": 16000,
    "bit_depth": 16,
    "channels": 1,
    "model": "solaria-3",
    "language_config": {
      "languages": [
        "en"
      ]
    },
    "pre_processing": {
      "audio_enhancer": true
    }
  }'
```

Every channel of the session is cleaned the same way. Only the audio the model hears changes: the messages, the
transcripts and their words have the same shape as without it, their times still those of the audio you sent.

### 3. Where your platform does not run it

The option is ignored and the session runs without it, as on Gladia's cloud API: `POST /v2/live` answers `201`
and the audio is transcribed as sent. Ask your operator to turn it on if you need it.

## Limits and gotchas

- **It can make things worse.** It helps close-talk audio with line noise, hiss or hum. On distant speech (a
  meeting room microphone, a speakerphone) it can remove parts of the voice and raise the error rate. Compare a
  few of your own calls with and without it before you turn it on for everyone.
- **About 340 ms more latency.** The enhancer reads a little audio ahead before it passes it on: every partial and
  final comes that much later.
- **Live only.** Gladia's pre-recorded API has no `pre_processing`: `POST /v2/pre-recorded` refuses it with a `400`
  (`pre_processing property should not exist`), as it refuses any field it does not know.
- **Off by default.** Omitted, or `false`: the audio is transcribed as sent, and the option is never refused.

## Troubleshooting

| symptom | cause | fix |
|---|---|---|
| no noise reduction heard | no host of your platform runs it: the option is ignored | ask your operator to turn it on |
| more errors than without it | distant or quiet speech | turn it off for those calls |
| finals later than usual | the enhancer's 340 ms | expected; turn it off where latency matters more than noise |

## Related pages

- [Change settings mid-session](/live/session-config/)
- [Live audio formats and sample rates](/live/audio-formats/)
- [Live transcription callbacks (webhooks)](/live/callbacks/)
