title: How to set level meter on sound recording in iphone?
body: <p>For recording sound, I am using the following code:</p>
  
  <pre><code>- (IBAction) recordClicked:(id)sender {
      NSLog(@"play Record");
      if (audioPlayerRecord) {
          if (audioPlayerRecord.isPlaying) [audioPlayerRecord stop];
          else {
              [audioPlayerRecord play];
              [self updateCurrentTimeForPlayer:audioPlayerRecord];
          }
          return;
      } 
  
      //Initialize playback audio session
      AVAudioSession *audioSession = [AVAudioSession sharedInstance];
      [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *recDir = [paths objectAtIndex:0];
      NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/recordTest.caf", recDir]];
  
      NSError *error;
      audioPlayerRecord = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&amp;error];
      [audioPlayerRecord play];
      duration.text = [NSString stringWithFormat:@"%d:%02d", (int)audioPlayerRecord.duration / 60, (int)audioPlayerRecord.duration % 60, nil];
      progressBar.maximumValue = audioPlayerRecord.duration;
      [self updateViewForPlayerState:audioPlayerRecord];
      NSLog(@"Recoder file &gt;");
  }
  </code></pre>
  
  <p>When recording is on going , I want to show the following type of level meter </p>
  
  <p><img src="https://i.stack.imgur.com/QJUWg.png" alt="Level meter"></p>
  
  <p>So is there any other simplified way to achieve this problem?</p>