From 98284cc0ca42c75ef8cf22d9435821c62a12c592 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 25 Oct 2022 16:05:25 -0700 Subject: 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. --- osc_ctrl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'osc_ctrl.py') 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) -- cgit v1.2.3