Summary:ASTERISK-14063: [patch] Add 16khz WAV support (format_wav16.c)
Reporter:Andrew Lindh (andrew)Labels:
Date Opened:2009-05-04 11:29:25Date Closed:2010-09-02 11:44:07
Versions:Frequency of
Environment:Attachments:( 0) format_wav16.c
( 1) wav16.patch
Description:This code adds read/write support for 16khz WAV files using the type and extension of "wav16".

See patch ASTERISK-1356657 for previous 16khz format additions.


I have been working with 16khz audio TTS apps and need to be able to store
the output in 16khz WAV files that asterisk can read. I could stip the WAV header and use SLIN16, but that's not nice or automatic.

I tried to add 16khz read support to the existing format_wav but that does not work. Asterisk assumes and depends on knowing the frequency for the file before reading it does not check for changes while reading it (as stated by kpfleming).

There was a patch ASTERISK-1356657 that added support for 16khz wave files but did not seem to pick a good extension (using Wav caused case sensitivity problems). It also combined the format into the existing program (as I did on my first patch).

My new patch posted is a complete new format_wav16.c and uses the new extension ".wav16" for the 16khz files. This follows the other asterisk formats of having a separate program for each format (even if they could share code). I selected "wav16" as the type/extension because it does not conflict with anything and the file type is clear and follows other formats asterisk uses (like slin/slin16).

This could safely be added to all versions of 1.6 (with the correct changes in the code) as it does not change any default actions or change anything that already works.
Comments:By: Jason Parker (jparker) 2009-05-04 12:43:59

I think this might be best done inside the existing format_wav.  There appears to be quite a lot of code duplication between them.


By: Andrew Lindh (andrew) 2009-05-04 14:10:49

There is total code duplication! I uploaded a patch for the combined version. I did the new program because there is a different program for SLIN and SLIN16 and same for siren7 and siren14.

By: Paul Belanger (pabelanger) 2010-06-14 15:31:48

Please update your patch against the latest version of trunk.

By: Andrew Lindh (andrew) 2010-06-15 15:24:24

It's giving me problems uploading files... Please delete the two there and I'll try uploading their replacements.

By: Paul Belanger (pabelanger) 2010-06-15 16:27:14

deleted files as requested.

By: Andrew Lindh (andrew) 2010-06-15 19:43:12

Upload fails...

Issue -1 not found.

By: Paul Belanger (pabelanger) 2010-06-15 20:28:57

Just did a quick test, and had no issues.  Are you selecting 'Check if this is a code or documentation submission'?  I would also clear your browser cache.

By: Andrew Lindh (andrew) 2010-06-15 21:51:21

Nothing changed, but upload works now...I guess if you keep clicking on the same button it has to work sometime! (EDIT: Looks like the upload problem was an IPv6 MTU issued that may have been resolved)

I uploaded the stand alone format_wav16 program and the patch to the standard format_wav program. Both based on today's trunk both provide the same functions, use one or the other.

BIG_ENDIAN use should be verified.

By: Paul Belanger (pabelanger) 2010-06-25 08:50:30


By: Andrew Lindh (andrew) 2010-07-24 07:02:37

It's been over a year.... Can we get this into 1.8?

By: Paul Belanger (pabelanger) 2010-07-24 15:51:38

Upload this to https://reviewboard.asterisk.org/ and we can triage this issue.

By: Leif Madsen (lmadsen) 2010-07-24 16:03:14

We need some people to test this, and get the code reviewed within the next week to have to make it in time for Asterisk 1.8.0. Thanks!

By: Leif Madsen (lmadsen) 2010-07-24 16:03:35

Also please make sure the latest patch here will apply cleanly to the 1.8 branch.

By: Digium Subversion (svnbot) 2010-09-02 11:43:10

Repository: asterisk
Revision: 284701

U   branches/1.8/formats/format_wav.c

r284701 | qwell | 2010-09-02 11:43:10 -0500 (Thu, 02 Sep 2010) | 8 lines

Add slin16 support for format_wav (new wav16 file extension)

(closes issue ASTERISK-14063)
Reported by: andrew
     wav16.patch uploaded by andrew (license 240)
Tested by: qwell, andrew



By: Digium Subversion (svnbot) 2010-09-02 11:44:07

Repository: asterisk
Revision: 284702

_U  trunk/
U   trunk/formats/format_wav.c

r284702 | qwell | 2010-09-02 11:44:06 -0500 (Thu, 02 Sep 2010) | 15 lines

Merged revisions 284701 via svnmerge from

 r284701 | qwell | 2010-09-02 11:43:09 -0500 (Thu, 02 Sep 2010) | 8 lines
 Add slin16 support for format_wav (new wav16 file extension)
 (closes issue ASTERISK-14063)
 Reported by: andrew
       wav16.patch uploaded by andrew (license 240)
 Tested by: qwell, andrew