This project has moved. For the latest updates, please go here.

Use of audio codecs

Mar 31, 2010 at 11:39 AM

Mark,

In a couple of other posts people have been asking about using ACM codecs to play other audio formats.  In your response to these posts you suggest that the WaveFormat structure has to be identified in order to pass data through the ACM codecs.

Please forgive my ignorance as my knowledge of audio formats and the workings of codecs is limited but I'd assumed that the purpose of a codec was to code/decode audio/video data into a standard format.  If I install say an OGG or FLAC codec, can I use NAudio to decompress the data and play the audio or do I have to derive specific WaveFormats etc. if so why ?  

How does Windows Media Player accomplish this, if I install a codec it just plays.  I presumed the codec understands the file format.

Any information you can provide would be appreciated.

Thanks

Steve

Coordinator
Mar 31, 2010 at 11:46 AM

hi Steve,

the difficulty is selecting the appropriate codec to use. You do not pass files to ACM (that would be nice and easy). Instead you pass it two WaveFormats. One is the format you want to convert from, the other is the format you want to convert to. Also, codecs do not generally expect to be passed anything but compressed audio. i.e. the additional metadata such as album art, track information, should not be passed into the codec. This means that you have do do some work to parse the file contents yourself.

There may be some tricks that Windows Media Player uses that I don't know about, which allow totally new file types to be passed through ACM codecs correctly.

Mark

Mar 31, 2010 at 12:17 PM

Mark,

Reading around a few bits and pieces I think Media Player utilises DirectShow filters.

Digging around in the source code I see that NAudio contains an OggEncoder class but reading other posts it would appear that OGG playback is not supported.  Are there plans to support OGG playback ?

A couple of other questions....

Does NAudio support other Windows Media formats e.g. WMA ?

Do you have any examples of using the DMO objects ?

Thanks

Steve

Coordinator
Apr 6, 2010 at 10:32 AM

the ogg interop is very old, and I doubt works properly any more. It would be nice to add ogg support but I don't have the time for it at the moment.

WMA support is also something I would like to offer in the future. Unfortunately, Microsoft did not make their Windows Media Format SDK at all user friendly for interop with .NET, or to work out how to perform simple tasks with it.

The only example of using DMO objects is the ResamplerDMO example. See my blog post here:

http://mark-dot-net.blogspot.com/2008/06/screencast-creating-wav-file-resampler.html

Mark