xxxxxxxxxx
#!/usr/bin/env python3
# Import playsound module
from playsound import playsound
# Input an existing wav filename
wavFile = input("Enter a wav filename: ")
# Play the wav file
playsound(wavFile)
# Input an existing mp3 filename
mp3File = input("Enter a mp3 filename: ")
# Play the mp3 file
playsound(mp3File)
xxxxxxxxxx
# pip3 install playsound
from playsound import playsound as play
play('sound.mp3')
xxxxxxxxxx
# pip3 install playsound
from playsound import playsound
print("Playing...")
playsound('music.mp3')
xxxxxxxxxx
import vlc
import time
p = vlc.MediaPlayer("fade music.mp3")
p.play()
time.sleep(60)
p.stop()
xxxxxxxxxx
import pygame
# Initialize Pygame
pygame.init()
# Load sound file
sound = pygame.mixer.Sound('path/to/sound/file.wav')
# Play the sound
sound.play()
# Wait for the sound to finish playing
pygame.time.wait(int(sound.get_length() * 1000))
# Quit Pygame
pygame.quit()