在哪里可以找到 getLevel()?

发布于 2024-09-10 21:58:42 字数 492 浏览 8 评论 0原文

下面的代码中使用了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

緦唸λ蓇 2024-09-17 21:58:42

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) ).

腻橙味 2024-09-17 21:58:42

查看已执行的导入。您可以找到 from someModule import getLevelfrom someModule import *

Look at the imports that have been executed. You'll either find from someModule import getLevel, or from someModule import *.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文