Skip to content

Commit

Permalink
fix(ios): linear rate adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Wassmer committed Sep 24, 2024
1 parent e8e2d4d commit 3d3078a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions ios/Plugin/TextToSpeech.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,11 @@ import Capacitor

// Adjust rate for a closer match to other platform.
@objc private func adjustRate(_ rate: Float) -> Float {
let baseRate = AVSpeechUtteranceDefaultSpeechRate
if rate == 1 {
return baseRate
}
if rate > baseRate {
return baseRate + (rate * 0.025)
}
return rate / 2
let baseRate: Float = AVSpeechUtteranceDefaultSpeechRate
if (rate >= 1.0 ) {
return (0.1 * rate) + (baseRate - 0.1)
}
return rate * baseRate
}

@objc private func resolveCurrentCall() {
Expand Down

0 comments on commit 3d3078a

Please sign in to comment.