<div class="gmail_quote">On Sat, Aug 28, 2010 at 3:22 AM, Jonas Kellens <span dir="ltr">&lt;<a href="mailto:jonas.kellens@telenet.be">jonas.kellens@telenet.be</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">






<div text="#000000" bgcolor="#ffffff">
<font face="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></font></div></blockquote><div>My guess is that your .wav file is NOT 8khz. The system doesn&#39;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&#39;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&#39;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 &quot;file convert $y/$i  $y/$x.g722&quot;<br><br>I&#39;m ignoring the siren &amp; 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&#39;t stick out against rest of Allison&#39;s existing recordings in Asterisk.<br>
Digium uses a filter program to &#39;heighten&#39; the sounds a little; That&#39;s the main reason, I think, that they<br>use the .raw format as an in-between. I&#39;ve been skipping this step, as it doesn&#39;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&#39;s sake, that you convert to all the possible<br>formats. Disk space is cheap, and you&#39;ll squeeze a little extra performance out of Asterisk by allowing<br>
it to pick the &#39;best&#39; 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></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div text="#000000" bgcolor="#ffffff"><font face="Helvetica, Arial, sans-serif">
<br>
Kind regards,<br>
<br>
Jonas.<br>
</font>
</div>

<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Steve Murphy<br>ParseTree Corp<br>
<br>