From ae5db8b21e7db2ab9941cca47a5d57352d3bb1fa Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 3 Sep 2023 18:27:45 -0700 Subject: Add threads to transcribe_v2.py Four threads: * Main thread * Transcription (mic -> collector -> whisper -> committer -> pager) * VR input * Keyboard input Also: * add OscPager class to encapsulate all OSC interactions. * bump `last_n_must_match` from 2 to 3 to reduce hallucinations --- Scripts/osc_ctrl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Scripts/osc_ctrl.py') diff --git a/Scripts/osc_ctrl.py b/Scripts/osc_ctrl.py index 6fc706e..5e6f2ff 100644 --- a/Scripts/osc_ctrl.py +++ b/Scripts/osc_ctrl.py @@ -29,10 +29,13 @@ def generateEncoding(): class OscState: def __init__(self, chars_per_sync: int, rows: int, cols: int, + bytes_per_char: int, ip = "127.0.0.1", port = 9000): self.client = getClient(ip, port) self.pager = MultiLinePager(chars_per_sync, rows, cols) self.encoding= generateEncoding() + self.bytes_per_char = bytes_per_char + self.client.bytes_per_char = bytes_per_char self.builtin_msg = "" # The last message sent to the built-in chatbox def reset(self): @@ -83,7 +86,7 @@ def playAudio(osc_state: OscState, nth_audio: int, value: bool): osc_state.client.send_message(addr, value) def updateRegion(client, region_idx, letter_encoded): - for byte in range(0, generate_utils.config.BYTES_PER_CHAR): + for byte in range(0, client.bytes_per_char): addr="/avatar/parameters/" + generate_utils.getBlendParam(region_idx, byte) letter_remapped = (-127.5 + letter_encoded[byte]) / 127.5 client.send_message(addr, letter_remapped) @@ -150,9 +153,6 @@ def pageMessage(osc_state: OscState, msg: str, estate: EmotesState) -> bool: ellipsis(osc_state.client, False) - # Wait for parameter sync. - time.sleep(SYNC_DELAY_S) - # Like `pageMessage` but uses the built-in chatbox. The built-in chatbox # truncates data at about 150 chars, so just send the suffix of the message for # now. -- cgit v1.2.3