Loudness Normalisation LUFS in C# with NAudio

Viewed 12

I am looking for informations on how to do a loudness normalisation (LUFS EBU128) with NAudio.

I need to read .wav files (not play them) who could be mono/stereo/multichannel and get their loudness value, I don't actually need to modify the files just get the value. I have no problem reading the files adapting one of the examples from NAudio :

    private static void ReadWavFile(FileInfo inputFile)
    {
        using (var inAudio = new WaveFileReader(inputFile.FullName))
        {
            //Calculate required byte[] buffer.
            var buffer = new byte[10 * inAudio.WaveFormat.AverageBytesPerSecond];//Assume average will be constant for WAV format.

            int index = 0;
            do
            {
                int bytesRead = 0;
                do
                {
                    bytesRead = inAudio.Read(buffer, 0, buffer.Length - bytesRead);
               
                } while (bytesRead > 0 && bytesRead < buffer.Length);

                index++;
            } while (inAudio.Position < inAudio.Length);
        }
    }

But I cannot find how to do a the loudness normalization part within NAudio. Is it possible ?

If it's not possible I also found other tools but they ask for a double[][] buffer while NAudio provides a byte[] or float[] one. Would it be possible to convert it ?

Thanks !

0 Answers
Related