• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Remote IO (iOS) and sample rate conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Remote IO (iOS) and sample rate conversion


  • Subject: Remote IO (iOS) and sample rate conversion
  • From: Ilya Konstantinov <email@hidden>
  • Date: Sun, 01 Feb 2015 19:50:46 +0200

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Next by Date: anyone experience with pulseaudio on here?
  • Next by thread: anyone experience with pulseaudio on here?
  • Index(es):
    • Date
    • Thread