---
title: "analyze(completionHandler:)"
framework: soundanalysis
role: symbol
role_heading: Instance Method
path: "soundanalysis/snaudiofileanalyzer/analyze(completionhandler:)"
---

# analyze(completionHandler:)

Analyzes the audio file asynchronously.

## Declaration

```swift
func analyze(completionHandler: @escaping @Sendable (Bool) -> Void)
```

```swift
func analyze() async -> Bool
```

## Parameters

- `completionHandler`: A completion closure (Swift) or block (Objective-C) the analyzer calls when it finishes analyzing a file.

## Mentioned in

Classifying Sounds in an Audio File

## Discussion

Discussion The method executes asynchronously and calls the completion handler after the analyzer finishes analyzing the entire file. The audio file analyzer sends errors to each request’s results observer. If you call the cancelAnalysis() method, the analyzer calls your completion handler and passes false because it can’t reach the end of the file.

## See Also

### Analyzing Data

- [analyze()](soundanalysis/snaudiofileanalyzer/analyze().md)
- [cancelAnalysis()](soundanalysis/snaudiofileanalyzer/cancelanalysis().md)
