---
name: "afReadFrames"
section: "3"
platform: "linux"
package: "audiofile"
version: "0.3.6-12"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/afReadFrames"
---

# afReadFrames(3)

read sample frames from a track in an audio file

## NAME

afReadFrames - read sample frames from a track in an audio file

## SYNOPSIS

```
#include <audiofile.h>
```

```
AFframecount afReadFrames(AFfilehandle file, int track, void *data,
    int count);
```

## DESCRIPTION

afReadFrames attempts to read up to *count* frames of audio data from the audio file handle *file* into the buffer at *data*.

## PARAMETERS

*file* is a valid file handle returned by [**afOpenFile**(3)](/afOpenFile/3.md).

*track* is always AF\_DEFAULT\_TRACK for all currently supported file formats.

*data* is a buffer of storing *count* frames of audio sample data.

*count* is the number of sample frames to be read.

## RETURN VALUE

afReadFrames returns the number of frames successfully read from *file*.

## ERRORS

afReadFrames can produce these errors:

AF\_BAD\_FILEHANDLE

the file handle was invalid

AF\_BAD\_TRACKID

the track parameter is not AF\_DEFAULT\_TRACK

AF\_BAD\_READ

reading audio data from the file failed

AF\_BAD\_LSEEK

seeking within the file failed

## SEE ALSO

[**afWriteFrames**(3)](/afWriteFrames/3.md)

## AUTHOR

Michael Pruett \<michael@68k.org\>
