Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Monaj

macrumors regular
Original poster
May 24, 2009
193
0
Hi all,

I noticed NSSpeechRecognizer in ADC library and I found it to be very interesting, so to play with it I prepared a simple application which will just listen the command and if recognized it displays it in log.

The code used is:


Code:
- (id)init {
 
	if (self = [super init]) {
		// Insert code here to initialize your application 
		NSArray *cmds = [NSArray arrayWithObjects:@"A",@"B", @"C",@"alpha",@"beta",@"vodka",@"wine",nil]; 
		recog = [[NSSpeechRecognizer alloc] init]; // recog is an ivar
		[recog setCommands:cmds];
		[recog setDelegate:self];
	}
	return self;
}
 
- (IBAction)listen:(id)sender
{   NSLog(@"listen:");
    if ([sender state] == NSOnState) { // listen
		[recog startListening];
    } else {
		[recog stopListening];
    }
}
 
- (void)speechRecognizer:(NSSpeechRecognizer *)sender didRecognizeCommand:(id)aCmd {
	NSLog(@"speechRecognizer: %@",(NSString *)aCmd);
}

I tried it many times for the commands registered but I was unable to get none of the messages in log, in delegate :(

There was always some noise in the background.. could this be the reason for it or I have done something wrong in the code??

Can anyone suggest me some solution for it??

Thanks,

Monaj
 
First, have you calibrated the recognizer in the appropriate pane of the Speech system preference? If you can't get it working there, then it certainly won't work in your program.

Second, have you done any searches for other examples using NSSpeechRecognizer? Try googling the search terms NSSpeechRecognizer example.
 
First, have you calibrated the recognizer in the appropriate pane of the Speech system preference? If you can't get it working there, then it certainly won't work in your program.
ok.. I will definitely check and ensure it to be working correct!

Second, have you done any searches for other examples using NSSpeechRecognizer? Try googling the search terms NSSpeechRecognizer example.

ok.. I will definitely look for some other examples

Thanks,

Monaj
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.