Drawing sound

Peter Hansen peter at engcorp.com
Fri Sep 24 15:53:14 EDT 2004


Chris wrote:
> I want a program that can "draw" sound.
> 
> Imagine drawing a graph of frequency against time -
> and then being able to play it over the computer speakers.
> 
> Can this be done in Python?
> 
> As a start, consider this simple QBASIC program that generates random 
> frequencies:
> 
> 10 frequency = 40 + 400 * RND
> 20 SOUND frequency, 7
> 30 GOTO 10
> 
> That's fine - except that it plays over the PC speaker - the one that's 
> just there for the happy beep - and not through the sound card and 
> proper speakers.
> 
> Can that be done in Python?
> Or in any other language?

Certainly.  Python or any other decent general-purpose language
can do this.

In Python, you'd want to look into PyGame, or perhaps wxPython
or one of the other GUI frameworks (provided it has adequate
sound support... wxPython has the wx.Sound class but I don't know
whether it's up to the job in this case).

-Peter



More information about the Python-list mailing list