#!/usr/bin/perl # # Yousef Rabah - started April 15th, 2004 # # -- record_wav.pl # # This script has a simple objective, which when it is called # (if the user wants to add a more interactive time to record, then # the script would prompt user to type the time for recording ) # Information is displayed here for user to know what to do for recording # TO record user would press space bar, and to stop you would hit space # bar again. # Here another system call will be called to record time. It would also take # rate of 16000 and with an output opion -o and it would be recorded as # record000, then record001 ... recordNNN. # Although recording can go up to recordNNN, we only want to deal with only # two files at a time, because that way we can contain and have a better strcuture. # It a process where 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 ############################################### use strict; my $time_rec_input; my $time_rec_value = "00:10"; my $start_rec; my $wav_files_directory = "/usr/local/share/sphinx3/model/lm/an4/wav_files"; my $name; ############################################################################# # If the user wants to add a more interactive time to record # #print "\n\nBefore recording, do you want to record duration for:\n"; #print "(1) 5 sec \n"; #print "(2) 10 sec \n"; #print "(3) 15 sec \n"; #print "Please press 1, 2, or 3: "; #$time_rec_input = ; #if ($time_rec_input =~ "1"){ # $time_rec_value = "00:05"; #} #elsif ($time_rec_input =~ "2"){ # $time_rec_value = "00:10"; #} #elsif($time_rec_input =~ "3"){ # $time_rec_value = "00:15"; #} #else { # print "\nYou're getting the default of 10 sec \n\n"; # $time_rec_value = "00:10"; #} # ############################################################################## print "\n\n\Information:\n"; print "To Record press 'space bar' and to Stop hit 'space bar' again.\n"; print "To Quit press 'Q'.\n\n"; print "Press 'S' to start: \a"; $a = ; # If input from standared in matches s or S or anything following s would execute # the system call of record, with functionality stated above. if ($a =~ /^[Ss]/){ system ("record -t $time_rec_value -r 16000 -l -o $wav_files_directory/record"); } # else if user pressed Q or q, the program will exit elsif ($a =~ /^[Qq]/){ exit(); } exit;