Skip to content

Instantly share code, notes, and snippets.

@EpicVoyage
Created December 10, 2017 19:10
Show Gist options
  • Save EpicVoyage/9b0374283179abbe92e61354512e1c3c to your computer and use it in GitHub Desktop.
Save EpicVoyage/9b0374283179abbe92e61354512e1c3c to your computer and use it in GitHub Desktop.
Read a web page aloud with Perl, Festival and MPlayer
#!/usr/bin/perl -w
use HTML::Feature;
use PerlSpeak;
my $f = HTML::Feature->new(enc_type => 'utf8');
my $url = shift;
print "Fetching ${url}\n";
my $result = $f->parse($url);
print "Title: ".$result->title()."\n";
my $flite;
my $flite_path = "/home/chris/festival/build/flite";
open $flite, "|${flite_path}/bin/flite -voice ${flite_path}/voices/cmu_us_awb.flitevox - article.wav";
print $flite "Title: ".$result->title()."\n";
print $flite "Article: ".$result->text();
close $flite;
`mplayer -really-quiet article.wav`;
unlink 'article.wav';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment