¿Dónde puedo encontrar a GetLevel ()?
Pregunta
En el código a continuación está usando getLevel()
.¿Dónde puedo encontrarlo (se trata de sonido y se ejecuta con la biblioteca de 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
Solución
Podría echar un vistazo a https://docs.python.org/library/audioop.html Este es otro módulo de Python para manejar el audio, pero que uno parece tener un método para obtener el nivel de audio (MAX (Fragmento, Ancho)).
Otros consejos
Mira las importaciones que se han ejecutado.Usted encontrará from someModule import getLevel
, o from someModule import *
.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow