MasterHackerLOIS
MasterHackerLOIS

Reputation: 37

How to play mp3/wav/m4a without external libaries and without windows media player showing up (python)

I want to play a sound in python but I don't want to use external libaries like pygame and I don't want the windows media player to show up.

Its not that I can't pip install things but other people who will be using this program won't know how to pip install python libaries.

winsound.PlaySound(r"C:\Temp\Soundboard\s1.mp3", winsound.SND_FILENAME)

^^^ That just plays a windows sound.

os.system("start C:\Temp\Soundboard\s1.mp3")

^^^ And that makes windows media player pop up to play the sound.

Any help will be greatly appreciated

Upvotes: 1

Views: 897

Answers (1)

Sebastian Mendez
Sebastian Mendez

Reputation: 2981

winsound will work fine, as long as the files are wav files. To play other files, I'd recommend using the vlc.py. Just include the entire file (or you can attempt to separate the parts that you don't need), found here, in your own file to use the relevant functions.

Upvotes: 1

Related Questions