---
title: "loadAudio"
sidebar_label: "loadAudio"
description: "Kotlin binding reference: loadAudio."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Io](index.md)/[loadAudio](loadAudio.md)

# loadAudio

[common]\
fun [loadAudio](loadAudio.md)(path: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), targetSampleRate: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, targetChannels: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [AudioData](../AudioData/index.md)

Decode an audio file to a host Float32 waveform plus its layout. [targetSampleRate](loadAudio.md) and [targetChannels](loadAudio.md) 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](peekAudio.md) with the same targets reports the frame count this returns.

[common]\
fun [loadAudio](loadAudio.md)(bytes: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html), targetSampleRate: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, targetChannels: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [AudioData](../AudioData/index.md)

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