title: Issues with recording and playing .wav files IOS
body: <p>I have been facing issues with recording the audio and playing them back on IOS. </p>
  
  <p>Here's what I use for Recording:</p>
  
  <pre><code>    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
      NSError *err = nil;
      [audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:&amp;err];
      if(err){
          NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
          return;
      }
      [audioSession setActive:YES error:&amp;err];
      err = nil;
      if(err){
          NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
          return;
      }
  
      recordSettings = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                        [NSNumber numberWithFloat: 16000.0],AVSampleRateKey,
                        [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,// kAudioFormatLinearPCM
                        [NSNumber numberWithInt:8],AVLinearPCMBitDepthKey,
                        [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
                        [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
                        [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
                        [NSNumber numberWithInt: AVAudioQualityLow],AVEncoderAudioQualityKey,
                        nil];
  
      recorderFilePath = [[NSString stringWithFormat:@"%@/%@", filePath, fileName] retain];
      NSLog(@"recorderFilePath: %@",recorderFilePath);
      NSURL *audioFileURL = [NSURL fileURLWithPath:recorderFilePath];
  
      recorder = [[ AVAudioRecorder alloc] initWithURL:audioFileURL settings:recordSettings error:&amp;err];
      if(!recorder){
          NSLog(@"recorder: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
          UIAlertView *alert =
          [[UIAlertView alloc] initWithTitle: @"Warning"
                                     message: [err localizedDescription]
                                    delegate: nil
                           cancelButtonTitle:@"OK"
                           otherButtonTitles:nil];
          [alert show];
          [alert release];
          return;
      }
  
      //prepare to record
      [recorder setDelegate: self];
      [recorder prepareToRecord];
      recorder.meteringEnabled = YES;
      [recorder record];
  </code></pre>
  
  <p>And recording just works fine for me, in .wav files with the settings mentioned above. Now, the problem is with the play back. </p>
  
  <p>The below is for playing the recorded .wav audio files. </p>
  
  <pre><code>    NSURL * url = [NSURL fileURLWithPath:filePath];
      audioPlayer = [[[AVAudioPlayer alloc] initWithContentsOfURL:url
                                                    error:&amp;err] autorelease];
      if (! audioPlayer) {
          NSLog(@"Sound named '%@' had error %@", name, [err localizedDescription]);
      } else {
          [audioPlayer prepareToPlay];  // Getting the return value NO here.
      }
     // audioPlayer.volume = 1; // Tried setting different values, but of no help.
     [audioPlayer play];  // Getting the return value NO here.
  </code></pre>
  
  <p>It's not throwing any error but it does nothing. No sound is being played. While it is possible to play ".mp3" file (test file from resources) with the player, it is a problem to play the files recorded with the above settings.</p>
  
  <p>I am not sure what I am missing here. Please help! thanks</p>