xxxxxxxxxx
# import required module
import simpleaudio as sa
# define an object to play
wave_object = sa.WaveObject.from_wave_file('note.wav)
print('playing sound using simpleaudio')
# define an object to control the play
play_object = wave_object.play()
play_object.wait_done()
xxxxxxxxxx
# pip3 install playsound
from playsound import playsound as play
play('sound.mp3')
xxxxxxxxxx
# import required module
from playsound import playsound
# for playing note.wav file
playsound('/path/note.wav')
print('playing sound using playsound')
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()