Menu

noise while recording audio using AVAudiorecorder in ios?

Help
2016-04-07
2016-04-08
  • nayan kalita

    nayan kalita - 2016-04-07

    Hi Everyone,

    I am using pocketsphinx for speech recognition on iPhone. I am giving a PCM wav as input to pocketsphinx. It was working good i am able to get output from pocketsphinx.

    My query is :

    I am using AVAudioRecorder to record the audio in PCM wave format. sample frequency 16K Hz. when record the audio there is consnat noise in the wave files. Also if i record a empty file ( with out sepaking anyting ) in silennce enviroment then also noise present in the files. for refence here i am uploading a empty file and a speech files in the below location.

    https://drive.google.com/folderview?id=0B5r-5MmR-hW7Z2RDOGQ2V1l1Zlk&usp=sharing

    I am using following settings to record audio using AVAudio recorder.

    // sets the path for audio file
    NSArray *pathComponents = [NSArray arrayWithObjects:
             [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
             [NSString stringWithFormat:@"%@.wav", recordedAudioFileName],
             nil];
    self.recordedAudioURL = [NSURL fileURLWithPathComponents:pathComponents];
    NSLog(@"Recording File Path dir: %@", recordedAudioURL);
    
    NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey];
    [recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
    [recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
    [recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
    [recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMax] forKey:AVEncoderAudioQualityKey];
    
    // initiate recorder
    NSError *error;
    userAudioRecorder = [[AVAudioRecorder alloc] initWithURL:[self recordedAudioURL] settings:recordSetting error:&error];
    if (error)
    {
     NSLog(@"*********************");
     NSLog(@"Error in initializing: %@", [error localizedDescription]);
     NSLog(@"*********************");
    }
    

    1) Is there is any wrong the code ?
    2) Is this much noise will affect the speech recognition accuracy.

     

    Last edit: Nickolay V. Shmyrev 2016-04-07
  • Nickolay V. Shmyrev

    1) Is there is any wrong the code ?

    No, the code is correct

    2) Is this much noise will affect the speech recognition accuracy.

    Very silent noise is always present in any speech recording unless it is artificially zeroed, it does not affect speech recognition accuracy, it even helps to get better recognition.

     
  • nayan kalita

    nayan kalita - 2016-04-08

    Hi Nickolay,

    Thank you for your feedback.

    Do you happen to know the source of this noise in iPhone recording using AVAudio Recorder.

    As the user can playback the audio file, the noise is annoying. How this noise can be suppressed.

     
    • Nickolay V. Shmyrev

      Your files do not have any annoying noise, and no noise to suppress, you can play them and listen.

      You probably play them incorrectly.

       

Log in to post a comment.