IOS avaudiorecorder Recording frequency, channel, number of bits configuration
#pragmaMark Recording Settings-(void) setup_voice_recoarder{Nserror*error =Nil; Audiosection=[Avaudiosession sharedinstance]; [Audiosection Setcategory:avaudiosessioncategoryplayandrecord Error:&ERROR]; if(Error) {NSLog (@"Recording Configuration error:%@", error); [Self showBackAlertWith:error.description]; return; } //16kHZ, single channel, 16-bit, WAV//[NSNumber Numberwithint:avaudioqualityhigh],avencoderaudioqualitykey,nsmutabledictionary* recordsetting =[nsmutabledictionary dictionarywithobjectsandkeys: [NSNumber numberwithfloat :16000], Avsampleratekey, [NSNumber Numberwithint:kaudioformatlinearpcm],avformatid Key, [nsnumber numberwithint:1], Avnumberofchannelskey, [NSNumber numberwithint: -], Avlinearpcmbitdepthkey, [NSNumber Numberwithbool:no],avlinearpcmisbigendia Nkey, [NSNumber Numberwithbool:no],avlinearpcmisfloatkey, NIL]; Nsurl*recordedtmpfile = [Nsurl fileurlwithpath:[[nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES) Objectatindex:0] stringByAppendingPathComponent: [NSString stringWithFormat:@"%.0f.%@", [NSDate timeintervalsincereferencedate] *1000.0,@"wav"]]];//settings for file namesVoiceurl=Recordedtmpfile; Voicerecorder=[[Avaudiorecorder alloc] initwithurl:recordedtmpfile settings:recordsetting error:null]; NSLog (@"file:%@", Recordedtmpfile); Voicerecorder.Delegate=Self ; Voicerecorder.meteringenabled=YES; [Voicerecorder Preparetorecord]; }
IOS avaudiorecorder Recording frequency, channel, number of bits configuration WAV format