# AudioData

    final class AudioData

Stores input audio samples in a circular buffer.
- `
  ### [init(format:sampleCount:)](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC6format11sampleCountAcA0eF6FormatV_Sitcfc)

  ` Creates a zero-initialized buffer with capacity for `sampleCount` frames per channel.

  #### Declaration

  Swift

      init(format: AudioDataFormat, sampleCount: Int)

- `
  ### [buffer](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC6bufferAA11FloatBufferCvp)

  ` Snapshot of all internal buffer elements in chronological order (most recent at the end).

  #### Declaration

  Swift

      final var buffer: FloatBuffer { get }

- `
  ### [bufferLength](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC12bufferLengthSivp)

  ` Capacity in number of multi-channel sample frames.

  #### Declaration

  Swift

      final var bufferLength: Int { get }

- `
  ### [format](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC6formatAA0eF6FormatVvp)

  `

  #### Declaration

  Swift

      final let format: AudioDataFormat

- `
  ### [load(audioRecord:)](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC4load11audioRecordyAA0eI0C_tKF)

  ` Loads the latest samples from `audioRecord`.

  #### Declaration

  Swift

      final func load(audioRecord: AudioRecord) throws

- `
  ### [load(buffer:offset:length:)](https://developers.google.com/edge/api/mediapipe/swift/common/Classes/AudioData.md.txt#/s:20MediaPipeTasksCommon9AudioDataC4load6buffer6offset6lengthyAA11FloatBufferC_S2itKF)

  ` Loads a slice of interleaved audio samples from `buffer` into the internal ring buffer.

  #### Declaration

  Swift

      final func load(buffer: FloatBuffer, offset: Int, length: Int) throws