Skip to content

Commit

Permalink
fix(ios)!: linear rate adjustment (#136)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The speech rate now has a linear behavior.
  • Loading branch information
dwassmer authored Sep 25, 2024
1 parent e8e2d4d commit e573114
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 e573114

Please sign in to comment.