I was making a timer and I wanted it to like make noise, ring when time was up.
Does anyone know how to have it ring? I simply want it to make a high pitched sound, for about 5 seconds and I already know how to make it repeat, if I can make the noise first.
>Solution :
You need external libraries/modules to play sound in Python[1]. The following links to resources and tutorials should provide some useful libraries get you started:
To install a Python library, you need to install pip (a Python package manager) first. See the pip docs on installation procedure.
Once you’ve install pip, you can simply run pip install whatever-sound-library to install a library. Then, assuming that you are using the right Python interpreter, you should be able to import the library and start using it.
See this article for examples on common external Python libaries.
Edit:
Since you mentioned that you’re using replit, you can refer to the replit docs on how to install Python packages
[1] Well, it’s not required per se, however because each operating system has its own API for sound, implementing a sound player yourself would be tedious (since you have to tailor to each OS) and not portable most of the time.
[2] Possible duplicate question?