---
title: "init(pcmFormat:frameCapacity:)"
framework: avfaudio
role: symbol
role_heading: Initializer
path: "avfaudio/avaudiopcmbuffer/init(pcmformat:framecapacity:)-5jhd5"
---

# init(pcmFormat:frameCapacity:)

Creates a PCM audio buffer instance for PCM audio data.

## Declaration

```swift
init?(pcmFormat format: AVAudioFormat, frameCapacity: AVAudioFrameCount)
```

## Parameters

- `format`: The format of the PCM audio the buffer contains.
- `frameCapacity`: The capacity of the buffer in PCM sample frames.

## Return Value

Return Value A new AVAudioPCMBuffer instance, or nil if it’s not possible.

## Discussion

Discussion The method returns nil due to the following reasons: The format has zero bytes per frame. The system can’t represent the buffer byte capacity as an unsigned bit-32 integer.

## See Also

### Related Documentation

- [frameLength](avfaudio/avaudiopcmbuffer/framelength.md)
- [frameCapacity](avfaudio/avaudiopcmbuffer/framecapacity.md)

### Creating a PCM Audio Buffer

- [init(pcmFormat:bufferListNoCopy:deallocator:)](avfaudio/avaudiopcmbuffer/init(pcmformat:bufferlistnocopy:deallocator:)-9iwe7.md)
