Hi,

Is Remote IO on iOS capable of sample rate conversion? Apple's
documentation implies so, e.g.: "To avoid unnecessary sample rate
conversion, be sure to use the audio hardware sample rate when defining
your stream format." However, whenever I set a stream format with sample
rate != [[AVAudioSession sharedInstance] sampleRate], the resulting audio
is garbled.

​My app code starts off by setting up the audio session:

​    AVAudioSession *theSession = [AVAudioSession sharedInstance];
    [​the​Session setPreferredSampleRate:​48000 error:​nil​];
    ​[the​Session setCategory:AVAudioSessionCategoryPlayAndRecord
error:​nil​];
    [​the​Session setActive:YES error:​nil​];

Later on, within my audio code (on top of Remote IO), I set up the stream
format:

  ...
  asbd.mSampleRate = 44100; // != 48000
  status = AudioUnitSetProperty(au,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Output, // the output side
    1, // ... of the input element
    &asbd, sizeof(asbd));

If I modify it to set asbd.mSampleRate = 48000, it starts functioning as
intended.
So, is Remote IO capable of sample rate conversion and there's something
broken in my code elsewhere, or do I *have* to use the audio session's
sample rate?

Thanks.

P.S. Yes, I know there's a performance penalty for sample rate conversion,
and I'm not doing it frivolously
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to