[WIP/TEST] Model : Add energy indicator for speaker

This commit is contained in:
misyaguziya
2024-02-09 02:29:49 +09:00
parent 2857d8f543
commit e08a3ab42d
2 changed files with 38 additions and 6 deletions

View File

@@ -122,4 +122,16 @@ class SelectedMicEnergyAndAudioRecorder(BaseEnergyAndAudioRecorder):
sample_rate=int(device["defaultSampleRate"]),
)
super().__init__(source=source, energy_threshold=energy_threshold, dynamic_energy_threshold=dynamic_energy_threshold, record_timeout=record_timeout)
# self.adjustForNoise()
class SelectedSpeakerEnergyAndAudioRecorder(BaseEnergyAndAudioRecorder):
def __init__(self, device, energy_threshold, dynamic_energy_threshold, record_timeout):
source = Microphone(speaker=True,
device_index= device["index"],
sample_rate=int(device["defaultSampleRate"]),
chunk_size=get_sample_size(paInt16),
channels=device["maxInputChannels"]
)
super().__init__(source=source, energy_threshold=energy_threshold, dynamic_energy_threshold=dynamic_energy_threshold, record_timeout=record_timeout)
# self.adjustForNoise()