How to add audio to replit

How do you add audio into replit

Repl link:

code snippet

from playsound import playsound
this is what i did

I’m not great at Python, but a quick Google search led me to this:

# use vlc to play audio
import vlc
# use sleep to wait until audio finishes playing
import time

# get the audio
audio = vlc.MediaPlayer("timer.mp3")
# start playing the audio
# wait until the audio finishes playing
# stop playing the audio
1 Like

Here’s a tutorial for playing audio Replit:


I will try that THX.

i will look at that.

I tryed your code piece and this is what happened

Any other Suggestions from anyone

I’ve been wondering this too. I tried to make a jukebox app, but it sends my CPU usage to red instantly and plays nothing. On other repls I have seen the audio work.

Can you give an example to a repl that does play sound? I couldn’t find any

Play sound is quite difficult to use since you need to import other things and install more things on the shell. I recommend searching on the replit docs about how to add audio in a relp. There is a python and node repl! This might be the solution.

I’ve never been sucsessful adding audio in repls. It is a very difficult job, I honestly think that it doesn’t work!

The replit docs has 2 ways, one for js and one for python. And both are currently broken

I think the error is that Repl doesn’t understand that you have an audio file in your repl and doesn’t play it.

I thinl it’s the libaries which are not correct.

I think its either something w/ the modules/libraries or repl not realizing there is an audio file.

Yeah! Those libaries aren’t reliable enough

Hi. This Repl works.

You will have to fork it first. When you first run the Repl it will ask you to confirm that you are happy for audio to be played.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.