---
title: "CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsamplebuffercopypcmdataintoaudiobufferlist(_:at:framecount:into:)"
---

# CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)

Copies PCM audio data from a sample buffer into an audio buffer list.

## Declaration

```swift
func CMSampleBufferCopyPCMDataIntoAudioBufferList(_ sbuf: CMSampleBuffer, at frameOffset: Int32, frameCount numFrames: Int32, into bufferList: UnsafeMutablePointer<AudioBufferList>) -> OSStatus
```

## Parameters

- `sbuf`: The sample buffer containing the PCM audio data to be copied.
- `frameOffset`: The frame offset number from which to begin the copy.
- `numFrames`: The total number of frames to copy.
- `bufferList`: The audio buffer list to populate.

## Discussion

Discussion The AudioBufferList must contain the same number of channels and its data buffers must be sized to hold the specified number of frames. This API is specific to audio format sample buffers, and will return kCMSampleBufferError_InvalidMediaTypeForOperation if called with a non-audio sample buffer. It will return an error if the sample buffer doesn’t contain PCM audio data or if its data buffer isn’t ready.

## See Also

### Modifying Sample Buffers

- [CMSampleBufferGetDataBuffer(_:)](coremedia/cmsamplebuffergetdatabuffer(_:).md)
- [CMSampleBufferSetDataBuffer(_:newValue:)](coremedia/cmsamplebuffersetdatabuffer(_:newvalue:).md)
- [CMSampleBufferGetImageBuffer(_:)](coremedia/cmsamplebuffergetimagebuffer(_:).md)
- [CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(_:bufferListSizeNeededOut:bufferListOut:bufferListSize:blockBufferAllocator:blockBufferMemoryAllocator:flags:blockBufferOut:)](coremedia/cmsamplebuffergetaudiobufferlistwithretainedblockbuffer(_:bufferlistsizeneededout:bufferlistout:bufferlistsize:blockbufferallocator:blockbuffermemoryallocator:flags:blockbufferout:).md)
- [CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)](coremedia/cmsamplebuffersetdatabufferfromaudiobufferlist(_:blockbufferallocator:blockbuffermemoryallocator:flags:bufferlist:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptions(_:allocatedSize:packetDescriptionsOut:packetDescriptionsSizeNeededOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptions(_:allocatedsize:packetdescriptionsout:packetdescriptionssizeneededout:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptionsptr(_:packetdescriptionspointerout:sizeout:).md)
