<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt"><div id="divSignature"></div>
<blockquote style="margin-right: 0px;" dir="ltr">
<div class="gmail_quote">On Sat, Aug 28, 2010 at 3:22 AM, Jonas Kellens <span dir="ltr"><<a href="mailto:jonas.kellens@telenet.be">jonas.kellens@telenet.be</a>></span> wrote:<br />
</div>
<blockquote class="gmail_quote" style="border-left: rgb(204,204,204) 1px solid; margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><span style="font-family: helvetica, arial, sans-serif;">Hello list,<br />
<br />
I have a file to be played in wav-format.<br />
<br />
I thought Asterisk would automatically take the wav-file and translate it to the codec used, but I see this :<br />
<br />
[Aug 28 11:16:29] WARNING[2705]: file.c:664 ast_openstream_full: File /var/lib/asterisk/sounds/vprompts/<b>zip-code.wav</b> does not exist in any format<br />
[Aug 28 11:16:29] WARNING[2705]: file.c:991 ast_streamfile: Unable to open /var/lib/asterisk/sounds/vprompts/<b>zip-code.wav</b> (format 0x8 (<b>alaw</b>)): No such file or directory<br />
[Aug 28 11:16:29] WARNING[2705]: pbx.c:5752 pbx_builtin_background: ast_streamfile failed on SIP/test1-0000000f for /var/lib/asterisk/sounds/vprompts/<b>zip-code.wav</b><br />
<br />
<br />
Am I missing a module to translate from wav to alaw/gsm/g726/... ??<br />
<br />
</span></div>
</blockquote></blockquote>
<div class="gmail_quote" dir="ltr">My guess is that your .wav file is NOT 8khz. The system doesn't accept anything but wav files at 8khz. Use <br />
sox to downsample to 8khz (and 1 chan), and the problems should go away. While you are at it, you could use sox to convert<br />
to the target format in a single operation.<br />
<br />
The scripts that Digium uses to take Allison's voice prompts (at 48khz) to the different formats, convert things to slin (raw) as a central<br />
format, but in my experience, the fewer steps the better. But I doubt that anyone could detect the difference in the end result...<br />
<br />
Here's what I do with CD-qual sounds to turn them into the common Asterisk formats:<br />
<br />
Assume $i is the name of the .wav file you want to convert:<br />
<br />
x=`basename $i .wav`<br />
sox -v 0.7 $i -r 16000 -c 1 -t sw $x.sln16<br />
sox -v 0.7 $i -r 8000 -c 1 -t sw $x.raw<br />
sox -r 8000 -c 1 -t sw $x.raw -t gsm $x.gsm ## OR ### sox -v 0.7 $i -r 8000 -t gsm $x.gsm<br />
sox -r 8000 -c 1 -t sw $x.raw -t ul $x.ulaw ## OR ### sox -v 0.7 $i -r 8000 -t ul $x.ulaw<br />
sox -r 8000 -c 1 -t sw $x.raw -t al $x.alaw ## OR ### sox -v 0.7 $i -r 8000 -t wav $x.wav<br />
rm $x.raw<br />
y=`pwd`<br />
sudo asterisk -rx "file convert $y/$i $y/$x.g722"<br />
<br />
I'm ignoring the siren & g729 formats; use asterisk for those in like format, depending on your asterisk version and codecs.<br />
Allison normalizes the volume of sounds she distributes; use the -v 0.7 to bring the volume down a bit to<br />
the standard, and your sounds won't stick out against rest of Allison's existing recordings in Asterisk.<br />
Digium uses a filter program to 'heighten' the sounds a little; That's the main reason, I think, that they<br />
use the .raw format as an in-between. I've been skipping this step, as it doesn't seem critical, in which<br />
case the direct conversion is probably preferable.<br />
<br />
I suggest, that if you are converting sounds for Asterisk's sake, that you convert to all the possible<br />
formats. Disk space is cheap, and you'll squeeze a little extra performance out of Asterisk by allowing<br />
it to pick the 'best' format. Dahdi type interfaces would prefer the ulaw/alaw formats; High-def phones<br />
like Snom (and appropriate Polycoms, etc) could use the g722. Ulaw and gsm transcodings are cheap,<br />
but no transcoding is cheaper still.<br />
<br />
murf<br />
<br />
Steve<br />
<br />
Thanks for sharing I appericate your insight as this is something I run up against as well. <br />
What about g729 we use this coded a lot what is the best method to transcode it it?<br />
<br />
Thanks<br />
Bryant<br />
</div></span>