How Can I Add Music

Question:
How Can I play Music

What code would i use to play creepy music intill the replis stopped

It depends: If it is a website, a HTML, CSS, JS Repl will do.

A Python Repl is also possible, though you have to run a forever loop to keep the Repl awake.

You just need to use the keep_alive to maintain the Python application no?

You do not need the “keep_alive” library to play sound. Just a forever loop like this:

while True:
    pass
1 Like

Try to be more specific here.
If you’re making a website, then use the followig JS code:

let audio = new Audio("audio_location");
audio.play();             // plays audio
audio.pause();            // pauses audio and can resume later
// check more methods on MDN

If you’re using Python, then Replit made a module called Replit Audio. Import it using from replit import audio on Python and type help(audio) in the Python console.
I hope this helps.

2 Likes

The proplem is that it never works does anyone have the full code

replit … yeah replit can’t really play audio in console in python. This is because it’s actually a server (VM iirc) that is running your code and sending input back. It’s built to solely send console text back. Now, what happens if you play sound? It’s basically that replit detects there’s sound and tries to send that to you. Except replit isn’t discord, their infrastructure for sound isn’t so great and you end up getting really really wonky sound

4 Likes

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