[Tutor] Musical note on python

eryksun eryksun at gmail.com
Wed Sep 12 12:47:29 CEST 2012


On Wed, Sep 12, 2012 at 4:49 AM, Dwight Hutto <dwightdhutto at gmail.com> wrote:
>
> pyaudio is compatible with python 3.0(just in case the OP has that
> version, and it doesn't look like on the main site it has it listed,
> nor if it's 64 bit, etc.

I'm surprised they don't have an official Python 3 port yet. I see now
the git repo hasn't seen a commit in 2 years. About a year ago I
ported PyAudio to Python 3 for my own use, based on the guide for
porting C extensions I found here:

http://python3porting.com/cextensions.html

But it was only a quick update (actually kind of tedious) of
_portaudiomodule.c. Christoph Gholke has a port online that modifies
setup.py as well. I prefer his version over my own (more eyes, fewer
bugs). It just needs a small modification for Linux (see below).

PyAudio for Windows Python 2.5 to 3.2 (32-bit and 64-bit):
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

Pre-release pygame for Python 3, in case you want to use SDL as a tone
generator:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

Debian Build

I downloaded Christoph's port of PyAudio from the site above and built
it on my Debian Linux box. I needed to install portaudio19-dev. You'll
also need python3-all-dev if it's not already installed. I had to
comment out line 138 of setup.py (data_files=data_files). Christoph
added it for the Windows build, but it's not required for Linux. I
only got a few compiler warnings running "sudo python3 setup.py
install". YMMV. The tone-playing script works fine, after making a few
modifications to use range instead of xrange and b''.join instead of
''.join.


More information about the Tutor mailing list