Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3870538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:44:14+00:00 2026-05-19T21:44:14+00:00

my Problem concerns AudioUnits. In order to design a voicechanging App for iPhone (with

  • 0

my Problem concerns AudioUnits. In order to design a voicechanging App for iPhone (with Objective-C xCode) i use RemoteIO audioUnit sample from this website:

http://atastypixel.com/blog/using-remoteio-audio-unit/

The audioUnit buffers are set to a length of 256 samples. For my project i need alot more (about 22050).
The quoted page says that the length of the audioUnit buffers can be adjusted like this:

float aBufferLength = 0.005; // In seconds
AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, 
                        sizeof(aBufferLength), &aBufferLength);

Now my specific question: The code above is not suitable for the mentioned audioUnit, because AudioSession is not used, never initialized and therefore produces an error.
Is there any other other possibilty to adjust the buffer-duration except for “kAudioSessionProperty_PreferredHardwareIOBufferDuration”?
The documentation is not quite useful in this case…
Thanks in advance, Lukas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T21:44:14+00:00Added an answer on May 19, 2026 at 9:44 pm

    There is no problem in defining and initializing an AudioSession with the RemoteIO Audio-Unit, and that’s the way to set the desired buffer length. I have some code doing exactly this, but it will take me a few hours till I get back home and can post it. You can look at Apple’s AurioTouch code-sample, or wait till I post it later.

    Anyway keep in mind 2 things:

    1. The buffer length will change only on the device, so don’t be surprised if you change it and see no difference on the simulator.
    2. You cannot get any buffer length you wish – that’s why the property is called PreferredHardwareIOBufferDuration. The buffer size is always a power of 2.

    With that in mind, did you consider allocating your own buffer and accumulate it till you have the desired number of samples?

    EDIT

    The code for initializing the audio session (should go before the audio unit is initialized):

    OSStatus result;
    result = AudioSessionInitialize(NULL, NULL, NULL, NULL);
    
    UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord;
    result = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(audioCategory), &audioCategory);
    
    // set preferred buffer size
    Float32 preferredBufferSize = .04; // in seconds
    result = AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(preferredBufferSize), &preferredBufferSize);
    
    // get actuall buffer size
    Float32 audioBufferSize;
    UInt32 size = sizeof (audioBufferSize);
    result = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration, &size, &audioBufferSize);
    
    result = AudioSessionSetActive(true);
    

    You can/should inspect result after each call in order to look for possible errors.
    You can read the documentation for AudioSessionInitialize for more information, but passing NULL for all 4 arguments still work. You should change it if, for example, you need to establish an interruption-listener callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: We have a web app that calls some web services asynchronously (from the
Problem: I have an address field from an Access database which has been converted
Problem: Given a list of strings, find the substring which, if subtracted from the
My problem concerns validating/normalising a user's input for the combination of Country and 'City'
I'm using gwt framework called smartgwt (however, problem concerns gwt and java) There, you
The problem: I have a legacy php app that is coded in no particular
like the title says my problem concerns the image uri of images taken by
I'd like to render a symfony form this way: My problem concerns the radio
The problem I'm trying to solve concerns a tree of MRT system. Each node
I'm implementing a small e-shop application in django. My question concerns modelling an Order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.