AttributeError: Could not find PyAudio; check installation…can’t use speech Recognition
In Terminal type pip install pipwin Then pipwin install pyaudio
In Terminal type pip install pipwin Then pipwin install pyaudio
Found an answer at https://groups.google.com/forum/#!msg/pyo-discuss/ptp_m39ACpI/XgKdK8YGNSoJ sudo apt-get install portaudio19-dev
you can use get_device_info_by_host_api_device_index. For instance: import pyaudio p = pyaudio.PyAudio() info = p.get_host_api_info_by_index(0) numdevices = info.get(‘deviceCount’) for i in range(0, numdevices): if (p.get_device_info_by_host_api_device_index(0, i).get(‘maxInputChannels’)) > 0: print(“Input Device id “, i, ” – “, p.get_device_info_by_host_api_device_index(0, i).get(‘name’))
pyaudio.Stream.read() has a keyword parameter exception_on_overflow, set this to False. For your sample code that would look like: import pyaudio import wave import sys chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = “output.wav” p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = … Read more
Try this (in admin mode command prompt): pip install pipwin pipwin install pyaudio pipwin is like pip, but it installs precompiled Windows binaries provided by Christoph Gohlke. Saves you a lot of googling and manual downloading.
It happens quite often that someone installs a Python package using pip, but then can’t seem to import it in Python. To understand why this happens, you must know how Windows finds executables to run, and how the Python software is installed. The basics: When running a command, Windows searches for an executable in the … Read more
I had the same problem, and I fix it just by enable/disable the access to the microphone in Setting>Confidentiality>Microphone (on Windows 10)
OK, here is a solution that isn’t pretty but works for me. As per my comment to ulidtko’s answer, pyaudio is not the problem but rather the underlying PortAudio that pyaudio is supposed to bind to. On ubuntu the portaudio drivers are installed with this package: sudo apt-get install python-gnuradio-audio-portaudio You must have this already, … Read more
I’m assuming you are on a Mac. This is a simple issue to fix. First install Xcode. Then restart your computer. Afterwards run the commands in sequence, xcode-select –install brew remove portaudio brew install portaudio pip3 install pyaudio So to clarify, Xcode is installed through the App Store. Xcode command line tools are required for … Read more
For the ALSA errors in particular, you can use ALSA’s snd_lib_error_set_handler function as described for example in this question. For one of my projects, I created a module called mute_alsa, which looks like this: import ctypes ERROR_HANDLER_FUNC = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p) def py_error_handler(filename, line, function, err, fmt): pass c_error_handler = ERROR_HANDLER_FUNC(py_error_handler) try: … Read more