---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/specialists/_shared/variables/defaultDecodeAudio.md
description: >-
  Default [`DecodeAudioFn`](https://adk.nht.io/api/@nhtio/adk/batteries/specialists/_shared/type-aliases/DecodeAudioFn): lazily imports the optional `audio-decode`
  peer, decodes the container, then downmixes to mono via [`downmixToMono`](https://adk.nht.io/api/@nhtio/adk/lib/utils/audio/functions/downmixToMono).
---

# Variable: defaultDecodeAudio

```ts
const defaultDecodeAudio: DecodeAudioFn;
```

Defined in: [src/batteries/specialists/\_shared/index.ts:165](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/specialists/_shared/index.ts#L165)

Default [DecodeAudioFn](../type-aliases/DecodeAudioFn.md): lazily imports the optional `audio-decode` peer, decodes the
container, then downmixes to mono via [downmixToMono](../../../../lib/utils/audio/functions/downmixToMono.md).

## Remarks

`audio-decode` resolves to one of two shapes depending on codec/environment: an
AudioBuffer-compatible object (`numberOfChannels` + `getChannelData()`) or a plain
`{ channelData: Float32Array[], sampleRate }` record (e.g. the wav path in Node). Both are
normalized identically to how `src/batteries/media/engines/audio_decode.ts` handles them,
lifted into this standalone function rather than shared code (that engine's own copy stays
untouched — it belongs to the media battery, not to specialists).

## Param

**bytes**

The encoded audio container bytes.

## Returns

The decoded mono PCM samples and the source sample rate, in Hz.

## Throws

An `Error` naming the install command when the `audio-decode` peer is not installed.
