I found an application that allows you to do this, and I wondered if this could be done with any built-in programs (I don't mean the Caps Lock, Num Lock radio buttons, their sound can be turned on in the control panel)? This can be done on python with the code below, but my winsound.PlaySound
doesn’t want to find the file and just plays the system sound of the error. This answer did not help (either through sys or creating a folder).
The code:
import winsound
import keyboard
duration = 250
q = 300
while True:
try:
if keyboard.is_pressed('q'):
winsound.PlaySound('C:\\some.wav',winsound.SND_FILENAME)
winsound.Beep(q, duration)#Since PlaySound does not want to search, you have to do it through squeak
except:
break