Ask coding questions

← Back to all posts
can anybody help to fix the sound
BrandonBailey3 (5)

when I manually play it from the mp3 it works but I can't hear it when I call death() and the code I'm using for this is from the Repl page a.play_file("dead.mp3")

Answered by LukeWright (114) [earned 5 cycles]
View Answer
Comments
hotnewtop
LukeWright (114)

you can use the playsound module.

If this helped, click the checkmark next to my comment!

BrandonBailey3 (5)

@LukeWright uuuhhhh it gave the error ModuleNotFoundError: No module named 'gi'

robowolf (446)

@BrandonBailey3 Try pip install playsound in the shell. If that doesn't work it means repl doesn't support it. You could also use other modules like winapi

LukeWright (114)

if you want to automate it, you could do

import os
os.system("pip install playsound")

This would make it so that you wont have to type "pip install playsound" everytime you open the repl.
@robowolf @BrandonBailey3