h--n
h--n

Reputation: 6023

Is there a .NET library to Normalize PCM WAV

I want to normalize PCM WAV files from client side(Silverlight). I am using ASP.NET MVC on the server side. And I found a C program here

https://neon1.net/prog/normalizer.html Does anyone know that if there are similar C# libraries that I can use directly?

Upvotes: 2

Views: 2862

Answers (2)

Mark Heath
Mark Heath

Reputation: 49482

"Normalizing" audio files is generally not a great idea, since if there is just one sample at full volume, then it will have no effect. A better approach would be to run a dynamic range compressor on the audio.

In Skype Voice Changer I have written sample code that uses NAudio and passes audio through dynamic range compressors. However, as others have said, NAudio isn't directly usable in Silverlight due to interop. But you should be able to copy WaveFileReader, WaveFormat and WaveFileWriter out and compile them without needing to make too many code changes. Also, you won't be able to use the WaveBuffer mechanism for casting between arrays of bytes and shorts/floats, so you need to do the conversion the slow way (e.g. using BitConverter).

Upvotes: 1

Ohad Schneider
Ohad Schneider

Reputation: 38106

Some ideas (aside of trying NAudio or Bass.NET)

  1. Call the compiled c executable
  2. Compile it as a dll and use P/Invoke
  3. Convert the C code to c#

Upvotes: 0

Related Questions