Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change audio recording settings to 16Khz and 16 bit when we record audio?
    primarykey
    data
    text
    <p>I have the settings shown below.</p> <p>I want change audio recording settings to 16Khz and 16 bit when we record audio.</p> <pre><code>NSArray *dirPaths; NSString *docsDir; dirPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); docsDir = [dirPaths objectAtIndex:0]; NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.wav"]; NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 2], AVNumberOfChannelsKey, [NSNumber numberWithFloat:44100.0], AVSampleRateKey, nil]; NSError *error = nil; audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&amp;error]; if (error) { } else { [audioRecorder prepareToRecord]; } </code></pre> <p>How to set those settings?</p> <p><strong>Edit the question</strong>:</p> <p>Thanks for giving the replies, i tried those ways but it did not work for me, Because my client is sending the recorded voice(the recorded voice what i am sending in bytes format) to ASR engine (Automatic speech recognition). i am not getting back the same response (i am getting the response audio says "quotation mark") what i send . Client says you are not recording the voice in 16KHz and 16 bit sample rate thats why you are getting that response. But i asked him the bytes what i send to his server, He given that .wav file it is playing perfectly. But if the same one he is sending to ASR engine , the ASR engine not accepts the recorded voice what i am sending(He says that ASR wont accept because you are not recording audio in 16KHz and 16 bit sample rate). Client given the following response. (But, I tried all the ways suggested by you)</p> <pre><code>Filename: sv_SE_356985580762248932.wav Folder: E:\developApp\TestappName\Mortionsn_dev\2nd-iteration\test_wfiles File Type: 44100Hz, 16-bit, Stereo Uncompressed Size: 1.63 MB (1,713,696 bytes) File Format: Windows PCM Windows PCM Size on Disk: 1.63 MB (1,717,892 bytes) Last Written (local): 3/11/2013 00:21:00.000 Length: 0:09.714 428,424 samples </code></pre> <p><strong>Edit the question 2nd Time By using Below Answers</strong>:</p> <p>Later by giving the suggestions i changed my settings code to:</p> <pre><code>NSMutableDictionary *recordSettings = [NSMutableDictionary dictionary]; [recordSettings setValue: [NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey]; [recordSettings setValue: [NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey];//8000.0 [recordSettings setValue: [NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey]; [recordSettings setValue: [NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey]; [recordSettings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey]; [recordSettings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey]; [recordSettings setValue: [NSNumber numberWithInt: AVAudioQualityMax] forKey:AVEncoderAudioQualityKey]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload