Skip to content
Sign upLog in
← Back to Community

Can you add sound to python?

Profile icon
CodingGoose

Hi! I am making a countdown clock, and found a .mp3 sound that I want python to play when the time is over. Is there a way to play sound on python ?

Answered by hg0428 [earned 5 cycles]
View Answer
Voters
Profile icon
BobNeo
Profile icon
hg0428
Profile icon
CodingGoose
Comments
hotnewtop
Profile icon
hg0428

Yes, there are many modules to play sound on python.
Playsound, pygame, pydub, Tkinter, and a lot more.
However you can not play sound on repl.it, because it runs through a Virtual Machine and the sound it not channeled to your browser.

Profile icon
CodingGoose

@hg0428
Ok. Thanks a lot!

:)

Profile icon
CodingGoose

Thank you all for all the asnwers :)

Profile icon
TheDrone7

This feature is currently not supported but is under development!

Profile icon
ARJPEG

@TheDrone7
It would be tough to implement because it needs to partially run on the VM but also the local machine. (I think)

Profile icon
TheDrone7

@adityaru
well, it is tough to implement which is why it still isn't here but it is not impossible, and so, it is being worked on.

Profile icon
ARJPEG

@TheDrone7
Well still, the repl.it team is still amazing.

Profile icon
TheDrone7

Not just the team but even the interns are absolutely outstanding.

@adityaru

Profile icon
ARJPEG

@TheDrone7
I wouldn't know.

Profile icon
TheDrone7

Well, it's one of the interns who's working on the sound part. ;)@adityaru

Profile icon
ARJPEG

@TheDrone7
Oh nice.

:)

Profile icon
xxpertHacker

@TheDrone7
Just to confirm, will sound be supported in all Repls? (Assuming your mission is successful of course)

Profile icon
TheDrone7

Yep thats right.

@StudentFires

Profile icon
c4syner

If you couldn't live without your clock having a mp3 sound to play (and host it through repl.it). There maybe a weird solution through Brython. It's a client-side python implementation to replace javascript in the browser, (weird right) and it supports audio playback. Only downside, some of the functions look more like javascript than python but I digress.
Happy Coding

Profile icon
CodingCactus

in pygame, not normal python
i think

Profile icon
CodingGoose

@CodingCactus
Ok, Thanks!

Profile icon
CodingCactus

:)

Profile icon
Codemonkey51