Questions tagged [pyaudio]

PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library.

PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio streams on a variety of platforms (e.g. GNU/Linux, Microsoft Windows and Mac OS X).

Sources:

  1. http://pypi.python.org/pypi/PyAudio/
  2. http://people.csail.mit.edu/hubert/pyaudio/
1375 questions
0
votes
2 answers

How do I do mathematical analysis on microphone audio information from pyaudio?

I am trying to obtain the pitch, the level, and other stuff from my microphone using Python. I am trying using pyaudio, but I read that I need to use other libraries to generate the maths. I can’t find how mix pyaudio with the math library.
0
votes
1 answer

Feed stream.write() in advance

I am translating a metronome I wrote for Android into Python for classic Desktop machines. Under Android, the buffer was 2s long and always filled wich means it was 2s-lag-proof. With Python and Pyaudio, I am doing something like (bar with 4…
funkygoby
  • 13
  • 6
0
votes
0 answers

Playback pure tone, variable phase stream with pyaudio

I'm building an acoustic cancelling device based on Pyaudio, fourier transforms and. c-Media usb audio card. The software is threaded, using the producer/consumer model. The device detects pure tones in the environment (reads chunks of microphone…
Pedro Guillem
  • 43
  • 1
  • 4
0
votes
0 answers

Possible to only Block stream.write function of PyAudio?

I'm trying to code a digital wavetable synthesizer that will eventually incorporate real-time pitch/volume input, but I'm stuck making the audio work properly. The basic idea is that the program checks for pitch and volume input about 100 times per…
BatWannaBe
  • 4,330
  • 1
  • 14
  • 23
0
votes
1 answer

RPI2b - "ALSA: Underrun Occurred"

I am running a python script on a rpi2b + a cirrus logic audio card. I want to iir filter music. I open a stream with pyaudio and have my callback function. The first (around) 5 seconds it runs fine and then I get this error... Couldnt find…
sanj3k
  • 11
  • 6
0
votes
1 answer

Generating wave sound from text file

I have generated sequence of frequency sound from text file using : import mmap import math import pyaudio fh = open('/home/jay/Documents/try.txt', 'rb') m = mmap.mmap(fh.fileno(), 0, access=mmap.ACCESS_READ) ba = bytearray(m) #sudo apt-get…
Jay Patel
  • 127
  • 1
  • 1
  • 11
0
votes
1 answer

Python adaptfilt-echo canceller example with two .wav files

this code isa modification from the example of adaptfilt2.0 echo canceller u(n) ------->->------+----------->->----------- | | +-----------------+ +------------------+ …
0
votes
1 answer

Choppy audio from separating and then joining .wav stereo channels

I am currently working on processing .wav files with python, using Pyaudio for streaming the audio, and the python wave library for loading the file data. I plan to later on include processing of the individual stereo channels, with regards to…
Morten B.
  • 93
  • 8
0
votes
1 answer

IOError: [Errno Invalid output device (no default output device)] -9996

I've copied and pasted some example code to play a wav file using pyaudio, but I get the error: IOError: [Errno Invalid output device (no default output device)] -9996. Here's the code: import pyaudio import wave import sys CHUNK = 1024 if…
Null Salad
  • 765
  • 2
  • 16
  • 31
0
votes
1 answer

PyAudio - Slow to instatiate stream object

I am using PyAudio in a Python script on a Raspberry Pi B. It (successfully) runs a recording loop every 10 seconds, listening for a keyword. But there is a substantial pause in between each loop which I am trying to eliminate. I have narrowed it…
Lee Melbourne
  • 407
  • 5
  • 20
0
votes
1 answer

Increase volume before streaming with Python

Here we have a normal code for streaming audio from a wav file with PyAudio: def play_sound(sound): CHUNK = 1024 wf = wave.open(sound, 'rb') p = pyaudio.PyAudio() stream = p.open(format=p.get_format_from_width(wf.getsampwidth()), …
Programer Beginner
  • 1,377
  • 6
  • 21
  • 47
0
votes
1 answer

Play mp3 file not using default output (playback) device in Python

I know that on PyAudio it is possible to choose on what playback device to stream on but PyAudio doesnt support mp3 files. My script would work if one of the following problem was solved: Play mp3 file on PyAudio Convert from mp3 to wav without…
Programer Beginner
  • 1,377
  • 6
  • 21
  • 47
0
votes
0 answers

Python programs freeze when run simultaneously

I have written 2 separate codes- one for transfer of audio simultaneously between two systems using sockets and pyaudio and the other for transfer of video between two systems using sockets and opencv2. Both codes when executed individually work…
shiva
  • 2,535
  • 2
  • 18
  • 32
0
votes
3 answers

Speeding up the sound processing algorithm

I use the following code to do some immediate sound processing/analyzing. It works, but really slow (compared to the planned speed). I have added some time markers to find out where the problem is and according to them there shouldn't be any.…
Victor Pira
  • 1,132
  • 1
  • 10
  • 28
0
votes
1 answer

In Python, how can the console output of a selection of code be suppressed?

I have a small selection of code: stream = pyaudio.PyAudio().open( format = pyaudio.PyAudio().get_format_from_width(1), channels = 1, rate = bitrate, output = True ) When I run it, it produces a few lines of console…
d3pd
  • 7,935
  • 24
  • 76
  • 127