Função Listen_Microfone()

Visualizando 3 posts - 1 até 3 (de 3 do total)
  • Autor
    Posts
  • #43970

    estou na aula relacionado a função chamada listen_microfone(), mas não consigo executar, porque da esse tipo de erro:

    2024-03-02 19:37:22.803819: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found
    2024-03-02 19:37:22.803961: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
    2024-03-02 19:37:29.357048: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found
    2024-03-02 19:37:29.358516: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cublas64_11.dll’; dlerror: cublas64_11.dll not found
    2024-03-02 19:37:29.360046: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cublasLt64_11.dll’; dlerror: cublasLt64_11.dll not found
    2024-03-02 19:37:29.361363: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cufft64_10.dll’; dlerror: cufft64_10.dll not found
    2024-03-02 19:37:29.362607: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘curand64_10.dll’; dlerror: curand64_10.dll not found
    2024-03-02 19:37:29.363989: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cusolver64_11.dll’; dlerror: cusolver64_11.dll not found
    2024-03-02 19:37:29.365062: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cusparse64_11.dll’; dlerror: cusparse64_11.dll not found
    2024-03-02 19:37:29.366069: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudnn64_8.dll’; dlerror: cudnn64_8.dll not found
    2024-03-02 19:37:29.366215: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
    Skipping registering GPU devices…
    2024-03-02 19:37:29.366836: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
    Traceback (most recent call last):
    File “c:\Repositorios\Pessoal\IA Expert\Assistente_Virtual\01_assistente.py”, line 247, in <module>
    listen_microphone()
    File “c:\Repositorios\Pessoal\IA Expert\Assistente_Virtual\01_assistente.py”, line 218, in listen_microphone
    with sr.Microphone() as source:
    File “C:\Users\mqjmarques\AppData\Local\Programs\Python\Python39\lib\site-packages\speech_recognition\__init__.py”, line 138, in __enter__
    self.audio.open(
    File “C:\Users\mqjmarques\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py”, line 754, in open
    stream = Stream(self, *args, **kwargs)
    File “C:\Users\mqjmarques\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py”, line 445, in __init__
    self._stream = pa.open(**arguments)
    OSError: [Errno -9999] Unanticipated host error

     

    #43974
    Dalton Vargas
    Moderador

      Olá Mateus,

      Parece que este problema está relacionado a biblioteca PyAudio, algum problema em acessar o microfone ou configurar o fluxo de áudio corretamente. Seguem algumas etapas que você pode tentar resolver o problema:

      • Verifique as dependências do PyAudio: Certifique-se de que todas as dependências do PyAudio estão instaladas corretamente. O PyAudio geralmente requer algumas bibliotecas do sistema para funcionar corretamente, dependendo do SO que você está usando.
      • Atualize o PyAudio: Tente remover a instalação atual do PyAudio e instalar a versão mais recente, pois isso pode corrigir problemas conhecidos.
      • Verifique outros programas que acessam o microfone: Se você tiver outros programas em execução que possam estar usando o microfone, isso pode causar conflitos com o PyAudio. Tente fechar outros aplicativos que possam estar usando o microfone e veja se isso resolve o problema.
      • Reinicie o computador: Às vezes, simplesmente reiniciar o computador pode resolver problemas temporários de acesso ao dispositivo de áudio.
      • Tente usar/executar este script de amostra do PyAudio:
        • import pyaudio
          import wave

          FORMAT = pyaudio.paInt16
          CHANNELS = 2
          RATE = 44100
          CHUNK = 1024
          RECORD_SECONDS = 5
          WAVE_OUTPUT_FILENAME = “file.wav”

          audio = pyaudio.PyAudio()

          # start Recording
          stream = audio.open(format=FORMAT, channels=CHANNELS,
          rate=RATE, input=True,
          frames_per_buffer=CHUNK)
          print “recording…”
          frames = []

          for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
          data = stream.read(CHUNK)
          frames.append(data)
          print “finished recording”

          # stop Recording
          stream.stop_stream()
          stream.close()
          audio.terminate()

          waveFile = wave.open(WAVE_OUTPUT_FILENAME, ‘wb’)
          waveFile.setnchannels(CHANNELS)
          waveFile.setsampwidth(audio.get_sample_size(FORMAT))
          waveFile.setframerate(RATE)
          waveFile.writeframes(b”.join(frames))
          waveFile.close()

      #43982

      Funcionou quando usei o microfone do PC e não fone de ouvido, valeu

    Visualizando 3 posts - 1 até 3 (de 3 do total)
    • Você deve fazer login para responder a este tópico.