Playing with audio files

Found a really cool website…. http://elvis.naturalvoices.com/demos/index.html
AT&T Text-to-speech engine with natural voices in US English, UK English, Spanish, German and French. Unfortunately its only good for 30 words so I needed a way to concatenate .wav files and then resample them at lower rates.

MORE…

**Concatenate wav files**

Copy and paste this script into a file called catwav in /usr/local/bin. Make it executable with the command chmod 755 /usr/local/bin/catwav.

#!/bin/sh
sox $1 -r 44100 -c 2 -s -w /tmp/$$-1.raw
sox $2 -r 44100 -c 2 -s -w /tmp/$$-2.raw
cat /tmp/$$-1.raw /tmp/$$-2.raw > /tmp/$$.raw
sox -r 44100 -c 2 -s -w /tmp/$$.raw $3
rm /tmp/$$*.raw

The correct syntax is:

catwav file1.wav file2.wav outputfile.wav

**Resample files using sox**

Converting your WAV files to good GSM files is easier than you might think if you have the program Sox installed. From the shell prompt, enter this command:

sox foo.wav -r 8000 foo.gsm resample -ql

and hit the key. In a few moments you will have a new GSM format file in the same directory as the original WAV file. In this example “foo.wav” is your main voice menu audio file in WAV format, and “foo.gsm” is the same file converted to GSM format. If you wanted to, you could use “main-voice-menu.gsm” as the name in place of “foo.gsm”: what matters here is the second file name you use in this command ends in “.gsm”.

If your WAV file was in stereo, add the -c1 option to convert to mono, or the output will sound very strange.

sox foo.wav -r 8000 -c1 foo.gsm resample -ql

You may get better results if you record your WAV file in 16 bit 8000 Hz mono and then run

sox foo.wav foo.gsm

If you have multiple WAV files in one directory and you want to convert them all, use this command:

for a in *.wav; do sox $a -r 8000 -c1 `echo $a|sed -e s/wav//`gsm resample -ql; done

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s