On Mon, Jan 12, 2009 at 16:15, Karl Fife <karlfife at gmail.com>
wrote:> QUESTION: Who's in the wrong:
>
> I recently saw an example of a u-law file with a metadata header on the
> file.
> The asterisk playback function 'PLAYED' the ascii header values as
if they
> were audio data, creating an audible 'click'.
>
> After realizing the click was coming from metadata (and fixing it), I
became
> curious:
>
> Which is 'correct? In other words:
>
> 1. Is it considered incorrect to ever include metadata on a u-law formatted
> file?
> or
> 2. Is it considered incorrect for a playback engine to fail to check for
> metadata headers before playback?
> or
> 3. Is it unspecified, and therefore considered incorrect for someone (ME)
to
> FEED a u-law stream into any playback engine without FIRST making sure that
> somebody's two-bit application didn't tack on an unsolicited
header? :-)
>
> In other words, should case 1 or 2 be considered a software defect?
No, it is not a defect.
You need to distinguish between the file format and audio codec. They
are independent of each other. You can store ULAW in a WAV file. The
default asterisk sounds (.g729, .ulaw, .alaw) are raw audio files,
thus there is no header. If Asterisk is expecting a raw format file,
it will playback the entire "contents."
If I save a WAV format file encoded in ulaw, name the file .ulaw, and
then play it back in Asterisk, the exact scenario you describe
happens.