Skip to content

Instantly share code, notes, and snippets.

@otsuarez
Last active April 5, 2019 17:41
Show Gist options
  • Save otsuarez/b3f515252a85bdea244c to your computer and use it in GitHub Desktop.
Save otsuarez/b3f515252a85bdea244c to your computer and use it in GitHub Desktop.
hubot say

En la oficina cuando un colega no te atiende por IRC le pegas un grito y problema resuelto. Pero que pasa cuando estas trabajando remoto desde casa y no te atiende por IRC?

La solución es sencilla: darle voz al IRC

El bot que utilizamos es hubot, para el text2speech engine festival y se le agregan archivos de sonido en castellano.

instalar festival

sudo apt-get install festival festlex-cmu festlex-poslex festvox-kallpc16k \
libestools1.2 festvox-ellpc11k

instalar archivos en castellano

wget http://forja.guadalinex.org/frs/download.php/153/festvox-palpc16k_1.0-1_all.deb
wget http://forja.guadalinex.org/frs/download.php/152/festvox-sflpc16k_1.0.0_all.deb
sudo dpkg -i festvox-*

editar archivos

/usr/share/festival/voices.scm
/usr/share/festival/languages.scm 

Probar que funciona

echo '(SayText "hola mundo")' | festival --language spanish

darle permisos al servicio y reiniciarlo de ser necesario

sudo gpasswd -a www-data audio
sudo apache2 restart
exec = require('child_process').exec
module.exports = (robot)->
robot.respond /say (.*)/, (msg) ->
username="username=#{msg.message.user.name}"
speech = msg.match[1]
script='/bin/echo "(SayText \\"'+speech+'\\")" | festival --language spanish'
console.log("running "+script)
message=" #{msg.message.user.name} said ... " + speech + "\n"
room='#devops-es'
robot.messageRoom room, message
child = exec script, (error,stdout,stderr) ->
msg.send message
#msg.send " #{msg.message.user.name} said ... " + script + "\n"
--- languages.scm 2014-07-16 11:53:39.126747913 -0300
+++ /usr/share/festival/languages.scm 2014-07-16 12:01:41.690748990 -0300
@@ -131,8 +131,10 @@
"(language_spanish)
Set up language parameters for Castillian Spanish."
- (voice_el_diphone)
- (set! male1 (lambda () (voice_el_diphone)))
+ (voice_JuntaDeAndalucia_es_pa_diphone)
+ (set! male1 voice_JuntaDeAndalucia_es_pa_diphone)
+ ;;(voice_JuntaDeAndalucia_es_sf_diphone)
+ ;;(set! male1 voice_JuntaDeAndalucia_es_sf_diphone)
(Parameter.set 'Language 'spanish)
)
@@ -164,6 +166,6 @@
(print "Unsupported language, using English")
(language_british_english))))
-(defvar language_default language_british_english)
+(defvar language_default language_castillian_spanish)
(provide 'languages)
--- voices.scm 2014-07-16 11:52:57.490747823 -0300
+++ /usr/share/festival/voices.scm 2014-07-16 11:53:28.014747888 -0300
@@ -323,7 +323,9 @@
the default voice. [see Site initialization]")
(defvar default-voice-priority-list
- '(kal_diphone
+ '(JuntaDeAndalucia_es_pa_diphone
+ JuntaDeAndalucia_es_sf_diphone
+ kal_diphone
cmu_us_bdl_arctic_hts
cmu_us_jmk_arctic_hts
cmu_us_slt_arctic_hts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment