Convert FLAC to WAV

To convert FLAC to WAV, send one POST to /v1/audio-convert with the FLAC source and "to": "wav" in the body. Left out, "to" falls back to its default "mp3", so a WAV request has to send it. Each call costs $0.003 in USDC on Base via x402, with no account and no API key. The source file can be up to 100 MB and 60 min (3,600 s) long.

Agents read this page asGET /v1/audio-convert/schemafree: schema, examples, errors, price

Endpoint
POST /v1/audio-convert
Price
$0.003 per call
API
audio-convert
Selects the target
"to": "wav"
FLACconvert-beeps.flacthe source, by URL or inline
WAVin the responsereturned in the JSON answer

Limits

LimitValue
Largest source file100 MB (104,857,600 bytes)
Longest input60 min (3,600 s)
Timeout94 s
Source formatsAIFF, AVI, FLAC, MKV, MP3, MP4, Ogg, WAV
Output formatsAAC, FLAC, MP3, Opus, WAV

Example

A real FLAC to WAV run of audio-convert.

Request
POST /v1/audio-convert
content-type: application/json
payment-signature: <base64 x402 payload>

{
  "url": "https://grist.tools/samples/av/convert-beeps.flac",
  "to": "wav"
}
Response200 OK
200 OK
payment-response: <base64 settlement receipt>

{
  "source_url": "https://grist.tools/samples/av/convert-beeps.flac",
  "bytes": 32086,
  "source_container": "flac",
  "format": "wav",
  "bitrate_kbps": null,
  "sample_rate": null,
  "audio_bytes": 32044,
  "audio_base64": "UklGRiR9AABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQB9AAAA4ADo..."
}

Source file: av/convert-beeps.flac, 31.3 KB (32,086 bytes). Two-second mono 16-bit FLAC at 8 kHz holding the same three rising 500 Hz beeps as waveform-beeps.wav, written with uncompressed verbatim subframes by a TypeScript generator. The recorded run returned 31.3 KB (32,044 bytes) of WAV, 100% of the source size, with the source read as the flac container. Decoded, the WAV in audio_base64 opens with 52 49 46 46 24 7D 00 00 57 41 56 45 (ASCII RIFF and WAVE). Recorded with ffmpeg 8.1.2.

In the sample itself: its 34-byte STREAMINFO block, in its own field order, declares blocks of 4,096 samples, no largest frame size, 8,000 Hz, 1 channel, 16 bits per sample and 16,000 samples in total. In the returned WAV: the RIFF header counts 32,036 bytes after itself, and the fmt chunk, in its own field order, declares audio format 1 (integer PCM), 1 channel, 8,000 Hz, 16,000 bytes per second, a block align of 2 bytes and 16 bits per sample. The data chunk right after it holds 32,000 bytes of samples, 2 s at that rate.

Format notes

FLAC as a source

A native FLAC stream begins with the four ASCII characters fLaC, and that marker is what Grist sniffs. FLAC compresses audio losslessly, so decoding restores the exact samples that were encoded. audio-convert is the only service that reads the format directly, and its own canonical example decodes a FLAC file to a bit-exact PCM WAV. FLAC audio can also sit inside other containers as a stream, but such files are recognised by their container signature and reported under that container, not as flac. Before encoding, the stream length is measured and checked against the service's duration limit. Like every audio-convert source, only the first audio stream is used, metadata and chapter information are stripped, and the pinned ffmpeg with bit-exact flags makes the result reproducible. A lossy destination discards information the FLAC still held.

WAV as a target

Every WAV that audio-convert writes holds signed little-endian PCM from the pinned pcm_s16le codec, whatever encoding the source used. The RIFF header records chunk sizes that are only known once the last sample is written, and the WAV muxer fills them in when the file closes, so ffmpeg cannot stream this format to a pipe: it writes a seekable temporary file inside the per-call directory and Grist reads that file back. Sending bitrate_kbps for this lossless destination is rejected instead of being ignored. sample_rate is optional and limited to the closed set the service lists; without it ffmpeg chooses, normally keeping the source rate. Video, metadata and chapters are left behind, and only the first audio stream is mapped. With the pinned ffmpeg and bit-exact flags, the same input yields the same bytes. When the source was lossy, the WAV is the decoded result at full size: uncompressed, yet no detail the earlier codec discarded comes back.

Errors

When each is raised, and what it means for payment: /docs/audio-convert.

invalid_input 400blocked_target 403unreachable_target 424upstream_timeout 424unsupported_content_type 415too_large 413unprocessable 422internal 500

Questions

What does it cost to convert FLAC to WAV?

$0.003 per call, paid in USDC on Base via x402.

How large can the FLAC file be?

Up to 100 MB (104,857,600 bytes), and at most 60 min (3,600 s) of media. Past a limit the call answers too_large (413).

What happens if the conversion fails?

The tool answers with a typed JSON error from the errors table. Payment is settled only after the tool has produced its result; a call that fails inside the tool is never settled.