---
name: "SDL_LoadWAV"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_LoadWAV"
---

# SDL\_LoadWAV(3)

Loads a WAV from a file path.

## NAME

SDL\_LoadWAV - Loads a WAV from a file path.

## HEADER FILE

Defined in SDL3/SDL\_audio.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_LoadWAV(const char \*path, SDL\_AudioSpec \*spec, Uint8 \*\*audio\_buf, Uint32 \*audio\_len);**

## DESCRIPTION

This is a convenience function that is effectively the same as:

-

  ```
  SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), true, spec, audio_buf, audio_len);
  ```

## FUNCTION PARAMETERS

- *path*

  the file path of the WAV file to open.

- *spec*

  a pointer to an  **SDL\_AudioSpec**\
    that will be set to the WAVE data's format details on successful return.

- *audio\_buf*

  a pointer filled with the audio data, allocated by the function.

- *audio\_len*

  a pointer filled with the length of the audio data buffer in bytes.

## RETURN VALUE

Returns true on success. **audio\_buf** will be filled with a pointer to an allocated buffer containing the audio data, and **audio\_len** is filled with the length of that audio buffer in bytes.

This function returns false if the .WAV file cannot be opened, uses an unknown data format, or is corrupt; call  **SDL\_GetError** () for more information.

When the application is done with the data returned in **audio\_buf** , it should call  **SDL\_free** () to dispose of it.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_free**(3)](/SDL_free/3.md), **•**(3), [**SDL\_LoadWAV\_IO**(3)](/SDL_LoadWAV_IO/3.md)
