title: How to write output of AUGraph to a file?
body: <p>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:</p>
  
  <pre><code>OSStatus MyAURenderCallback(void *inRefCon,
                          AudioUnitRenderActionFlags *actionFlags,
                          const AudioTimeStamp *inTimeStamp,
                          UInt32 inBusNumber,
                          UInt32 inNumberFrames,
                          AudioBufferList *ioData) {
      if (*actionFlags &amp; kAudioUnitRenderAction_PostRender) {
          ExtAudioFileRef outputFile = (ExtAudioFileRef)inRefCon;
          ExtAudioFileWriteAsync(outputFile, inNumberFrames, ioData);
      }
  }
  </code></pre>
  
  <p>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.  </p>
  
  <p>Does anybody know what is wrong with this?  Or does anyone know of a better way to record the AUGraph output to a file?</p>
  
  <p>Thanks for the help.</p>