Ask coding questions

← Back to all posts
Playing audio in Python
noway15

Exactly what it sounds like. I know that I need audio from replit, but after that I'm kinda confused on what to do.

Voters
noway15
Comments
hotnewtop
FloCal35

Both Coder100 and OldWizard209 (I won't ping them) answered you question but keep in mind that

Replit audio in python does not work for people viewing your projects


Because they are so new, spotlight pages can't play audio yet. So if you want to post it on the Apps page or if you want to share it with someone, instead of hearing the wonderful audio file, they will see an anoying error that stops the program

Coder100

yeah, its in the docs, which are a bit hard to access:
https://docs.replit.com/tutorials/12-audio

OldWizard209

Its all in the Docs.

First import replit and make sure to upload the sound file as .mp3 or .wav . Type this code:

The time.sleep in the end is there because once the file is executed, repl abruptly stops. So it is there so that the audio can run.