'How to detect pcm sound level/dB in Node.Js

I am recording user voices on my discord server using Discord.Js and these are stored as a buffer in pcm format. I want to detect anyone shouting, doing ear-rape or any other loud actions.

The buffer contains a "16-bit signed PCM, stereo 48KHz"

how can i determine the average desibel of this sound?

thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source