Skip to content

v0.5.0

Choose a tag to compare

@sjoenk sjoenk released this 09 Feb 12:00
· 109 commits to main since this release
7d1f21a

WAV Conversion Parameters

convertToWav and convertToWavBytes now accept optional sampleRate, channels, and bitDepth parameters, giving full control over WAV output encoding. When omitted, the source sample rate and channels are preserved with 16-bit depth (existing behavior).

// Convert to mono 44.1kHz 24-bit WAV
final path = await AudioDecoder.convertToWav(
  'input.mp3', 'output.wav',
  sampleRate: 44100,
  channels: 1,
  bitDepth: 24,
);

// Same for in-memory bytes
final wavBytes = await AudioDecoder.convertToWavBytes(
  mp3Bytes,
  formatHint: 'mp3',
  sampleRate: 22050,
  channels: 1,
  bitDepth: 16,
);

Supported values

Parameter Values Default
sampleRate Any valid rate (e.g. 8000, 22050, 44100, 48000) Source sample rate
channels 1 (mono), 2 (stereo), or more Source channel count
bitDepth 8, 16, 24, 32 16

Platform implementation

Platform Approach
iOS / macOS AVAssetReader output settings
Android Manual PCM resampling, channel conversion, bit depth conversion
Windows Media Foundation media type attributes
Linux GStreamer capsfilter
Web OfflineAudioContext + manual encoding

Full Changelog: v0.4.0...v0.5.0