Integrating PyAudio & PySimpleGUI

Blocking and non blocking operations in python

Keno Leon
7 min readApr 20, 2021

--

Intro

As part of my research on Signal Processing and AI, I wanted to visually represent real time audio data from my microphone, this simple request turned out to be not so simple at all for a number of reasons we will cover, along the way we will see how to integrate PyAudio with a GUI (I use PySimpleGUI but you can modify the code for your UI of choice), and talk a bit about blocking and non blocking operations in Python.

Your time is valuable, I get it. If you just want to copy pasta 🍝some code to integrate PyAudio/PySimpleGUI you are looking for the last code example, there's also a repo with the code samples:https://github.com/KenoLeon/PySimpleGUI-PyAudio

Spec

As mentioned all I want is a little widget box that allows me to capture the sound from my microphone and display it in a window, something like this:

PyAudio

I am using PyAudio because at this time it seems the library of choice for dealing with audio in Python, the documentation is a bit…

--

--