Monday, November 15, 2010

Festival Speech Synthesis and Codec2

Here'a a bash script that takes as its first argument a string of quoted text. It then passes this through the festival text-to-sound processor and plays two versions of the result. The first version is unprocessed; the second version has been encoded with codec2 and then decoded.

The results are generally impressive. But I hope this might be some help in improving the codec. For instance, the roughening of sibilants like 'sss' in English (which becomes something like a 'sh' under codec2) is easily reproduced with festival.

To use this script, change the first line to point to the directory in which your c2enc file resides, save the script as, say, '' and then issue the command 'chmod a+x' so that the script is executable. Then run it on the command line with ' "Salmon steaks grill beautifully."' You'll hear the non-codec2 version, then the codec2 version.

TFILEA="/tmp/$(basename $0).$$a.tmp"
TFILERAW="/tmp/$(basename $0).$$.raw"
echo $1 | text2wave | sox - -r 8000 -t raw -s -2 $TFILERAW 
play -r 8000 -t raw -s -2 $TFILERAW
du -sh $TFILEA
play -r 8000 -t raw -s -2 $TFILERAW

No comments:

Post a Comment