MAI Flash defaults to PCM: wrap it as WAV, vs Sume output formats

OpenRouter lists MAI-Voice-2.1-Flash output as mp3 or pcm, default pcm, which will not play as saved. Wrap it as WAV in Python; Sume defaults to mp3.

4 min readSume
All posts

MAI-Voice-2.1-Flash on OpenRouter outputs mp3 or pcm and defaults to pcm, so a saved response will not play in most players until you add a WAV header. Sume's TTS Router defaults to mp3 and can return a ready-made wav.

The two defaults

The OpenRouter model page for Flash lists mp3 or pcm output with pcm as the default. The page I read does not state the sample rate in the text I used, so check it before you wrap the file. Sume documents the default as mp3 at 44.1 kHz and 128 kbps.

Default audio formats (read 2026-10-05)
ServiceDefaultAlternativesPlayable as saved
MAI-Voice-2.1-Flash via OpenRouterpcmmp3No for pcm, needs a header
Sume TTS Routermp3, 44.1 kHz, 128 kbpswav, raw; 8 to 48 kHz; pcm_s16le, pcm_f32le, pcm_mulaw, pcm_alawYes

Wrap raw PCM as WAV

Python's standard wave module writes the header. Set the rate and sample width to what the service reports; the values here (24 kHz, 16-bit, mono) are placeholders, not Microsoft's documented numbers.

import wave

def pcm_to_wav(pcm_path, wav_path, rate=24000, width=2, channels=1):
    with open(pcm_path, "rb") as f:
        data = f.read()
    with wave.open(wav_path, "wb") as w:
        w.setnchannels(channels)
        w.setsampwidth(width)
        w.setframerate(rate)
        w.writeframes(data)

pcm_to_wav("flash.pcm", "flash.wav")

Ask Sume for wav directly

Set output_format to a container, sample rate and encoding and the job result is a normal wav. Wav files are large; a voiceover that must stay under an upload cap is smaller as mp3.

curl -sS -X POST https://api.sume.com/v1/tts-router/generate \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"sonic-3.6","transcript":"Test line.","avatar_handle":"product_host","language":"en","output_format":{"container":"wav","sample_rate":24000,"encoding":"pcm_s16le"}}' \
  | jq -r '.data.request_id'

Where this stops

I did not call Flash, so the sample rate in the example is an assumption you must replace. If a header is wrong the audio plays fast, slow or as noise.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume