Byte array size

I'm new to audio analysis, but I need to complete a (seemingly) simple task. I have a byte array containing 16-bit recording (one channel) and a sampling rate of 44100. How to perform a quick analysis to get the volume at any time? I need to calculate the threshold, so the function returns true if it is above a certain amplitude (volume) and false if not. I thought I could iterate over the byte array and check its value, with 255 being the loudest, but it doesn’t seem to work even when I am not recording anything, there is background noise, and part of the array is filled with 255. Any suggestions would be great. Thanks

+3
source share
3 answers

Since you have 16-bit data, you should expect the signal to range from -32768 to +32767. To calculate the volume, you can take an interval of about 1000 samples and calculate their rms value. Sum the sample squared values ​​by 1000 and take the square root. check this number on your doorstep.

+4
source

Wave energy is usually measured using the root square .

, , ( , ).

, -. ☺

+3

I could try applying a standard deviation sliding window. OTOH, I would not assume that 255 = the loudest. Maybe, but I would like to know what encoding is used. If any compression is present, then I doubt that 255 is "the loudest."

0
source

Source: https://habr.com/ru/post/1778658/


All Articles