From 8a9c1f410041d94e17ff986603be68bc1313a63f Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 8 Sep 2022 16:03:56 +0800 Subject: [PATCH] Fix duration estimation based on word count --- .../Sources/Services/AudioSession/SpeechSynthesizer.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift index 7d8ef0039..8d30eea5b 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift @@ -34,7 +34,7 @@ struct Utterance: Decodable { struct SpeechDocument: Decodable { public let pageId: String - public let averageWPM: Double = 150 + public let averageWPM: Double = 195 public let wordCount: Double public let language: String @@ -42,12 +42,8 @@ struct SpeechDocument: Decodable { public let utterances: [Utterance] - public func approxDuration(forSpeed speed: Double) -> Double { - wordCount / averageWPM * speed / 60.0 - } - public func estimatedDuration(utterance: Utterance, speed: Double) -> Double { - utterance.wordCount / averageWPM * speed / 60.0 + utterance.wordCount / averageWPM * speed * 60.0 } var audioDirectory: URL {