Technology Uncategorized

Playing a sound file in python on Raspberry Pi

…not as easy as you might think.

The most recommended package for python to do things like play sounds is pygame.

However, pygame is not available for python3.

Another recommendation I found was pyaudio, so I started exploring pyaudio.¬†Pyaudio for python3 is not available under the Raspian wheezy distribution archives, so you can’t get with apt-get in command line.

To get pyaudio for python3, you have to get via git, and then turn on all the ports and such. As I am new to all of this, I found it quite baffling.

…and it didn’t work. so…

for the second time in a week, I had to admit defeat with the latest bleeding edge technology (even though python3 isnt that new, and nor is php5), and use an older version that I know will work. Python2 it is then, with pygame. Ouch.


Update!!!! I found a package that allows you to play mp3 files with python on a pi. To install:

sudo apt-get install mpg321

Have yet to try it, but I am excited