Output Formats
Supported audio output formats and their use cases.
Available Formats
| Format | Extension | MIME Type | Compression | Best For |
|---|---|---|---|---|
| MP3 | .mp3 | audio/mpeg | Lossy | Web, streaming, general use |
| WAV | .wav | audio/wav | None | Editing, highest quality |
| OGG | .ogg | audio/ogg | Lossy | Web, open source projects |
| FLAC | .flac | audio/flac | Lossless | Archival, high-fidelity |
| AAC | .aac | audio/aac | Lossy | Apple devices, mobile |
Format Details
MP3 (Default)
The most widely compatible format. Good balance of quality and file size.
- Bitrate: 128-320 kbps
- Pros: Universal support, small files
- Cons: Lossy compression
- Use for: Web playback, podcasts, general distribution
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": "your_api_key"},
json={
"text": "Hello, world!",
"voice": "Peter",
"output_format": "mp3" # Default
}
)
with open("output.mp3", "wb") as f:
f.write(response.content)
WAV
Uncompressed audio for maximum quality and editing flexibility.
- Bitrate: ~1,400 kbps (16-bit, 44.1kHz)
- Pros: No quality loss, easy to edit
- Cons: Large file size
- Use for: Video production, audio editing, professional work
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": "your_api_key"},
json={
"text": "High quality audio for editing.",
"voice": "Peter",
"output_format": "wav",
"sample_rate": 44100 # CD quality
}
)
with open("output.wav", "wb") as f:
f.write(response.content)
OGG (Vorbis)
Open source format with good compression.
- Bitrate: Variable, typically 96-320 kbps
- Pros: Open source, good quality at low bitrates
- Cons: Less universal support than MP3
- Use for: Web applications, games, open source projects
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": "your_api_key"},
json={
"text": "Open source audio format.",
"voice": "Peter",
"output_format": "ogg"
}
)
with open("output.ogg", "wb") as f:
f.write(response.content)
FLAC
Lossless compression - original quality with smaller file size than WAV.
- Compression: ~50-60% of original WAV
- Pros: No quality loss, smaller than WAV
- Cons: Larger than lossy formats, less universal
- Use for: Archival, audiophile applications
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": "your_api_key"},
json={
"text": "Lossless audio for archival.",
"voice": "Peter",
"output_format": "flac"
}
)
with open("output.flac", "wb") as f:
f.write(response.content)
AAC
Advanced Audio Coding - efficient compression, great for mobile.
- Bitrate: 96-256 kbps
- Pros: Better quality than MP3 at same bitrate
- Cons: Requires licensing for encoding
- Use for: iOS apps, Apple ecosystem, mobile streaming
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": "your_api_key"},
json={
"text": "Optimized for Apple devices.",
"voice": "Peter",
"output_format": "aac"
}
)
with open("output.aac", "wb") as f:
f.write(response.content)
Sample Rates
| Sample Rate | Quality | File Size | Use Case |
|---|---|---|---|
| 8000 Hz | Telephone | Smallest | IVR, phone systems |
| 16000 Hz | Wideband | Small | Voice assistants, chatbots |
| 22050 Hz | FM Radio | Medium | Podcasts, streaming |
| 24000 Hz | High Quality | Medium | Default, general use |
| 44100 Hz | CD Quality | Large | Music, professional |
| 48000 Hz | Studio | Largest | Video production, broadcast |
Choosing the Right Format
| Use Case | Format | Sample Rate |
|---|---|---|
| Web Application | MP3 | 24000 |
| Mobile App (iOS) | AAC | 24000 |
| Mobile App (Android) | MP3 or OGG | 24000 |
| Video Production | WAV | 48000 |
| Podcast | MP3 | 44100 |
| Audiobook | MP3 or FLAC | 44100 |
| IVR System | WAV or MP3 | 8000 |
| Game Audio | OGG | 22050 |