From 869dc893b90742e508a550b896229083d12ee0db Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 26 Sep 2023 14:59:59 -0400 Subject: [PATCH] Use WPM approach to delay the text --- www/app/transcripts/useWebSockets.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/app/transcripts/useWebSockets.ts b/www/app/transcripts/useWebSockets.ts index c3b77f40..ee15540d 100644 --- a/www/app/transcripts/useWebSockets.ts +++ b/www/app/transcripts/useWebSockets.ts @@ -31,7 +31,9 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { const text = textQueue[0]; setTranscriptText(text); - const delay = text.length * 100; + const WPM_READING = 200; // words per minute to read + const wordCount = text.split(/\s+/).length; + const delay = (wordCount / WPM_READING) * 60 * 1000; setTimeout(() => { setIsProcessing(false); setTextQueue((prevQueue) => prevQueue.slice(1));