在哪里可以找到 getLevel()?
下面的代码中使用了getLevel()
。我在哪里可以找到它(它是关于声音的,它与 pyaudio 库一起运行)
# this is the threshold that determines whether or not sound is detected
THRESHOLD = 0
#open your audio stream
# wait until the sound data breaks some level threshold
while True:
data = stream.read(chunk)
# check level against threshold, you'll have to write getLevel()
if getLevel(data) > THRESHOLD:
break
# record for however long you want
# close the stream
In the code below is using getLevel()
. where can I find it (it is about sound, and it run with pyaudio library)
# this is the threshold that determines whether or not sound is detected
THRESHOLD = 0
#open your audio stream
# wait until the sound data breaks some level threshold
while True:
data = stream.read(chunk)
# check level against threshold, you'll have to write getLevel()
if getLevel(data) > THRESHOLD:
break
# record for however long you want
# close the stream
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查看 https://docs.python.org/library/audioop.html< /a>
这是另一个处理音频的 python 模块,但该模块似乎有一种方法来获取音频级别( max(fragment, width) )。
You could have a look at https://docs.python.org/library/audioop.html
This is another python module to handle audio, but that one does seem to have a method to get the audio level ( max(fragment, width) ).
查看已执行的导入。您可以找到
from someModule import getLevel
或from someModule import *
。Look at the imports that have been executed. You'll either find
from someModule import getLevel
, orfrom someModule import *
.