I want to try to play a sound but I don't know how.
This question will remain unsolved. ;(
My teacher looked and there's no way to do it.
Hi,
Great Question! The code is below! If this helped, mark it as correct!
For MP3 & WAV. Files:
from playsound import playsound
playsound('myfile.wav')
Tell me if you need code for a different file format!
@TalinSharma OK thanks. I couldn't get it. 😆
@TalinSharma
one more thing how would I play them after imported and variables assigned?
You're Welcome!
@brogen
@TalinSharma
How can I play the sounds?
Just import at the top and put the second line of code after the variables. Like this:
from playsound import playsound
#YOUR CODE HERE
playsound('myfile.wav')
Hope it helped!
@TalinSharma
What code would I use to play it? Like a print command? Or maybe a run command?
From the module playsound you import playsound... Then you just put in playsound() and in the parenthesis the file's name! @brogen
@TalinSharma
Still won't play try running it.
@TalinSharma The playsound package does not work on Repl.it.
@brogen Use the Repl.it Audio Library
Oh. Sorry I didn't know! @SixBeeps
@SixBeeps I'm just giving up. I can't find anything to help.
Search google! @brogen
Don't Give UP! @brogen
@TalinSharma hi, please do not ask for cycles, thanks!
I just asked for marking it correct but sure... @realTronsi
@TalinSharma yeah thats not allowed
@TalinSharma Technically is asking for cycles
I know but like 90% of people do it... Sorry! @SixBeeps
@TalinSharma well tell all of those 90% of people to stop when you see it, or at least report thanks! : )
Very good question.