play audio programmatically?

Dear all,

what would be the most sensible way to play audio programmatically in

I am aware this is quite general question as probably there are
several ways of doing it...

My intention is to play an audio (probably a stream) from Python and I
have been reading that I would need some module like PyMedia or pygame
that do not seem to be available in Angstrom linux for BeagleBoard.
Obviously I could launch from Python a command line script to play an
audio... (I wouldn't know which one but I guess it is feasible).

How would people do it?

Thanks in advance for all opinions.

I am trying to use pyAudio, which works fine on my PC.

But on the BeagleBoard I have installed the package:

and it fails to import it... (no module named pyaudio).

How do I know which is the module inside the package python-audio?


would you be willing to try ubuntu? i have this working with alsa:

   alsamixer: to unmute outputs and set volume
   aplay sound.wav

remember that the audio out is only line level and is not loud enough to drive unamplified speakers

Hi Michael,

thanks for your reply.
I am actually installing ubuntu on a separate SD card just now...
let's see what is happening.

With Angstrom I was able to use aplay.
However I had problems from scripting side (in python) as:
1. python-audio doesn't include pyAudio module as I was expecting
2. with python alsaaudio module I am not able to play properly a wav
file (while in the ubuntu pc I can) and while using the same
parameters that I am using on aplay (as I posted in here:

So I think if I succeed by installing ubuntu I may have an easier
(dreaming doesn't cost much :slight_smile:


I had trouble with some Python modules in Angstrom which is why I move to Ubuntu.

I found this page very helpful in getting the right settings in Alsa Mixer:

thanks for the link.
I think generally I should be better off with ubuntu as it should be
easier to transfer apps/scripts from the ubuntu pc I am using.
But I also think I am not following the right process for building a
Ubuntu SD card:
I started here, but it is still installing packages since... last

If I manage to finish I will copy the SD card somewhere so that next
time should be just a copy operation...

I followed these steps and used the pre-built image so I didn't have to worry about setting up a cross development environment:

This makes much more sense, thanks.

Listen I cannot make any audio playing now, although I don't get any
sort of error.
I've used aplay, and in different ways python-audio or python alsa...
without success.
It doesn't give me any sort of error, but nothing comes out.

Did you came across that?

Yes, it did take awhile. I had to experiment a lot with alsa mixer to get sound out, but basically I followed that page I mentioned to you.

There is a way to get alsa (via alsactl) to write its settings to a file. I'll see if I can do that, then send you the file.


Here's what I did:

sudo apt-get install alsa


       Unmute HeadsetL and HeadsetR
       turn volume up for �DAC2 Analog� ~50
       DAC2 Digital Fine� ~50-75
       ï¿½Headset� to ~ 67

aplay Memo.wav

Remember you need an amplifier; the output is not amplified

I can send you my alsactl file if you wish, or post it on the wiki or something


Hi Michael,

I was not aware that you could store these settings, which is good
Please, if you could send me your file that would help a lot.