Ask coding questions

← Back to all posts
How to play an audio file in python?
HarperframeInc

I'm not sure how to play audio files.
I've tried many stack-overflow answers, but they don't work.
Any Solutions?

Answered by amasad [earned 5 cycles]
View Answer
Voters
bobertoroberto
DaddyisBack123
yanovsky
ShauryanK
isrsanchez
benjammmmmmmm
InfernoKay
JAYDENCHO1
HenryViechnicki
shmew
Comments
hotnewtop
amasad

Hey we have an API for sound now. It's in beta be sure to be an explorer to try it https://docs.repl.it/repls/audio

SeamusDonahue

still doesn't seem to function, at least for me (and yes I am an explorer its some other problem)

HarperframeInc

@SeamusDonahue Make an issue here (Suggesting your using python)

SeamusDonahue

posted issue there. thanks! @HarperframeInc

mat1

Unfortunately, it is currently impossible to play audio files in Repl.it because of the way it works.
Please upvote this comment if it was helpful or useful in any way

ash15khng

In repl.it it isn't possible, as repl.it runs on another computer somewhere, so the audio cannot be heard.

HappyFakeboulde

Repl.it currently does not support audio.
If you want me to help you with something outside of repl.it, you'll need to tell me the file format and the OS you're using.

GitOverHere

print ("\a")

HarperframeInc

@GitOverHere That's a beep. I'm not sure I could use this solution. Mat has already answered this question, but thank you for your help!

GitOverHere

@HarperframeInc I think if you put a bunch of beeps together, they make a sound. Theoretically, you could load an audio file into python to create a function that converts the audio data into beeps by calling print("\a") depending on the frequency played in the audio file. I think this could work, but I'm not sure because I have not tried it.

LionelPOUJET

Any update of this ?
Thanks a lot for your feedback