📜 ⬆️ ⬇️

Synthesis of Russian speech in Linux

I read an article about SAPI and Powershell ( Teaching PowerShell to talk ), and I wondered how the synthesis of Russian-speaking speech in my native OS, Linux'e. As it turned out, everything is far from being so rosy, and the quality of synthesis is far from Alena’s voice, but still.

For the synthesis of speech in linux, traditionally, Festival uses the latest stable version 1.95, but there is no Russian voice in the delivery, after a bit I came across a project to synthesize Russian through the Festival , where it is written that at least version 1.96 beta will be needed to work with Russian . Well, nothing in Ubuntu 9.04 is just that. Then there are two options, either build the package yourself, or put a separate package for Debian or Ubuntu users, this miracle weighs ~ 190 meters, so I would say. Since I have Ubuntu decided to put the package.
The package is called Festvox-ru , and will be available in ubuntu starting from version 9.10, since it is in the hands of 9.04, then we download the package and install it manually. And then a little problem came up.
When I tried to ask the festival to say something in Russian, he was simply silent, if the language was indicated
echo "" | festival --tts --language russian echo "" | festival --tts --language russian , then echo "" | festival --tts --language russian out with an error:
"Unsupported language, using English"
SIOD ERROR: unbound variable: voice_rab_diphone
festival: fatal error exiting.

Dams, try to do so as in the manual, start the festival interactively, specify the voice forcibly (voice_msu_ru_nsh_clunits) and ask to say something (SayText “Check”), voila, everything works fine, we put it in the form of bash script'a and get

#!/bin/sh
festival -b "(begin (voice_msu_ru_nsh_clunits) (SayText \"$1\" nil))"

')
Now we save it into the sayit.sh file, assign the rights to launch chmod a + x sayit.sh and check
./sayit.sh "Verification"
Hooray! everything is working.
If we want to read the file, use:

#!/bin/sh
festival -b "(begin (voice_msu_ru_nsh_clunits) (tts_file \"$1\" nil))"


But still, why did the Russian language not work by default? We dig further.
A little googling and we find bugreport to debian'ovtsami from Sergey Kirpichev, here is this bugreport . Looks like we need to fix the languages.scm / file
So go to the / usr / share / festival directory where we find this file and make changes.
We finish at the beginning:

(define (language_russian)
"(language_russian)
Set up language parameters for Russian."
(set! male1 voice_msu_ru_nsh_clunits)
(male1)
(Parameter.set 'Language 'russian)
)

and define (select_language language). add a couple of lines

((equal? language 'russian)
(language_russian))

Everything is now Russian language supported.
We try to read the file.
festival --language russian -tts festival.txt
Well, everything is not even so bad, the only “but” is what Festival quite clearly thinks before starting to pronounce, and sometimes he doesn’t like the text, for example, instead of missing what he cannot say, he falls out with the message about
LTS_Ruleset russian_downcase: no rule matches:
LTS_Ruleset: # * here * <a #
Well, that means you need to kill the link text.
So far, the result is not particularly pleasing to me, in principle, the synthesis of Russian speech under Linux on the one hand is possible, on the other hand the quality of this synthesis leaves much to be desired. And I had two new shell script. sayit.sh and readit.sh ^ _ ^
Examples of dubbing can be found in the article Learn the iPod Shuffle G3 to speak Russian

Sources used:

The art of programming in the shell script language
Russian in the Festival
New base for speech synthesis, and voice for festival
Debian Bug report logs - # 516262 festival: Please add support for --language russian
PS on the advice of rengel_system , instead of installing the package with handles, connect this repository
PPS on the advice of eugenex15 decided to try espeak. it is installed very simply, the Russian language is immediately out of the box, to save a voice sample, you can only add one parameter, but the quality seemed to me just awful. Perhaps you can build a pronunciation to get a more or less civil result, but I did not succeed.
PPPS laid out two examples of the synthesized phrase with default parameters in espeak and in festival
espeak
festival
(if anyone can suggest another place where it will be more convenient to put wav's, I will gladly use it)
UPD: Answer from habrauser vk2 voice of Alena

Source: https://habr.com/ru/post/60977/


All Articles