Change AUGraph Sampling Rate on iOS

I implemented an AUGraph similar to the one found in the iOS Developer Library . However, in my application, I need to be able to reproduce sound with different sampling frequencies (possibly two different).

I was looking through Apple documentation and could not find a way to set the sample rate at runtime. I was thinking of three possible workarounds:

  • Re-initialize the AUGraph every time I need to change the sampling rate,
  • Initialize a different AUGraph for each different sample rate;
  • Convert the sampling frequency of each sound before playback;

These methods seem really awkward and cumbersome for the processor.

What is the best way to change the AUGraph sample rate at runtime?

+3
source share
3 answers

usually # 1 for continuous audio streaming scenarios.

your program may have a particular need or benefit using a different approach that you have indicated:

  • # 2: you need to handle when reinitializing is not a problem.
  • # 3: you need to mix and process two streams with different sampling frequencies at the same time, especially if you find that SRCing signal several times.

but if you just need SRC playback and low latency is not a concern, you can try AudioQueue instead.

+1
source

, . №2 - , №3. libsndfile .

0

, , ( , ).

, , , . iOS , .

0

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


All Articles