From f8f6cb7e52e0f7ab4b99a1a8a278a9a9c43deaf8 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Tue, 29 Mar 2022 16:39:48 -0400 Subject: [PATCH] Stopping the voice connection after the fadeout and change fadeout duration --- NoiseGatev2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NoiseGatev2.py b/NoiseGatev2.py index c0f4bfd..a87fb43 100644 --- a/NoiseGatev2.py +++ b/NoiseGatev2.py @@ -129,7 +129,7 @@ class NoiseGateStream(discord.AudioSource): def __init__(self, _stream): super(NoiseGateStream, self).__init__() self.stream = _stream # The actual audio stream object - self.NG_fadeout = 480/20 # Fadeout value used to hold the noisegate after de-triggering + self.NG_fadeout = 240/20 # Fadeout value used to hold the noisegate after de-triggering self.NG_fadeout_count = 0 # A count set when the noisegate is triggered and was de-triggered self.process_set_count = 0 # Counts how many processes have been made in order to limit the prints @@ -156,6 +156,8 @@ class NoiseGateStream(discord.AudioSource): print(f"Frames in fadeout remaining: {self.NG_fadeout_count}") self.process_set_count += 1 if curr_buffer: + if self.NG_fadeout_count == 0: + voice_connection.stop() return bytes(curr_buffer) except OSError as e: