Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight


by httptech (Chaplain)
on Jun 01, 2000 at 21:53 UTC ( #15869=sourcecode: print w/replies, xml ) Need Help??
Category: PerlMonks Clients
Author/Contact Info Joe Stewart aka httptech
Description: Speech interface to chatterbox, using festival server for the text-to-speech processing. You need to have the festival daemon running and install the Speech::Festival module.

Since it's based on ZZamboni's Chatterbox Client you will need to download his module as well.

# - Talking Perl Monks
# By Joe Stewart
# Mainly just a hack to the sample driver program for
# by Diego Zamboni, May 2000.
# Use:
# -l Username
#      Asks for your password. Stores cookies in ~/.pm-cookie.
#      This is only necessary the first time you use it. After that it
+ uses
#      the cookie automatically.
# Type messages to send
# Type /checkoff <number> to remove personal messages (this is the equ
#  of checking on them in the web page).
use strict;
use PerlMonksChat;
use IO::Select;
use Text::Wrap qw(wrap);
use Speech::Festival;

$| = 1;
$SIG{'INT'} = \&endit;

my $festival = new Speech::Festival;
conn $festival || warn "Could not connect to festival: $!";

my $user;
my $passwd;

my $usecolor=1;
my $color_username="";
my $color_personalmsg="";
my $color_sysmsg="";
my $color_normal="";

if ($ARGV[0] && $ARGV[0] eq "-l") {
  shift @ARGV;
  $user=shift @ARGV or die "User expected as argument to -l\n";
  print "Password? ";
  chomp $passwd;

my $period=shift @ARGV || 10;

if ($usecolor) {
  eval "use Term::ANSIColor";
  unless ($@) {
    $color_username=color('BOLD GREEN');
    $color_personalmsg=color('YELLOW BOLD');

my $p=PerlMonksChat->new();
if ($user) {
  $p->login($user, $passwd);

my $s=IO::Select->new;

  while (1) {
    my @lines = map { s/^(<[^>]+>)/$color_username$1$color_normal/;
                wrap("", "\t", "$_\n") } $p->getnewlines(1);
    for (@lines) {
    my @ready=$s->can_read($period);
    if (@ready) {
      foreach (@ready) {
        my $line=<$_>;
        chomp $line;
        if ($line =~ /^\/?(checkoff|co)\s+/ && (my @ids=($line=~/(\d+)
+/g))) {
          $p->checkoff(map { 'deletemsg_'.$_ } @ids);
          print $color_sysmsg, "* Done *", $color_normal,"\n";
        elsif ($line =~ /^\s*\/quit\s*$/) {
        else {          $p->send($line);

sub speak_to_me($) {
    my $text = shift;
    $text =~ s/^.*?\s+//;
    request $festival "(SayText \"$text\")";

sub endit {
    print "Disconnecting from Festival: ";
    disconnect $festival;
Replies are listed 'Best First'.
RE: Monktalk
by KM (Priest) on Jun 07, 2000 at 21:58 UTC
    Just FYI.. I showed this to Kevin Lenzo (one of the Festival people) since it is always good to know how your software is being used. And he said 'neato!'. Just thought you would like to know the feedback :)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://15869]
[Discipulus]: my warmest comprehension karlgoethebier ;=(
[Discipulus]: yes LanX.. is so good to be appreciated (I fortunately have a big self estimation that compensate)
[LanX]: you can manipulate a html tree by addressing and replacing so called document objects (DOM) and from my experience the same methods can be used with any XML, though I didn't test all browsers yet
LanX just joking, playing "ego judo"
[marto]: good morning all
[Corion]: Hi marto!
[marto]: the race to the bottom continues, many people lost their job yesterday as a client moves to another outsourcer
[LanX]: brexit or perlxit ?
[Corion]: Ow, marto :-/ I hope you aren't affected (except for the looming dread of more work for the same pay)
[marto]: unrelated

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-03-23 09:54 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.