from playsound import playsound
playsound('audio.mp3')
#Hope it helps :)
import pygame
pygame.init()
mixer.music.load("music/main.wav")#music file
mixer.music.play(-1)
import pygame
pygame.init()
pygame.mixer.play('datei.wav')
#has to be in .mp3 format
#has to be in same folder
#load the music
pygame.mixer.music.load('song.mp3')
#play the music infinite
pygame.mixer.music.play(-1)
#or play it one time
pygame.mixer.music.play(0)
pygame.mixer.music.load('jazz.wav')
pygame.mixer.music.play(-1)
from pygame import mixer
# Starting the mixer
mixer.init()
# Loading the song
mixer.music.load("song.mp3")
# Setting the volume
mixer.music.set_volume(0.7)
# Start playing the song
mixer.music.play()
# infinite loop
while True:
print("Press 'p' to pause, 'r' to resume")
print("Press 'e' to exit the program")
query = input(" ")
if query == 'p':
# Pausing the music
mixer.music.pause()
elif query == 'r':
# Resuming the music
mixer.music.unpause()
elif query == 'e':
# Stop the mixer
mixer.music.stop()
break