https://openai.com/research/whisper
https://github.com/openai/whisper
After installing, I played around with runtime options:
print ” — convert_WMA_2_TXT($wmaFile)\n”;
#my $cmd = “whisper $wmaFile –model large”;
my $cmd = “whisper $wmaFile –model small.en”;
d:\recordings\runWhisper.pl
use Getopt::Std;
use Cwd;
my $dt = sprintf "%0.4d_%0.2d_%0.2d",(localtime())[5]+1900,(localtime())[4] +1,(localtime())[3];
my $tm = sprintf "%0.2d%0.2d%0.2d",(localtime())[2,1,0];
my $now = sprintf "%0.2d/%0.2d/%0.4d %0.2d:%0.2d:%0.2d",(localtime())[4] +1,(localtime())[3],(localtime())[5]+1900,(localtime())[2,1,0];
sub Usage {
print " USAGE\n";
print " $0 -m<Mode> -r<rootPath> -d<debugInt> -h\n";
print " -m<Mode> ~ Mode Typical Nothing\n";
print " -- CRON ~ Skip Human Prompts\n";
print " -- SHOW ~ Skip Actual Execution\n";
print " -r<rootPath> ~ defaults to current folder ie .\n";
print " -d<debugInt> ~ debugInt Indicator\n";
print " -h ~ Shows Usage\n";
print " -------------------------------------------------------------\n";
print " This tool will skip .wma files that have a matching .txt file indicating that they have already been converted.\n";
}
my $SLASH = &getSLASH();
my $cDir = cwd;
$cDir =~ s!\/!${SLASH}!g;
print "$cDir\n";
getopts('m:r:d:h');
my $MODE = $opt_m || "";
my $DEBUG = $opt_d || 0;
my $ROOT = $opt_r || $cDir;
if ($opt_h) {&Usage; exit 0;}
my @PROCESS = &getTop_Folders();
for (my $i=0;$i<scalar(@PROCESS);$i++) {
my $folder = $PROCESS[$i];
chomp($folder);
printf " Process: %0.2d == %-s\n",$i,$folder;
my @WMA_LIST = &getWMA_Files($folder);
my @PROCESS_WMA = &fromARRAY(@WMA_LIST);
for (my $x=0;$x<scalar(@PROCESS_WMA);$x++) {
my $wmaFile = $PROCESS_WMA[$x];
chomp($wmaFile);
printf " %0.2d == %-s\n",$x,$wmaFile;
chdir("${ROOT}${SLASH}${folder}");
&convertWMA_2_Txt("${ROOT}${SLASH}${folder}${SLASH}${wmaFile}");
}
}
sub convertWMA_2_Txt {
print cwd . "\n";
my $wmaFile = shift || "";
if (! -f $wmaFile) {
print " -- convertWMA_2_Txt($wmaFile) Could Not Locate File!\n";
return;
}
print " -- convert_WMA_2_TXT($wmaFile)\n";
#my $cmd = "whisper $wmaFile --model large";
my $cmd = "whisper $wmaFile --model small.en";
print " -- $cmd\n";
system($cmd);
}
sub getTop_Folders {
my $fCmd = "dir /b /a:d ${ROOT}";
print "$fCmd\n";
my $fCmdX = `${fCmd}`;
chomp($fCmdX);
my @FOLDERS = split('\n',$fCmdX);
my @RTN = &fromARRAY(@FOLDERS);
return @RTN;
}
sub getWMA_Files {
my $folder = shift || "";
print " --getWMA_Files($folder)\n";
my $wmaCmd = "dir /b /a:-d \"${ROOT}${SLASH}${folder}${SLASH}*.WMA\"";
print " $wmaCmd\n" if $DEBUG > 0;
my $wmaCmdX = `${wmaCmd}`;
chomp($wmaCmdX);
print " $wmaCmdX\n" if $DEBUG > 10;
my @WMA = split('\n',$wmaCmdX);
my @DATA;
for (my $x=0;$x<scalar(@WMA);$x++) {
my $xvar = $WMA[$x];
print " --xvar:$xvar\n" if $DEBUG > 0;
my ($file,$ext) = split('\.',$xvar);
print " --file:$file\n" if $DEBUG > 0;
print " -- ext:$ext\n" if $DEBUG > 0;
my $txtFile = "${ROOT}${SLASH}${folder}${SLASH}${file}.txt";
print " -- txt:$txtFile\n" if $DEBUG > 0;
if (-f "${txtFile}") {
print " $txtFile Found!\n" if $DEBUG > 0;
} else {
print " $txtFile Not Found!\n" if $DEBUG > 0;
$txtFile = "";
}
printf " %0.4d == %-50s %-s\n",$x,$xvar,$txtFile;
if ($txtFile eq "") {push(@DATA,$xvar);}
}
return @DATA;
}
sub fromARRAY {
print " =============== FROM ARRAY ===============\n" if $DEBUG > 0;
my @ARRAY = @_;
my @RETURN;
my $ans="";
if ($MODE ne "NO-PROMPT") {
for (my $i=0;$i<=scalar(@ARRAY)-1 ;$i++) {
my $c = $i+1;
print "\t$c $ARRAY[$i]\n";
}
print "\n\tEnter Choice (x~exit| s~skip | n~new) 1,2,ect | 1-5,8-19 | a for all] [a]:";
$ans = <STDIN>;
chomp($ans);
print "\n";
if (lc($ans) eq "x") {
&_EXIT_CLEAN("Exit by user!");
}
if (lc($ans) eq "s") {return;}
}
if ($ans eq "") {
$ans = "a";
}
if ($ans eq "a") {
print "\t\tLoading All .ftp files\n" if $DEBUG > 0;
for my $f(@ARRAY) {
push(@RETURN,$f);
}
} else {
my @INPUT = split(',',$ans);
my $test="";
for my $line(@INPUT) {
print " *** Looking for Input ($line-1) :" if $DEBUG > 0;
my ($s,$e) = split('-',$line);
if (! defined $e) {$e="";}
if ($e eq "") {
$test = $s;
$test =~ s/[aA-zZ]//g;
if ($test ne "") {
if ($ARRAY[$s-1] ne "") {
print "Found SPECIFIC: " . $ARRAY[$s-1] . " ***\n" if $DEBUG > 0;
push(@RETURN,$ARRAY[$s-1]);
}
}
} else {
for (my $int=$s;$int<=$e ;$int++) {
$test = $int;
$test =~ s/[aA-zZ]//g;
if ($test ne "") {
if ($ARRAY[$int-1] ne "") {
print "Found RANGE" . $ARRAY[$int-1] . " ***\n" if $DEBUG > 0;
push(@RETURN,$ARRAY[$int-1]);
}
}
}
}
}
}
print " FROM_ARRAY_RETURN_LIST:\n" if $DEBUG > 0;
if (scalar(@RETURN) > 0) {
for (my $ix=0;$ix<=scalar(@RETURN)-1 ;$ix++) {
print " --$ix $RETURN[$ix]\n" if $DEBUG > 0;
}
} else {
if ($ans ne "") {push(@RETURN,$ans);}
}
return @RETURN;
}
sub getSLASH {
###########################################################################
#REMS# getSLASH() -- Get either \ or / depending on OS
#REMS# Return: SLASH
if ($^O =~ /Win/) {
$SLASH = "\\";
}else {
$SLASH = "/";
}
return $SLASH;
}