Leser: 1
2 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!c:\perl\bin\perl.exe use strict; use warnings; use Win32::SAPI5; use CGI; $| = 1; my $audiofile = 'test.wav'; my $q = new CGI(); my $text = $q->param('text') || qq(ein text, der zu lang ist, um ganz abgespielt zu werden); print $q->header("audio/x-wav"); # setup Microsoft Speech API my $stream = Win32::SAPI5::SpFileStream->new(); $stream->Open($audiofile, 3, 0); # 3 = SSFMCreateForWrite my $voice = Win32::SAPI5::SpVoice->new(); $voice->SetProperty(AudioOutputStream => $stream->GetObject); $voice->Speak($text); $stream->Close(); open my $fh, '<', $audiofile or die $!; binmode $fh; binmode STDOUT; while (<$fh>) { print } close($fh);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!c:\perl\bin\perl.exe use strict; use warnings; use Win32::SAPI5; use CGI; $| = 1; my $audiofile = 'test.wav'; my $q = new CGI(); my $text = $q->param('text') || qq(ein text, der zu lang ist, um ganz abgespielt zu werden); # setup Microsoft Speech API my $stream = Win32::SAPI5::SpFileStream->new(); $stream->Open($audiofile, 3, 0); # 3 = SSFMCreateForWrite my $voice = Win32::SAPI5::SpVoice->new(); $voice->SetProperty(AudioOutputStream => $stream->GetObject); $voice->Speak($text); $stream->Close(); my $size = (stat($audiofile))[7]; print $q->header(-type => "audio/x-wav", -Content_length => $size); open my $fh, '<', $audiofile or die $!; binmode $fh; binmode STDOUT; while (<$fh>) { print } close($fh);
2 Einträge, 1 Seite |