Its can be done using root mean square (RMS).

One way to build your own rms function using python is:

def rms( data ):
    count = len(data)/2
    format = "%dh"%(count)
    shorts = struct.unpack( format, data )
    sum_squares = 0.0
    for sample in shorts:
        n = sample * (1.0/32768)
        sum_squares += n*n
    return math.sqrt( sum_squares / count )

Another choice is use audioop to find rms:

data = stream.read(CHUNK)
rms = audioop.rms(data,2)

Now if do you want you can convert rms to decibel scale decibel = 20 * log10(rms)

求.wav.mp3音频里一分钟平均响度(分贝),存在csv中_one0_opiece ...

https://blog.csdn.net/one0_opiece/article/details/83824540

2018年11月7日 ... 环境需要有包pudub,ffmpeg,pyaudio并下载ffmpeg 放在文件目录中 ... 获取文件 目录下的mp3 wav格式音频. def file_name(file_dir):. L=[] for root ...

Pyaudio : how to check volume - Stack Overflow

https://stackoverflow.com/questions/25868428/pyaudio-how-to-check-volume

data = stream.read(CHUNK) rms = audioop.rms(data,2). Now if do you want you can convert rms to decibel scale decibel = 20 * log10(rms).

python 获取麦克风声音_python调用pyaudio使用麦克风录制wav声音 ...

https://blog.csdn.net/weixin_39941859/article/details/111438087

2020年12月16日 ... python的pyaudio可以进行录音,播放,生成wav文件等等,WAVE是录音时 ... 直接 通过麦克风录制声音,我们可以通过调用该库,获取到wav测试语音。 ... 自己用 python写的演示同时播放多个wave文件,计算声音分贝,语音激励.

pyaudio如何判断音量大小啊-CSDN论坛

https://bbs.csdn.net/topics/392167067

python 获取麦克风声音_python调用pyaudio使用麦克风录制wav声音文件的教程. python的pyaudio可以进行录音,播放,生成wav文件等等,WAVE是录音时用的 ...

Realtime Audio Visualization in Python

https://swharden.com/blog/2016-07-19-realtime-audio-visualization-in-python/

Jul 19, 2016 ... This script gets some audio from the microphone and shows the values in the console (ten times). import pyaudio import numpy as np CHUNK = ...

linux 获取声音分贝- 云+社区- 腾讯云

https://cloud.tencent.com/developer/information/linux%20%E8%8E%B7%E5%8F%96%E5%A3%B0%E9%9F%B3%E5%88%86%E8%B4%9D

分贝(decibel)是量度两个相同单位之数量比例的计量单位,主要用于度量声音 ... 播放声音,假如你想在python中回放声音,参考pyalsaaudio(linux)或pyaudio

Python:实时或从wav文件获取音量分贝级别- Thinbug

https://www.thinbug.com/q/52943151

Python:实时或从wav文件获取音量分贝级别. 时间:2018-10-23 07:12:24. 标签: python numpy signal-processing wav pyaudio. 对于项目工作,我需要从已录制 ...

PyAudio and Decibel change and panning - Stack Overflow

https://stackoverflow.com/questions/47599106/pyaudio-and-decibel-change-and-panning

We get IDLE session prompt back upon breaking from play loop. You can tailor that your needs. Output: Python 2.7.9 (default, Dec 10 2014, ...

Python: Get volume decibel Level real time or from a wav file - Stack ...

https://stackoverflow.com/questions/52943151/python-get-volume-decibel-level-real-time-or-from-a-wav-file

Short answer: dB isn't the same as dB. Your results are probably correct. Long answer: dB levels always define a relation to some reference ...

Audio Processing in Python Part II: Exploring Windowing, Sound ...

https://makersportal.com/blog/2018/9/17/audio-processing-in-python-part-ii-exploring-windowing-sound-pressure-levels-and-a-weighting-using-an-iphone-x

Sep 17, 2018 ... Frequency Spectrum of Real Data Recorded with pyaudio ... The A-weighting function in the decibel domain takes on the following form: ...

Real time audio input/output in Python with PyAudio - Raspberry Pi ...

https://raspberrypi.stackexchange.com/questions/38756/real-time-audio-input-output-in-python-with-pyaudio

Nov 29, 2015 ... I do not know why your audio is not working. Perhaps you need to explicitly state the output device index. This is what I did to get audio out ...

A simple proof of concept to extract pitch and volume of streamed ...

https://gist.github.com/notalentgeek/48aeab398b6b74e3a9134a61b6b79a36

and volume directly with help of PyAudio and Aubio. # Python libraries. ... Frequency under -40 dB will considered. # as a silence. ... Finally get the pitch.

FFT to spectrum in decibel - Signal Processing Stack Exchange

https://dsp.stackexchange.com/questions/32076/fft-to-spectrum-in-decibel

Jul 11, 2016 ... Even after doing magdB = 20 * math.log10(abs(STFT)) to have decibel values, we get a max of 47.9 dB . But this 47.9 dB doesn't mean ...

Using Python to plot the current microphone's input and the Fourier ...

https://gist.github.com/ZWMiller/53232427efc5088007cab6feee7c6e4c

import pyaudio. import numpy ... PyAudio(). # start Recording. stream = audio. open(format=FORMAT, ... Fast Fourier Transform, 10*log10(abs) is to scale it to dB ... print function must be used with braces according to python 3 so it gives error ...