Skip to content

Commit

Permalink
Check for sox version only if the soundfile is not already cached.
Browse files Browse the repository at this point in the history
  • Loading branch information
zaf committed Dec 26, 2014
1 parent 52d866c commit 6bb45b9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions googletts.agi
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ $name = " -- $AGI{request}:";
die "$name sox or mpg123 is missing. Aborting.\n" if (!$sox || !$mpg123);

chomp($sox, $mpg123);
# Detect sox version #
if (!$sox_ver) {
$sox_ver = (system("$sox --version > /dev/null 2>&1") == 0) ? 14 : 12;
}
warn "$name Found sox version $sox_ver in: $sox, mpg123 in: $mpg123\n" if ($debug);

# Sanitising input #
$AGI{arg_1} = decode('utf8', $AGI{arg_1});
Expand Down Expand Up @@ -218,7 +213,11 @@ foreach my $line (@text) {
# Convert mp3 file to 16bit 8Khz or 16kHz mono raw #
system($mpg123, "-q", "-w", "$tmpname.wav", $tmpname) == 0
or die "$name $mpg123 failed: $?\n";

# Detect sox version #
if (!$sox_ver) {
$sox_ver = (system("$sox --version > /dev/null 2>&1") == 0) ? 14 : 12;
warn "$name Found sox version $sox_ver in: $sox, mpg123 in: $mpg123\n" if ($debug);
}
my @soxargs = get_sox_args("$tmpname.wav", "$tmpname.$fexten");
system(@soxargs) == 0 or die "$name $sox failed: $?\n";
unlink "$tmpname.wav";
Expand Down

0 comments on commit 6bb45b9

Please sign in to comment.