IPhone Simulator Sound only works for 44100 Hz, 22050 Hz and 11025 Hz

Is anyone out there using an 8 kHz simulator at the AudioUnit level?

IPhone simulator sound works only for frequencies 44100 Hz, 22050 Hz and 11025 Hz. Otherwise, it can happen strangely.

I'm having trouble recording sound in the iPhone simulator. The code works fine on the hard drive, but the simulator is not so strange.

I am working on the AudioUnit level, and I set the sampling rate (using the properties of the audio session) to 8000 Hz. Works great on the hardware level, but on the simulator, the render callback requests one block of data of the appropriate size, and then forwards every 11.6 ms, requesting one byte.

I tried to set the sampling rate to 44100/4 (11025 Hz), and it worked fine. Therefore, I tried to set the sampling rate of audio recordings to 11024 and broke. The same with 11026. 11025 works.

My assumption is that there is an error in the sound code of the simulator. I think that inside it should have a buffer that is a quarter of a second, and it cannot handle situations where the sampling frequency is not a multiple of something.

Can anyone try this in their own simulator code? Try sampling rates of 11024, 11025, and 11026 and see if only 11025 works?

UPDATE: if I ask for 11024, it gives me 8000, but the render callback continues to deliver ioData with only one frame request (1 byte). Same behavior when I ask for 8000 Hz.

UPDATE2: The simulator also works when I program at the AudioQueue API level. It processes 8 kHz. It looks like this is similar to the AudioUnit API level.

+4
source share
3 answers

As far as I can tell, the simulator goes into dysfunctional mode when you request its remote I / O module to work in 8 kHz mode. Or any other mode other than 44100/4.

Once again, it is not that he rejected my format or suggested the best. The problem is that it claims to be consent, then goes into weird mode, requesting one or two bytes at a time, probably due to some fencepost error.

If I set the device subtype to VoiceProcessingIO, 8 kHz works fine, I thought that the side of the microphone gets a little fussy every few times.

So the problem is that the Simulator Remote I / O module claims to support 8 kHz, but only works if you configured it as a subtype of VoiceProcessing.

+4
source

The simulator is named so because it is not an emulator.

+1
source

First of all, there are several β€œcanonical” samples. I know 8000, 11025, 22050, 41000, 48000 and 96000 Hz. I would not expect that any audio system will work with an arbitrary value, except for the canonical ones.

They say that a simulator, as you know, does not behave exactly like a real iDevice, especially an audio subsystem. For example, an IIRC simulator cannot play all the audio formats that an iOS device can play. As @JustSid said, this is a simulator, not an emulator. Nothing replaces testing on the device itself.

0
source

Source: https://habr.com/ru/post/1346613/


All Articles