title: Record and play audio same time
body: <p>I am trying to make the audio record and play back at the same time.  Here is the code.  It will only record and play back later. I want it to play back simultaneously over the speakers.  Any help.  I am not even sure I am using the right classes.  </p>
  
  <pre><code> AVAudioSession * audioSession = [AVAudioSession sharedInstance];
  
  [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
  [audioSession setActive:YES error:nil];
  
      temporaryRecFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithString:@"VoiceFile"]]];
  
      recorder = [[AVAudioRecorder alloc] initWithURL:temporaryRecFile settings:nil error:nil];
  
      [recorder setDelegate:self];
      [recorder prepareToRecord];
      [recorder record];
  
      AVAudioPlayer * player = [[AVAudioPlayer alloc] initWithContentsOfURL:temporaryRecFile error:nil];
      player.volume = 1;
      [player play];
  </code></pre>