[Twisted-Python] PyMedia & Tk - based mp3 sound recorder
petri.savolainen at iki.fi
Mon Nov 29 09:55:42 EST 2004
I've tried to write a simple sound recorder for python. Basically, it
just reads sound from mic or line in, and encodes it to mp3 on the fly.
See http://pymedia.org/tut/src/voice_recorder.py.html for a simple
example I've taken the pymedia recorder code from. Works nicely - but no
GUI etc. of course.
I've added a very simple Tk-base GUI using twisted, using
task.LoopingCall to drive the recorder loop that reads chunks data from
sound device and encodes them.
The problem is that the sound is now garbled - it sounds as if the loop
is not fast enough or it's dropping some sound data. Apart from twisted
and Tk integration, the code should be essentially the same as the
original example that works fine.
I''ve tried with different task looping frequencies and even added Psyco
optiomization to the code, and all this has made but tiny difference
-and my PC is an AMD 2400+ with plenty of memory so I would think speed
is not the issue here; the encoding preferences are mono, 22050Hz and
The source code (about 120 lines in all) is attached - any advice or
improvement suggestions would be greatly appreciated.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Twisted-Python