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

NAudio third-party dependencies

Mar 22, 2011 at 8:47 PM

First off, let me say NAudio is an excellent library which helped me a lot on a commercial project a few months ago.

During said project, I installed a small program which used the library on a web server.
The server itself did not have a sound card nor sound drivers, codecs and the likes.

What I noticed was that NAudio was dependent on the existence of those drivers or codecs in the system, otherwise it would throw some exception.

I noticed the code was dependent on the Windows API and outside DLL files, even for operations which, I believe, should not require a sound card. For example, compositing a Wave file from audio samples.

I think the main point of interest here is WaveInterop.cs.

My question, could NAudio in the future, support such operations without being dependent on third party DLLs - that is, using only binary streams?

Are all these interops required, and if so, why? Couldn't they be replaced with managed code?

Cheers,
Amir Grozki

Coordinator
Mar 30, 2011 at 9:49 AM

You need some way of talking to the audio hardware to play or record audio, so you have to call into unmanaged APIs at some point. There are parts of NAudio that are fully manged though, such as the ability to read and write WAV files.

Mar 30, 2011 at 4:13 PM

I ran into exceptions related to hardware when trying to read and write WAV files, no playing or recording involved.

It is possible I ran into a bug, but unfortunately I cannot recreate it today.

Thank you for your the answer!

May 14, 2013 at 4:23 PM
markheath wrote:
You need some way of talking to the audio hardware to play or record audio, so you have to call into unmanaged APIs at some point. There are parts of NAudio that are fully manged though, such as the ability to read and write WAV files.
Does that mean that you can't run NAudio on a headless server with no sound card in it? I'm looking to do some bulk processing from a server, not a desktop PC and want to be able to use NAudio to do conversions.

Is there a list of external dependencies that may not be present?
Coordinator
May 14, 2013 at 4:24 PM
sure, you can use the parts of NAudio that don't need a soundcard. You just can't play audio or record it. If you are converting audio from one format to another for example, you have no need of a soundcard, just whatever codecs you plan to use,.