I am developing an application where I need to recognize human(to be precise baby crying) voice. I referred following articles for开发者_运维技巧 recording sound on iPhone microphone and sample it.
http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/ http://developer.apple.com/library/ios/#samplecode/aurioTouch/Introduction/Intro.html http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html
...but I didn't get how can I accurately distinguish the human voice from any other voice. Any help or sample code on this would be really helpful.
So far I wrote following code:
-(void)levelTimerCallback:(NSTimer *)timer {
[recorder updateMeters];
const double ALPHA = 0.05;
double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0]));
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;
NSLog(@"frequency: %f", lowPassResults);
NSLog(@"Average input: %f Peak input: %f", [recorder averagePowerForChannel:0], [recorder peakPowerForChannel:0]);
if (lowPassResults < 0.95)
[self playSound];
}
Thanks.
This is a very difficult problem. Speech recognition is a complex subject, and even massive companies can't get it right. A suggestion would be to sample it and see if it is within a certain, high-pitched range. Beyond that, you would need to read up on speech recognition theory.
As this answer shows, it is not within the range of the iPhone SDK, so it will not be a simple answer.
精彩评论