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

  • SEARCH
  • Home
  • 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 7182415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:45:58+00:00 2026-05-28T17:45:58+00:00

I am trying to write (what should be) a simple app that has a

  • 0

I am trying to write (what should be) a simple app that has a bunch of audio units in sequence in an AUGraph and then writes the output to a file. I added a callback using AUGraphAddRenderNotify. Here is my callback function:

OSStatus MyAURenderCallback(void *inRefCon,
                        AudioUnitRenderActionFlags *actionFlags,
                        const AudioTimeStamp *inTimeStamp,
                        UInt32 inBusNumber,
                        UInt32 inNumberFrames,
                        AudioBufferList *ioData) {
    if (*actionFlags & kAudioUnitRenderAction_PostRender) {
        ExtAudioFileRef outputFile = (ExtAudioFileRef)inRefCon;
        ExtAudioFileWriteAsync(outputFile, inNumberFrames, ioData);
    }
}

This sort of works. The file is playable and I can hear what I recorded but there is horrible amounts of static that makes it barely audible.

Does anybody know what is wrong with this? Or does anyone know of a better way to record the AUGraph output to a file?

Thanks for the help.

  • 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-28T17:45:59+00:00Added an answer on May 28, 2026 at 5:45 pm

    I had a epiphany with regards to Audio Units just now which helped me solve my own problem. I had a misconception about how audio unit connections and render callbacks work. I thought they were completely separate things but it turns out that a connection is just short hand for a render callback.

    Doing an kAudioUnitProperty_MakeConnection from the output of audio unit A to the input of audio unit B is the same as doing kAudioUnitProperty_SetRenderCallback on the input of unit B and having the callback function call AudioUnitRender on the output of audio unit A.

    I tested this by doing a make connection after setting my render callback and the render callback was no longer invoked.

    Therefore, I was able to solve my problem by doing the following:

    AURenderCallbackStruct callbackStruct = {0};
    callbackStruct.inputProc = MyAURenderCallback;
    callbackStruct.inputProcRefCon = mixerUnit;
    
    AudioUnitSetProperty(ioUnit,
                         kAudioUnitProperty_SetRenderCallback,
                         kAudioUnitScope_Input,
                         0,
                         &callbackStruct,
                         sizeof(callbackStruct));
    

    And them my callback function did something like this:

    OSStatus MyAURenderCallback(void *inRefCon,
                            AudioUnitRenderActionFlags *actionFlags,
                            const AudioTimeStamp *inTimeStamp,
                            UInt32 inBusNumber,
                            UInt32 inNumberFrames,
                            AudioBufferList *ioData) {
    
        AudioUnit mixerUnit = (AudioUnit)inRefCon;
    
        AudioUnitRender(mixerUnit,
                        actionFlags,
                        inTimeStamp,
                        0,
                        inNumberFrames,
                        ioData);
    
        ExtAudioFileWriteAsync(outputFile, 
                               inNumberFrames, 
                               ioData);
    
        return noErr;
    }
    

    This probably should have been obvious to me but since it wasn’t I’ll bet there are others that were confused in the same way so hopefully this is helpful to them too.

    I’m still not sure why I had trouble with the AUGraphAddRenderNotify callback. I will dig deeper into this later but for now I found a solution that seems to work.

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

Sidebar

Related Questions

I'm trying to write a simple app that should mute my mobile phone for
I'm trying to write a very simple terminal app that will scan for Bluetooth
I'm trying to write a simple app that lets a user grant my code
I'm trying to write a simple Compact Framework winforms app. The main form has
Ruby 1.9.1, OSX 10.5.8 I'm trying to write a simple app that parses through
I'm trying to write a very simple app for Android. It should do 2
im trying to write an app that will display a list off lines from
I'm trying to create an Android client for a client/server app that has previously
I'm trying to write really simple iOS5 app just searching for specific type of
I'm trying to create a Facebook canvas app that allow users to write a

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.