<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/AudioReader",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents11AudioReaderV"
  },
  "title" : "AudioReader"
}
-->

# AudioReader

An audio file reader.

```
struct AudioReader
```

## Topics

### Creating an audio reader

[`init(configuration: AudioReader.Configuration)`](/documentation/CreateMLComponents/AudioReader/init(configuration:))

Creates an audio reader.

### Getting the properties

[`var configuration: AudioReader.Configuration`](/documentation/CreateMLComponents/AudioReader/configuration-swift.property)

The audio reader configuration

### Managing buffers

[`struct AsyncBuffers`](/documentation/CreateMLComponents/AudioReader/AsyncBuffers)

An async sequence of audio buffers read from an audio file.

[`struct Configuration`](/documentation/CreateMLComponents/AudioReader/Configuration-swift.struct)

The configuration of the audio reader.

[`struct MicrophoneAsyncBuffers`](/documentation/CreateMLComponents/AudioReader/MicrophoneAsyncBuffers)

An async sequence of audio frames.

### Reading audio

[`static func read(contentsOf: URL, configuration: AudioReader.Configuration) throws -> AudioReader.AsyncBuffers`](/documentation/CreateMLComponents/AudioReader/read(contentsOf:configuration:))

Reads an audio file as an async sequence of audio buffers.

[`static read(_:configuration:)`](/documentation/CreateMLComponents/AudioReader/read(_:configuration:))

Reads a sequence of annotated files as a lazy sequence of results each containing an audio buffers or an error.

[`static func readMicrophone(configuration: AudioReader.Configuration) async throws -> AudioReader.MicrophoneAsyncBuffers`](/documentation/CreateMLComponents/AudioReader/readMicrophone(configuration:))

Reads an async sequence of audio frames captured with a microphone.

### Applying

[`func applied(to: URL, eventHandler: EventHandler?) throws -> AudioReader.AsyncBuffers`](/documentation/CreateMLComponents/AudioReader/applied(to:eventHandler:))

Reads an audio file as an async sequence of audio buffers.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Transformer`](/documentation/CreateMLComponents/Transformer)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)