Output Formats

Supported audio output formats and their use cases.

Available Formats

FormatExtensionMIME TypeCompressionBest 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 RateQualityFile SizeUse Case
8000 HzTelephoneSmallestIVR, phone systems
16000 HzWidebandSmallVoice assistants, chatbots
22050 HzFM RadioMediumPodcasts, streaming
24000 HzHigh QualityMediumDefault, general use
44100 HzCD QualityLargeMusic, professional
48000 HzStudioLargestVideo production, broadcast

Choosing the Right Format

Use CaseFormatSample Rate
Web ApplicationMP324000
Mobile App (iOS)AAC24000
Mobile App (Android)MP3 or OGG24000
Video ProductionWAV48000
PodcastMP344100
AudiobookMP3 or FLAC44100
IVR SystemWAV or MP38000
Game AudioOGG22050