Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-12 Thread John Marvin

shadowym wrote:


I found that the distortion was consistent.  In other words it happened in
the same way at the same time in a particular file.  I suspect it has
something to do with how Asterisk plays it back and not any sort of
hardware/IDE/interrupt issue.  Kris, the developer of Astlinux didn't seem
to have any ideas why it would not work as well on Asterisk either.


If the distortion is consistant as you say, then you are probably seeing 
the same problem I found a workaround for.


I was disappointed in the sound quality of the gsm files, so I was happy 
to find the Native Sounds files. However, I then ran into the clicks and 
pops when playing them. Reading some of the earlier comments in this 
discussion someone mentioned an issue with Asterisk not padding files to 
even 20ms increments when playing them. So, although that may be a bug 
in Asterisk, I thought I would see if that was the problem by writing a 
quick C program to pad all my ulaw files to multiples of 160 bytes. 
Voila, all clicks and pops were gone. So, I don't know if that is the 
only issue, and perhaps there are other problems people are having, but 
padding the files fixed the issue for me. Obviously this should be fixed 
in Asterisk.


If anyone else wants to try this experiment I've enclosed the simple C 
program I wrote below. If you compile it and call it padulaw here is how 
I fixed all the files:


find /var/lib/asterisk/sounds -type f -name '*.ulaw' | xargs padulaw

This program could be easily modified to pad .sln files to a multiple of 
320 bytes (the files would be padded with 0x rather than 0xff).


John

#include stdio.h
#include fcntl.h
#include sys/stat.h
#include sys/types.h

#define ULAW_SILENCE 0xff
#define MS20_BYTES  160

unsigned char silence[MS20_BYTES];

void pad_file(char *);

main(int argc, char **argv)
{
int i;
int nfiles;

if (argc  2) {
fprintf(stderr,Usage: %s file name ...\n,argv[0]);
exit(1);
}

nfiles = argc - 1;
for (i = 0; i  nfiles; i++) {
pad_file(argv[i+1]);
}

exit(0);
}

void
pad_file(char *fname)
{
int fd;
int i;
struct stat sbuf;
int filesize;
int remainder;
int nwrite;

fd = open(fname,O_WRONLY|O_APPEND);
if (fd  0) {
fprintf(stderr,Could not open %s for writing.\n,fname);
return;
}

if (fstat(fd,sbuf) != 0) {
fprintf(stderr,Could not stat file %s.\n,fname);
return;
}

filesize = (int) sbuf.st_size;
remainder = filesize % MS20_BYTES;
if (remainder == 0) {
close(fd);
return;
}

nwrite = MS20_BYTES - remainder;
for (i = 0; i  nwrite; i++)
silence[i] = (unsigned char)ULAW_SILENCE;

if (write(fd,(void *)silence,nwrite) != nwrite) {
fprintf(stderr,Write Failure on file %s\n,fname);
return;
}

close(fd);
return;
}
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-12 Thread Steve Davies

On 9/12/06, John Marvin [EMAIL PROTECTED] wrote:

shadowym wrote:

[snip]

Asterisk not padding files to
even 20ms increments when playing them. So, although that may be a bug
in Asterisk, I thought I would see if that was the problem by writing a
quick C program to pad all my ulaw files to multiples of 160 bytes.
Voila, all clicks and pops were gone. So, I don't know if that is the
only issue, and perhaps there are other problems people are having, but
padding the files fixed the issue for me. Obviously this should be fixed
in Asterisk.

If anyone else wants to try this experiment I've enclosed the simple C
program I wrote below. If you compile it and call it padulaw here is how
I fixed all the files:

find /var/lib/asterisk/sounds -type f -name '*.ulaw' | xargs padulaw

This program could be easily modified to pad .sln files to a multiple of
320 bytes (the files would be padded with 0x rather than 0xff).

John


[snip]

I don't suppose you know what the silence padding bytes would be for ALAW?

Thanks,
Steve
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-12 Thread Steve Davies

On 9/12/06, Steve Davies [EMAIL PROTECTED] wrote:


I don't suppose you know what the silence padding bytes would be for ALAW?


Found it... It is 0x55.

Thanks for the program :)
Steve
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-11 Thread Tzafrir Cohen
On Sat, Jul 01, 2006 at 01:29:30PM +0200, Paul Hewlett wrote:

Maybe on other distros the sound files are being read from an IDe disk and 
 the interrupts generated are distorting the sound - on astlinux the 
 soundfiles are in a memory filesystem - no interrupts - no distortion ?

Bigger systems have large buffers.

An hourly cron job to can the sound files you normally use to /dev/null?

-- 
Tzafrir Cohen sip:[EMAIL PROTECTED]
icq#16849755  iax:[EMAIL PROTECTED]
+972-50-7952406  jabber:[EMAIL PROTECTED]
[EMAIL PROTECTED] http://www.xorcom.com
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-11 Thread shadowym
I have the same problem and so do many others.  I filed a bug report but it
was cancelled because the developers did not feel it was a problem with
Asterisk.  Perhaps they just don't want to support native sounds.  If they
did it would technically be considered a problem with Asterisk.  So
basically there does not appear to be any interest in fixing this. 

I found that the distortion was consistent.  In other words it happened in
the same way at the same time in a particular file.  I suspect it has
something to do with how Asterisk plays it back and not any sort of
hardware/IDE/interrupt issue.  Kris, the developer of Astlinux didn't seem
to have any ideas why it would not work as well on Asterisk either.

-Original Message-
From: Tzafrir Cohen [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 10, 2006 11:20 PM
To: asterisk-users@lists.digium.com
Subject: Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

On Sat, Jul 01, 2006 at 01:29:30PM +0200, Paul Hewlett wrote:

Maybe on other distros the sound files are being read from an IDe 
 disk and the interrupts generated are distorting the sound - on 
 astlinux the soundfiles are in a memory filesystem - no interrupts - no
distortion ?

Bigger systems have large buffers.

An hourly cron job to can the sound files you normally use to /dev/null?

-- 
Tzafrir Cohen sip:[EMAIL PROTECTED]
icq#16849755  iax:[EMAIL PROTECTED]
+972-50-7952406  jabber:[EMAIL PROTECTED]
[EMAIL PROTECTED] http://www.xorcom.com


___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-09-11 Thread Kristian Kielhofner

Tzafrir Cohen wrote:

On Sat, Jul 01, 2006 at 01:29:30PM +0200, Paul Hewlett wrote:


  Maybe on other distros the sound files are being read from an IDe disk and 
the interrupts generated are distorting the sound - on astlinux the 
soundfiles are in a memory filesystem - no interrupts - no distortion ?



Bigger systems have large buffers.

An hourly cron job to can the sound files you normally use to /dev/null?



	Although tmpfs is used extensively in AstLinux, all of the sound 
prompts are stored and read from disk.  This issue has come up several 
times, and I have no idea why they sound so much better in AstLinux. 
Don't get me wrong - I'm glad they do, but they should work equally well 
for all users of Asterisk, not just those that use AstLinux!


	Actually, now that I think about it, AstLinux does have one crucial 
difference.  By default, DMA for IDE transfers are disabled (better 
compatibility with compact flash - rather safe than sorry)...  I should 
try to enable DMA on a system that supports it and see what happens.


--
Kristian Kielhofner
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-07-01 Thread Paul Hewlett
On Thursday 29 June 2006 18:07, Kristian Kielhofner wrote:
 shadowym wrote:
  I too have noticed problems with Asterisk native sounds using ulaw on
  Asterisk 1.2.9.1.  Don't know about other versions but it seems to work
  quite well in Astlinux 0.40.  In theory, since I am using ulaw for SIP
  there is no transcoding so it is a more efficient use of CPU resources
  and it should sound much better in general.  It does sound better except
  for the frequent cracles, pops, and momentary dropouts which makes it
  much more objectionable to listen to compared to the standard GSM files.
 
  Is there a bug report on this yet?

 shadowym,

   While I haven't noticed this myself, many people have pointed this out.
   I can assure you that the prompts in AstLinux 0.4 are the same native
 prompts provided on astlinux.org.  I don't know why they seem to sound
 so much better in AstLinux than with standard Asterisk installs, but as
 I said many people have noticed this.  In theory, the native sounds
 should sound much better no matter how you play them back.  Interesting...

 --
 Kristian Kielhofner

   Maybe on other distros the sound files are being read from an IDe disk and 
the interrupts generated are distorting the sound - on astlinux the 
soundfiles are in a memory filesystem - no interrupts - no distortion ?

Paul
 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-06-29 Thread shadowym
I too have noticed problems with Asterisk native sounds using ulaw on
Asterisk 1.2.9.1.  Don't know about other versions but it seems to work
quite well in Astlinux 0.40.  In theory, since I am using ulaw for SIP there
is no transcoding so it is a more efficient use of CPU resources and it
should sound much better in general.  It does sound better except for the
frequent cracles, pops, and momentary dropouts which makes it much more
objectionable to listen to compared to the standard GSM files.  

Is there a bug report on this yet? 

 -Original Message-
 From: Tim Panton [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, June 29, 2006 2:04 AM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [Asterisk-Users] Standard Sound Files Distortion
 
 
 On 28 Jun 2006, at 19:50, Douglas Garstang wrote:
 
  -Original Message-
  From: Doug Lytle [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, June 28, 2006 12:31 PM
  To: Asterisk Users Mailing List - Non-Commercial Discussion
  Subject: Re: [Asterisk-Users] Standard Sound Files Distortion
 
 
  Douglas Garstang wrote:
  I've been noticing lately what seems to be some distortian
  in the standard asterisk sound files, used for voicemail.
  These files are stored on the local Asterisk system. When Asterisk 
  plays them, I can hear some cracles and pops. I'd never 
 noticed these 
  until recently.
 
 
  What I've learned from reading the list, is it usually is 
 a sign of 
  shared IRQs.  Just a thought.
 
  Thanks for the reply. I just worked out what it was. I had 
 ulaw copies 
  of all the sound files in the digits/ directory. For some 
 reason, the 
  ulaw files either had the cracks and pops in the 
 recordings, or when 
  asterisk played the ulaw files, it generated the cracks and pops.
 
 I've noticed something that may (or may not) be related.
 
 If you have a sound file that isn't an exact multiple of 20ms 
 long, then asterisk 1.2.9.1 (don't know about other versions 
 - yet) sends out a 'partial' packet with the remaining data 
 in it. For ulaw, the data would normally be 160 bytes, but a 
 few (the last?) packet(s) might be 54 bytes (or whatever). 
 This confuses my softphone.
 Do we think this is correct behavior ? Shouldn't asterisk pad 
 the sound out to 20ms?
 
 Note - this never occurs with GSM data, like the 'standard' 
 voice files, as gsm is always a multiple of 20ms long.
 
 T.
 
 Tim Panton
 [EMAIL PROTECTED]
 
 
 
 
 
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Asterisk Native Sound Distortion (ulaw)

2006-06-29 Thread Kristian Kielhofner

shadowym wrote:

I too have noticed problems with Asterisk native sounds using ulaw on
Asterisk 1.2.9.1.  Don't know about other versions but it seems to work
quite well in Astlinux 0.40.  In theory, since I am using ulaw for SIP there
is no transcoding so it is a more efficient use of CPU resources and it
should sound much better in general.  It does sound better except for the
frequent cracles, pops, and momentary dropouts which makes it much more
objectionable to listen to compared to the standard GSM files.  

Is there a bug report on this yet? 



shadowym,

	While I haven't noticed this myself, many people have pointed this out. 
 I can assure you that the prompts in AstLinux 0.4 are the same native 
prompts provided on astlinux.org.  I don't know why they seem to sound 
so much better in AstLinux than with standard Asterisk installs, but as 
I said many people have noticed this.  In theory, the native sounds 
should sound much better no matter how you play them back.  Interesting...


--
Kristian Kielhofner
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users