Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # start gnuchess in backpipe
- while [ 42 ] ; do nc -l -p 7777 0<backpipe | gnuchess 1>backpipe; done
- # start julius stt-daemon
- ./julius -quiet -input mic -C julian.jconf
- #start festival tts-daemon
- festival -b '(voice_msu_ru_nsh_clunits)' --server &>/dev/null
- echo "Вам мат" | festival --language russian --tts
- #------------voice_in_gnuchess.pl------------------
- #!/usr/bin/perl
- while (<ARGV>)
- {
- $linr = $_ if /sentence1/;
- @string = split(/<s>/,$linr);
- $string[1]=~s/<\/s>//g;
- $fraza = $string[1];
- print $fraza;
- #system("echo '$fraza' | festival --tts");
- $linr="";
- #---------------------------------------------------
- #------------_# wave2flac.sh #_-----------------
- #!/bin/sh
- rm -r $1.flac
- arecord -d1 -r 8000 -t wav $1.wav
- ffmpeg -i $1.wav -ab 96 -ar 8000 $1.flac
- -------------EOF----------------------------
- --------------------# out_gnuchess.pl #---------
- #!/usr/bin/perl
- use Socket;
- use IO::Handle;
- use IO::Socket;
- use Text::Iconv;
- use locale;
- $srv_ip="127.0.0.1";
- $srv_port="7777";
- $EOL = "\015\012";
- #$conv = Text::Iconv->new('windows-1251','utf-8');
- #$conv = Text::Iconv->new('windows-1251', 'koi8-r');
- #$conv = Text::Iconv->new('koi8-r','utf-8');
- #$conv = Text::Iconv->new('utf-8','koi8-r');
- socket(SERVER,PF_INET,SOCK_STREAM,getprotobyname('tcp'));
- $server_addr=inet_aton("$srv_ip");
- $paddr=sockaddr_in($srv_port,$server_addr);
- connect(SERVER,$paddr);
- SERVER->autoflush(1);
- print "Connected successfully\n";
- while (){
- $lin = <STDIN>;
- print SERVER $lin;
- $l=0;
- while ($l eq 0){
- $lout=<SERVER>;
- $l = grep(/^My/, $lout);
- if ($lout=~/^My/){
- @str=split(/:/,$lout);
- print $lout;
- $lout_ru=&translit($str[1]);
- # $lout_ru=&tr2k8($str[1]);
- print "ru = $lout_ru\n";
- # $lout_iconv= $conv->convert($lout_ru);
- # print "iconv = $lout_iconv";
- &speak($lout_ru);
- }
- if ($lout=~/^Ill/){
- print $lout;
- $l=1;
- }
- }
- }
- close(SERVER);
- exit;
- sub translit
- {
- ($_)=@_;
- s/A/А/g; s/a/а/g;
- s/B/БЭ/g; s/b/бэ/g;
- s/C/ЦЭ/g; s/c/цэ/g;
- s/D/ДЭ/g; s/d/дэ/g;
- s/E/Е/g; s/e/е/g;
- s/F/ЭФФ/g; s/f/эфф/g;
- s/G/ДЖЭ/g; s/g/джэ/g;
- s/H/АШ/g; s/h/аш/g;
- #my $text = shift;
- #$text=~ y/\x00-\x7F/\x80-\xFF/;
- #$text =~ y/abvgdeezijklmnoprstufh/'абвгдеёзийклмнопрстуфх'/;
- #$text =~ y/ABVGDEEZIJKLMNOPRSTUFH/'АБВГДЕЁЗИЙКЛМНОПРСТУФХ'/;
- return $_;
- }
- sub tr2k8
- { ($_)=@_;
- s/E\'/Э/g; s/e\'/э/g;
- s/E/Е/g; s/e/е/g;
- s/Jo/Ё/g; s/jo/ё/g;
- s/J\'o/Йо/g; s/j\'o/йо/g; s/J\'O/ЙО/g;
- s/Sch/Щ/g; s/sch/щ/g;
- s/Sc\'h/Сцх/g; s/sc\'h/сцх/g; s/SC\'H/СЦХ/g;
- s/Ch/Ч/g; s/ch/ч/g;
- s/C\'h/Цх/g; s/c\'h/цх/g; s/C\'H/ЦХ/g;
- s/Sh/Ш/g; s/sh/ш/g;
- s/S\'h/Сх/g; s/s\'h/сх/g; s/S\'H/СХ/g;
- s/Ja/Я/g; s/ja/я/g;
- s/J\'a/Йа/g; s/j\'a/йа/g; s/J\'A/ЙА/g;
- s/Zh/Ж/g; s/zh/ж/g;
- s/Z\'h/Зх/g; s/z\'h/зх/g; s/Z\'H/ЗХ/g;
- s/Ju/Ю/g; s/ju/ю/g;
- s/J\'u/Йу/g; s/j\'u/йу/g; s/J\'U/ЙУ/g;
- tr/
- abvgdzijklmnoprstufhc\"y\'ABVGDZIJKLMNOPRSTUFHC\"Y\'/
- абвгдзийклмнопрстуфхцъыьАБВГДЗИЙКЛМHОПРСТУФХЦЪЫЬ/;
- return $_;
- }
- sub speak($lout_ru){
- system("echo '$lout_ru' |iconv -f utf-8 -t windows-1251");
- #system("espeak '$lout'");
- system("echo '$lout_ru' |iconv -f windows-1251 -t utf-8 | festival --language russian --tts");
- }
- #-----------------------EOF------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement