# Optimize for Voice | AudioDN Examples

> Capture any voice recording, ship a tiny Opus variant, and drop the original so voicemail-scale libraries stay cheap to store and stream.

Source: https://audiodeliverynetwork.com/examples/optimize-for-voice/

---

# Optimize for Voice

Turn answering-machine messages, call recordings, and voice notes into something you can actually scale. Upload whatever the recorder produces, let AudioDN mint a speech-tuned **Opus** file at 32 or 64 kbps, then drop the original so you only keep — and stream — the tiny archive listeners need.

Opus is built for speech and low-bitrate streaming. At 32 kbps mono it often sounds clearer than much larger MP3/AAC encodes of the same voicemail — and your storage curve collapses once you remove the original WAV.

## What you can ship

Use this pattern whenever speech is the product: voicemail, support call archives, IVR prompts, narration, and voice memos. Those sources are usually mono with narrow dynamics — keeping a multi-megabyte WAV (or a music-oriented HQ AAC) forever burns storage and bandwidth for almost no perceptual gain. A dedicated `voice` variant gives every upload a predictable, speech-tuned file you can hand to players, download endpoints, or cold storage.

| Stage | Typical footprint (~45s mono) | Notes |
| --- | --- | --- |
| Source WAV (48 kHz / 16-bit) | ~4 MB | Lossless capture / sample used below |
| Opus `voice` @ 32 kbps mono | ~180 KB | Clear speech; ideal for voicemail & IVR-scale libraries |
| Opus `voice` @ 64 kbps mono | ~360 KB | Extra headroom for noisy lines or thicker accents |

That is roughly a **20×–40×** shrink versus the source WAV before you delete the original. At library scale — thousands of messages — you move from “keep everything forever” to “keep what listeners actually play.”

## 1\. Upload any quality voice recording

Skip client-side crush. Phone apps, Zoom exports, cheap recorders, and studio WAVs can all land in the same collection — AudioDN probes the file and builds variants from the best available source. Prefer the highest quality you have at upload time (WAV / FLAC / AIFF when possible) so the Opus encode starts from a clean signal.

This walkthrough uses a generated answering-machine sample — a classic beep followed by an overbearing mother asking, with maximum comic timing, when the grandchildren are happening. Download the source WAV if you want to run the upload yourself: [answering-machine-message.wav](/examples/answering-machine-message.wav).

Create an upload session

#### Example Request

  

```
# COLLECTION_ID: uuid of the collection to upload into
curl -X POST "https://api.audiodelivery.net/v1/upload_session" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "collection_id": "COLLECTION_ID",
  "expires_in": 7200
}'
```

```
// COLLECTION_ID: uuid of the collection to upload into

const payload = {
  "collection_id": "COLLECTION_ID",
  "expires_in": 7200
};

const response = await fetch('https://api.audiodelivery.net/v1/upload_session', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload)
});

const data = await response.json();
```

```
# COLLECTION_ID: uuid of the collection to upload into

import requests

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}

payload = {
    "collection_id": "COLLECTION_ID",
    "expires_in": 7200
}

response = requests.post(
    "https://api.audiodelivery.net/v1/upload_session",
    headers=headers,
    json=payload,
)
data = response.json()
```

Create a track in the session

#### Example Request

  

```
# SESSION_ID: upload_session_id from the previous call
curl -X POST "https://api.audiodelivery.net/v1/upload/SESSION_ID/track" \
  -H "Content-Type: application/json" \
  -d '{
  "file_name": "answering-machine-message.wav"
}'
```

```
// SESSION_ID: upload_session_id from the previous call

const payload = {
  "file_name": "answering-machine-message.wav"
};

const response = await fetch('https://api.audiodelivery.net/v1/upload/SESSION_ID/track', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload)
});

const data = await response.json();
```

```
# SESSION_ID: upload_session_id from the previous call

import requests

headers = {
    "Content-Type": "application/json",
}

payload = {
    "file_name": "answering-machine-message.wav"
}

response = requests.post(
    "https://api.audiodelivery.net/v1/upload/SESSION_ID/track",
    headers=headers,
    json=payload,
)
data = response.json()
```

Upload the file bytes

PUT track\_upload.upload\_url

```
# PUT the recording bytes to track_upload.upload_url.
# Any supported audio works — start with the highest quality you have (WAV shown here).
curl -X PUT "$UPLOAD_URL" \
  --data-binary @answering-machine-message.wav \
  -H "Content-Type: audio/wav"
```

Poll `GET /v1/track/:track_id` until `track_status_id` is `ready`. Organization-wide variants finish during this pass — including an Original Upload file if that recipe is enabled. Upload session details: [Upload Sessions API](/docs/api/upload-sessions).

## 2\. Transcode to a voice Opus variant

Create a `transcode` variant named `voice` with `codec: “opus”`. For speech, start at **32 kbps mono** — dramatically smaller than music presets, still intelligible on earbuds and handsets. Bump to **64 kbps** when you need more fidelity for noisy sources. Strip tags and cover art; they only waste bytes on voicemail.

Configure the recipe once in the dashboard so every upload gets a `voice` file automatically, or append it to a ready track with the Variants API (below). Only lossy codecs are allowed on this endpoint — Opus is exactly what you want here.

Recommended: 32 kbps mono Opus

#### Example Request

  

```
# TRACK_ID: uuid of the ready track
curl -X POST "https://api.audiodelivery.net/v1/track/TRACK_ID/variant" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "variant_type_id": "transcode",
  "index": "voice",
  "codec": "opus",
  "bitrate": 32,
  "is_stereo": false,
  "is_strip_tags": true,
  "is_strip_cover": true
}'
```

```
// TRACK_ID: uuid of the ready track

const payload = {
  "variant_type_id": "transcode",
  "index": "voice",
  "codec": "opus",
  "bitrate": 32,
  "is_stereo": false,
  "is_strip_tags": true,
  "is_strip_cover": true
};

const response = await fetch('https://api.audiodelivery.net/v1/track/TRACK_ID/variant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload)
});

const data = await response.json();
```

```
# TRACK_ID: uuid of the ready track

import requests

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}

payload = {
    "variant_type_id": "transcode",
    "index": "voice",
    "codec": "opus",
    "bitrate": 32,
    "is_stereo": False,
    "is_strip_tags": True,
    "is_strip_cover": True
}

response = requests.post(
    "https://api.audiodelivery.net/v1/track/TRACK_ID/variant",
    headers=headers,
    json=payload,
)
data = response.json()
```

Optional: 64 kbps if you need more headroom

#### Alternate Request

  

```
# TRACK_ID: uuid of the ready track
curl -X POST "https://api.audiodelivery.net/v1/track/TRACK_ID/variant" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "variant_type_id": "transcode",
  "index": "voice",
  "codec": "opus",
  "bitrate": 64,
  "is_stereo": false,
  "is_strip_tags": true,
  "is_strip_cover": true
}'
```

```
// TRACK_ID: uuid of the ready track

const payload = {
  "variant_type_id": "transcode",
  "index": "voice",
  "codec": "opus",
  "bitrate": 64,
  "is_stereo": false,
  "is_strip_tags": true,
  "is_strip_cover": true
};

const response = await fetch('https://api.audiodelivery.net/v1/track/TRACK_ID/variant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload)
});

const data = await response.json();
```

```
# TRACK_ID: uuid of the ready track

import requests

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}

payload = {
    "variant_type_id": "transcode",
    "index": "voice",
    "codec": "opus",
    "bitrate": 64,
    "is_stereo": False,
    "is_strip_tags": True,
    "is_strip_cover": True
}

response = requests.post(
    "https://api.audiodelivery.net/v1/track/TRACK_ID/variant",
    headers=headers,
    json=payload,
)
data = response.json()
```

#### Index must be unique

The `index` value (`voice`) must not collide with an existing organization or track variant. Pick one bitrate recipe per index — do not POST both 32 and 64 against the same `voice` name.

The track re-enters `processing` while Opus is built, then returns to `ready`. Parameter reference: [Variants API](/docs/api/variants).

## 3\. Drop the original when you are happy

While you are still tuning recipes, keep the Original Upload so you can regenerate variants. Once `voice` sounds right and you no longer need re-processing, delete the original to reclaim the big WAV (or other source) from storage. After that, AudioDN cannot mint new variants for that track — only the remaining files (like `voice`) stay available for playback and download.

In the dashboard, open the track → files / variants, confirm `voice` is ready, then remove the Original Upload. See [Original Upload](/docs/variant-types#original-upload) for the trade-off: originals are insurance; after you are happy with the Opus result, they are mostly expensive nostalgia.

Pattern for voicemail / archival products: upload high quality → wait for `voice` → delete original → deliver only `variants=“voice”` forever.

## 4\. Play only the voice variant

Point the player at the track and request `variants=“voice”` with a Client-Side Player key. Listeners never download the multi-megabyte source — just the Opus file you decided to keep.

#### Dependency

 

```
npm install @audiodn/components
```

```
<script type="module" src="https://unpkg.com/@audiodn/components@latest/dist/player.js"></script>
```

#### Usage

```
<script type="module">
  import '@audiodn/components/player';
</script>

<audiodn-player
  api-key="YOUR_PLAYER_API_KEY"
  scope="track"
  id="9b46405d-edc0-497c-9c36-4c97ceb15337"
  variants="voice"
  size="regular"
></audiodn-player>
```

### Live demo

Playback is the `voice` Opus variant of the answering-machine sample — hear the footprint you get to ship.

Demo voicemail — generated sample for this example (answering-machine beep + message).

More player options: [Player component docs](/docs/components/player).

## Checklist

-   Upload the highest-quality voice source you have (WAV shown; any supported format works).
-   A `voice` transcode exists with `codec: “opus”`, mono, and 32 (or 64) kbps.
    
-   Listen to `variants=“voice”` and confirm speech quality is good enough for your product.
-   Delete the Original Upload when you no longer need to regenerate variants — keep only the cheap Opus archive.

Published July 14, 2026
