1# Install pyglet before starting from the command line
2>>> -m pip install pyglet
3
4# The code :
5import pyglet # Imports the module
6pyglet.options['search_local_libs'] = True # Allows pyglet to access files in your directory
7
8my_music = pyglet.media.load("Name_Of_My_Song.ogg") # Loads the audio file you want to play (it does not have to be a .ogg
9
10my_player = pyglet.media.Player() # Creates a player
11
12my_player.queue(my_music) # Adds your song to the players queue
13my_player.loop = True # If you want the player to loop your song. By default this value is False
14my_player.play() # Starts playing your audio file when you run the app
15
16pyglet.app.run() # Runs the app