ysmd_
New Member
I have a code on python (3.11)
That code plays a sound when I mute/unmute microphone by pressing at '-' but when code on obs is crashing (not responding).
And OBS not starting/long starting after that.
from pynput.keyboard import Key, Listener
import pydub
from pydub import AudioSegment
from pydub.playback import play
is_microphone_muted = False
def sound_disconnect():
songd = AudioSegment.from_mp3("mute.mp3")
play(songd)
def sound_connect():
songc = AudioSegment.from_mp3("unmute.mp3")
play(songc)
def on_press(key):
global is_microphone_muted
if key.char == ('-'):
if is_microphone_muted == False:
is_microphone_muted = True
sound_disconnect()
elif is_microphone_muted == True:
is_microphone_muted = False
sound_connect()
with Listener(on_press=on_press) as listener:
listener.join()
That code plays a sound when I mute/unmute microphone by pressing at '-' but when code on obs is crashing (not responding).
And OBS not starting/long starting after that.