I am using this code for record setting but still i have some issue. can any help me to short out this issues..
我正在使用此代码进行记录设置,但我仍有一些问题。能不能帮我把这个问题弄错了..
NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue:[NSNumber numberWithInt: kAudioFormatLinearPCM] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
[recordSetting setValue:[NSNumber numberWithInt: 8] forKey:AVLinearPCMBitDepthKey];
[recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
[recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityHigh] forKey:AVEncoderAudioQualityKey];
[recordSetting setValue:[NSNumber numberWithInt:96] forKey:AVEncoderBitRateKey];
[recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVEncoderBitDepthHintKey];
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityHigh] forKey:AVSampleRateConverterAudioQualityKey];
AVAudioRecorder *recorder = [[AVAudioRecorder alloc] initWithURL:fileURL settings:recordSetting error:nil];
[recorder setDelegate:self];
recorder.meteringEnabled = YES;
[recorder prepareToRecord];
[self setAudioRecorder:recorder];
[recorder release];
My Test:
I go to the "Record Your Shout" screen and press record. I am in a quiet room by myself with no noise at all around me I do not say anything for 5 seconds When I preview that recording there is very loud static noise
我的测试:我进入“录制你的呼喊”屏幕并按下录音。我自己在一个安静的房间里,周围没有任何噪音我5秒钟没有说什么当我预览录音时,静音很大
I then closed ShoutOmatic and used the "Voice Memo" that comes with the iPhone and do the same thing and the sound quality is crystal clear, perfect.
然后我关闭了ShoutOmatic并使用iPhone附带的“语音备忘录”并做同样的事情,音质清晰,完美。
2 个解决方案
#1
1
This isn't an exact solution, but it's a start. Note that on the AVAudioPlayer, you're not setting any of the userInfo properties - you're handing it a file and saying "here you go". Try locating that file (when recorded via the Simulator) and playing it in iTunes or another media player. Does it have static? If so, you're certain the problem is in the recording, not the playback.
这不是一个确切的解决方案,但它是一个开始。请注意,在AVAudioPlayer上,您没有设置任何userInfo属性 - 您正在处理文件并说“在这里”。尝试找到该文件(通过模拟器录制时)并在iTunes或其他媒体播放器中播放。它有静电吗?如果是这样,您确定问题出在录音中,而不是播放中。
Step 2, it seems like you have a lot of specifiers for the record format - don't be afraid to use the defaults. I'd start commenting out lines one at a time (of course checking that the recording still works) and see if you can't get it to resolve. That might tell you what mutually-incompatible record settings you have.
第2步,似乎你有很多记录格式的说明符 - 不要害怕使用默认值。我开始一次评论一行(当然检查录音仍然有效),看看你是否无法解决它。这可能会告诉您具有相互不兼容的记录设置。
#2
0
you've specified 8 bit audio - 16 would be better.
你已经指定了8位音频 - 16会更好。
for speech, mono is also typical (you have specified stereo).
对于语音,单声道也是典型的(您已指定立体声)。
#1
1
This isn't an exact solution, but it's a start. Note that on the AVAudioPlayer, you're not setting any of the userInfo properties - you're handing it a file and saying "here you go". Try locating that file (when recorded via the Simulator) and playing it in iTunes or another media player. Does it have static? If so, you're certain the problem is in the recording, not the playback.
这不是一个确切的解决方案,但它是一个开始。请注意,在AVAudioPlayer上,您没有设置任何userInfo属性 - 您正在处理文件并说“在这里”。尝试找到该文件(通过模拟器录制时)并在iTunes或其他媒体播放器中播放。它有静电吗?如果是这样,您确定问题出在录音中,而不是播放中。
Step 2, it seems like you have a lot of specifiers for the record format - don't be afraid to use the defaults. I'd start commenting out lines one at a time (of course checking that the recording still works) and see if you can't get it to resolve. That might tell you what mutually-incompatible record settings you have.
第2步,似乎你有很多记录格式的说明符 - 不要害怕使用默认值。我开始一次评论一行(当然检查录音仍然有效),看看你是否无法解决它。这可能会告诉您具有相互不兼容的记录设置。
#2
0
you've specified 8 bit audio - 16 would be better.
你已经指定了8位音频 - 16会更好。
for speech, mono is also typical (you have specified stereo).
对于语音,单声道也是典型的(您已指定立体声)。