use strict; opendir(DIR, "./") or die $!; # open current directory my @files; while (my $file = readdir(DIR)) { # Use a regular expression to ignore files beginning with a period push(@files, lc($file)); } closedir(DIR); # read the prompt. my $promptfile = shift; print STDERR "reading $promptfile\n"; open(PROMPT, $promptfile); my $i = 0; while (my $prompt = ) { $i++; print STDERR $prompt . "\n"; $prompt =~ s/^\d+\.\s//; # remove "93. "; $prompt = lc($prompt); # concat a list of .wav files corresponding to the prompt my $files = ""; foreach my $word (split(/\s+/, $prompt)) { # choose a random file from the files, that beings with the given $word. my @grepped = grep(/^$word/, @files); my $file = $grepped[ int(rand(scalar @grepped)) ]; # choose a random file $files .= $file . " "; } my $output = sprintf("S%05d",$i); my $command = "sox $files $output.wav"; print STDERR $command . "\n"; # TODO: add system call. system($command); print STDOUT "$output.wav $output.mfc\n"; } close(PROMPT); #### Use of uninitialized value $file in concatenation (.) or string at scripts/conca tprompt.pl line 29, line 100. sox S00100.wav sox FAIL sox: Not enough input filenames specified #### perl -w scripts/concatprompt.pl trainprompts > codetrain.scp