Help with Optimization of Python software: real-time audio controller

Laurent Pointal laurent.pointal at limsi.fr
Mon Feb 12 09:40:04 EST 2007


craiglewiston at gmail.com a écrit :
> As mentioned above, my application deals with music training. I have a
> Tkinter GUI, which communicates via pyserial with an external device I
> built myself.  The code reads in a MIDI file and converts the song to
> "output data " for the external device and the GUI, all adjusted to
> the user-selected tempo.  While the MIDI file is playing, there are 4
> main actions the code must take:
> 1) Send "output data" signals out to the external hardware.
> 2) Poll the input from the external hardware device for incoming
> keypresses.  If detected, then the play the sound corresponding to
> that key.
> 3) Start and keep a metronome running for the durations of the song.
> 4) Update GUI

> 
> I'm able to get all the above "accomplished" through the use of
> threads and a top-level loop (for updating the Tkinter GUI  - if
> you've worked with threads and Tkinter, then you know that you can't
> update a Tkinter GUI from a thread, but instead have to do it on the
> top level loop).
<zip>

> Also, just for reference, here's a list of the modules I'm using and
> my system info:
> Audio:  SndObj
> Ser com: pyserial
> GUI: Tkinter
> System: Apple PowerBook G4 (PowerPC), Mac OS 10.4, Python 2.4.4
> 
> Thanks,
> Craig Lewiston
> 


You may take a look at PureData, interface is in TCL/Tk, but realtime
sound management layers are in compiled C.
"just" copy it using Python as high level language...
I dont think Python itself just using scripting can achieve needed
performance for *realtime* (like) audio.

http://www.puredata.info/
http://www-crca.ucsd.edu/~msp/



More information about the Python-list mailing list