---
title: "add(_:withObserver:)"
framework: soundanalysis
role: symbol
role_heading: Instance Method
path: "soundanalysis/snaudiofileanalyzer/add(_:withobserver:)"
---

# add(_:withObserver:)

Adds a new analysis request to the audio file analyzer.

## Declaration

```swift
func add(_ request: any SNRequest, withObserver observer: any SNResultsObserving) throws
```

## Parameters

- `request`: A sound analysis request.
- `observer`: An doc://com.apple.soundanalysis/documentation/SoundAnalysis/SNResultsObserving instance that receives the analyzer’s results. The analyzer maintains a weak reference to the observer.

## Mentioned in

Classifying Sounds in an Audio File

## Discussion

Discussion The method throws an error (Swift) or returns an error (Objective-C) if the analyzer is actively processing the file.

## See Also

### Managing Requests

- [SNRequest](soundanalysis/snrequest.md)
- [SNResultsObserving](soundanalysis/snresultsobserving.md)
- [remove(_:)](soundanalysis/snaudiofileanalyzer/remove(_:).md)
- [removeAllRequests()](soundanalysis/snaudiofileanalyzer/removeallrequests().md)
