#!/usr/bin/perl # # Yousef Rabah - started April 13th, 2004 # # getSpeech.pl # # Using people (from people.pm) & db (from db.pm) # # -- First of all, with this script, its always the case that the raw file used will always be record000. # What happens is that even if person wants to add string, the second recording, # which would be record001 would be cated into record000, so in tern record000 # would include the first spoke string plus the second one. Now once record001 is # cated into record000 then record001 is removed, so that if user wants to search more # or add another string it would be saved as record001 and then the process is repeated. # -- Now open the current directory that the ASR (SPHINX) system is located at # and we need to basically put the correct raw sound file in this location # so that Sphinx would try to decode what was said. So here we are just putting # the location of the raw file in the sphinx location. # -- Then define Locations of the ASR sphinx locations S3BATCH is the sphinx application we are running # and define location of other sources that need to be present as arguements for the S3BATCH. # -- Then, execute system call that will run the program and decode speech # and a log file will be generated that will display all commands, # what occured, as well as how the system (sphinx) got to the decoding # of speech. It shows the process. # -- Finally, executed system call that will grep the line of decoded text and put in in variable # that will in turn put it in another file, DecodedSpeech.txt . This way other scripts # would be able to use the text generation. # ################################################################################## use strict; use people; use db; my $raw_file; my $sound_file; my $an4_file; my $raw_name; my $wav_location = "/usr/local/share/sphinx3/model/lm/an4/wav_files/record000.wav"; my $decode_speech; #= "/root/perl/log_info.txt"; # variable that will contain the decoded speech my $where = "/root/perl/DecodeSpeech.txt"; # Here is it always the case that the raw file used will always be record000. # What happens is that even if person wants to add string, the second recording, # which would be record001 would be cated into record000, so in tern record000 # would include the first spoke string plus the second one. Now once record001 is # cated into record000 then record001 is removed, so that if user wants to search more # or add another string it would be saved as record001 and then the process is repeated $sound_file = "record000"; $raw_file="raw_files/$sound_file"; # Now open the current directory that the ASR (SPHINX) system is located at # and we need to basically put the correct raw sound file in this location # so that Sphinx would try to decode what was said. So here we are just putting # the location of the raw file in the sphinx location. $an4_file = "/usr/local/share/sphinx3/model/lm/an4/an4.ctl"; open (OUT, ">$an4_file") || die "cannot create $an4_file: $!"; print OUT $raw_file; close (OUT) || die "cannot close $an4_file: $!"; # define Locations of the ASR sphinx locations # $S3BATCH is the sphinx application we are running my $S3BATCH ="/usr/local/bin/livepretend "; # The rest of these are file locations that the $S3BATCH will use # to run the sphinx application properly my $TASK ="/usr/local/share/sphinx3/model/lm/an4 "; my $CTLFILE ="/usr/local/share/sphinx3/model/lm/an4/an4.ctl "; my $ARGS ="/usr/local/share/sphinx3/model/lm/an4/args.an4 "; # execute system call that will run the program and decode speech # and a log file will be generated that will display all commands, # what occured, as well as how the system (sphinx) got to the decoding # of speech. It shows the process. $decode_speech = system ("$S3BATCH $CTLFILE $TASK $ARGS > an4.log 2>&1"); # executed system call that will grep the line of decoded text and put in in variable # that will in turn put it in another file, DecodedSpeech.txt . This way other scripts # would be able to use the text generation. system "grep FWDVIT an4.log >$where"; exit;