title: How can I track down interference between the flutter libraries audo_recorder and stereo
body: <p>I'm building an app with Flutter that allows me to record audio and then play it back later. I'm using the package <code>audio_recorder 0.4.0</code> for recording the audio and the package <code>stereo 1.0.0</code> for playing back the audio.</p>
  
  <p>When I record using the iOS simulator, everything works fine. But when I run on the physical device (iPhone 6 Plus), I always get a 28 byte file at the end of the recording session - basically just a header to the m4a file.</p>
  
  <p>I've tracked this down to some kind of interference between the two libraries. I can record on the physical device just fine if I use the sample app included with <code>audio_recorder 0.4.0</code>. But all I have to do is add the line <code>stereo: 1.0.0</code> to the dependencies in pubspec.yml of that same sample project and suddenly I start getting the 28 byte files on the physical device at the end of a recording session instead of a normal size m4a file.</p>
  
  <p>I have a two-part question:</p>
  
  <ol>
  <li><p>What kind of interference could the <code>stereo</code> library be causing to make this kind of failure in the <code>audio_recorder</code> library? I suspected channel interference, but my attempt to isolate that didn't yield anything.</p></li>
  <li><p>How can I track down what is causing this?</p></li>
  </ol>
  
  <p>I have examined the console output from both sessions. When it is failing, I see several (8) of these lines in the the console output right after attempting to start recording:</p>
  
  <pre><code>mediaserverd    1111: AudioConverterNew returned -50
  </code></pre>
  
  <p>Others have suggested that this error occurs when there is no microphone available.</p>
  
  <p>I also see this suspicious difference between the outputs. 
  When recording is broken:</p>
  
  <pre><code>default 11:36:57.098825 -0700   mediaserverd    4414: { "action":"set_play_state", "session":{"ID":"0x3315820","PID":14591,"name":"Runner"}, "details":"entry" }
  default 11:36:57.100484 -0700   mediaserverd    -CMSessionMgr- cmsSetIsPlaying: CMSession: 'sid:0x3315820, Runner(14591), 'prim'' with [MediaPlayback/Default] [NonMixable] [System Audio] starting playing.
  default 11:36:57.104699 -0700   mediaserverd    CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
      Volume = "0.75";
      VolumeCategory = "Audio/Video";
      VolumeOperationProcess = "com.monkela.audioRecordSample";
      VolumeOperationTime = 576708;
      VolumePlayingState = 1;
  }: (
      857014545
  )
  default 11:36:57.105879 -0700   mediaserverd    -CMVAEndptMgr- vaemSetDeviceVolume: CMSession: Setting cmsvolume = 0.750 for device ID: VirtualAudioDevice_Default
  default 11:36:57.107295 -0700   mediaserverd    VirtualAudio_Device.cpp:2046:SetPropertyData: [volm/outp/0] on device [ type: vdef; id: 354; addr: 0x1014e1ba0; hidden: 0; VA strms: { o/883/0x106fc5980 }; agg dev: [ id: 872; addr: 0x106f1a460; uid: "VAD [vdef] AggDev 52"; virt strms: {  }; phys devs: { [ id: 292; addr: 0x104b0fdb0; uid: "Speaker"; streams: { i/294/0x104b11cd0, o/293/0x104b12790 } ] } ] ]: 0.750000.
  default 11:36:57.108123 -0700   mediaserverd    OutputVolumeControl_HAL_Common.cpp:662:CommitVolume: Setting Volume = -14.500000 dB, Final HW Volume = 0.000000 dB, Final SW Volume = -14.500000 dB, External Volume Handler: No
  default 11:36:57.109008 -0700   mediaserverd    OutputVolumeControl_HAL_Common.cpp:663:CommitVolume:     PhysicalDevice UID = "Speaker"
  default 11:36:57.109721 -0700   mediaserverd    OutputVolumeControl_HAL_Common.cpp:664:CommitVolume:     Scope = 1869968496 ("outp")
  default 11:36:57.110704 -0700   mediaserverd    OutputVolumeControl_HAL_Common.cpp:665:CommitVolume:     Element = 0 ("0")
  default 11:36:57.112062 -0700   mediaserverd    OutputVolumeControl_HAL_Common.cpp:698:CommitVolume:     SW Volume: 0.750000 scalar
  default 11:36:57.114393 -0700   mediaserverd    VirtualAudio_Device.cpp:2066:SetPropertyData: Client request to set nominal sample rate to 44100.000000 on VAD 354.
  default 11:36:57.116038 -0700   assertiond  [Runner:14591] Attempting to acquire assertion for Runner:14591: &lt;BKProcessAssertion: 0x101349110; "CMSession.14591."com.monkela.audioRecordSample"."MediaPlayback".isPlayingProcessAssertion" (audio:inf); id:…C74721DE1F95&gt;
  default 11:36:57.116572 -0700   assertiond  [Runner:14591] Add assertion: &lt;BKProcessAssertion: 0x101349110; id: 13077-914DDDE2-35CE-4420-85ED-C74721DE1F95; name: CMSession.14591."com.monkela.audioRecordSample"."MediaPlayback".isPlayingProcessAssertion; state: active; reason: audio; duration: infs&gt; {
      owner = &lt;BSProcessHandle: 0x101009be0; mediaserverd:13077; valid: YES&gt;;
      flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;
  }
  </code></pre>
  
  <p>When recording is working:</p>
  
  <pre><code>default 11:39:19.865022 -0700   mediaserverd    2863: { "action":"activate", "session":{"ID":"0x3315826","PID":14609,"name":"Runner"}, "details":"entry" }
  default 11:39:19.880637 -0700   mediaserverd    CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
      "active devices" = "[ { vdef, [  ], [ pspk ( 0 ) ] }, { vspd, [ pmbi ( 0 ) ], [  ] }, { vcal, [ pdln ( 0 ) ], [ puln ( 0 ) ] } ]";
      category = csav;
      "going_active" = 1;
      mode = imdf;
      "staying_active" = 0;
  }: (
      857014546
  )
  </code></pre>
  
  <p>The output when recording is broken suggests that my attempt to start recording actually starts playing something (i.e. invoking the wrong library).</p>