<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioPCMBuffer/init(pcmFormat:frameCapacity:)-5jhd5",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioPCMBuffer(im)initWithPCMFormat:frameCapacity:"
  },
  "title" : "init(pcmFormat:frameCapacity:)"
}
-->

# init(pcmFormat:frameCapacity:)

Creates a PCM audio buffer instance for PCM audio data.

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

A new [`AVAudioPCMBuffer`](/documentation/AVFAudio/AVAudioPCMBuffer) instance, or `nil` if it’s not possible.

## 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

[`frameLength`](/documentation/AVFAudio/AVAudioPCMBuffer/frameLength)

The current number of valid sample frames in the buffer.

[`frameCapacity`](/documentation/AVFAudio/AVAudioPCMBuffer/frameCapacity)

The buffer’s capacity, in audio sample frames.



---

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)