[Twisted-Python] PyMedia & Tk - based mp3 sound recorder
exarkun at divmod.com
Mon Nov 29 11:10:21 EST 2004
On Mon, 29 Nov 2004 16:55:42 +0200, Petri Savolainen <petri.savolainen at iki.fi> wrote:
>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
You may want to look at how Shtoom gets its audio input. It uses Twisted and seems to have audio handling down pretty well.
More information about the Twisted-Python