Hi ππ
Today, I will share with you how to play MP3 files in Python.
You have many liblares in Python To play MP3 files.
1 - pygame
Install from here pip install pygame
Code
from pygame import mixer
import time
mixer.init()
mixer.music.load('Dirty Backseat - S.S.S (feat. AZZI).mp3')
mixer.music.play()
while mixer.music.get_busy(): # wait for music to finish playing
time.sleep(1)
2 - playsound
Install playsound from pip install playsound
from playsound import playsound
playsound('Dirty Backseat - S.S.S (feat. AZZI).mp3')
3 - vlc
Install vlc from pip install python-vlc
import vlc
p = vlc.MediaPlayer("sample.mp3")
p.play()
Now we're done π€
Don't forget to like and follow π
Support me on PayPal π€
https://www.paypal.com/paypalme/amr396