Good day to you.
In this article, I would like to consider a rake in the form of a text2wave script from the system kit for generating Festival voice on FreeBSD. I faced this problem when creating a voice menu in Asterisk using Festival.
Who is interested in cat.
')
Intro
Being engaged, for own development, deployment of IP-PBX Asterisk, reached the moment of voice generation. Given the built-in support for the Festival and a huge number of instructions available on the Internet, got down to business. Installed Festival from the ports. I downloaded and installed a Russian voice. I threw a menu with the Festival () team, and, oh, a miracle, it all worked. So here it is, as it rarely happens.
The problem arose with mobile clients. X-lite on WinCE and Nokia’s built-in client stubbornly refused to work with the resulting menu. The first tore up the session immediately, the second managed to get a couple of syllables, after which he, too, fell off.
Short searches have indicated an alternative to using the Festival () command in a dialplan. It was a call through AGI or through the System () script text2wave, saving the file with it, and after playing it with the commands Playback () or Background (). Armed with a pair of instructions, I immediately took action, and then I got a rake.
[root@AsteriskPV:/usr/local/share/festival/examples]# cp text2wave /usr/local/bin/
[root@AsteriskPV:/usr/local/share/festival/examples]# rehash
[root@AsteriskPV:/usr/local/share/festival/examples]# text2wave
WARNING
No default voice found in ("/usr/ports/audio/festival/work/festival/lib/voices/")
either no voices unpacked or voice-path is wrong
Scheme interpreter will work, but there is no voice to speak with.
WARNING
Rake
I think how so ... because there is a voice, it works fine ...
^C
[root@AsteriskPV:/usr/local/share/festival/examples]# text2wave
WARNING
No default voice found in ("/usr/ports/audio/festival/work/festival/lib/voices/")
either no voices unpacked or voice-path is wrong
Scheme interpreter will work, but there is no voice to speak with.
WARNING
I look more attentively, and I understand that somehow he does not catch voices from there. I climb into the script and find there a wonderful line
#!/bin/sh
"true" ; exec /usr/ports/audio/festival/work/festival/bin/festival --script $0 $*
That is, he refers to the folder in which he was going. Well, I think business and rule
#!/bin/sh
"true" ; exec /usr/local/bin/festival --script $0 $*
Run
[root@AsteriskPV:/usr/local/share/festival/examples]# text2wave
SIOD ERROR: unbound variable : Pâ–’
and break off.
In general, it should be noted that I watched this picture most of the day. It was more than useless to drag the script from the instructions; it will not work on FreeBSD. As well as the proposed method of launching Festival in server mode. So, everything as always, we take a dozen instructions and with the help of a file we force it to work. But we continue.
After a rather lengthy picking and blind poking, the understanding came from the work folder — it works, from / usr / local / bin — not.
A simple comparison showed a problem.
[root@AsteriskPV:/usr/local/share/festival/examples]# ll /usr/local/bin/festival
-r-xr-xr-x 1 root wheel 132 Nov 24 20:27 /usr/local/bin/festival
[root@AsteriskPV:/usr/local/share/festival/examples]# ll /usr/ports/audio/festival/work/festival/bin/festival
lrwxr-xr-x 1 root wheel 57 Nov 24 20:25 /usr/ports/audio/festival/work/festival/bin/festival -> /usr/ports/audio/festival/work/festival/src/main/festival
Run script and link to executable file. The results are naturally different. Well, let's get into the script.
[root@AsteriskPV:/usr/local/share/festival/examples]# cat /usr/local/bin/festival
#!/bin/sh
# path for audsp
PATH=/usr/local/libexec:$PATH
export PATH
exec festival.naked --libdir /usr/local/share/festival/lib $*
Mentally glue the scripts to run the Festival and to generate files using text2wave.
We get the following command
/usr/local/libexec/festival.naked --libdir /usr/local/share/festival/lib $* --script $0 $*
Any attempts and combinations of these two options lead to a confident result.
[root@AsteriskPV:/usr/local/share/festival/examples]# /usr/local/libexec/festival.naked --libdir /usr/local/share/festival/lib --script text2wave $*
SIOD ERROR: unbound variable : Pâ–’
If you remove the first parameter, the voice falls off, if the second voice is there but the Festival is loaded in the usual interactive mode.
Decision
The decision was obvious, but the implementation also took some time. the result was a small modification of the text2wave script
"true" ; exec /usr/ports/audio/festival/work/festival/bin/festival --script $0 $*
change to
"true" ; exec /usr/local/libexec/festival.naked --script /usr/local/bin/text2wave $*
but
(load (path-append libdir "init.scm"))
change to
(set! libdir '/usr/local/share/festival/lib)
(load (path-append libdir "init.scm"))
That's all. Now you can run
echo 123 | text2wave -o 123.ulaw -otype ulaw -
Well, it's natural to call, at least from System () at least from AGI.
As always, the solution was obvious and simple, just look at it.
Postscript number 1.
During the search, a solution was found for the bundle * of both the Festival and the
mailing list of Edinburgh University .
This is an
excerpt from the
mailing lists , pereposchennaya in a dozen places, obviously it was the best solution that they found.
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Rate 11025)
(Parameter.set 'Audio_Required_Format 'riff)
(Parameter.set 'Audio_Command "lame --quiet --preset voice $FILE - >> $HOME/festival-output.mp3")
Postscript number 2.
To run Festival in server mode, a rather controversial combination with the screen is used.
It looks like this:
[root@SIP:/home/admin]# cat /usr/local/etc/rc.d/festival
#!/bin/sh
. /etc/rc.subr
name="festival"
start_cmd="${name}_start"
stop_cmd=":"
festival_start()
{
screen -d -m -s /usr/local/etc/festivalst.sh
}
festival_stop()
{
killall festival.naked
killall screen
}
festival_restart()
{
killall festival.naked
killall screen
screen -d -m -s /usr/local/etc/festivalst.sh
}
#load_rc_config $name
run_rc_command "$1"
[root@SIP:/home/admin]# cat /usr/local/etc/festivalst.sh
festival --server