audio on os x using python, mad, ao

apa7hy.spam at apa7hy.spam at
Wed May 3 03:21:43 EDT 2006

this message was originally posted by someone else and closed without a
proper answer.  i'm reposting it in hopes that someone will provide a

Begin Quote:

"I'm attempting to play an mp3 file on OSX, but am running into some
difficulty. When using py-mad and py-ao, I only get static with the
following code (which is derived off another mailing that I found from
this list's archives):
#!/usr/bin/env python

py-mad (mp3 ability)
py-ao (system audio ability)
import mad, ao, sys
mf = mad.MadFile(sys.argv[1])
dev = ao.AudioDevice('macosx')#osx device, linux: use "oss" or "alsa"
while 1:
     buf =
     if buf is None:
         break, len(buf))

Does anyone know why this produces static, or whether there's a better
method of producing audio output that's also cross-platform (OSX,
linux)? I've looked at pymedia, but they do not support OSX at the


More information about the Python-list mailing list