jameslyons / python_speech_features

This library provides common speech features for ASR including MFCCs and filterbank energies.
MIT License
2.38k stars 617 forks source link

[Question:] How to capture intensity or perceived loudness of a given audio file at regular intervals #61

Closed StanSilas closed 6 years ago

StanSilas commented 6 years ago

If you are playing a song on your laptop, As you increase the volume from 0 to 100, the audio becomes louder and louder.

Say I have an .mp3 or .wav , how do I capture this ^ perceived loudness/intensity at regular intervals (may be 0.1 second) in the audio using python speech features?

Any advice is appreciated.

Thanks Vivek

morenoh149 commented 6 years ago

the amplitude of the waveform is the loudness. So to measure the loudness every 0.1 seconds you get the amplitude at that point in time. Maybe you want something else?

this project uses scipy and that returns a numpy array (https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html#scipy.io.wavfile.read) so you'd just seek in that np array to the time you're interested in and return the value at that time.

venkatsubash2003 commented 1 year ago

Do you mean that Loudness is nothing but Amplitude per second?

jameslyons commented 1 year ago

Loudness is a perceptual quality of audio related nonlinearly to the audio waveform. You can approximate it quite well by squaring the time domain waveform, summing the result and taking the logarithm (cube root can also work here). If you are interested in rough perceptual loudness per second, that will do if you sum over 1 second segments of your audio.

On Thu, 29 Dec 2022, 4:35 pm Venkat Sai Subash Panchakarla, < @.***> wrote:

Do you mean that Loudness is nothing but Amplitude per second?

— Reply to this email directly, view it on GitHub https://github.com/jameslyons/python_speech_features/issues/61#issuecomment-1367101731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM7KQPL5ZM4XT35RK5CJYTWPUWKHANCNFSM4E7PSCVQ . You are receiving this because you modified the open/close state.Message ID: @.***>