Music in python??
Is there/how do you get music in Python. I need it for my upcoming major post that is Star Wars themed (of course) and could use the main theme (or duel of the fates) playing in the background.
Voters
Coder100
Try this: https://docs.repl.it/repls/audio
You will have to use their special library because they run a virtual machine, and thus cannot play sound.
from replit import audio audio.play_file('<INSERT AUDIO FILE HERE>.wav')
littlepenguin
Here:
from replit import audio while how_many_loops: audio.play_file("star_wars_duel_of_the_fates_battle.mp3") # make sure that you have this file in your project. print("Music ended! Obi-Wan Kenobi won.")
Solution
Here you go:
and you need to upload your audio file into your repl, and put it in
play_file
here's a link for more info:
https://docs.repl.it/repls/audio