April 2010
6 posts
Compiling SYSV_IPC python module with GCC on AIX...
I had a need to use good old SYSV message queues to interoperate with a bunch of old C programs, straight from python. Come in sysv_ipc module to the rescue, which works great on a variety of systems, but I need it on AIX.
Using Perzl wonderful rpm packages for AIX, I was able to compile it with GCC 4.2 and setup it into Python 2.6.
Modify common.h to unset SHM_SIZE (Obsolete step as of...
Play a MP3 file with pymad and pyaudio
Based on the wave example from pyaudio:
import pyaudio
import mad
import sys
if len(sys.argv) < 2:
print "Plays a wave file.\n\n" +\
"Usage: %s filename.wav" % sys.argv[0]
sys.exit(-1)
mf = mad.MadFile(sys.argv[1])
p = pyaudio.PyAudio()
# open stream
stream = p.open(format =
p.get_format_from_width(pyaudio.paInt32),
channels = 2,
...
Play an MP3 file with pymad and pyao
This is for Mac OS X, adapt to your needs:
import mad, ao, sys
mf = mad.MadFile(sys.argv[1])
dev = ao.AudioDevice('macosx', bits=32, rate=mf.samplerate(), channels=2)
buf = mf.read()
while buf != None:
dev.play(buf, len(buf))
buf = mf.read()
Crash on object deletion in pyao and pyogg
The author of pyogg goofed up on python object deletion in the wrapper. This was reported.
Unfortunately libao (0.82) is also affected, and there’s no action even on the previous pyogg bug. It causes a “glibc double-free” on Linux and a “pointer being freed was not allocated” on Mac OS X.
The project seems quite dead, but is merely a wrapper to the C libs where...
Uninstalling ActivePython and ActiveTCL
Little script to easily uninstall either. Take care to adapt to your needs.
#activepython
sudo rm -R /Library/Frameworks/Python.framework /Applications/Python\ 3.1 /usr/local/bin/{2to3*,py*,idle*}
#activetcl
sudo rm -R /Library/Frameworks/{Tcl,Tk}.framework /Applications/Utilities/Wish\ 8.5.app /usr/local/bin/{tclsh8.5,wish8.5} /Library/Documentation/Help/ActiveTcl-8.5