ar1st0crat / NWaves

.NET DSP library with a lot of audio processing functions
MIT License
453 stars 71 forks source link

creating new wavefile does not normalize data. #43

Closed hooch21 closed 3 years ago

hooch21 commented 3 years ago

When you read a 16 bit .wav file using as a new FileStream and then create a waveFile from that stream using the command var waveFile = new NWaves.Audio.WaveFile(stream) or new NWaves.Audio.WaveFile(stream,true)

and then extract the signal using signal = waveFile[Channels.Left];

The signal values (.samples) ARE NOT normalized between -1 and 1.

Mike

hooch21 commented 3 years ago

Well, actually it does normalize the values just not to what I was expecting. It is normalizing to the maximum bit depth which is 16 bits or (2^16). In my case the max and min values from NWaves was .224. I was expecting the max value to be -1 or 1. I thought it would normalize by dividing by the magnitude of the largest value in the audio file. It did not do that. It normalized by dividing all values by 2^16. So, this is not a problem and you can close it.