Actually connecting the noisegate
This commit is contained in:
2
sound.py
2
sound.py
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user