Skip to main content

//clika-runtime/io.clika.runtime/Io/loadAudio

loadAudio

[common]
fun loadAudio(path: String, targetSampleRate: Int = 0, targetChannels: Int = 0): AudioData

Decode an audio file to a host Float32 waveform plus its layout. targetSampleRate and targetChannels of 0 keep the file's own values; a non-zero channel count mixes to it (mono is the equal-weight average of the source channels) and a non-zero rate resamples, so peekAudio with the same targets reports the frame count this returns.

[common]
fun loadAudio(bytes: ByteArray, targetSampleRate: Int = 0, targetChannels: Int = 0): AudioData

Decode an encoded audio payload in memory; the same targets as the file form.