title: iOS: Audio Recording File Format
body: <p>I am implementing the Audio recording. It works fine with <code>caf</code> &amp; <code>wave</code> format. But the problem is file size is too big. </p>
  
  <p>So, can anyone help me for record audio with format which also played in window &amp; file size is little low.</p>
  
  <p>The code I tried is below:</p>
  
  <pre><code> dirPaths = NSSearchPathForDirectoriesInDomains(
                                                      NSDocumentDirectory, NSUserDomainMask, YES);
      docsDir = [dirPaths objectAtIndex:0];
       NSString *soundFilePath = [docsDir
                                  stringByAppendingPathComponent:@"sound.wave"];
       NSLog(@"%@",soundFilePath);
       NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
  
       NSDictionary *recordSettings = [NSDictionary 
                           dictionaryWithObjectsAndKeys:
                                      [NSNumber numberWithInt:AVAudioQualityMin],
                                       AVEncoderAudioQualityKey,
                                       [NSNumber numberWithInt:16], 
                                       AVEncoderBitRateKey,
                                       [NSNumber numberWithInt: 2], 
                                       AVNumberOfChannelsKey,
                                       [NSNumber numberWithFloat:8000.0], AVSampleRateKey,
                                       [NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
                                       nil];
  
       NSError *error = nil;
  
       audioRecorder = [[AVAudioRecorder alloc]
                        initWithURL:soundFileURL
                        settings:recordSettings
                        error:&amp;error];
  
       if (error)
       {
           NSLog(@"error: %@", [error localizedDescription]);
  
       } else {
          [audioRecorder prepareToRecord];
       }
  </code></pre>