martes, 15 de julio de 2014

Script instalación/configuración Conversor Texto a Voz - Jarvis

Como complemento a una entrada anterior, publicamos hoy un script de instalación y configuración del conversor de texto a voz que he llamado Jarvis.

Se trata de una combinación entre festival y mbrola, añadiendo una voz femenina (Silvia) generada por la gente de Guadalinex, el paquete .deb puedes descargarlo directamente desde este enlace: Descargar voz Femenina de Forja Guadalinex o si quieres descargar la versión definitiva anterior, hazlo desde este enlace (festvox-sflpc16k_1.0.0_all.deb).
 
El script lleva a cabo la instalación de los programas necesarios (aptitude para hacer las instalaciones, festival y mbrola como elementos de sintetización de voz), descarga automáticamente la última versión de la voz femenina creada en uno de los proyectos de Forja guadalinex, a continuación copia los archivos de configuración retocados previamente en la ubicación adecuada y finalmente, lanza un script de prueba para ver si todo ha sido instalado/configurado satisfactoriamente.

Preparativos para que todo funcione adecuadamente:

a) Crea una carpeta en tu home en la que debes alojar los scripts, los archivos de configuración y el .deb de la voz femenina.

b) Entra en dicha carpeta y crea en ella dos archivos voices.scm y languages.scm. Copia y pega en cada uno de ellos las líneas de configuración que se te facilitan más abajo. Esta configuración ya está preparada para reconocer la voz femenina que vamos a descargar.

c) Una vez tengas los dos archivos (voices y languages), copia el código fuente del instalador y llámalo instala.sh. Dale permisos de ejecución, pero no lo lances aún.

d) Copia el código fuente del script de prueba de sintetizador y llámalo jarvis.sh. Dale permisos de ejecución. No lo lances aún.

Antes de llevar a cabo la ejecución, asegúrate que en la carpeta que has creado se encuentran los siguientes archivos:

  • voices.scm (archivo de configuración de la voz)
  • languages.scm (archivo de configuración del lenguaje)
  • instala.sh (es el instalador)
  • jarvis.sh (script para probar el funcionamiento)

Realizando la ejecución:
Una vez tengas todos los elementos en la carpeta, lanza el script de instalación y supervisa los mensajes que te vaya mostrando por si existe algún problema con la versión de algún paquete o librería.

¿Qué es lo que ha ido ocurriendo?

  1. Si todo ha ido bien, se habrán instalado automáticamente: aptitude, festival y mbrola. 
  2. Se habrán descargado el paquete .deb y habrá sido instalado mediante dpkg. Este paquete será festvox-sflpc16k_1.0.0_all.deb (versión estable) o festvox-sflpc16k_1.0-1_all.deb (última versión que es la que se desarga en el script). 
  3. Se habrán copiado los archivos de configuración voices.scm y languages.scm a la carpeta de festival adecuada. 
  4. Y, finalmente, se habrá invocado al script de prueba del sintetizador (jarvis.sh), quedando a la espera de que teclees algo para reproducirlo por tu sistema de audio.

Ya sólo queda que modifiques, si tú quieres, el script de prueba para que diga lo que tú quieras. Y eso es todo, a partir de aquí os dejo el código fuente de los scripts, así como de los archivos de configuración retocados.



CÓDIGO FUENTE DEL INSTALADOR/CONFIGURADOR (instala.sh)

#!/bin/bash

#Script de instalación y configuración de
#sintetizador de voz Festival, combinado con
#Mbrola. Adicionalmente se instala el paquete
#de voz femenina de Guadalinex.
error=0
function aptitude()
{
    apt-get install aptitude
    if [ $? -eq 0 ]
    then
        echo "Aptitude instalado satisfactoriamente."
    else
        echo "Error al instalar aptitude."
        error=1
    fi
}

function festival()
{
    #Es posible que alguna de las librerías necesarias cambie de versión, por
    #lo que hay que estar antento a los posibles mensajes de error y warnings

    aptitude install festival festlex-cmu festlex-poslex festvox-kallpc16k libestools1.2 festvox-ellpc11k
    if [ $? -eq 0 ]
    then
        echo "Instalación satisfactoria de Festival."
    else
        echo "Error al instalar Festival."
        error=1
    fi
}

function mbrola()
{
    apt-get install mbrola
    if [ $? -eq 0 ]
    then
        echo "Instalación satisfactoria de mbrola."
    else
        echo "Error al instalar mbrola."
        error=1
    fi
}


function instala()
{
    echo "INSTALACIÓN"
    echo "PASO 1: Instalando aptitude..."
    aptitude
    if [ $error -eq 0 ]
    then
        echo "PASO 2: Instalando Festival..."       
        festival
        if [ $error -eq 0 ]
        then
            echo "PASO 3: Instalando mbrola..."
            mbrola
        fi
    else
        echo "Atención, existen errores previos."
        echo "La instalación se cancelará."
        exit 1
    fi
    echo "Instalación finalizada."
}

function instala_voz()
{

#Descargamos el paquete .deb de la voz femenina en la carpeta en la que nos encontramos

wget http://forja.guadalinex.org/frs/download.php/154/festvox-sflpc16k_1.0-1_all.deb

if [ -f festvox-sflpc16k_1.0-1_all.deb ]
then
    echo "Instalando voz femenina..."
    dpkg -i festvox-sflpc16k_1.0-1_all.deb
    if [ $? -eq 0 ]
    then
        echo "Instalación de voz satisfactoria."
    else
        echo "Error al instalar la voz."
    fi
else
    echo "Error, no existe el fichero de voz."
fi
}

function configura()
{
#En este instante se copiarán los archivos voices.scm y languages.scm
#de Festival ya preconfigurados, a la ubicación definitiva en /usr/share/festival
#y se realizará la instalación de la voz femenina
echo "CONFIGURACIÓN"

ruta="/usr/share/festival/"
echo "Copiando archivos de configuración..."
cp voices.scm $ruta
if [ $? -eq 0 ]
then
    echo "voices.scm copiado con éxito"
fi
cp languages.scm $ruta
if [ $? -eq 0 ]
then
    echo "voices.scm copiado con éxito"
fi
instala_voz
echo "Configuración finalizada."
}

if [ "$USERNAME" == "root" ]
then
    instala
    configura
    read -p "Pulsa una tecla para probar el sintetizador."
    clear
    echo "CONVERSIÓN DE TEXTO A VOZ - JARVIS"   
    echo "Para cerrar pulsa x"
    ./jarvis.sh
else
    clear
    echo "Lo siento, este script debe ejecutarse con privilegios de administrador"
    read -p "El script se cerrará..."
    exit 1
fi

CÓDIGO FUENTE DEL SCRIPT DE PRUEBA DEL SINTETIZADOR DE VOZ (jarvis.sh)

#!/bin/bash

frase=""
while [ "$frase" != "x" ]
do
    read -p "Frase: " frase
    if [ "$frase" != "x" ]   
    then   
        echo $frase | iconv -f utf-8 -t iso-8859-1 | festival --tts
    fi
done

echo "Sintetizador detenido" | iconv -f utf-8 -t iso-8859-1 | festival --tts

LÍNEAS DE CONFIGURACIÓN DEL ARCHIVO DE VOCES(voices.scm)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                                                                       ;;
;;;                Centre for Speech Technology Research                  ;;
;;;                     University of Edinburgh, UK                       ;;
;;;                       Copyright (c) 1996,1997                         ;;
;;;                        All Rights Reserved.                           ;;
;;;                                                                       ;;
;;;  Permission is hereby granted, free of charge, to use and distribute  ;;
;;;  this software and its documentation without restriction, including   ;;
;;;  without limitation the rights to use, copy, modify, merge, publish,  ;;
;;;  distribute, sublicense, and/or sell copies of this work, and to      ;;
;;;  permit persons to whom this work is furnished to do so, subject to   ;;
;;;  the following conditions:                                            ;;
;;;   1. The code must retain the above copyright notice, this list of    ;;
;;;      conditions and the following disclaimer.                         ;;
;;;   2. Any modifications must be clearly marked as such.                ;;
;;;   3. Original authors' names are not deleted.                         ;;
;;;   4. The authors' names are not used to endorse or promote products   ;;
;;;      derived from this software without specific prior written        ;;
;;;      permission.                                                      ;;
;;;                                                                       ;;
;;;  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ;;
;;;  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ;;
;;;  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ;;
;;;  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ;;
;;;  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ;;
;;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ;;
;;;  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ;;
;;;  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ;;
;;;  THIS SOFTWARE.                                                       ;;
;;;                                                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Preapre to access voices. Searches down a path of places.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define current-voice nil
  "current-voice
   The name of the current voice.")

;; The path to search for voices is created from the load-path with
;; an extra list of directories appended.

(defvar system-voice-path '("/usr/share/festival/voices/")
  "system-voice-path
   Additional directory not near the load path where voices can be
   found, this can be redefined in lib/sitevars.scm if desired.")

(defvar system-voice-path-multisyn '( )
  "system-voice-path-multisyn
   Additional directory not near the load path where multisyn voices can be
   found, this can be redefined in lib/sitevars.scm if desired.")

(defvar voice-path
  (remove-duplicates
   (append (mapcar (lambda (d) (path-append d "voices/")) load-path)
       (mapcar (lambda (d) (path-as-directory d)) system-voice-path)
       ))

  "voice-path
   List of places to look for voices. If not set it is initialised from
   load-path by appending \"voices/\" to each directory with
   system-voice-path appended.")

(defvar voice-path-multisyn
  (remove-duplicates
   (append (mapcar (lambda (d) (path-append d "voices-multisyn/")) load-path)
       (mapcar (lambda (d) (path-as-directory d)) system-voice-path-multisyn)
       ))

  "voice-path-multisyn
   List of places to look for multisyn voices. If not set it is initialised from
   load-path by appending \"voices-multisyn/\" to each directory with
   system-voice-path-multisyn appended.")


;; Declaration of voices. When we declare a voice we record the
;; directory and set up an autoload for the vocie-selecting function

(defvar voice-locations ()
  "voice-locations
   Association list recording where voices were found.")

(defvar voice-location-trace nil
  "voice-location-trace
   Set t to print voice locations as they are found")

(define (voice-location name dir doc)
  "(voice-location NAME DIR DOCSTRING)
   Record the location of a voice. Called for each voice found on voice-path.
   Can be called in site-init or .festivalrc for additional voices which
   exist elsewhere."
  (let ((func_name (intern (string-append "voice_" name)))
    )

    (set! name (intern name))
    (set! voice-locations (cons (cons name dir) voice-locations))
    (eval (list 'autoload func_name (path-append dir "festvox/" name) doc))
    (if voice-location-trace
    (format t "Voice: %s %s\n" name dir)
    )
    )
  )

(define (voice-location-multisyn name rootname dir doc)
  "(voice-location NAME ROOTNAME DIR DOCSTRING)
   Record the location of a voice. Called for each voice found on voice-path.
   Can be called in site-init or .festivalrc for additional voices which
   exist elsewhere."
  (let ((func_name (intern (string-append "voice_" name)))
    )

    (set! name (intern name))
    (set! voice-locations (cons (cons name dir) voice-locations))
    (eval (list 'autoload func_name (path-append dir "festvox/" rootname) doc))
    (if voice-location-trace
    (format t "Voice: %s %s\n" name dir)
    )
    )
  )



(define (current_voice_reset)
"(current_voice_reset)
This function is called at the start of defining any new voice.
It is design to allow the previous voice to reset any global
values it has messed with.  If this variable value is nil then
the function wont be called.")

(define (voice_reset)
"(voice_reset)
This resets all variables back to acceptable values that may affect
voice generation.  This function should always be called at the
start of any function defining a voice.  In addition to reseting
standard variables the function current_voice_reset will be called.
This should always be set by the voice definition function (even
if it does nothing).  This allows voice specific changes to be reset
when a new voice is selection.  Unfortunately I can't force this
to be used."
   (Parameter.set 'Duration_Stretch 1.0)
   (set! after_synth_hooks default_after_synth_hooks)

   ;; The follow are reset to allow existing voices to continue
   ;; to work, new voices should be setting these explicitly
   (Parameter.set 'Token_Method 'Token_English)
   (Parameter.set 'POS_Method Classic_POS)
   (Parameter.set 'Phrasify_Method Classic_Phrasify)
   (Parameter.set 'Word_Method Classic_Word)
   (Parameter.set 'Pause_Method Classic_Pauses)
   (Parameter.set 'PostLex_Method Classic_PostLex)

   (set! diphone_module_hooks nil)
   (set! UniSyn_module_hooks nil)

   (if current_voice_reset
       (current_voice_reset))
   (set! current_voice_reset nil)
)


(defvar Voice_descriptions nil
  "Internal variable containing list of voice descriptions as
decribed by proclaim_voice.")

(define (proclaim_voice name description)
"(proclaim_voice NAME DESCRIPTION)
Describe a voice to the systen.  NAME should be atomic name, that
conventionally will have voice_ prepended to name the basic selection
function.  OPTIONS is an assoc list of feature and value and must
have at least features for language, gender, dialect and
description.  The first there of these are atomic, while the description
is a text string describing the voice."
  (let ((voxdesc (assoc name Voice_descriptions)))
    (if voxdesc
    (set-car! (cdr voxdesc) description)
    (set! Voice_descriptions
          (cons (list name description) Voice_descriptions))))
)

(define (voice.description name)
"(voice.description NAME)
Output description of named voice.  If the named voice is not yet loaded
it is loaded."
  (let ((voxdesc (assoc name Voice_descriptions))
    (cv current-voice))
    (if (null voxdesc)
    (unwind-protect
     (begin
       (voice.select name)
       (voice.select cv) ;; switch back to current voice
       (set! voxdesc (assoc name Voice_descriptions)))))
    (if voxdesc
       voxdesc
       (begin
     (format t "SIOD: unknown voice %s\n" name)
     nil))))

(define (voice.select name)
"(voice.select NAME)
Call function to set up voice NAME.  This is normally done by
prepending voice_ to NAME and call it as a function."
  (eval (list (intern (string-append "voice_" name)))))

(define (voice.describe name)
"(voice.describe NAME)
Describe voice NAME by saying its description.  Unfortunately although
it would be nice to say that voice's description in the voice itself
its not going to work cross language.  So this just uses the current
voice.  So here we assume voices describe themselves in English
which is pretty anglo-centric, shitsurei shimasu."
  (let ((voxdesc (voice.description name)))
    (let ((desc (car (cdr (assoc 'description (car (cdr voxdesc)))))))
      (cond
       (desc (tts_text desc nil))
       (voxdesc
    (SayText
     (format nil "A voice called %s exist but it has no description"
         name)))
       (t
    (SayText
     (format nil "There is no voice called %s defined" name)))))))

(define (voice.list)
"(voice.list)
List of all (potential) voices in the system.  This checks the voice-location
list of potential voices found be scanning the voice-path at start up time.
These names can be used as arguments to voice.description and
voice.describe."
   (mapcar car voice-locations))

;; Voices are found on the voice-path if they are in directories of the form
;;        DIR/LANGUAGE/NAME

(define (search-for-voices)
  "(search-for-voices)
   Search down voice-path to locate voices."

  (let ((dirs voice-path)
    (dir nil)
    languages language
    voices voicedir voice
    )
    (while dirs
     (set! dir (car dirs))
     (setq languages (directory-entries dir t))
     (while languages
       (set! language (car languages))
       (set! voices (directory-entries (path-append dir language) t))
       (while voices
     (set! voicedir (car voices))
     (set! voice (path-basename voicedir))
     (if (string-matches voicedir ".*\\..*")
         nil
         (voice-location
          voice
          (path-as-directory (path-append dir language voicedir))
          "voice found on path")
         )
     (set! voices (cdr voices))
     )
       (set! languages (cdr languages))
       )
     (set! dirs (cdr dirs))
     )
    )
  )

;; A single file is allowed to define multiple multisyn voices, so this has
;; been adapted for this. Rob thinks this is just evil, but couldn't think
;; of a better way.
(define (search-for-voices-multisyn)
  "(search-for-voices-multisyn)
   Search down multisyn voice-path to locate multisyn voices."
  (let ((dirs voice-path-multisyn)
    (dir nil)
    languages language
    voices voicedir voice voice-list
    )
    (while dirs
     (set! dir (car dirs))
     (set! languages (directory-entries dir t))
     (while languages
       (set! language (car languages))
       (set! voices (directory-entries (path-append dir language) t))
       (while voices
     (set! voicedir (car voices))
     (set! voice (path-basename voicedir))
     (if (string-matches voicedir ".*\\..*")
         nil
         (begin
           ;; load the voice definition file, but don't evaluate it!
           (set! voice-def-file (load (path-append dir language voicedir "festvox"
                               (string-append voicedir ".scm")) t))
           ;; now find the "proclaim_voice" lines and register these voices.
           (mapcar
        (lambda (line)
          (if (string-matches (car line) "proclaim_voice")
              (voice-location-multisyn (intern (cadr (cadr line)))  voicedir (path-append dir language voicedir) "registerd multisyn voice")))
        voice-def-file)
         ))
     (set! voices (cdr voices)))
       (set! languages (cdr languages)))
     (set! dirs (cdr dirs)))))

(search-for-voices)
(search-for-voices-multisyn)

;; We select the default voice from a list of possibilities. One of these
;; had better exist in every installation.

(define (no_voice_error)
  (format t "\nWARNING\n")
  (format t "No default voice found in %l\n" voice-path)
  (format t "either no voices unpacked or voice-path is wrong\n")
  (format t "Scheme interpreter will work, but there is no voice to speak with.\n")
  (format t "WARNING\n\n"))

(defvar voice_default 'no_voice_error
 "voice_default
A variable whose value is a function name that is called on start up to
the default voice. [see Site initialization]")

(defvar default-voice-priority-list
  '(JuntaDeAndalucia_es_sf_diphone
    kal_diphone
    cmu_us_bdl_arctic_hts
    cmu_us_jmk_arctic_hts
    cmu_us_slt_arctic_hts
    cmu_us_awb_arctic_hts
;    cstr_rpx_nina_multisyn       ; restricted license (lexicon)
;    cstr_rpx_jon_multisyn       ; restricted license (lexicon)
;    cstr_edi_awb_arctic_multisyn ; restricted license (lexicon)
;    cstr_us_awb_arctic_multisyn
    ked_diphone
    don_diphone
    rab_diphone
    en1_mbrola
    us1_mbrola
    us2_mbrola
    us3_mbrola
    gsw_diphone  ;; not publically distributed
    el_diphone
    )
  "default-voice-priority-list
   List of voice names. The first of them available becomes the default voice.")

(let ((voices default-voice-priority-list)
      voice)
  (while (and voices (eq voice_default 'no_voice_error))
     (set! voice (car voices))
     (if (assoc voice voice-locations)
         (set! voice_default (intern (string-append "voice_" voice)))
         )
     (set! voices (cdr voices))
     )
  )


(provide 'voices)

LÍNEAS DE CONFIGURACIÓN DEL ARCHIVO DE LENGUAJES (languages.scm)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                                                                       ;;
;;;                Centre for Speech Technology Research                  ;;
;;;                     University of Edinburgh, UK                       ;;
;;;                       Copyright (c) 1996,1997                         ;;
;;;                        All Rights Reserved.                           ;;
;;;                                                                       ;;
;;;  Permission is hereby granted, free of charge, to use and distribute  ;;
;;;  this software and its documentation without restriction, including   ;;
;;;  without limitation the rights to use, copy, modify, merge, publish,  ;;
;;;  distribute, sublicense, and/or sell copies of this work, and to      ;;
;;;  permit persons to whom this work is furnished to do so, subject to   ;;
;;;  the following conditions:                                            ;;
;;;   1. The code must retain the above copyright notice, this list of    ;;
;;;      conditions and the following disclaimer.                         ;;
;;;   2. Any modifications must be clearly marked as such.                ;;
;;;   3. Original authors' names are not deleted.                         ;;
;;;   4. The authors' names are not used to endorse or promote products   ;;
;;;      derived from this software without specific prior written        ;;
;;;      permission.                                                      ;;
;;;                                                                       ;;
;;;  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ;;
;;;  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ;;
;;;  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ;;
;;;  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ;;
;;;  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ;;
;;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ;;
;;;  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ;;
;;;  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ;;
;;;  THIS SOFTWARE.                                                       ;;
;;;                                                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  Specification of voices and some major choices of synthesis
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  This should use some sort of database description for voices so
;;;  new voices will become automatically available.
;;;

(define (language_british_english)
"(language_british_english)
Set up language parameters for British English."
  (require 'voices)
  ;;  Will get more elaborate, with different choices of voices in language

  (set! male1 (lambda () (voice_rab_diphone)))
  (set! male2 (lambda () (voice_don_diphone)))
  (if (symbol-bound? 'voice_gsw_diphone)
      (set! male3 voice_gsw_diphone))
  (if (symbol-bound? 'voice_gsw_450)
      (set! male4 voice_gsw_450))

  (male1)
  (Parameter.set 'Language 'britishenglish)
)


(define (language_italian)
"(language_italian)
Set up language parameters for Italian."

  (if (symbol-bound? 'voice_lp_diphone)
      (set! female1 (lambda () (voice_lp_diphone))))
  (set! male1 (lambda () (voice_pc_diphone)))

  (male1)
  (Parameter.set 'Language 'italian)
)


(define (language_american_english)
"(language_american_english)
Set up language parameters for Aemerican English."

  (if (symbol-bound? 'voice_kal_diphone)
      (set! female1 (lambda () (voice_kal_diphone))))
  (set! male1 (lambda () (voice_ked_diphone)))

  (male1)
  (Parameter.set 'Language 'americanenglish)
)

(define (language_finnish)
"(language_finnish)
Set up language parameters for Finnish."
  (if (symbol-bound? 'voice_suo_fi_lj_diphone)
      (set! female1 (lambda () (voice_suo_fi_lj_diphone))))
  (set! male1 (lambda () (voice_hy_fi_mv_diphone)))

  (male1)
  (Parameter.set 'Language 'finnish)
)

(define (language_czech)
"(language_czech)
Set up language parameters for Czech."
   (set! male1 (lambda () (voice_czech_ph)))
   (male1)
   (Parameter.set 'Language 'czech)
)

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

(define (language_scots_gaelic)
"(language_scots_gaelic)
Set up language parameters for Scots Gaelic."
  (error "Scots Gaelic not yet supported.")

  (Parameter.set 'Language 'scotsgaelic)
)

(define (language_welsh)
"(language_welsh)
Set up language parameters for Welsh."

  (set! male1 (lambda () (voice_welsh_hl)))

  (male1)
  (Parameter.set 'Language 'welsh)
)

(define (language_castillian_spanish)
"(language_spanish)
Set up language parameters for Castillian Spanish."

  ;;(voice_el_diphone)
  ;;(set! male1 (lambda () (voice_el_diphone)))

(voice_JuntaDeAndalucia_es_sf_diphone)
(set! male1 voice_JuntaDeAndalucia_es_sf_diphone)

  (Parameter.set 'Language 'spanish)
)

(define (select_language language)
  (cond
   ((or (equal? language 'britishenglish)
    (equal? language 'english))  ;; we all know its the *real* English
    (language_british_english))
   ((equal? language 'americanenglish)
    (language_american_english))
   ((equal? language 'scotsgaelic)
    (language_scots_gaelic))
   ((equal? language 'welsh)
    (language_welsh))
   ((equal? language 'italian)
    (language_italian))
   ((equal? language 'spanish)
    (language_castillian_spanish))
   ((equal? language 'finnish)
    (language_finnish))
   ((equal? language 'czech)
    (language_czech))
   ((equal? language 'klingon)
    (language_klingon))
   ((equal? language 'russian)
    (language_russian))
   (t
    (print "Unsupported language, using English")
    (language_british_english))))

;;(defvar language_default language_british_english)
(defvar language_default language_castillian_spanish)
(provide 'languages)




No hay comentarios: