Festival (Português)

From ArchWiki
Jump to navigation Jump to search

Tango-preferences-desktop-locale.pngEsse artigo ou seção precisa de tradução.Tango-preferences-desktop-locale.png

Notas: Este artigo está sendo traduzido. (Discuta na Talk:Festival (Português)#)

Festival é um sistema geral de síntese de fala multilíngue desenvolvido no CSTR (Centre for Speech Technology Research).

O Festival oferece uma estrutura geral para a construção de sistemas de síntese de voz, incluindo exemplos de vários módulos. Como um todo, ele oferece texto completo para fala por meio de um número de APIs: do nível de shell, embora um interpretador de comandos Scheme, como uma biblioteca C ++, de Java e uma interface Emacs. O festival é multilíngue (atualmente inglês britânico, inglês americano, italiano, tcheco e espanhol, com outros idiomas disponíveis em protótipo).

Instalação

Instale o pacote festival. Você precisa de um pacote de voz como festival-english ou festival-us.

Teste festival:

$ echo "This is an example. Arch is the best." | festival --tts

Se você ouvir todo o texto do exemplo, você instalou com sucesso um sistema TTS.

Se você não ouvir nada, consulte a seção Solução de problemas. Se você tiver um sistema desktop, você quase certamente receberá uma mensagem sobre /dev/dsp e precisará seguir essas instruções.

Usando a extensão de IMS alemão para festival com mbrola

Você pode usar o pacote festival-imsAUR com os patches do IMS Stuttgart.

O Instituto de Processamento de Linguagem Natural (IMS) da Universidade de Stuttgart desenvolveu uma extensão ao festival especialmente para o idioma alemão. Ela usa vozes alemãs com mbrolaAUR. Para instalá-la, a extensão precisa ser baixada dos servidores da universidade (siga as instruções aqui) e o PKGBUILD precisa ser modificado.

Adicione esses dois arquivos baixados do IMS (NÃO use o terceiro arquivo, ims_german_1.3-os.fix.tgz)

 ims_german_1.3-os.tgz
 bomp_full.corr.tgz

com seus md5sums para a variável source e coloque-os na mesma pasta que o PKGBUILD. Na seção prepare(), inclua as seguintes linhas (no final da seção):

   # add ims config
   sed -i 's/ALSO_INCLUDE +=$/# IMS module for German\nALSO_INCLUDE += ims_german_text/' "$srcdir/festival/config/config.in"
   cat<<EOF >> "$srcdir/festival/lib/sitevars.scm"
 (set! mbrola-path "/usr/share/mbrola/")
 (set! mbrola_progname "/usr/bin/mbrola -e")
 EOF
   echo "(require 'ims_german_opensource)" >> "$srcdir/festival/lib/siteinit.scm"

Isso deve instalar o suporte para as vozes alemãs de1 até de4. Instale pelo menos uma dessas vozes, p.ex., mbrola-voices-de2AUR, e depois usá-lo no festival, selecionando a voz via

 (voice_german_de2_os)
 (SayText "Hallo Welt.")

no prompt ou use-o em text2wave via

 text2wave -o spoken.wav -eval '(voice_german_de2_os)' entrada.txt

sendo entrada.txt o nome do arquivo contendo o texto a ser processado.

Configuração

Não existe um arquivo de configuração global /etc, mas você pode configurar o festival com o seu arquivo ~/.festivalrc ou editando diretamente /usr/share/festival/festival.scm. Ambos são arquivos de esquema, usam sintaxe de esquema e são executados toda vez que o festival é executado.

Uso com um servidor de som

Para PulseAudio, adicione essas linhas ao final de seu arquivo ~/.festivalrc ou a /usr/share/festival/festival.scm:

(Parameter.set 'Audio_Required_Format 'aiff)
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Command "paplay $FILE --client-name=Festival --stream-name=Speech")

Para ALSA, use essas linhas (fonte):

(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")

Voz

Arch splits the set of official voices into festival-english and festival-us. The AUR has some others, in various states of maintenance which may or may not be currently working.

To see what voices you currently have installed and what your default is, go into the Festival shell (which is a scheme REPL) and type the following (some space added for clarity):

   $ festival
   
   Festival Speech Synthesis System 2.1:release November 2010
   Copyright (C) University of Edinburgh, 1996-2010. All rights reserved.
   
   clunits: Copyright (C) University of Edinburgh and CMU 1997-2010
   clustergen_engine: Copyright (C) CMU 2005-2010
   hts_engine: 
   The HMM-based speech synthesis system (HTS)
   hts_engine API version 1.04 (http://hts-engine.sourceforge.net/)
   Copyright (C) 2001-2010  Nagoya Institute of Technology
                 2001-2008  Tokyo Institute of Technology
   All rights reserved.
   For details type `(festival_warranty)'
   
   festival> voice_default 
   voice_cmu_us_slt_arctic_hts          ;;<-- THIS IS THE VOICE FESTIVAL SPEAKS WITH
   
   festival> default-voice-priority-list 
   (kal_diphone                         ;;<-- THIS IS THE HARD-CODED LIST OF VOICES FESTIVAL CAME PRE-AWARE OF
    cmu_us_bdl_arctic_hts
    cmu_us_jmk_arctic_hts
    cmu_us_slt_arctic_hts
    cmu_us_awb_arctic_hts
    ked_diphone
    don_diphone
    rab_diphone
    en1_mbrola
    us1_mbrola
    us2_mbrola
    us3_mbrola
    gsw_diphone
    el_diphone)
   
   festival> (voice_                    ;;<-- PRESS TAB HERE TO SEE WHAT VOICES FESTIVAL HAS AVAILABLE
   voice_cmu_us_slt_arctic_hts     voice_kal_diphone               voice_nitech_us_slt_arctic_hts  voice_reset
   voice_default                   voice_nitech_us_clb_arctic_hts  voice_rab_diphone
   
   festival> (voice_cmu_us_slt_arctic_hts) 
   cmu_us_slt_arctic_hts
   
   festival> (SayText "Arch makes me happy")
   #<Utterance 0x7fb5b8c423b0>
   
   festival> 

To permanently change the default voice you can add a line like this to the end of ~/.festivalrc:

(set! voice_default voice_cmu_us_slt_arctic_hts)

You cannot set the voice with festival.scm; to set voices globally, set order of searched voices in /usr/share/festival/voices.scm.

Patches de compatibilidade com HTS

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: festival-us comes with cmu_us_slt_arctic_hts (Discuss in Talk:Festival (Português)#)

Some say that HTS voices for Festival are the best ones freely available. Sadly they are not compatible with Festival >2.1 without patching it (and the new voice versions are not made available for downloading).

You can install the patched version from AUR: festival-patched-htsAUR and festival-hts-voices-patchedAUR

Instalação manual de voz

You can also get voices straight from festvox.org. In their downloads, the files named "festvox_*.tgz" each contain a different voice, as built by the festival team. They do work, but you will need to manually unzip and move the folder containing the voice to the appropriate place. On a recent Arch, the appropriate place is /usr/share/festival/voices/english/ and the way to tell what folder contains the voice is to look for a 'festvox/' subfolder inside of it.

You can then test that your new voices are found by loading up the festival prompt again.

Uso

Read a text file:

$ festival --tts /path/to/letter.txt

Be obnoxious while demonstrating piping

$ (echo "Get ready for some pain"; sudo cat /var/log/messages.log) | festival --tts

Convert a text file to mp3:

$ cat letter.txt | text2wave | lame - file.mp3 && mplayer file.mp3

Modo interativo (testar voz etc.)

festival has an interactive prompt you can use for testing. Some examples (with sample output):

$ festival 
[...]
festival> 

List available voices:

festival> (voice.list)
(cstr_us_awb_arctic_multisyn kal_diphone don_diphone)

Set voice:

festival> (voice_cstr_us_awb_arctic_multisyn)
#<voice 0x1545b90>

Speak:

festival> (SayText '"test this is a test oh no a test bla test")
inserting pause after: t.
Inserting pause
[...]
id _63 ; name t ; 
id _65 ; name # ; 
#<Utterance 0x7f7c0c144810>

More:

festival> help 
"The Festival Speech Synthesizer System: Help

Quit: ctrl+d or

festival> (quit)

Exemplo de script

One classic app that can make use of this is ping. Use this script to constantly ping a host, and return ping if success, fail if not:

#!/bin/bash
while :; do
    ping -c 1 $1 && (echo "Ping" | festival --tts) || (echo "Fail" | festival --tts)
done

Note that this does not really work on multisynth voices, as they take a while to prepare before playing.

Solução de problemas

Não é possível abrir /dev/dsp

If festival returns the following error message:

Linux: can't open /dev/dsp

See #Uso com um servidor de som above.

Alsa playing at wrong speed

If the solution above gives you a squeaky voice, you might want to try changing your aplay options:

(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Command "aplay -Dplug:default -f S16_LE -r $SR $FILE")

O comando aplay não funciona

Install alsa-utils.

Veja também