Python Sound
Python has not supported sound for quite a while now.
Are the developers planning to add sound?
When will this happen?
Will this even happen?
you can, in fact, have sound with pygame.
@BananaJellyfish give me example
@Coder2195Text well, if ur using pygame, you do pygame.mixer.Sound('insert_sound_name_here'.wav) after importing your sound. im not sure if it is possible without pygame
edit your post so there is an example for proof ... @BananaJellyfish
@Coder2195Text oh actually repl.it wont support the .mixer module... never mind
@BananaJellyfish That what I was talking about
@Coder2195Text oh. I thought you meant in general
Thats in javascript, isnt it? I think they mean sound in [email protected]
sound with python on replit doesn't work. I mean, when you run something with sound It will sometimes play and other times it won't. The tnkter module is also unavailable so you can't use that either. The playsound module gives an error when you try to download the package. os.system also doesn't work for some reason whatsoever. there is a way, I forgot how, where you can play a .wav audio file and it plays without an error but you can't hear it. So basically all in all you can't play audio with python on replit. I'm pretty sure you can do it with Py.Charm because you can use the tnkiter module.
You've already received two good answers, though I'd just like to clarify: Python does not have a built-in sound library, and I doubt they will add one due to the issues with compatibility. Python has third-party libraries made by the community to support sound, some dedicated (such as playsound
or simpleaudio
) which you can install from PyPi. Replit, however, runs your code remotely on a container in their servers, so any sound produced would not get to you, in the browser, if it was even produced. To combat this, Replit has created an API for playing sound, which allows you to bypass this and get Replit to play the sound directly in the browser. You can do this quite easily with the replit
module; see Bookie0's answer.
@19wintersp I went onto the website for "combatting" sound inconvienece... It doesn't work...
@Coder2195Text You need to be an explorer, like it says in massive text at the top. Do you have that turned on?
@19wintersp I already have it on and it doesn't work
@Coder2195Text Could you be more specific about what's not working? The example repls do not work on their own; their audio files are blank.
@19wintersp the audio files are blank
There's already sound in Python, use repl.it audio. Check this out for the full blog.
You'll probably need to be an explorer for that. To be an explorer, go to account:
And scroll down to roles and check 'explorer':
Quick program:
from replit import audio # imports library # replace audio_file.mp3 with the actual file # you can use .mp3, .wav, and .aiff source = audio.play_file("audio_file.mp3")
Good luck and have fun! :D
i don't think they're going to support other modules audio, but they do have an audio system of their own. here's a tutorial on it.
https://docs.repl.it/repls/audio