C # How to get Audio Decibel values ​​at intervals

How can I get the Decibel values ​​for the wav / mp3 file that I have every 1 second? using any audio library that works with C # ..

sort of:

Time: 0, DB: 0.213623
Time: 1, DB: 0.2692261
Time: 2, DB: 0.2355957
Time: 3, DB: 0.2363281
Time: 4, DB: 0.3799744
Time: 5, DB: 0.3580322
Time: 6, DB: 0.1331177
Time: 7, DB: 0.3091431
Time: 8, DB: 0.2984009

I am very grateful for your help :)

Yours faithfully,

+3
source share
2 answers

I found a solution from the examples provided in the NAudio library. since the solution i found is so great. I am not going to publish it here. so I’ll just give hints in case someone wants to do the same. NAudioDemo app → AudioPlayBackDemo folder → AudioPlayBackPanel.cs file ...

+1
source

NAudio WaveFileReader Mp3FileReader, . (, 16- , ). , , .

. , ? , , 1 ( 16- 32768). . :

short sample16Bit = BitConverter.ToShort(buffer,index);
double volume = Math.Abs(sample16Bit / 32768.0);
double decibels = 20 * Math.Log10(volume);

NAudio "SampleAggregator" , , , . , .

(. )

+11

All Articles