decode

fun decode(path: String, targetSampleRate: Int? = 16000): AudioRawData?

Decodes an audio file to raw PCM data.

By default, resamples to 16kHz for compatibility with Calibra APIs. Set targetSampleRate = null to decode at native sample rate.

Return

Decoded audio data with PCM bytes, sample rate, and channel info, or null if decoding failed

Parameters

path

Absolute path to the audio file

targetSampleRate

Target sample rate in Hz (default: 16000 for Calibra compatibility). Set to null to decode at native sample rate without resampling.