Tell me everything

brian_d_foy on 2002-11-17T09:27:50

Right after I posted my thoughts on speech multiplexers, I had another idea. Would perl errors be easier to deal with if Marlene Deitrich spoke them to me? I cannot actually do that a the moment, but that stuff Kevin Lenzo works on can probably create the voice and all that. I can; however, use one of the Mac's voices.

I wrote a simple program to speak whatever I give it as input. I set the MAC_VOICE environment variable to one of the voices in the Speech panel of System Preferences. I name the program "speak".

#!/usr/bin/perl

use Mac::Speech;

my $Default_voice = 'Victoria';

my $voice = $Mac::Speech::Voice{ $ENV{MAC_VOICE} || 'Victoria' }; my $channel = NewSpeechChannel($voice); SpeakText( $channel, '' );

while( <> ) { SpeakText( $channel, $_ ); sleep 1 while SpeechBusy(); } DisposeSpeechChannel($channel);


I created a perl program that would generate an error. Since I use strict, I have to declare all of my variables somehow. In this program I do not do that, so I should get an error.

#!/usr/bin/perl
use strict;

$x = 1;


When I run this program, I get an error. The particular error may vary by your version of Perl.

Global symbol "$x" requires explicit package name at bad.pl line 4.
Execution of bad.pl aborted due to compilation errors.


I redirect this to speak. Since perl errors show up on standard error I redirect that to standard output (2>&1) so I can pipe it to speak.

g3_brian[1121]$ perl bad.pl 2>&1 | speak


Is the error message any easier to take? Well, not really. I want to throttle the speaker, actually. Maybe I can experiment with the voice timing and whatnot to make it better.

Just for fun I redirected the text to an upcoming article into speak. Despite the goofy voice, I could understand most of the text. This could be really handy---instead of reading the article yet another time, I listen to it. The new experience should help me catch things I missed with my eyes.

Along the same lines, but for another day:

  • speaking Eliza
  • speaking IRC
  • speaking email
  • speaking regular expressions
  • speaking perl5db