开发者

Where can I find getLevel()?

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 agai开发者_如何学Gonst threshold, you'll have to write getLevel()
    if getLevel(data) > THRESHOLD:
        break

# record for however long you want
# close the stream


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜