Actually connecting the noisegate

This commit is contained in:
Logan Cusano
2022-03-26 02:24:06 -04:00
parent 465c0e00ea
commit 7a9dbfb53a
2 changed files with 2 additions and 67 deletions

View File

@@ -42,6 +42,7 @@ class PCMStream:
async def play(self):
if not self.stream.active:
self.stream.start()
await self.connect()
# call back read function for the stream
def read(self, num_bytes):
@@ -61,6 +62,7 @@ class NoiseGate(threading.Thread):
def run(self) -> None:
while self.voice_connection.is_connected():
print(f"Volume: '{float(20 * audioop.rms(self.PCMStream_Instance.read(16), 2)) >= 5}'")
if float(20 * audioop.rms(self.PCMStream_Instance.read(16), 2)) >= 5:
# Play the stream
self.voice_connection.play(discord.PCMAudio(self.PCMStream_Instance))