Is there a function in wxPython or anything that can creat a variable frequency sounds?

The only function I know that you can give a sound frequency to is winsound.Beep(frequency, duration), and it may only work on Windows machines. The sound goes to the internal speaker, hence the word beep.

WxPython and PyGame both have sound functions, but you have to supply them with a wave file (.wav). There is also winsound.PlaySound(soundfile, winsound.SND_FILENAME|winsound.SND_ASYNC) that needs a wave file. At least these function drive your external sound system via the sound card.

You could create a series of short wave files of known frequency, there are some audio programs available to do that. Just give each file a name relating to the frequency and load them up to play at random or user selected. Sounds makeshift and it is!

Many moons ago I wrote a code snippet on how to create MIDI soundeffects. It is written in C++ look at:
http://www.daniweb.com/code/snippet97.html
Would be nice, if one could apply that to Python. There is a PythonMidi package floating around and I am looking at it.
http://www.mxm.dk/products/public/pythonmidi

If you want to use Tkinter, there is a sound module called tkSnack you can download. This module will allow you to create a note of a specific frequency and duration and play it via the sound card to an external sound system. See the Python snippet at:
http://www.daniweb.com/code/snippet414.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.