Page 1 of 1

Playing a beep using Python

Posted: Sat Nov 14, 2015 10:40 am
by JonnyAlpha
Hi;

I have been asked a question that I cant find the answer to.

Can you / how do you play a sound using python, but not from a sound file i.e. can you use Python to generate a sound?

Thanks in advance

Re: Playing a beep using Python

Posted: Sat Nov 14, 2015 10:54 am
by JonnyAlpha
Sorry the gentleman is trying to use print "\a"

Re: Playing a beep using Python

Posted: Sat Nov 14, 2015 11:15 am
by Laurens-wuyts
You can try:

Code: Select all

print('\a')
Which is working in Windows 10. ;)
I'm not sure if it produces a sound on a RPi. :?

Laurens

Re: Playing a beep using Python

Posted: Sun Nov 15, 2015 11:41 am
by JonnyAlpha
Thanks Laurens I think that is the problem, this line of code does not result in a sound from the Pi.

Re: Playing a beep using Python

Posted: Sun Nov 15, 2015 11:47 am
by Laurens-wuyts
You can try what's mentioned here. ;)

Laurens