IOS: Audio Devices: Setting an Arbitrary Sample Rate

Can I set any sample rate I want? What are the limitations?

What about equipment sample rates? And once this is established, what is the limit on the internal sampling frequencies that have passed between units?

I assume that the actual hardware speed may need to be with some bit shift of 44.1 kHz, and any internal sampling frequencies should be a shift down of this initial value (e.g. 22.1 kHz, 11.05 kHz). It's close?

As I understand it,
 1. I set the sampling rate of the hardware in the audio session.
 2. The system will set the sampling frequency as close as possible to the sampling frequency indicated by me.
 3. Then I request an audio session for the same property that I set, which will give me the actual sampling rate used

At the level of audio devices, in particular on the RemoteIO device, the documentation states that the two points at which the device connects to the hardware (i.e., the input area of ​​the microphone (input) bus and the output volume of the speaker (output)), the sampling frequency can be received , but not installed .

However, I am trying to access this value when building the remote I / O module, and it returns zero. Maybe I need to start the device before I can get meaningful data from its connections (the start action probably creates connections). So the solution here is to get the sample rate from the audio session and use it as described above.

NECESSARY: Audio device

+5
source share
1 answer

I assume you are on iOS since you mention AudioSessions. Therefore, you will want:

  • Check for audio input. AudioSessionGetProperty (kAudioSessionProperty_AudioInputAvailable...)

  • Set the audio session to playback and recording. AudioSessionSetProperty (kAudioSessionProperty_AudioCategory...)withkAudioSessionCategory_PlayAndRecord

  • Activate the session. AudioSessionSetActive()

  • Get your preferred sample rate. AudioSessionGetProperty (kAudioSessionProperty_CurrentHardwareSampleRate)

.

, , API . , , .

+1

All Articles