Вопрос

В приведенном ниже коде используется 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
Это было полезно?

Решение

Вы могли бы взглянуть на https://docs.python.org/library/audioop.html Это еще один модуль python для обработки аудио, но в нем, похоже, есть метод получения уровня звука (max(фрагмент, ширина)).

Другие советы

Посмотрите на импорт, который был выполнен.Вы либо найдете from someModule import getLevel, или from someModule import *.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top