Jonas Kellens
2010-Aug-28 09:22 UTC
[asterisk-users] Asterisk does not translate from wav to alaw
Hello list, I have a file to be played in wav-format. I thought Asterisk would automatically take the wav-file and translate it to the codec used, but I see this : [Aug 28 11:16:29] WARNING[2705]: file.c:664 ast_openstream_full: File /var/lib/asterisk/sounds/vprompts/*zip-code.wav* does not exist in any format [Aug 28 11:16:29] WARNING[2705]: file.c:991 ast_streamfile: Unable to open /var/lib/asterisk/sounds/vprompts/*zip-code.wav* (format 0x8 (*alaw*)): No such file or directory [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/*zip-code.wav* Am I missing a module to translate from wav to alaw/gsm/g726/... ?? Kind regards, Jonas. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100828/7abc08b8/attachment.htm
Tilghman Lesher
2010-Aug-28 14:31 UTC
[asterisk-users] Asterisk does not translate from wav to alaw
On Saturday 28 August 2010 04:22:18 Jonas Kellens wrote:> Hello list, > > I have a file to be played in wav-format. > > I thought Asterisk would automatically take the wav-file and translate > it to the codec used, but I see this : > > [Aug 28 11:16:29] WARNING[2705]: file.c:664 ast_openstream_full: File > /var/lib/asterisk/sounds/vprompts/*zip-code.wav* does not exist in any > format > [Aug 28 11:16:29] WARNING[2705]: file.c:991 ast_streamfile: Unable to > open /var/lib/asterisk/sounds/vprompts/*zip-code.wav* (format 0x8 > (*alaw*)): No such file or directory > [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/*zip-code.wav* > > > Am I missing a module to translate from wav to alaw/gsm/g726/... ??Please drop the ".wav" extension from the Playback/Background. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org
Steve Murphy
2010-Aug-28 14:33 UTC
[asterisk-users] Asterisk does not translate from wav to alaw
On Sat, Aug 28, 2010 at 3:22 AM, Jonas Kellens <jonas.kellens at telenet.be>wrote:> Hello list, > > I have a file to be played in wav-format. > > I thought Asterisk would automatically take the wav-file and translate it > to the codec used, but I see this : > > [Aug 28 11:16:29] WARNING[2705]: file.c:664 ast_openstream_full: File > /var/lib/asterisk/sounds/vprompts/*zip-code.wav* does not exist in any > format > [Aug 28 11:16:29] WARNING[2705]: file.c:991 ast_streamfile: Unable to open > /var/lib/asterisk/sounds/vprompts/*zip-code.wav* (format 0x8 (*alaw*)): No > such file or directory > [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/*zip-code.wav* > > > Am I missing a module to translate from wav to alaw/gsm/g726/... ?? > > My guess is that your .wav file is NOT 8khz. The system doesn't acceptanything but wav files at 8khz. Use 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 to the target format in a single operation. 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 format, but in my experience, the fewer steps the better. But I doubt that anyone could detect the difference in the end result... Here's what I do with CD-qual sounds to turn them into the common Asterisk formats: Assume $i is the name of the .wav file you want to convert: x=`basename $i .wav` sox -v 0.7 $i -r 16000 -c 1 -t sw $x.sln16 sox -v 0.7 $i -r 8000 -c 1 -t sw $x.raw 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 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 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 rm $x.raw y=`pwd` sudo asterisk -rx "file convert $y/$i $y/$x.g722" I'm ignoring the siren & g729 formats; use asterisk for those in like format, depending on your asterisk version and codecs. Allison normalizes the volume of sounds she distributes; use the -v 0.7 to bring the volume down a bit to the standard, and your sounds won't stick out against rest of Allison's existing recordings in Asterisk. Digium uses a filter program to 'heighten' the sounds a little; That's the main reason, I think, that they use the .raw format as an in-between. I've been skipping this step, as it doesn't seem critical, in which case the direct conversion is probably preferable. I suggest, that if you are converting sounds for Asterisk's sake, that you convert to all the possible formats. Disk space is cheap, and you'll squeeze a little extra performance out of Asterisk by allowing it to pick the 'best' format. Dahdi type interfaces would prefer the ulaw/alaw formats; High-def phones like Snom (and appropriate Polycoms, etc) could use the g722. Ulaw and gsm transcodings are cheap, but no transcoding is cheaper still. murf> Kind regards, > > Jonas. > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- Steve Murphy ParseTree Corp -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100828/3c6a437d/attachment.htm
Bryant Zimmerman
2010-Aug-28 15:35 UTC
[asterisk-users] Asterisk does not translate from wav to alaw
On Sat, Aug 28, 2010 at 3:22 AM, Jonas Kellens <jonas.kellens at telenet.be> wrote: Hello list, I have a file to be played in wav-format. I thought Asterisk would automatically take the wav-file and translate it to the codec used, but I see this : [Aug 28 11:16:29] WARNING[2705]: file.c:664 ast_openstream_full: File /var/lib/asterisk/sounds/vprompts/zip-code.wav does not exist in any format [Aug 28 11:16:29] WARNING[2705]: file.c:991 ast_streamfile: Unable to open /var/lib/asterisk/sounds/vprompts/zip-code.wav (format 0x8 (alaw)): No such file or directory [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/zip-code.wav Am I missing a module to translate from wav to alaw/gsm/g726/... ?? My guess is that your .wav file is NOT 8khz. The system doesn't accept anything but wav files at 8khz. Use 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 to the target format in a single operation. 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 format, but in my experience, the fewer steps the better. But I doubt that anyone could detect the difference in the end result... Here's what I do with CD-qual sounds to turn them into the common Asterisk formats: Assume $i is the name of the .wav file you want to convert: x=`basename $i .wav` sox -v 0.7 $i -r 16000 -c 1 -t sw $x.sln16 sox -v 0.7 $i -r 8000 -c 1 -t sw $x.raw 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 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 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 rm $x.raw y=`pwd` sudo asterisk -rx "file convert $y/$i $y/$x.g722" I'm ignoring the siren & g729 formats; use asterisk for those in like format, depending on your asterisk version and codecs. Allison normalizes the volume of sounds she distributes; use the -v 0.7 to bring the volume down a bit to the standard, and your sounds won't stick out against rest of Allison's existing recordings in Asterisk. Digium uses a filter program to 'heighten' the sounds a little; That's the main reason, I think, that they use the .raw format as an in-between. I've been skipping this step, as it doesn't seem critical, in which case the direct conversion is probably preferable. I suggest, that if you are converting sounds for Asterisk's sake, that you convert to all the possible formats. Disk space is cheap, and you'll squeeze a little extra performance out of Asterisk by allowing it to pick the 'best' format. Dahdi type interfaces would prefer the ulaw/alaw formats; High-def phones like Snom (and appropriate Polycoms, etc) could use the g722. Ulaw and gsm transcodings are cheap, but no transcoding is cheaper still. murf Steve Thanks for sharing I appericate your insight as this is something I run up against as well. What about g729 we use this coded a lot what is the best method to transcode it it? Thanks Bryant -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100828/6d395db2/attachment.htm
Tilghman Lesher
2010-Aug-28 15:52 UTC
[asterisk-users] Asterisk does not translate from wav to alaw
On Saturday 28 August 2010 10:35:59 Bryant Zimmerman wrote:> Thanks for sharing I appericate your insight as this is something I run up > against as well. > What about g729 we use this coded a lot what is the best method to > transcode it it?If you load "res_convert.so", you will have a CLI command "file convert ...". Usage: file convert <file_in> <file_out> Convert from file_in to file_out. If an absolute path is not given, the default Asterisk sounds directory will be used. Example: file convert tt-weasels.gsm tt-weasels.ulaw -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org