Bug 258587 - Web speech: mapSpeechRateToPlatformRate exceeds AVSpeechUtteranceMaximumSpeechRate
Summary: Web speech: mapSpeechRateToPlatformRate exceeds AVSpeechUtteranceMaximumSpeec...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-06-27 13:15 PDT by Avi Drissman
Modified: 2023-06-27 14:40 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Avi Drissman 2023-06-27 13:15:45 PDT
https://github.com/WebKit/WebKit/blob/fca03d0dccb29ce539876bba8d7180f93ecc12b9/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm#L96:

    // WebSpeech says to go from .1 -> 10 (default 1)
    // AVSpeechSynthesizer asks for 0 -> 1 (default. 5)
    if (rate < 1)
        rate *= AVSpeechUtteranceDefaultSpeechRate;
    else
        rate = AVSpeechUtteranceDefaultSpeechRate + ((rate - 1) * (AVSpeechUtteranceMaximumSpeechRate - AVSpeechUtteranceDefaultSpeechRate));

This maps the slower rates linearly from AVSpeechUtteranceMinimumSpeechRate to AVSpeechUtteranceDefaultSpeechRate. However, while this maps

1 → AVSpeechUtteranceDefaultSpeechRate

it maps

10 → 0.5 + ((10-1)*.5) = 0.5 + 4.5 = 5

and 5 is significantly larger than AVSpeechUtteranceMaximumSpeechRate (1).

Is it intentional to pass a speech rate higher than the maximum?
Comment 1 Radar WebKit Bug Importer 2023-06-27 14:04:33 PDT
<rdar://problem/111411189>
Comment 2 Avi Drissman 2023-06-27 14:40:09 PDT
I’m switching Chromium from NSSpeechSynthesizer to AVSpeechSynthesizer. I’m scaling differently, FYI: https://chromium-review.googlesource.com/c/chromium/src/+/4638862