title: AVAudioEngine sound recording changes tonality
body: <p>I have few <code>AVAudioPlayerNode</code>s for each sound user can play. Each player node is connected to its own <code>AVAudioMixerNode</code> to change volume. All of these mixers are connected to one <code>AVAudioMixerNode</code> (I named it <code>soundsMixerNode</code>) which is connected to the engine's <code>mainMixerNode</code>. User can record these sounds and then play the result record via <code>AVAudioPlayer</code>. The problem is that this record has a shifted tonality. Like if I used a pitch effect. And I get this result only on devices, simulators works good. Maybe the problem is in <code>AVAudioSession</code> categories or modes? Or maybe I have problems with <code>AVAudioFormat</code> or setting? I don't understand.
  Here's my audio graph:</p>
  
  <pre><code>PlayerNode1 – MixerNode1
                          \
  ...                      soundsMixerNode – self.engine.mainMixerNode
                          /
  PlayerNodeN – MixerNodeN
  </code></pre>
  
  <p>Here's my session setup:</p>
  
  <pre><code>AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  [audioSession setPreferredIOBufferDuration:128.0/audioSession.sampleRate error:NULL];
  [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
                withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker
                      error:&amp;error];
  [audioSession setActive:YES error:&amp;error];
  </code></pre>
  
  <p>Here's my recording <code>AVAudioFile</code> setup:</p>
  
  <pre><code>NSDictionary* recordSettings = [self.engine.outputNode inputFormatForBus:0].settings;
  NSError* error = nil;
  self.fileForRecording = [[AVAudioFile alloc] initForWriting:url
                                                     settings:recordSettings
                                                        error:&amp;error];
  </code></pre>
  
  <p>And recording code:</p>
  
  <pre><code>AVAudioFormat* recordingFormat = [self.soundsMixerNode outputFormatForBus:0];
  if (recordingFormat.sampleRate &gt; 0) {
      typeof(self) weakSelf = self;
      [self.soundsMixerNode installTapOnBus:0
                                 bufferSize:1024
                                     format:recordingFormat
                                      block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
                                          NSError* error;
                                         [weakSelf.fileForRecording writeFromBuffer:buffer error:&amp;error];
                                      }];
  }
  </code></pre>