Closed Bug 1254738 Opened 8 years ago Closed 8 years ago

Speech dispatcher rate conversion is wildly inaccurate

Categories

(Core :: Web Speech, defect)

Unspecified
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla48
Tracking Status
firefox48 --- verified

People

(Reporter: eeejay, Assigned: eeejay)

References

Details

Attachments

(1 file, 2 obsolete files)

With some experimentation, it seems that the rate values given to speechd bring very inaccurate results. From looking at how Chromium converts the rate values, it is apparent that the min/max speeds in speechd are 3x.

Some normalization needs to happen to make this consistent with other platforms browsers.
Blocks: 1254234
Could you explain the log10 usage here a bit?
Flags: needinfo?(eitan)
Attachment #8728133 - Flags: review?(bugs) → review+
Comment on attachment 8728133 [details]
MozReview Request: Bug 1254738 - Fix utterance rate conversion for speech dispatcher. r?smaug

https://reviewboard.mozilla.org/r/38809/#review36183

::: dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
(Diff revision 1)
> -  // speech-dispatcher expects -100 to 100 with 0 being default.
> -  int rate = 0;
> +  // The rate range in speechd is roughly x3 at both ends (0.334 .. 3).
> +  int rate = std::max<float>(std::min<float>(aRate, 3), 0.334);
>  
> -  if (aRate > 1) {
> -    rate = static_cast<int>((aRate - 1) * 10);
> +  // speech-dispatcher expects -100 to 100 with 0 being default.
> +  spd_set_voice_rate(mSpeechdClient, log10(rate) / log10(3) * 100);
> -  } else if (aRate <= 1) {

So could you at least change the comment about "-100 to 100" a bit explaining what the limits are and that we end up passing from -43 to 43
Sorry for not being responsive. I took that math from Chromium. That is how they translate rate values. It gives more correct rate scaling, but I think we could do better, specifically at rates that are smaller than 1x.

I made a little tool that can be used to compare speech rates across platforms/voices/browsers. I want to have as much consistency as possible, even though I know getting it fully accurate is impossible.

I'll come up with another translation and flag you for review soon.
Flags: needinfo?(eitan)
I'm lost with the new mozreview way of doing things.. not sure how to obsolete the patch correctly. I'll upload another one soon.
I'm more than happy to review in bugzilla the old way ;)
But up to you. If you prefer MozReview, use that.
Attachment #8728133 - Attachment is obsolete: true
These adjustments actually make the speech rate better across all voices.
Attachment #8730910 - Flags: review?(bugs)
^ that is after the applied patch
Comment on attachment 8730910 [details] [diff] [review]
Normalize speech rate for speech dispatcher.

>+  // We provide a rate of 0.1 to 10 with 1 being default.
I don't understand what this means now. Please fix the comment
Attachment #8730910 - Flags: review?(bugs) → review+
MozReview-Commit-ID: 79OuII34vz7
Attachment #8730910 - Attachment is obsolete: true
Assignee: nobody → eitan
https://hg.mozilla.org/mozilla-central/rev/f7597cb7ff9b
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Verified fixed on Firefox 48 Beta 2, buildID: 20160620091522 (with "media.webspeech.synth.enabled" set to true), using this tool: http://eeejay.github.io/webspeechdemos/rates.html.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.