<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureSpatialAudioMetadataSampleGenerator/analyzeAudioSample(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureSpatialAudioMetadataSampleGenerator(im)analyzeAudioSample:"
  },
  "title" : "analyzeAudioSample(_:)"
}
-->

# analyzeAudioSample(_:)

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

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

## Parameters

`sbuf`

a sample buffer containing spatial audio.

## Return Value

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

## Discussion

You must call this method with each and every spatial audio buffer you provide to [`AVAssetWriter`](/documentation/AVFoundation/AVAssetWriter), so it can be analyzed for the generation of a proper spatial audio timed metadata value.

---

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)