Hi.
How can i open a mp3 file and play it in python?
There is a mp3 file on my Linux desktop and i want to open it from a python file and play it.
What should i do?
Niloofar24
15
Posting Whiz
Recommended Answers
Jump to PostThe easiest way would be to install a python game/media library like pygame, pyglet or pySFML and use that to play your mp3. There are plenty of other media libraries with python language bindings.
Search your Linux distros package lists for one of the above python modules, or you could …
Jump to PostLook's like you need Avbin
An other option is to use your favorite player.import subprocess # pick an external mp3 player you have sound_program = "path to player" # …
Jump to PostSooner or later you will use the pygame module anyway ...
''' pg_playmp3f.py play MP3 music files using Python module pygame pygame is free from: http://www.pygame.org (does not create a …
All 13 Replies
JasonHippy
739
Practically a Master Poster
Niloofar24
15
Posting Whiz
snippsat
661
Master Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Niloofar24
15
Posting Whiz
Niloofar24
15
Posting Whiz
Niloofar24
15
Posting Whiz
Froweey
29
Newbie Poster
JasonHippy
739
Practically a Master Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Niloofar24
15
Posting Whiz
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.