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.

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.
| Service | Default | Alternatives | Playable as saved |
|---|---|---|---|
| MAI-Voice-2.1-Flash via OpenRouter | pcm | mp3 | No for pcm, needs a header |
| Sume TTS Router | mp3, 44.1 kHz, 128 kbps | wav, raw; 8 to 48 kHz; pcm_s16le, pcm_f32le, pcm_mulaw, pcm_alaw | Yes |
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
- MAI-Voice 24 kHz 160 kbps mp3 header vs Sume output_format settings
Microsoft's REST example asks for audio-24khz-160kbitrate-mono-mp3. Sume has no 160 kbps option: mp3 bit rates are 32, 64, 96, 128 or 192 kbps at up to 48 kHz.
- MAI voice ids end in a model name; Sume voice ids do not
A MAI id like en-US-Harper:MAI-Voice-2.1-Flash is not a Sume voice id. Sume takes a UUID or voi_ plus 32 hex and returns 400 invalid_voice_id for anything else.
- Make a Talking Photo Speak Spanish: TTS Language, Then Fabric
Two steps on Sume: generate Spanish speech with the language set, then animate a still with Fabric. Costs for a 30-second clip and what Avatar Video can't do.
- Map a bulk queue item index back to a SKU: keep your own ledger
Queue items return index, status and run_id, not your SKU. Save a SKU-by-index table at submit time and join it to the queue receipt when you poll.
Written by Sume