summaryrefslogtreecommitdiffstats
path: root/Scripts/osc_ctrl.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-09-03 18:27:45 -0700
committeryum <yum.food.vr@gmail.com>2023-09-03 18:27:45 -0700
commitae5db8b21e7db2ab9941cca47a5d57352d3bb1fa (patch)
treec2c4ea74158c9b9c76db519819957f1317af59c4 /Scripts/osc_ctrl.py
parent2a4c6051acd8140bde6c1abad62bd613673de4b4 (diff)
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
Diffstat (limited to 'Scripts/osc_ctrl.py')
-rw-r--r--Scripts/osc_ctrl.py8
1 files changed, 4 insertions, 4 deletions
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.