diff options
Diffstat (limited to 'Scripts')
| -rw-r--r-- | Scripts/osc_ctrl.py | 5 | ||||
| -rw-r--r-- | Scripts/transcribe.py | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Scripts/osc_ctrl.py b/Scripts/osc_ctrl.py index 422d854..7c7d0ae 100644 --- a/Scripts/osc_ctrl.py +++ b/Scripts/osc_ctrl.py @@ -100,7 +100,6 @@ def pageMessage(osc_state: OscState, msg: str) -> bool: # Really long messages just wrap back around. which_region = (slice_idx % generate_utils.config.numRegions(0)) - #print("send to region {}".format(which_region)) # if in last region: # how long is it @@ -109,12 +108,16 @@ def pageMessage(osc_state: OscState, msg: str) -> bool: #print("num regions: {}".format(num_regions)) if which_region == num_regions - 1: layers_in_last_region = num_cells % generate_utils.config.CHARS_PER_SYNC + if layers_in_last_region == 0: + layers_in_last_region = generate_utils.config.CHARS_PER_SYNC #print("layers in last region: {}".format(layers_in_last_region)) old_len = len(msg_slice) msg_slice = msg_slice[0:layers_in_last_region] #print("truncate msg_slice from length {} to length {}".format(old_len, # len(msg_slice))) + #print("send \"{}\" to region {}".format(msg_slice, which_region)) + enable(osc_state.client) # Seek to the current region. diff --git a/Scripts/transcribe.py b/Scripts/transcribe.py index f90867a..8491e4d 100644 --- a/Scripts/transcribe.py +++ b/Scripts/transcribe.py @@ -280,16 +280,17 @@ def transcribeAudio(audio_state, model): words = ''.join(c for c in text.lower() if (c.isalpha() or c == " ")).split() + old_text = audio_state.text + + audio_state.text = string_matcher.matchStrings(audio_state.text, + text, window_size = 25) + now = time.time() print("Transcription ({} seconds): {}".format( now - last_transcribe_time, audio_state.text)) last_transcribe_time = now - old_text = audio_state.text - - audio_state.text = string_matcher.matchStrings(audio_state.text, - text, window_size = 25) if old_text != audio_state.text: # We think the user said something, so reset the amount of # time we sleep between transcriptions to the minimum. |
