---
title: "init(buffer:bufferStartTime:)"
framework: speech
role: symbol
role_heading: Initializer
path: "speech/analyzerinput/init(buffer:bufferstarttime:)"
---

# init(buffer:bufferStartTime:)

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

## Declaration

```swift
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

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. CMTime(value: avAudioTime.sampleTime, timescale: CMTimeScale(avAudioTime.sampleRate))

## See Also

### Creating an input element

- [init(buffer:)](speech/analyzerinput/init(buffer:)-3nt02.md)
- [init(buffer:)](speech/analyzerinput/init(buffer:)-2ysg3.md)
