title: Core Audio MIDI Synth AU & MusicPlayer - Cannot be pulled by AudioUnitRender programmatically
body: <p>I have an AUGraph with AudioUnits. My MIDI Synth AudioUnit was created by this: </p>
  
  <pre><code>    AudioComponentDescription midiSynthDesc;
      midiSynthDesc.componentType = kAudioUnitType_MusicDevice;
      midiSynthDesc.componentSubType = kAudioUnitSubType_MIDISynth;
  </code></pre>
  
  <p>Then I load the SF2 File into the MIDI AudioUnit: </p>
  
  <pre><code>    NSURL *bankURL = [[NSBundle mainBundle] URLForResource:@"Combined" withExtension:@"sf2"];
      AudioUnitSetProperty(midiSynthUnit,
                           kMusicDeviceProperty_SoundBankURL,
                           kAudioUnitScope_Global,
                           0,
                           &amp;bankURL,
                           sizeof(bankURL));
  </code></pre>
  
  <p>I have this SF2 loaded MIDI-Synth AudioUnit connected to Remote-IO AudioUnit, then I added MusicPlayer to this AUGraph to play:</p>
  
  <pre><code>    MusicPlayerSetSequence(musicPlayer, musicSequence);
      NewMusicSequence(&amp;musicSequence);
      MusicSequenceFileLoad(musicSequence, (__bridge CFURLRef)midiFileURL, 0, 0)
      MusicSequenceSetAUGraph(musicSequence, processingGraph);
      MusicPlayerPreroll(musicPlayer);
      MusicPlayerStart(musicPlayer);
  </code></pre>
  
  <p>And it works with the Remote-IO, I can hear the MIDI file playing. </p>
  
  <p>However, if I pull the MIDI Synth Audio Unit programmatically, trying to render the MIDI File into Raw Audio Data and then write into m4a file: </p>
  
  <pre><code>    OSStatus err = noErr;
      err = AudioUnitRender(midiSynthUnit, &amp;flags, &amp;inTimeStamp, busNumber, numberFrames, bufferList);
  </code></pre>
  
  <p>No audio data can be read ( bufferList's mData == 0 Always).
  No matter how many times I call AudioUnitRender, MusicPlayerGetTime always tells me that the current beat of the Music Player is 0:</p>
  
  <pre><code>    Float64 currentBeat;
      MusicPlayerGetTime(musicPlayer, &amp;currentBeat);
  </code></pre>
  
  <p>Can anybody tell me why? 
  Any suggestion how to read the MIDI File with SF2 soundfont file and convert into raw audio data / render MIDI into m4a file? </p>
  
  <p>Thanks</p>