Remove Noise Gate from master (moved to its own branch)

This commit is contained in:
Logan Cusano
2022-02-17 00:50:12 -05:00
parent 6b9e48d722
commit 1997d5ca5d
2 changed files with 5 additions and 15 deletions

5
bot.py
View File

@@ -88,10 +88,13 @@ class Bot(commands.Bot):
voice_connection = await channel.connect()
# Create an audio stream from selected device
self.streamHandler = sound.PCMStream(voice_connection)
self.streamHandler = sound.PCMStream()
# Ensure the selected device is available and start the audio stream
self.streamHandler.change_device(self.DEVICE_ID)
# Play the stream
voice_connection.play(discord.PCMAudio(self.streamHandler))
# Start the SDR and begin playing to the audio stream
self.start_sdr()

View File

@@ -1,6 +1,5 @@
import sounddevice as sd
from pprint import pformat
from NoiseGate import NoiseGate
DEFAULT = 0
sd.default.channels = 2
@@ -8,14 +7,11 @@ sd.default.dtype = "int16"
sd.default.latency = "low"
sd.default.samplerate = 48000
noisegate_obj = NoiseGate()
class PCMStream:
globals()
def __init__(self, voice_connection):
def __init__(self):
self.stream = None
self.voice_connection = voice_connection
def read(self, num_bytes):
# frame is 4 bytes
@@ -29,10 +25,8 @@ class PCMStream:
self.clean_up()
self.stream = sd.RawInputStream(device=device_ID)
noisegate_obj.init_stream(device_ID, self.voice_connection, self)
self.stream.start()
noisegate_obj.start()
def clean_up(self):
global noisegate_obj
@@ -40,13 +34,6 @@ class PCMStream:
self.stream.stop()
self.stream.close()
if noisegate_obj.NG_Started.is_set():
print("Closing the noisegate")
noisegate_obj.stop_NG.set()
noisegate_obj.join()
noisegate_obj = NoiseGate()
print("Started the noisegate")
class DeviceNotFoundError(Exception):
def __init__(self):