Decibel values ​​at specific points in the wav file

I am trying to measure the output and output from a wav file. Preferably the first and last 5 seconds or so. I'm basically trying to assign a numerical value that means "this song has a slow lead" or "This song has a sharp end."

My thinking was to get the slope of the dB values, but I can't find the linux command line tool that will give me the dB values. I know that they can be measured because Audacity has the form of a signal (db).

enter image description here

Basically, I'm looking for a way to collect data points to duplicate this graph so that I can get the slope.

EDIT - work in java

+2
source share
2 answers

I don't know any command line tools for this, but writing a python script using this function is quite simple using scipy libraries.

We can use scipy.io.wavfile to enter the IO file and then calculate the dB values ​​ourselves (note that this will not necessarily be the standard dB value, as this will depend on your speakers and volume settings).

First we get the file:

 from scipy.io.wavfile import read samprate, wavdata = read('file.wav') 

Then we break the file into pieces, where the number of blocks depends on how accurately you want to measure the volume:

 import numpy as np chunks = np.array_split(wavdata, numchunks) 

Finally, we calculate the volume of each fragment:

 dbs = [20*log10( sqrt(mean(chunk**2)) ) for chunk in chunks] 

where dbs now a list of dB values ​​(again, not necessarily true SPL sound levels) for each fragment of your file.

You can also easily split the data differently using overlapping chunks, etc.

References: - scipy.io.wavfile - dB (SPL)

+4
source

Here are just a few of the questions on how to read audio files and draw waveforms and waveforms in Java.

How to create a sound file in Java

How can I extract data from my wav file?

Java program to create a PNG form for an audio file

0
source

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


All Articles