---
title: "analyzeAudioSample(_:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturespatialaudiometadatasamplegenerator/analyzeaudiosample(_:)"
---

# analyzeAudioSample(_:)

Analyzes the provided audio sample buffer for its contribution to the spatial audio timed metadata value.

## Declaration

```swift
func analyzeAudioSample(_ sbuf: CMSampleBuffer) -> OSStatus
```

## Parameters

- `sbuf`: A sample buffer containing spatial audio.

## Return Value

Return Value noErr if the sample is successfully analyzed, otherwise a non-zero error code.

## Discussion

Discussion You must call this method with each and every spatial audio buffer you provide to AVAssetWriter, so it can be analyzed for the generation of a proper spatial audio timed metadata value.

## See Also

### Analyzing audio samples

- [newTimedMetadataSampleBufferAndResetAnalyzer()](avfoundation/avcapturespatialaudiometadatasamplegenerator/newtimedmetadatasamplebufferandresetanalyzer().md)
- [timedMetadataSampleBufferFormatDescription](avfoundation/avcapturespatialaudiometadatasamplegenerator/timedmetadatasamplebufferformatdescription.md)
- [resetAnalyzer()](avfoundation/avcapturespatialaudiometadatasamplegenerator/resetanalyzer().md)
