# AudioChunk

    struct AudioChunk: Sendable, Equatable

Incremental mono PCM audio chunk emitted by `TextToSpeech.synthesizeStream(_:options:)`.
- `
  ### [init(samples:sampleRateHz:chunkIndex:isFinal:wordTimestamps:)](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV7samples12sampleRateHz10chunkIndex7isFinal14wordTimestampsACSaySfG_S2iSbSayAA13WordTimestampVGtcfc)

  `

  #### Declaration

  Swift

      init(samples: [Float], sampleRateHz: Int = 24000, chunkIndex: Int = 0, isFinal: Bool = false, wordTimestamps: [WordTimestamp] = [])

- `
  ### [chunkIndex](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV10chunkIndexSivp)

  ` Zero-based monotonic index of this chunk within the stream.

  #### Declaration

  Swift

      var chunkIndex: Int

- `
  ### [durationSeconds](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV15durationSecondsSfvp)

  ` Duration of this chunk in seconds.

  #### Declaration

  Swift

      var durationSeconds: Float { get }

- `
  ### [isFinal](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV7isFinalSbvp)

  ` True if this is the final chunk of the synthesis stream.

  #### Declaration

  Swift

      var isFinal: Bool

- `
  ### [sampleRateHz](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV12sampleRateHzSivp)

  ` Audio sample rate in Hz (e.g. 24000 for Kokoro-82M).

  #### Declaration

  Swift

      var sampleRateHz: Int

- `
  ### [samples](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV7samplesSaySfGvp)

  ` Normalized 32-bit floating-point mono PCM samples in `[-1.0, 1.0]`.

  #### Declaration

  Swift

      var samples: [Float]

- `
  ### [wordTimestamps](https://developers.google.com/edge/api/mediapipe/swift/audio/Structs/AudioChunk.md.txt#/s:19MediaPipeTasksAudio0D5ChunkV14wordTimestampsSayAA13WordTimestampVGvp)

  ` Word-level timing alignments for this chunk.

  #### Declaration

  Swift

      var wordTimestamps: [WordTimestamp]