<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Speech",
  "identifier" : "/documentation/Speech/AnalyzerInput/init(buffer:bufferStartTime:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Speech"
    ],
    "preciseIdentifier" : "s:6Speech13AnalyzerInputV6buffer0D9StartTimeACSo16AVAudioPCMBufferC_So6CMTimeaSgtcfc"
  },
  "title" : "init(buffer:bufferStartTime:)"
}
-->

# init(buffer:bufferStartTime:)

Creates an audio input object for audio that may be discontiguous with previous input.

```
init(buffer: AVAudioPCMBuffer, bufferStartTime: CMTime?)
```

## Parameters

`buffer`

An audio buffer.

`bufferStartTime`

The time-code of the start of the audio buffer. If `nil`, this audio buffer is assumed to start immediately after the previous buffer (or at time-code zero if there is no previous buffer). The `CMTime` can have a different timescale than the sample rate of the audio data.

## Discussion

The audio buffer must not overlap or precede other audio input, as determined by the `bufferStartTime` value.

> Important: If the buffer is converted from other differently-formatted audio, ensure that the buffer’s start time is accurate.
> 
> Some conversion algorithms can use a “priming” method that may shift some audio to a later converted buffer. This shift will misalign the original and converted audio buffers; the original buffer’s start time would not be usable as the `bufferStartTime` value for the converted buffer.

> Tip: Convert an `AVAudioTime` instance to a `CMTime` instance with this code.
> 
> ```swift
> CMTime(value: avAudioTime.sampleTime, timescale: CMTimeScale(avAudioTime.sampleRate))
> ```

---

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)