pyaudio

when installing pyaudio, pip cannot find portaudio.h in /usr/local/include

那年仲夏 提交于 2019-11-27 17:58:30
I'm using mac osx 10.10 As the PyAudio Homepage said, I install the PyAudio using brew install portaudio pip install pyaudio the installation of portaudio seems successful, I can find headers and libs in /usr/local/include and /usr/local/lib but when I try to install pyaudio, it gives me an error that src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found #include "portaudio.h" ^ 1 error generated. error: command 'cc' failed with exit status 1 actually it is in /usr/local/include why can't it find the file? some answers to similar questions are not working for me(like using

Record speakers output with PyAudio

偶尔善良 提交于 2019-11-27 14:31:39
I'm trying to record the ouput from my computer speakers with PyAudio. I tried to modify the code example given in the PyAudio documentation, but it doesn't work. Here's my code: import pyaudio import wave CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = "output.wav" p = pyaudio.PyAudio() SPEAKERS = p.get_default_output_device_info()["hostApi"] #The part I have modified stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK, input_host_api_specific_stream_info=SPEAKERS) #The part I have modified

Pyaudio installation error - 'command 'gcc' failed with exit status 1'

被刻印的时光 ゝ 提交于 2019-11-27 11:53:34
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio 0.2.4 Downloading http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.4.tar.gz Processing pyaudio-0.2.4.tar.gz Running PyAudio-0.2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0Tetss/PyAudio-0.2.4/egg-dist-tmp-PYy9T8 In file included from /usr/include/python2.7

What are chunks, samples and frames when using pyaudio

无人久伴 提交于 2019-11-27 10:51:43
问题 After going through the documentation of pyaudio and reading some other articles on the web, I am confused if my understanding is correct. This is the code for audio recording found on pyaudio's site: import pyaudio import wave CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = "output.wav" p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) print("* recording") frames =

Cannot install pyaudio, gcc error

橙三吉。 提交于 2019-11-27 05:37:09
问题 Trying to install pyaudio with instructions per here: $ git clone http://people.csail.mit.edu/hubert/git/pyaudio.git $ cd pyaudio $ sudo python setup.py install running install running build running build_py running build_ext building '_portaudio' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o In file included from /usr/include/python2.7

How can the terminal output of executables run by Python functions be silenced in a general way?

前提是你 提交于 2019-11-27 05:31:59
I want to suppress all of the terminal output produced by a function that runs executables. I have attempted to suppress the output of a Python function by using a context manager that temporarily redefines stdout and stderr each time the function is called. This suppresses terminal output produced by print calls in the function, but it doesn't seem to work when the function calls executables that produce terminal output. So, how could the output of executables called by Python functions be suppressed? My code is below. I have included an example function that calls ls to try to illustrate the

PyAudio Input overflowed

倖福魔咒の 提交于 2019-11-27 04:29:16
I'm trying to make real-time plotting sound in python. I need to get chunks from my microphone. Using PyAudio, try to use 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 = RATE, input = True, frames_per_buffer = chunk) print "* recording" all = [] for i in range(0, RATE / chunk * RECORD_SECONDS): data = stream.read(chunk) all.append(data) print "* done recording" stream.close() p.terminate() After, I

Convert multi-channel PyAudio into NumPy array

烂漫一生 提交于 2019-11-27 04:28:44
问题 All the examples I can find are mono, with CHANNELS = 1 . How do you read stereo or multichannel input using the callback method in PyAudio and convert it into a 2D NumPy array or multiple 1D arrays? For mono input, something like this works: def callback(in_data, frame_count, time_info, status): global result global result_waiting if in_data: result = np.fromstring(in_data, dtype=np.float32) result_waiting = True else: print('no input') return None, pyaudio.paContinue stream = p.open(format

Detect tap with pyaudio from live mic

蹲街弑〆低调 提交于 2019-11-26 21:39:49
How would I use pyaudio to detect a sudden tapping noise from a live microphone? Russell Borogove One way I've done it: read a block of samples at a time, say 0.05 seconds worth compute the RMS amplitude of the block (square root of the average of the squares of the individual samples) if the block's RMS amplitude is greater than a threshold, it's a "noisy block" else it's a "quiet block" a sudden tap would be a quiet block followed by a small number of noisy blocks followed by a quiet block if you never get a quiet block, your threshold is too low if you never get a noisy block, your

when installing pyaudio, pip cannot find portaudio.h in /usr/local/include

橙三吉。 提交于 2019-11-26 19:08:28
问题 I'm using mac osx 10.10 As the PyAudio Homepage said, I install the PyAudio using brew install portaudio pip install pyaudio the installation of portaudio seems successful, I can find headers and libs in /usr/local/include and /usr/local/lib but when I try to install pyaudio, it gives me an error that src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found #include "portaudio.h" ^ 1 error generated. error: command 'cc' failed with exit status 1 actually it is in /usr/local