From ac37851c7d820657faa9888c427966267e0a7abb Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 12 Sep 2023 08:49:27 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=91=8D[Update]=20model=20func=20OSC?= =?UTF-8?q?=20Change=20Input=20Voice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/osc/osc_tools.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/models/osc/osc_tools.py b/models/osc/osc_tools.py index b44e17cb..c2f765ec 100644 --- a/models/osc/osc_tools.py +++ b/models/osc/osc_tools.py @@ -30,8 +30,28 @@ def sendTestAction(ip_address="127.0.0.1", port=9000): sleep(0.01) client.send_message("/input/Vertical", False) +# send Input Voice +def sendInputVoice(flag=False, ip_address="127.0.0.1", port=9000): + input_voice = osc_message_builder.OscMessageBuilder(address="/input/Voice") + input_voice.add_arg(flag) + b_input_voice = input_voice.build() + client = udp_client.SimpleUDPClient(ip_address, port) + client.send(b_input_voice) + +def sendChangeVoice(ip_address="127.0.0.1", port=9000): + sendInputVoice(flag=0, ip_address=ip_address, port=port) + sleep(0.05) + sendInputVoice(flag=1, ip_address=ip_address, port=port) + sleep(0.05) + sendInputVoice(flag=0, ip_address=ip_address, port=port) + sleep(0.05) + def receiveOscParameters(target, filter="/*", ip_address="127.0.0.1", port=9001): _dispatcher = dispatcher.Dispatcher() _dispatcher.map(filter, target) server = osc_server.ThreadingOSCUDPServer((ip_address, port), _dispatcher) - server.serve_forever() \ No newline at end of file + server.serve_forever() + +if __name__ == "__main__": + sendChangeVoice() + sendChangeVoice() \ No newline at end of file From cd78cadbbb1e8900ccdeceefb60f1c0616f3cc36 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 12 Sep 2023 09:03:17 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=91=8D[Update]=20config=20=20ENABLE?= =?UTF-8?q?=5FOSC=5FERROR=5FLOG=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config.py b/config.py index 42c8b151..a47cd8b6 100644 --- a/config.py +++ b/config.py @@ -388,6 +388,15 @@ class Config: if type(value) is bool: self._ENABLE_OSC = value + @property + def ENABLE_OSC_ERROR_LOG(self): + return self._ENABLE_OSC_ERROR_LOG + + @ENABLE_OSC_ERROR_LOG.setter + def ENABLE_OSC_ERROR_LOG(self, value): + if type(value) is bool: + self._ENABLE_OSC_ERROR_LOG = value + @property def UPDATE_FLAG(self): return self._UPDATE_FLAG @@ -507,6 +516,7 @@ class Config: self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_OSC = False + self._ENABLE_OSC_ERROR_LOG = True self._UPDATE_FLAG = False self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" # self._BREAK_KEYSYM_LIST = [ From cd46a16178ac04c189d1c28f55895b9c0b9b285f Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 12 Sep 2023 09:04:24 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=91=8D[Update]=20model=20view.printTo?= =?UTF-8?q?Textbox=5FOSCError()=E3=81=AE=E5=8B=95=E4=BD=9C=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=81=ABENABLE=5FOSC=5FERROR=5FLOG=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ea563ec2..b86fc746 100644 --- a/main.py +++ b/main.py @@ -28,7 +28,8 @@ def sendMicMessage(message): osc_message = message model.oscSendMessage(osc_message) else: - view.printToTextbox_OSCError() + if config.ENABLE_OSC_ERROR_LOG is True: + view.printToTextbox_OSCError() view.printToTextbox_SentMessage(message, translation) if config.ENABLE_LOGGER is True: @@ -90,7 +91,8 @@ def sendChatMessage(message): osc_message = message model.oscSendMessage(osc_message) else: - view.printToTextbox_OSCError() + if config.ENABLE_OSC_ERROR_LOG is True: + view.printToTextbox_OSCError() # update textbox message log view.printToTextbox_SentMessage(message, translation) From 73c9ea4e03b612172b834e8cfb83fa2cda32cc9f Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 12 Sep 2023 09:42:23 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=91=8D[Update]=20model=20INPUT=5FMIC?= =?UTF-8?q?=5FRECORD=5FTIMEOUT=E3=81=A8INPUT=5FMIC=5FPHRASE=5FTIMEOUT?= =?UTF-8?q?=E3=81=AE=E5=A4=A7=E5=B0=8F=E3=81=AB=E3=82=88=E3=82=8B=E6=96=87?= =?UTF-8?q?=E5=AD=97=E8=B5=B7=E3=81=93=E3=81=97=E3=81=AE=E3=83=90=E3=82=B0?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/model.py b/model.py index 99923c2c..6eb1e5a6 100644 --- a/model.py +++ b/model.py @@ -215,17 +215,23 @@ class Model: def startMicTranscript(self, fnc): mic_audio_queue = Queue() + device = [device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0] + record_timeout = config.INPUT_MIC_RECORD_TIMEOUT + phase_timeout = config.INPUT_MIC_PHRASE_TIMEOUT + if record_timeout > phase_timeout: + record_timeout = phase_timeout + self.mic_audio_recorder = SelectedMicRecorder( - [device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0], - config.INPUT_MIC_ENERGY_THRESHOLD, - config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD, - config.INPUT_MIC_RECORD_TIMEOUT, + device=device, + energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD, + dynamic_energy_threshold=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD, + record_timeout=record_timeout, ) self.mic_audio_recorder.recordIntoQueue(mic_audio_queue) mic_transcriber = AudioTranscriber( speaker=False, source=self.mic_audio_recorder.source, - phrase_timeout=config.INPUT_MIC_PHRASE_TIMEOUT, + phrase_timeout=phase_timeout, max_phrases=config.INPUT_MIC_MAX_PHRASES, ) def sendMicTranscript(): @@ -274,17 +280,23 @@ class Model: def startSpeakerTranscript(self, fnc): spk_audio_queue = Queue() spk_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0] + + record_timeout = config.INPUT_SPEAKER_RECORD_TIMEOUT + phase_timeout = config.INPUT_SPEAKER_PHRASE_TIMEOUT + if record_timeout > phase_timeout: + record_timeout = phase_timeout + self.spk_audio_recorder = SelectedSpeakerRecorder( - spk_device, - config.INPUT_SPEAKER_ENERGY_THRESHOLD, - config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, - config.INPUT_SPEAKER_RECORD_TIMEOUT, + device=spk_device, + energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD, + dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, + record_timeout=record_timeout, ) self.spk_audio_recorder.recordIntoQueue(spk_audio_queue) spk_transcriber = AudioTranscriber( speaker=True, source=self.spk_audio_recorder.source, - phrase_timeout=config.INPUT_SPEAKER_PHRASE_TIMEOUT, + phrase_timeout=phase_timeout, max_phrases=config.INPUT_SPEAKER_MAX_PHRASES, ) def sendSpkTranscript():