11 Years
Discussion Span
Last Post by vegaseat

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:
Would be nice, if one could apply that to Python. There is a PythonMidi package floating around and I am looking at it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.