VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
vincent.delporte at bi... Guest
|
Posted: Tue Jan 01, 2008 5:06 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
Hello
Happy New Year! I succesfully installed the Ports of Zaptel BSD 1.4.0
and Asterisk 1.4.13 (that's the latest in the Ports). To save CPU, I'd
like to play PCM WAV files instead of eg. GSM. Per...
www.voip-info.org/wiki/view/Convert+WAV+audio+files+for+use+in+Asterisk
... I recorded a sample of my voice using XP's Sound Recorder, then
ran the following :
sox test_wav.wav -r 8000 -c 1 -s -w test_wav_out.wav resample -ql
But it seems like I'm missing the codec or something:
===========
-- Executing [s at default:2] Playback("SIP/2000-0871d000",
"/usr/local/lib/asterisk/test_wav_out.wav") in new stack
WARNING[37390]: file.c:563 ast_openstream_full: File
/usr/local/lib/asterisk/test_wav_out.wav does not exist in any format
WARNING[37390]: file.c:866 ast_streamfile: Unable to open
/usr/local/lib/asterisk/test_wav_out.wav (format 0x4 (ulaw)): No such
file or directory
===========
Here's what "core show file formats" says:
===========
Format Name Extensions
gsm wav49 WAV|wav49
slin wav wav
adpcm vox vox
slin sln sln|raw
g722 g722 g722
ulaw au au
alaw alaw alaw|al
ulaw pcm pcm|ulaw|ul|mu
ilbc iLBC ilbc
h264 h264 h264
h263 h263 h263
gsm gsm gsm
g729 g729 g729
g726 g726-16 g726-16
g726 g726-24 g726-24
g726 g726-32 g726-32
g726 g726-40 g726-40
g723 g723sf g723|g723sf
18 file formats registered.
===========
Am I missing something in the configuration files, or maybe I'm
missing some module?
Thank you. |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Tue Jan 01, 2008 9:03 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Tue, 1 Jan 2008 17:23:29 +0530, "Godson Gera" <godson.g at gmail.com>
wrote:
Quote: | s,2,Playback(/usr/local/lib/asterisk/test_wav_out)
And asterisk will automatically pickup the file that it can play with any
asterisk supported format from the specified path.
|
OK. Is there a way to tell Asterisk which codec to use so it doesn't
try figuring out the file format used? Thanks. |
|
Back to top |
|
|
mkn0014 at gmail.com Guest
|
Posted: Tue Jan 01, 2008 10:10 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
Vincent wrote:
Quote: | On Tue, 1 Jan 2008 17:23:29 +0530, "Godson Gera" <godson.g at gmail.com>
wrote:
Quote: | s,2,Playback(/usr/local/lib/asterisk/test_wav_out)
And asterisk will automatically pickup the file that it can play with any
asterisk supported format from the specified path.
|
OK. Is there a way to tell Asterisk which codec to use so it doesn't
try figuring out the file format used? Thanks.
|
The codec is specified (for a sip device) in sip.conf, like this:
[general]
disallow=all
allow=ulaw
allow=alaw
allow=gsm
And you know that you can convert the files to every codec format that
is in use then will the cpu load be minimalized !
To convert between different codec formats can you use the asterisk CLI
command:
file convert <file_in.format> <file_out.format>
To convert from a shell script can you do like this:
#!/bin/bash
# Converts a audio file from alaw to a ulaw
rasterisk -x "file convert /tmp/file_in.alaw /tmp/file_out.ulaw"
More examples:
The old way:
http://www.voip-info.org/tiki-index.php?page=Convert+WAV+audio+files+for+use+in+Asterisk
I will try to update this page with "convert".
As a final touch, I have heard that sln should be the prefered format
where you dont have the same format as the codec used in a channel.
"Asterisk native format is sln"
/Mats |
|
Back to top |
|
|
godson.g at gmail.com Guest
|
Posted: Tue Jan 01, 2008 10:35 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Jan 1, 2008 3:36 PM, Vincent <vincent.delporte at bigfoot.com> wrote:
Quote: | Hello
Happy New Year! I succesfully installed the Ports of Zaptel BSD 1.4.0
and Asterisk 1.4.13 (that's the latest in the Ports). To save CPU, I'd
like to play PCM WAV files instead of eg. GSM. Per...
<http://www.voip-info.org/wiki/view/Convert+WAV+audio+files+for+use+in+Asterisk>
| Asterisk automatically takes care of saving CPU issue as it picks the file
that have less translation cost (in other words it picks the file that gives
the best CPU performance based on call situations like in which codec format
the call is bridged ). That way you don't have to worry about specifying
particular format moreover there is no provision to do that in Playback
application. You can see translation costs by typing the following in
console.
core show translation
--
Godson Gera,
http://godsongera.blogspot.com
Asterisk India Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080101/6237e371/attachment.htm |
|
Back to top |
|
|
adam at plexicomm.net Guest
|
Posted: Tue Jan 01, 2008 11:55 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
Thanks nice script.
But why au files in addition to gsm?
----- Original Message -----
From: dave cantera
To: Asterisk Users Mailing List - Non-Commercial Discussion ; vincent.delporte at bigfoot.com
Sent: Tuesday, January 01, 2008 11:27 AM
Subject: Re: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file?
vincent,
here is a script that I used to convert a single wav file or the entire directory... no file specified on launch, converts all files in the current directory...
creates a logfile, although trivial...
daveC
#!/bin/sh
#
# convert-all.sh
#
# convert all *.wav files to .gsm .au formats
#
if [ "null${1}" == "null" ]
then
FILE_LIST=`ls *.wav`
else
FILE_LIST=`ls ${1}*.wav`
fi
LOG="./log_convert.log"
echo "======================================================= " >>${LOG}
echo " started at `date` " >>${LOG}
echo " Removing all current .gsm files..."
rm -f *.gsm
for FNAME in ${FILE_LIST}
do
echo "---- ------- ----- "
echo "---- " >>${LOG}
echo " Processing ${FNAME}... "
echo " Processing ${FNAME}... " >>${LOG}
BASEFNAME=`echo ${FNAME} | awk '{print substr($0,1,length($0)-4)}'`
echo " making ${BASEFNAME}.gsm... "
echo " making ${BASEFNAME}.gsm... " >>${LOG}
#sox -q -V -c 1 ${FNAME} -r 8000 -c 1 -w ${BASEFNAME}.gsm resample -ql 2>>${LOG}
sox -q -V ${FNAME} -r 8000 -c 1 ${BASEFNAME}.gsm resample -ql 2>>${LOG}
echo "---- " >>${LOG}
echo " making ${BASEFNAME}.au... "
echo " making ${BASEFNAME}.au... " >>${LOG}
sox -q -V ${FNAME} -t au -r 8000 -c 1 -w ${BASEFNAME}.au resample -ql 2>>${LOG}
done
Vincent wrote:
Hello
Happy New Year! I succesfully installed the Ports of Zaptel BSD 1.4.0
and Asterisk 1.4.13 (that's the latest in the Ports). To save CPU, I'd
like to play PCM WAV files instead of eg. GSM. Per...
www.voip-info.org/wiki/view/Convert+WAV+audio+files+for+use+in+Asterisk
... I recorded a sample of my voice using XP's Sound Recorder, then
ran the following :
sox test_wav.wav -r 8000 -c 1 -s -w test_wav_out.wav resample -ql
But it seems like I'm missing the codec or something:
===========
-- Executing [s at default:2] Playback("SIP/2000-0871d000",
"/usr/local/lib/asterisk/test_wav_out.wav") in new stack
WARNING[37390]: file.c:563 ast_openstream_full: File
/usr/local/lib/asterisk/test_wav_out.wav does not exist in any format
WARNING[37390]: file.c:866 ast_streamfile: Unable to open
/usr/local/lib/asterisk/test_wav_out.wav (format 0x4 (ulaw)): No such
file or directory
===========
Here's what "core show file formats" says:
===========
Format Name Extensions
gsm wav49 WAV|wav49
slin wav wav
adpcm vox vox
slin sln sln|raw
g722 g722 g722
ulaw au au
alaw alaw alaw|al
ulaw pcm pcm|ulaw|ul|mu
ilbc iLBC ilbc
h264 h264 h264
h263 h263 h263
gsm gsm gsm
g729 g729 g729
g726 g726-16 g726-16
g726 g726-24 g726-24
g726 g726-32 g726-32
g726 g726-40 g726-40
g723 g723sf g723|g723sf
18 file formats registered.
===========
Am I missing something in the configuration files, or maybe I'm
missing some module?
Thank you.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
My wife's sister is in California.
I should buy her a Videophone2008!
Truly, The Next Best Thing to Being There!
--
WorldWideVideoPhones.com
856.380.0894
------------------------------------------------------------------------------
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.17.13/1205 - Release Date: 12/31/2007 3:32 PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080101/20fcfdb9/attachment.htm |
|
Back to top |
|
|
tzafrir.cohen at xorco... Guest
|
Posted: Tue Jan 01, 2008 12:42 pm Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Tue, Jan 01, 2008 at 11:27:54AM -0500, dave cantera wrote:
Quote: | vincent,
here is a script that I used to convert a single wav file or the entire
directory... no file specified on launch, converts all files in the current
directory...
creates a logfile, although trivial...
daveC
#!/bin/sh
#
# convert-all.sh
#
# convert all *.wav files to .gsm .au formats
#
if [ "null${1}" == "null" ]
then
FILE_LIST=`ls *.wav`
else
FILE_LIST=`ls ${1}*.wav`
fi
LOG="./log_convert.log"
echo "======================================================= " >>${LOG}
echo " started at `date` " >>${LOG}
echo " Removing all current .gsm files..."
rm -f *.gsm
|
# A note from the Useless Use of ls Committee:
for FNAME in $1*.wav
Quote: | for FNAME in ${FILE_LIST}
do
echo "---- ------- ----- "
echo "---- " >>${LOG}
echo " Processing ${FNAME}... "
echo " Processing ${FNAME}... " >>${LOG}
BASEFNAME=`echo ${FNAME} | awk '{print substr($0,1,length($0)-4)}'`
echo " making ${BASEFNAME}.gsm... "
echo " making ${BASEFNAME}.gsm... " >>${LOG}
#sox -q -V -c 1 ${FNAME} -r 8000 -c 1 -w ${BASEFNAME}.gsm resample -ql
2>>${LOG}
sox -q -V ${FNAME} -r 8000 -c 1 ${BASEFNAME}.gsm resample -ql 2>>${LOG}
echo "---- " >>${LOG}
echo " making ${BASEFNAME}.au... "
echo " making ${BASEFNAME}.au... " >>${LOG}
sox -q -V ${FNAME} -t au -r 8000 -c 1 -w ${BASEFNAME}.au resample -ql 2>>$
{LOG}
done
|
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir |
|
Back to top |
|
|
david.cantera at iacne... Guest
|
Posted: Tue Jan 01, 2008 8:34 pm Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
tzafrir,
thanks for the note... yep, it is useless...
daveC
Tzafrir Cohen wrote:
Quote: | On Tue, Jan 01, 2008 at 11:27:54AM -0500, dave cantera wrote:
Quote: | vincent,
here is a script that I used to convert a single wav file or the entire
directory... no file specified on launch, converts all files in the current
directory...
creates a logfile, although trivial...
daveC
#!/bin/sh
#
# convert-all.sh
#
# convert all *.wav files to .gsm .au formats
#
if [ "null${1}" == "null" ]
then
FILE_LIST=`ls *.wav`
else
FILE_LIST=`ls ${1}*.wav`
fi
LOG="./log_convert.log"
echo "======================================================= " >>${LOG}
echo " started at `date` " >>${LOG}
echo " Removing all current .gsm files..."
rm -f *.gsm
|
# A note from the Useless Use of ls Committee:
for FNAME in $1*.wav
Quote: | for FNAME in ${FILE_LIST}
do
echo "---- ------- ----- "
echo "---- " >>${LOG}
echo " Processing ${FNAME}... "
echo " Processing ${FNAME}... " >>${LOG}
BASEFNAME=`echo ${FNAME} | awk '{print substr($0,1,length($0)-4)}'`
echo " making ${BASEFNAME}.gsm... "
echo " making ${BASEFNAME}.gsm... " >>${LOG}
#sox -q -V -c 1 ${FNAME} -r 8000 -c 1 -w ${BASEFNAME}.gsm resample -ql
2>>${LOG}
sox -q -V ${FNAME} -r 8000 -c 1 ${BASEFNAME}.gsm resample -ql 2>>${LOG}
echo "---- " >>${LOG}
echo " making ${BASEFNAME}.au... "
echo " making ${BASEFNAME}.au... " >>${LOG}
sox -q -V ${FNAME} -t au -r 8000 -c 1 -w ${BASEFNAME}.au resample -ql 2>>$
{LOG}
done
|
|
--
My wife's sister is in California.
I should buy her a Videophone2008!
Truly, The Next Best Thing to Being There!
--
WorldWideVideoPhones.com
856.380.0894 |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Wed Jan 02, 2008 12:17 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Tue, 01 Jan 2008 16:10:47 +0100, MatsK <mkn0014 at gmail.com> wrote:
Quote: | The codec is specified (for a sip device) in sip.conf, like this:
|
Good to know. Actually, I'll have Asterisk save voicemails as WAV and
move the files to the www's htdocs, and send an e-mail to users with
the link they'll just have to click to listen to them.
Actually, I'm thinking of embedding a Flash player in the web page,
and update its playlist file so that the browser doesn't launch the
external app that is registered with Windows to play WAV files. But I
haven't found any Flash player that can play WAV, only MP3 :-/
Quote: | And you know that you can convert the files to every codec format that
is in use then will the cpu load be minimalized !
|
Yup, but the CPU is just a Pentium 233MHz. I just converted a 20MB WAV
file from a CD-quality (44KHz sample rate, stereo) into the format
Asterisk likes (8HKz, mono), and it took about 10mn. So conversion is
out of the question, as Asterisk is likely to have a problem answering
other incoming calls while it's busy converting the last voicemail
message.
Quote: | To convert between different codec formats can you use the asterisk CLI
command:
|
Thanks, I didn't know this command. |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Wed Jan 02, 2008 12:18 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Tue, 1 Jan 2008 21:05:11 +0530, "Godson Gera" <godson.g at gmail.com>
wrote:
Quote: | Asterisk automatically takes care of saving CPU issue as it picks the file
that have less translation cost
|
Yes, but that's OK for files that I use in the IVR, but not for
voicemail messages. The CPU is too slow to handle
WAV-to-something_more_compact conversion in a timely manner. |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Wed Jan 02, 2008 12:19 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Tue, 01 Jan 2008 11:27:54 -0500, dave cantera
<david.cantera at iacnet.net> wrote:
Quote: | here is a script that I used to convert a single wav file or the entire
directory... no file specified on launch, converts all files in the
current directory...
|
Thanks for the script. I'll keep it handy. |
|
Back to top |
|
|
mkn0014 at gmail.com Guest
|
Posted: Wed Jan 02, 2008 3:50 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
Vincent wrote:
Quote: | On Tue, 01 Jan 2008 16:10:47 +0100, MatsK <mkn0014 at gmail.com> wrote:
Quote: |
And you know that you can convert the files to every codec format that
is in use then will the cpu load be minimalized !
|
Yup, but the CPU is just a Pentium 233MHz. I just converted a 20MB WAV
file from a CD-quality (44KHz sample rate, stereo) into the format
Asterisk likes (8HKz, mono), and it took about 10mn. So conversion is
out of the question, as Asterisk is likely to have a problem answering
other incoming calls while it's busy converting the last voicemail
message.
|
Thats true, so I normaly convert files on my development box, don't
wan't to disturb the production. And the conversion of prompts is a one
time task! To "re encode" is a cpu load that happens every time the
prompt is used! |
|
Back to top |
|
|
thp at westhawk.co.uk Guest
|
Posted: Wed Jan 02, 2008 9:11 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On 2 Jan 2008, at 05:17, Vincent wrote:
Quote: | On Tue, 01 Jan 2008 16:10:47 +0100, MatsK <mkn0014 at gmail.com> wrote:
Quote: | The codec is specified (for a sip device) in sip.conf, like this:
|
Good to know. Actually, I'll have Asterisk save voicemails as WAV and
move the files to the www's htdocs, and send an e-mail to users with
the link they'll just have to click to listen to them.
Actually, I'm thinking of embedding a Flash player in the web page,
and update its playlist file so that the browser doesn't launch the
external app that is registered with Windows to play WAV files. But I
haven't found any Flash player that can play WAV, only MP3 :-/
|
There is a Java Applet I wrote that plays GSM files at :
http://www.westhawk.co.uk/software/playGSM/PlayGSM.jar
with an example at:
http://www.westhawk.co.uk/software/playGSM/PlayGSM.html
Source code is in the Jar. It would be very easy to convert it
to playing SLIN, ulaw or whatever.
Tim. |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Wed Jan 02, 2008 9:34 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Wed, 2 Jan 2008 14:11:29 +0000, Tim Panton <thp at westhawk.co.uk>
wrote:
Quote: | There is a Java Applet I wrote that plays GSM files at :
|
I'll take a look. Thanks. |
|
Back to top |
|
|
tzafrir.cohen at xorco... Guest
|
Posted: Wed Jan 02, 2008 9:52 am Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Wed, Jan 02, 2008 at 06:17:04AM +0100, Vincent wrote:
Quote: | On Tue, 01 Jan 2008 16:10:47 +0100, MatsK <mkn0014 at gmail.com> wrote:
Quote: | The codec is specified (for a sip device) in sip.conf, like this:
|
Good to know. Actually, I'll have Asterisk save voicemails as WAV and
move the files to the www's htdocs, and send an e-mail to users with
the link they'll just have to click to listen to them.
Actually, I'm thinking of embedding a Flash player in the web page,
and update its playlist file so that the browser doesn't launch the
external app that is registered with Windows to play WAV files. But I
haven't found any Flash player that can play WAV, only MP3 :-/
|
Huh?
What do you have to gain from using a flash player?
Every web browser that supports a flash addon supports also playing wav
(that is: WAV/RIFF files) files natively. But not vice-versa.
BTW: support for WAV/gsm is also getting more and more common.
Quote: |
Quote: | And you know that you can convert the files to every codec format that
is in use then will the cpu load be minimalized !
|
Yup, but the CPU is just a Pentium 233MHz. I just converted a 20MB WAV
file from a CD-quality (44KHz sample rate, stereo) into the format
Asterisk likes (8HKz, mono), and it took about 10mn. So conversion is
out of the question, as Asterisk is likely to have a problem answering
other incoming calls while it's busy converting the last voicemail
message.
|
Huh?
And you want to encode MP3s on that server? It won't save you *that*
much space either.
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir |
|
Back to top |
|
|
vincent.delporte at bi... Guest
|
Posted: Wed Jan 02, 2008 11:27 pm Post subject: [asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file? |
|
|
On Wed, 2 Jan 2008 16:52:57 +0200, Tzafrir Cohen
<tzafrir.cohen at xorcom.com> wrote:
Quote: | What do you have to gain from using a flash player?
|
By default, unless a plug-in was installed (eg. QuickTime, yuck), if I
click on WAV file in FireFox or IE (Opera is OK), it spawns the
application that registered with Windows to play WAV files. I'd like
to avoid this.
When using a Flash player, it just plays the file without launching an
external app. And users get to see a playlist from which they just to
pick which message they want to hear. Much better:
http://musicplayer.sourceforge.net/
Quote: | And you want to encode MP3s on that server? It won't save you *that*
much space either.
|
No, precisely: I _don't_ want to compress files in MP3, I want to keep
them in WAV. The goal is not to save space, but to save CPU
FWIW, I sucessfully flashed the CF card with Askozia, which is based
on FreeBSD + Asterisk 1.4 and is derived from the MonoWall project:
http://askozia.com/pbx/
It runs very nicely on that IBM Netvista sporting a Pentium 233MHz and
256MB RAM. |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|