Instance Method


Sets the preferred audio I/O buffer duration, in seconds.


- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError * _Nullable *)outError;



The audio I/O buffer duration, in seconds, that you want to use.


On input, a pointer to an error object. If an error occurs, the pointer is set to an NSError object that describes the error. If you do not want error information, pass in nil.

Return Value

YES if a request was successfully made, or NO otherwise.


This method requests a change to the I/O buffer duration. To determine whether the change takes effect, use the IOBufferDuration property.

The audio I/O buffer duration is the number of seconds for a single audio input/output cycle. For example, with an I/O buffer duration of 0.005 s, on each audio I/O cycle:

  • You receive 0.005 s of audio if obtaining input.

  • You must provide 0.005 s of audio if providing output.

The typical maximum I/O buffer duration is 0.93 s (corresponding to 4096 sample frames at a sample rate of 44.1 kHz). The minimum I/O buffer duration is at least 0.005 s (256 frames) but might be lower depending on the hardware in use.

You can set a preferred I/O buffer duration before or after activating the audio session.

See Also

Working with Audio Device Settings


The gain applied to inputs associated with the session.


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

- setInputGain:error:

Changes the input gain to the specified value.


The system wide output volume set by the user.


The latency for audio input, measured in seconds.


The latency for audio output, measured in seconds.


The current audio sample rate, in hertz.


The preferred sample rate, in hertz.

- setPreferredSampleRate:error:

Sets the preferred sample rate for input and output.


The current I/O buffer duration, in seconds.


The preferred I/O buffer duration, in seconds.