summaryrefslogtreecommitdiffstats
path: root/osc_ctrl.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2022-10-25 16:05:25 -0700
committeryum <yum.food.vr@gmail.com>2022-10-25 16:05:25 -0700
commit98284cc0ca42c75ef8cf22d9435821c62a12c592 (patch)
treea013ab37e7ddf109496028cc50f4312a74a27bda /osc_ctrl.py
parentde99d88a1c15c64812d16231e1b58e6e32e1588a (diff)
Add exponentially longer sleeps to transcribe loop
When the user pauses their speech for an extended period of time, the transcription engine will sleep for progressively longer intervals, up to 1.5 seconds between transcriptions. This allows us to reduce idle resource consumption. To enable responsive transcription while the user is speaking actively, we reset the sleep duration to the minimum whenever a change is detected.
Diffstat (limited to 'osc_ctrl.py')
-rw-r--r--osc_ctrl.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/osc_ctrl.py b/osc_ctrl.py
index 4353939..328b55c 100644
--- a/osc_ctrl.py
+++ b/osc_ctrl.py
@@ -33,6 +33,8 @@ class EvilGlobalState():
encoding = {}
state = EvilGlobalState()
+# The characters in the TaSTT are all numbered from top left to bottom right.
+# This function provides a mapping from letter ('a') to index (26).
def generateEncoding(state):
for i in range(0, 26):
state.encoding[chr(ord('A') + i)] = i
@@ -103,7 +105,6 @@ def sendMessageCellDiscrete(client, msg_cell, which_cell):
if msg_cell != state.encoding[' '] * BOARD_COLS:
addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam()
client.send_message(addr, False)
- print("beep")
time.sleep(CELL_TX_TIME_S / 3.0)