[Asterisk-Dev] Re: MS-ADPCM in format_wav?

Roger Smith rsmith at mac.com
Wed Feb 2 12:59:19 MST 2005


>On Wed, 2005-02-02 at 15:47 +0000, Tony Mountifield wrote:
>>  In article <1107359089.2799.18.camel at critch>,
>>  Steven Critchfield <critch at basesys.com> wrote:
>>  > On Wed, 2005-02-02 at 11:02 +0000, Tony Mountifield wrote:
>>  > > Does anyone know if there has been any work done on enhancing format_wav
>>  > > to support MS-ADPCM format (fmt codec type 2)?
>>  > >
>>  > > If not, I may consider having a go myself, but I don't want to re-invent
>>  > > the wheel unnecessarily.
>>  >
>>  > You wouldn't modify format_wav under the current method. You can copy it
>>  > to format_wav2 to mimic the way GSM wav files are handled by
>>  > format_wav49. Then you only need to modify the seek function, and the
>>  > header creation/update. After that, you just need to make sure the codec
>>  > is set to adpcm so your incoming frames are already in the right format.
>>
>>  OK, thanks, I'll have a look at that. At the moment, I'm more interested
>>  in being able to play adpcm files than record them. Rather than relying
>>  on a matching codec, I was thinking more of having format_wav2 decode the
>>  ADPCM into SLIN or something, like format_mp3 does.
>>
>>  And having each format in a separate module looks like it requires each
>>  format to have a different file extension, rather than looking at the
>>  fmt chunk in the file to determine the format. Is that correct?
>>
>>  I'll take a look at format_adpcm too. Thanks to you and bkw for 
>>the pointers.
>
>Ideally, if asterisk doesn't support the codec, you should look into
>making the codec then. Putting audio encoding at the format level isn't
>a real good idea.
>
>Now as for combining the wav functions into one simple format_wav, that
>wouldn't be too bad. Of course you would still have to signify to
>asterisk what codec you wanted the file to be recorded in when you said
>wav. The only thing that is different between the 2 currently supported
>wav formats is the header functions and a few assumptions with how to
>deal with blocks of audio for the codec.
>
>For instance, in format_wav_gsm, you read a 65 byte block and send it to
>the on it's way. you can not use anything smaller than 65 bytes, and you
>have to be on the proper boundaries too. But in format_wav, you just
>have to be on the right 2 byte boundary to send the slinear bytes to the
>codec.
>
>I'm assuming adpcm and MS-adpcm is similar. 
>--
>Steven Critchfield <critch at basesys.com>
>


I'll throw in a couple of comments here. A good starting point to 
understand the Microsoft-adpcm file format, is to read an Apple tech 
note http://developer.apple.com/technotes/tn/tn1081.html  that 
describes the differences between IMA-ADPCM and MS-ADPCM, note the 
real issue is how the data is stored on disk. RAW ADPCM samples (for 
example if you put a voice capable modem into voice mode (see the 
V.253 Modem AT Command set) then asterisk's adpcm codec will handle 
it. However it's when windows software "writes these adpcm samples to 
a wav file, is where the issue is..

The original question (correct me if i am wrong Steven) is how to 
take a windows .wav file that contains  adpcm audio samples that are 
created under MS Windows and "play" them to a caller via asterisk. 
The Apple tech note is a great starting point on describing the 
issues for parsing the data.

Another good open source code base that I have used to read and 
"play" a windows .wav file over a modem (i.e an answering machine) is 
the vgetty/voice subproject  that's part of mgetty. There is code in 
vgetty that parses the MSADPCM wav file and creates a .RMD file 
(which is a RAW ADPCM file) that you just write to the phone line.

Do a search for "pvf tools" to see some of the different formats 
supported by the vgetty project.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20050202/32facb4f/attachment.htm


More information about the asterisk-dev mailing list