julius-3.5.2-quickstart-windows.zip speech recognition commands
Extract the file to a folder and you can immediately use run_julian.bat
path=cygwin;bin julian -input mic -C julian.jconf
As you can see it's using the default Windows mike to run the configuration file
the path parts are important as it uses a cygwin dll, and the command "julian" is assuming that c:\julius-3.5.2-quickstart-windows\bin is accessible
BATCH FILE -> JULIUN STANDARD -> PIPE TO julius-command-menu.exe -> commands in conf.txt
What I've contrived to do is take my "listener" c program and pipe the julius output to it...
myJulius.bat (which can be a startup script or in the startup folder?) path=cygwin;bin julian -input mic -C julian.jconf |
/ John Pfeiffer 2010-08 extending my earlier c receive pipe program take input from stdin (piped voice recognition from Julius) if a successful voice match for a "DIAL" command, use the conf.txt dos command TODO: improve security from system() call /
include
include
include
define BUFFERMAX 1024
define LINEMAX 1024
int getConfigurationFromFile ( char configfilebuffer [ BUFFERMAX ][ LINEMAX ] );
int main( int argc, char* argv[] )
{
int configurationlines = 0;
char configfilebuffer [ BUFFERMAX ][ LINEMAX ] ;
char c;
char buffer [ BUFFERMAX ];
int charcounter = 0;
FILE* fptr;
configurationlines = getConfigurationFromFile ( configfilebuffer );
fptr = fopen( "log.txt" , "w" );
if( fptr == NULL )
{ fprintf( stderr , "error opening file\n");
exit(1);
}
printf("\nusage: recv.c.exe then type things, type @ or ~ followed by enter to quit\n");
memset( buffer , '\0' , sizeof( buffer) );
charcounter = 0;
c = fgetc( stdin );
while( c != EOF && c != '~' && c != '@' && charcounter < BUFFERMAX )
{
buffer[ charcounter ] = c;
charcounter++;
if( c == '\n' )
{
fprintf( fptr, "%s" , buffer ) ;
fprintf( stdout , "%s" , buffer );
fflush( fptr );
if( strstr( buffer , "</s>") != NULL )
{
if( strstr( buffer , "DIAL ZERO") != NULL )
{ system( configfilebuffer[ 0 ] );
}
if( strstr( buffer , "DIAL ONE") != NULL )
{ system( configfilebuffer[ 1 ] );
}
if( strstr( buffer , "DIAL TWO") != NULL )
{ system( configfilebuffer[ 2 ] );
}
if( strstr( buffer , "DIAL THREE") != NULL )
{ system( configfilebuffer[ 3 ] );
}
if( strstr( buffer , "DIAL FOUR") != NULL )
{ system( configfilebuffer[ 4 ] );
}
if( strstr( buffer , "DIAL FIVE") != NULL )
{ system( configfilebuffer[ 5 ] );
}
if( strstr( buffer , "DIAL SIX") != NULL )
{ system( configfilebuffer[ 6 ] );
}
if( strstr( buffer , "DIAL SEVEN") != NULL )
{ system( configfilebuffer[ 7 ] );
}
if( strstr( buffer , "DIAL EIGHT") != NULL )
{ system( configfilebuffer[ 8 ] );
}
if( strstr( buffer , "DIAL NINE") != NULL )
{ system( configfilebuffer[ 9 ] );
}
} /* end if strstr( </s> ) */
memset( buffer , '\0' , sizeof( buffer) );
charcounter = 0;
}
c = fgetc( stdin );
} /* end while c != EOF */
fclose( fptr );
return 0;
} / end main /
int getConfigurationFromFile ( char configfilebuffer [ BUFFERMAX ][ LINEMAX ] ) { int linecounter = 0; FILE* configfileptr;
configfileptr = fopen( "conf.txt" , "r" );
if( configfileptr == NULL )
{ fprintf( stderr , "\n\n!!!!!Error opening configuration file\n\n");
exit(1);
}
memset( configfilebuffer , '\0' , sizeof( configfilebuffer ) );
while( ! feof(configfileptr) )
{
fgets( configfilebuffer[ linecounter ] , LINEMAX , configfileptr);
fputs( configfilebuffer[ linecounter ] , stdout );
linecounter++;
}
fclose( configfileptr );
return linecounter;
}/ end getConfigurationFromFile function /
The important piece of text we're looking for is:
sentence1: DIAL ZERO
The conf.txt file is independent of the binary executables so that it is simple to change what command "DIAL ZERO" activates.
Note that you do have to command line standards (e.g. DOS) when using a system call so funny characters in paths/filenames may not work.
ALSO, you could have the conf.txt call a batch file which does lots of things...