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
9
votes
2 answers

Output audio file not created correctly, or has unknown duration time

I am currently trying to record some utterances, in which the record session should start when a key is pressed and held down, and stop when it is released. I made the python script for recording and storing the data.. from pynput import…
Smo
  • 137
  • 1
  • 9
9
votes
1 answer

Creating suitable WAV files for Google Speech API

I'm using pyaudio to record my voice as wav file. I'm using following code: def voice_recorder(): FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 22050 CHUNK = 1024 RECORD_SECONDS = 4 WAVE_OUTPUT_FILENAME = "first.wav" …
JayGatsby
  • 1,541
  • 6
  • 21
  • 41
9
votes
5 answers

pyaudio-OSError: [Errno -9999] Unanticipated host error

I just want to run a simple python audio code: import pyaudio import wave import sys CHUNK = 1024 wf = wave.open("4.wav", 'rb') # instantiate PyAudio (1) p = pyaudio.PyAudio() # open stream (2) stream =…
RahimEnt
  • 199
  • 1
  • 1
  • 16
9
votes
1 answer

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

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…
boortmans
  • 1,138
  • 2
  • 24
  • 40
9
votes
2 answers

UDP sound transfer : played sound have big noise

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…
ami_GS
  • 852
  • 15
  • 21
8
votes
5 answers

how to convert wav file to float amplitude

so I asked everything in the title: I have a wav file (written by PyAudio from an input audio) and I want to convert it in float data corresponding of the sound level (amplitude) to do some fourier transformation etc... Anyone have an idea to…
user995673
  • 81
  • 1
  • 1
  • 2
8
votes
1 answer

Audio Frequencies in Python

I'm writing a code to analyse a single audio frequency sung by a voice. I need a way to analyse the frequency of the note. Currently I am using PyAudio to record the audio file, which is stored as a .wav, and then immediately play it back. import…
Ollie
  • 105
  • 1
  • 1
  • 9
8
votes
2 answers

Pyaudio Installation failure on Ubuntu

Pyaudio Installation failure on Ubuntu I have ubuntu 18LTS python 2 and python 3 pip 10 I installed libportaudio2 and libasound-dev from suggestions I found on google. Is it because I need to install other libraries as well? Here is the error I…
echo
  • 767
  • 2
  • 9
  • 24
8
votes
0 answers

Trying to understand PyAudio error: [Errno -9981] Input overflowed

I am trying to do a sound processing project with PyAudio, but I sometimes get this error and I don't understand why. The following code plays back audio heard on my laptop mic, and then pauses for 3 seconds and then continues. This code runs fine,…
pyjamas
  • 4,608
  • 5
  • 38
  • 70
8
votes
2 answers

How to play mp3 from bytes?

Is there a way to play mp3 from bytes directly using python? If not, can I convert the binary to a different audio format and make the binary playable? Edit: The following code works for wav files but not mp3 from pygame import mixer,…
tushar
  • 741
  • 1
  • 8
  • 21
8
votes
1 answer

get the amplitude data from an mp3 audio files using python

I have an mp3 file and I want to basically plot the amplitude spectrum present in that audio sample. I know that we can do this very easily if we have a wav file. There are lot of python packages available for handling wav file format. However, I do…
Nik391
  • 517
  • 2
  • 7
  • 24
8
votes
1 answer

Get an audio sample as float number from pyaudio-stream

As I am currently about to build a device based on a Raspberry Pi for measuring some stuff from noise recorded with a sound card (e.g. variance), and trying to do this within python, I got stuck figuring out how to get a an audiosample as…
Markus Burger
  • 83
  • 1
  • 1
  • 3
8
votes
2 answers

PyAudio does not work and breaks sound on ubuntu

Ok, so I installed pyaudio from the package python-pyaudio using apt-get , now when I Import and Invoke as follows: Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more…
Amith KK
  • 555
  • 2
  • 8
  • 20
8
votes
1 answer

PyAudio ErrNo Input Overflowed -9981

I was getting the same error as the user in Python, Error audio Recording in 16000Hz using Pyaudio The error was the same (except for the line numbers) as in the below graphic: As I was writing this, I found the solution to my problem in this link.…
user426364
  • 160
  • 9
7
votes
2 answers

Audio recording in Python with Pyaudio, error ||PaMacCore (AUHAL)|| ... msg=Audio Unit: cannot do in current context

I am using pyaudio to record sounds on my Mac BigSur 11.6 (20G165). Specifically, I'm redirecting sound from an application to the input using BlackHole, which works fine. It usually works fine but, sometimes, I get this error in the…
stef
  • 737
  • 4
  • 13
  • 31