Update to latest (not working)
This commit is contained in:
@@ -81,6 +81,7 @@ class NoiseGate(AudioStream):
|
||||
|
||||
def core(self, error=None):
|
||||
if error:
|
||||
LOGGER.info('Error in the core')
|
||||
LOGGER.warning(error)
|
||||
|
||||
while not voice_connection.is_connected():
|
||||
@@ -90,6 +91,9 @@ class NoiseGate(AudioStream):
|
||||
LOGGER.debug(f"Playing stream to discord")
|
||||
voice_connection.play(discord.PCMAudio(self.NGStream), after=self.core)
|
||||
|
||||
def list_devices(self):
|
||||
return query_devices()
|
||||
|
||||
async def close(self):
|
||||
LOGGER.debug(f"Closing")
|
||||
await voice_connection.disconnect()
|
||||
@@ -107,10 +111,11 @@ class NoiseGateStream(discord.AudioSource):
|
||||
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
|
||||
|
||||
def read(self):
|
||||
def read(self, num_bytes):
|
||||
num_frames = num_bytes / 4
|
||||
try:
|
||||
while voice_connection.is_connected():
|
||||
curr_buffer = bytearray(self.stream.stream.read(960))
|
||||
curr_buffer = bytearray(self.stream.stream.read(num_frames))
|
||||
buffer_rms = audioop.rms(curr_buffer, 2)
|
||||
if buffer_rms > 0:
|
||||
buffer_decibel = 20 * math.log10(buffer_rms)
|
||||
|
||||
Reference in New Issue
Block a user