Ubuntu 10.04 and Python 2.6

I just want to output a simple tone.
I have searched the Internet and found there are thousands, if not millions of responses to Google, and the this forum's search engine. I read so many my eyes are crossed. But really, does anyone know of a tutorial or something that will allow me to output a simple tone?

Supposedly, pymedia (sourceforge project) is for multiple operating systems and lets you handle sounds.
I have not tried it.

I saw on this forum that the winsound module allows you to play .wav files under windows.

Pygame is another option.

def load_sound(name):
class NoneSound:
def play(self): pass
if not pygame.mixer:
return NoneSound()
fullname = os.path.join('data', name)
try:
sound = pygame.mixer.Sound(fullname)
except pygame.error, message:
print 'Cannot load sound:', wav
raise SystemExit, message
return sound

Tutorial at:
http://pygame.org/docs/tut/chimp/ChimpLineByLine.html

For a winsound example of a simple tone.

import winsound, random

winsound.Beep(random.randint(900,2750),100) #plays random tone

Assuming you are using windows.

As the first part of my question clearly states, I am using Ubuntu 10.04. That is, of course, a Linux distribution.Thanks anyway.Thanks to all for answering. I could not get any to work for me.

As saulm mentioned, PyAudiere would benefit. It is crossplatform so it will work on Ubuntu.

import audiere, time
d = audiere.open_device()
t = d.create_tone(1600) 
t.play() 
time.sleep(5)
t.stop()

This should get you started. By the way, a quick trip with Google would have supplied the answer.

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.