diff options
| author | yum <yum.food.vr@gmail.com> | 2022-10-15 18:14:40 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2022-10-15 18:14:40 -0700 |
| commit | eba68f4fb35078327b75e99c25100ec1154efb13 (patch) | |
| tree | ad39f825de5e4db1feb1ec55d09b83487c40c86f /osc_ctrl.py | |
| parent | 3059967c75a41ed79b40ed3f84adbb874b0c3a33 (diff) | |
Tweak transcribe.py
Slightly improve temporal stability and responsiveness at the cost of
limiting to a 30 second recording.
Before committing to a transcription, wait for two consecutive
transcriptions such that they are identical, or the former is a
prefix of the latter. This helps with temporal stability by eliminating
most one-off wildly inaccurate transcriptions.
Also make osc_ctrl.sendMessageLazy a little lazier, limiting it to 2
consecutive non-empty cells per call. This allows us to recover from
mistranscriptions faster.
Diffstat (limited to 'osc_ctrl.py')
| -rw-r--r-- | osc_ctrl.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/osc_ctrl.py b/osc_ctrl.py index 40cb7d1..0352e6f 100644 --- a/osc_ctrl.py +++ b/osc_ctrl.py @@ -161,6 +161,7 @@ class OscTxState: # The message last sent to the board. last_msg_encoded = [] empty_cells_to_send_per_call = 1 + nonempty_cells_to_send_per_call = 2 # 0 indicates it's closed. 1 indicates half size. 2 indicates full size. board_size = 0 @@ -246,6 +247,7 @@ def sendMessageLazy(client, msg, tx_state): msg_encoded_len = len(msg_encoded) empty_cells_sent = 0 + nonempty_cells_sent = 0 n_cells = ceil(msg_encoded_len / NUM_LAYERS) for cell in range(0, n_cells): cell_begin = cell * NUM_LAYERS @@ -272,6 +274,12 @@ def sendMessageLazy(client, msg, tx_state): tx_state.last_msg_encoded = msg_encoded[0:cell_end] return False empty_cells_sent += 1 + else: + if nonempty_cells_sent >= tx_state.nonempty_cells_to_send_per_call: + print("nonempty cell budget exceeded") + tx_state.last_msg_encoded = msg_encoded[0:cell_end] + return False + nonempty_cells_sent += 1 sendMessageCellDiscrete(client, cell_msg, cell) |
