From d1024fef1b216af5d3d991228c6b83311a71bb42 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 30 Dec 2022 01:10:32 -0800 Subject: Bugfix: regenerated FX layers now work on uploaded avatars VRChat won't update the FX layer associated with an avatar unless its GUID changes. Delete the GUID file when overwriting our generated FX layer to work around this. * Change paging behavior: when a region is updated, we re-page everything that comes after it. This fixes the issue where we go back to update something, then jump back to the current screen, leaving some random chunk of text somewhere on the board. * Reduce transcription time from 28s to 10s. I'm going to expose this to the user since there's a fundamental latency/stability tradeoff here. --- Scripts/libtastt.py | 5 +++++ Scripts/paging.py | 12 +++++++++--- Scripts/transcribe.py | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'Scripts') diff --git a/Scripts/libtastt.py b/Scripts/libtastt.py index 18de922..6881d89 100644 --- a/Scripts/libtastt.py +++ b/Scripts/libtastt.py @@ -620,3 +620,8 @@ if __name__ == "__main__": with open(args.guid_map, 'wb') as f: pickle.dump(guid_map, f) + # If we don't do this, then VRChat will fail to update the animator + # when users update their avatars. + if os.path.exists(args.fx_dest + ".meta"): + os.remove(args.fx_dest + ".meta") + diff --git a/Scripts/paging.py b/Scripts/paging.py index 8cde278..1b53216 100644 --- a/Scripts/paging.py +++ b/Scripts/paging.py @@ -13,13 +13,16 @@ def getSlice(msg: str, idx: int, slice_len: int) -> str: return msg[begin:end] + (" " * (end - msg_len)) return None -def setSlice(msg: str, idx: int, slice_len: int, msg_slice: str) -> str: +def setSlice(msg: str, idx: int, slice_len: int, msg_slice: str, + include_suffix: bool = True) -> str: begin = idx * slice_len end = (idx + 1) * slice_len prefix = msg[0:begin] prefix += " " * (begin - len(prefix)) suffix = msg[end:] - msg = prefix + msg_slice + suffix + msg = prefix + msg_slice + if include_suffix: + msg += suffix return msg class SingleLinePager: @@ -35,7 +38,8 @@ class SingleLinePager: old_slice = getSlice(self.msg, i, self.slice_len) new_slice = getSlice(msg, i, self.slice_len) if old_slice != new_slice: - self.msg = setSlice(self.msg, i, self.slice_len, new_slice) + self.msg = setSlice(self.msg, i, self.slice_len, new_slice, + include_suffix = False) return new_slice, i return "", -1 @@ -87,6 +91,7 @@ if __name__ == "__main__": p.msg = "test" assert(p.getNextSlice("test")[0] == "") assert(p.getNextSlice("tast")[0] == "ta") + assert(p.getNextSlice("tast")[0] == "st") assert(p.getNextSlice("tast")[0] == "") p.msg = "" @@ -106,6 +111,7 @@ if __name__ == "__main__": assert(p.getNextSlice("yo")[0] == "yo") assert(p.getNextSlice("yogi")[0] == "gi") assert(p.getNextSlice("yugi")[0] == "yu") + assert(p.getNextSlice("yugi is a")[0] == "gi") assert(p.getNextSlice("yugi is a")[0] == "is") assert(p.getNextSlice("yugi is a")[0] == " a") assert(p.getNextSlice("yugi is a pussy")[0] == "pu") diff --git a/Scripts/transcribe.py b/Scripts/transcribe.py index 21bb4ba..0530946 100644 --- a/Scripts/transcribe.py +++ b/Scripts/transcribe.py @@ -35,7 +35,7 @@ class AudioState: # The maximum length that recordAudio() will put into frames before it # starts dropping from the start. - self.MAX_LENGTH_S = 28 + self.MAX_LENGTH_S = 10 self.MAX_LENGTH_S_WHISPER = 30 # The minimum length that recordAudio() will wait for before saving audio. self.MIN_LENGTH_S = 1 -- cgit v1.2.3