Created
December 10, 2017 19:10
-
-
Save EpicVoyage/9b0374283179abbe92e61354512e1c3c to your computer and use it in GitHub Desktop.
Read a web page aloud with Perl, Festival and MPlayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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