pyaudio

List all audio devices with Python's pyaudio (portaudio binding)

徘徊边缘 提交于 2019-12-04 20:40:53
问题 I tried import pyaudio p = pyaudio.PyAudio() for i in range(p.get_device_count()): print p.get_device_info_by_index(i) but I don't get the full list of all devices : for example I don't get ASIO devices in this list. This is strange, because portaudio should give ASIO devices as well, right ? How can I list all audio devices with pyaudio ? 回答1: I've created (a while after this question was posted) the sounddevice module for Python, which includes its own DLLs with ASIO support (and all other

Pyaudio : how to check volume

女生的网名这么多〃 提交于 2019-12-04 20:31:53
I'm currently developping a VOIP tool in python working as a client-server. My problem is that i'm currently sending the Pyaudio input stream as follows even when there is no sound (well, when nobody talks or there is no noise, data is sent as well) : CHUNK = 1024 p = pyaudio.PyAudio() stream = p.open(format = pyaudio.paInt16, channels = 1, rate = 44100, input = True, frames_per_buffer = CHUNK) while 1: self.conn.sendVoice(stream.read(CHUNK)) I would like to check volume to get something like this : data = stream.read(CHUNK) if data.volume > 20%: self.conn.sendVoice(data) This way I could

PyAudio Memory Error

亡梦爱人 提交于 2019-12-04 15:03:02
I am having an issue with my code which causes a memory error. I believe it is caused by this function (see below). def sendAudio(): p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, output = True, frames_per_buffer = chunk) data = stream.read(chunk) client(chr(CMD_AUDIO), encrypt_my_audio_message(data)) def keypress(event): if event.keysym == 'Escape': root.destroy() if event.keysym == 'Control_L': #print("Sending Data...") sendAudio() #print("Data Sent!") What the function does is read from the microphone then send that data over the

Building PortAudio and PyAudio on Mac running Snow Leopard (arch issues)

家住魔仙堡 提交于 2019-12-04 11:29:23
I'd like to tell you what I've tried and then I'd really welcome any comments you can provide on how I can get PortAudio and PyAudio setup correctly! I've tried installing the stable and svn releases of PortAudio from their website for my Core 2 Duo MacBook Pro running Snow Leopard. The stable release has a sizeof error that can be fixed(?) , but the daily svn release installs fine with ./configure && make && make install (so this is what I'm using). The tests are compiled properly and I can get the binaries to produce output/can read microphone input. Ok, so then PyAudio has troubles.

Loopback ('What u hear') recording in Python using PyAudio

只愿长相守 提交于 2019-12-04 10:40:16
Good day, I'm trying to record my speaker output with Python using PyAudio. Currently, I'm able to record my microphone input and send this over to the 'listener'. What I'm trying to do now is create a loopback, so it will record the output from my speakers. I was able to do this with the 'Stereo Mix' from windows, but since this needs to be cross platform, there should be another way to do this. Does anyone has some advice on how I could achieve this? Here is my current code for recording an input stream. import socket import pyaudio import wave #record CHUNK = 1024 FORMAT = pyaudio.paInt16

python pyaudio using multiprocessing

本秂侑毒 提交于 2019-12-04 09:55:03
I'm trying to grab samples from a stream of audio and put them in a shared Queue. I have another process that pulls from this queue. When I run, I get this error: * recording Traceback (most recent call last): File "record.py", line 43, in <module> data = stream.read(CHUNK) File "/Library/Python/2.7/site-packages/pyaudio.py", line 605, in read return pa.read_stream(self._stream, num_frames) IOError: [Errno Input overflowed] -9981 EDIT: Apparently problem has been around for a while with no solution posted (I tried their suggestions): PyAudio Input Overflowed -9981 - No solution working Geting

Trying to install pyaudio using pip

让人想犯罪 __ 提交于 2019-12-04 06:29:56
问题 I try to install pyaudio in pycharm, and I get this error error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 I used pip install pyaudio command. Copy comment: I downloaded PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl try to install it using this command pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64 but it does not work and get this error ERROR: Could not find a version that satisfies the requirement PyAudio-0.2.11-cp37-cp37m-win

Python, Error audio Recording in 16000Hz using Pyaudio

橙三吉。 提交于 2019-12-03 14:57:13
I use Python 2.7.3, Mac OS 10.8.2 and Xcode 4.5.1 I am trying to record sound using PyAudio following the instructions in http://people.csail.mit.edu/hubert/pyaudio/ and using the program """PyAudio example: Record a few seconds of audio and save to a WAVE file.""" 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 = [] for i in range(0, int(RATE / CHUNK

Stream audio from pyaudio with Flask to HTML5

白昼怎懂夜的黑 提交于 2019-12-03 13:34:36
问题 I want to stream the audio of my microphone (that is being recorded via pyaudio) via Flask to any client that connects. This is where the audio comes from: def getSound(self): # Current chunk of audio data data = self.stream.read(self.CHUNK) self.frames.append(data) wave = self.save(list(self.frames)) return data Here's my flask-code: @app.route('/audiofeed') def audiofeed(): def gen(microphone): while True: sound = microphone.getSound() #with open('tmp.wav', 'rb') as myfile: # yield myfile

UDP sound transfer : played sound have big noise

我与影子孤独终老i 提交于 2019-12-03 09:51:17
问题 I have no idea how to solve this problem. Please help me :) I would like to send sound data, recorded by one PC, to the other PC and play it. (by UDP) The program might work correctly, but the sound contain(?) uncomfortable noise. when I tried to record & play sound in one program sequence, it worked correctly. There was no noise. In case of using UDP even in one PC, use IP 127.0.0.1, the noise appeared. At first, I thought the factor is because played sound is out in the other PC and I fixed