---
title: "makeSampleBuffer(for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avsamplebuffergenerator/makesamplebuffer(for:)"
---

# makeSampleBuffer(for:)

Creates a sample buffer, and attempts to load its data asynchronously if requested.

## Declaration

```swift
func makeSampleBuffer(for request: AVSampleBufferRequest) throws -> sending CMSampleBuffer
```

## Parameters

- `request`: A sample buffer creation request.

## Return Value

Return Value A sample buffer object.

## Discussion

Discussion If you created the generator with a nil timebase, any associated AVSampleBufferRequest objects default to using a request mode of AVSampleBufferRequest.Mode.immediate. Call the notifyOfDataReady(for:completionHandler:) class method to have the system notify you when sample buffer data is available. The request may fail based on generator configuration or file format.

## See Also

### Creating a sample buffer

- [makeBatch()](avfoundation/avsamplebuffergenerator/makebatch().md)
- [makeSampleBuffer(for:addTo:)](avfoundation/avsamplebuffergenerator/makesamplebuffer(for:addto:).md)
- [createSampleBuffer(for:)](avfoundation/avsamplebuffergenerator/createsamplebuffer(for:).md)
