views:

41

answers:

2

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?

A: 

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#
ohadsc
P/Invoke not gonna work in Silverlight
Denis
@ohadsc, Thanks for that. I considered these possibles but just wanted to see if there is a ready-to-use call which does the normalization work. I guess there isn't. And I will try to implement it using NAudio.
nnn
@Denis, that's right, I'll do it on server side.
nnn
+1  A: 

"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).

Mark Heath
@Mark, Thanks. It helps. I will look into the "Dynamic range compressor" and "Skype Voice Changer"
nnn