Merge from master #5

Merged
logan merged 65 commits from master into NoiseGateV2 2022-02-27 21:47:09 -05:00
Showing only changes of commit 167c06f331 - Show all commits

View File

@@ -1,3 +1,4 @@
import sounddevice
import sounddevice as sd
from pprint import pformat
@@ -14,12 +15,15 @@ class PCMStream:
self.stream = None
def read(self, num_bytes):
# frame is 4 bytes
frames = int(num_bytes / 4)
data = self.stream.read(frames)[0]
try:
# frame is 4 bytes
frames = int(num_bytes / 4)
data = self.stream.read(frames)[0]
# convert to pcm format
return bytes(data)
# convert to pcm format
return bytes(data)
except sounddevice.PortAudioError as err:
print(f"Error in PCMStream.read: '{err}'")
def change_device(self, device_ID):
self.clean_up()
@@ -35,8 +39,8 @@ class PCMStream:
self.stream.close()
except Exception as e:
print(f"Error in clean_up: '{e}'")
except sounddevice.PortAudioError as err:
print(f"Error in PCMStream.clean_up: '{err}'")