<!--
{
  "documentType" : "article",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/audio-hardware",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Audio hardware"
}
-->

# Audio hardware

Inspect and configure audio device settings including input gain, sample rate, and channel counts.

## Topics

### Configuring sample rate

[`var sampleRate: Double`](/documentation/AVFAudio/AVAudioSession/sampleRate)

The current audio sample rate, in hertz.

[`var preferredSampleRate: Double`](/documentation/AVFAudio/AVAudioSession/preferredSampleRate)

The preferred sample rate, in hertz.

[`func setPreferredSampleRate(Double) throws`](/documentation/AVFAudio/AVAudioSession/setPreferredSampleRate(_:))

Sets the preferred sample rate for audio input and output.

### Setting input gain

[`var inputGain: Float`](/documentation/AVFAudio/AVAudioSession/inputGain)

The gain applied to inputs associated with the session.

[`var isInputGainSettable: Bool`](/documentation/AVFAudio/AVAudioSession/isInputGainSettable)

A Boolean value that indicates whether you can set the input gain.

[`func setInputGain(Float) throws`](/documentation/AVFAudio/AVAudioSession/setInputGain(_:))

Changes the input gain to the specified value.

### Configuring I/O buffer duration

[`var ioBufferDuration: TimeInterval`](/documentation/AVFAudio/AVAudioSession/ioBufferDuration)

The current I/O buffer duration, in seconds.

[`var preferredIOBufferDuration: TimeInterval`](/documentation/AVFAudio/AVAudioSession/preferredIOBufferDuration)

The preferred I/O buffer duration, in seconds.

[`func setPreferredIOBufferDuration(TimeInterval) throws`](/documentation/AVFAudio/AVAudioSession/setPreferredIOBufferDuration(_:))

Sets the preferred audio I/O buffer duration.

### Inspecting latency

[`var inputLatency: TimeInterval`](/documentation/AVFAudio/AVAudioSession/inputLatency)

The latency for audio input, in seconds.

[`var outputLatency: TimeInterval`](/documentation/AVFAudio/AVAudioSession/outputLatency)

The latency for audio output, in seconds.

### Inspecting output volume

[`var outputVolume: Float`](/documentation/AVFAudio/AVAudioSession/outputVolume)

The systemwide output volume set by the user.

### Setting the number of input channels

[`var preferredInputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/preferredInputNumberOfChannels)

The preferred number of input channels for the current route.

[`func setPreferredInputNumberOfChannels(Int) throws`](/documentation/AVFAudio/AVAudioSession/setPreferredInputNumberOfChannels(_:))

Sets the preferred number of input channels for the current route.

[`var inputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/inputNumberOfChannels)

The number of audio input channels for the current route.

[`var maximumInputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/maximumInputNumberOfChannels)

The maximum number of input channels available for the current audio route.

### Setting the number of output channels

[`var preferredOutputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/preferredOutputNumberOfChannels)

The preferred number of output channels for the current route.

[`func setPreferredOutputNumberOfChannels(Int) throws`](/documentation/AVFAudio/AVAudioSession/setPreferredOutputNumberOfChannels(_:))

Sets the preferred number of output channels for the current route.

[`var outputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/outputNumberOfChannels)

The number of audio output channels.

[`var maximumOutputNumberOfChannels: Int`](/documentation/AVFAudio/AVAudioSession/maximumOutputNumberOfChannels)

The maximum number of output channels available for the current audio route.

### Configuring multichannel support

[`var supportsMultichannelContent: Bool`](/documentation/AVFAudio/AVAudioSession/supportsMultichannelContent)

A Boolean value that indicates whether your app supplies multichannel audio content.

[`func setSupportsMultichannelContent(Bool) throws`](/documentation/AVFAudio/AVAudioSession/setSupportsMultichannelContent(_:))

Sets whether your app supplies multichannel audio content.



---

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)