Last Comment Bug 1254738 - Speech dispatcher rate conversion is wildly inaccurate
: Speech dispatcher rate conversion is wildly inaccurate
Status: VERIFIED FIXED
:
Product: Core
Classification: Components
Component: Web Speech (show other bugs)
: unspecified
: Unspecified Linux
-- normal (vote)
: mozilla48
Assigned To: Eitan Isaacson [:eeejay]
:
: André Natal
Mentors:
Depends on:
Blocks: 1254234
  Show dependency treegraph
 
Reported: 2016-03-08 15:14 PST by Eitan Isaacson [:eeejay]
Modified: 2016-06-23 06:55 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
verified


Attachments
MozReview Request: Bug 1254738 - Fix utterance rate conversion for speech dispatcher. r?smaug (58 bytes, text/x-review-board-request)
2016-03-08 15:15 PST, Eitan Isaacson [:eeejay]
bugs: review+
Details | Review
Normalize speech rate for speech dispatcher. (2.54 KB, patch)
2016-03-15 14:22 PDT, Eitan Isaacson [:eeejay]
bugs: review+
Details | Diff | Splinter Review
Normalize speech rate for speech dispatcher. r=smaug (2.57 KB, patch)
2016-03-16 10:18 PDT, Eitan Isaacson [:eeejay]
no flags Details | Diff | Splinter Review

Description User image Eitan Isaacson [:eeejay] 2016-03-08 15:14:05 PST
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.
Comment 1 User image Eitan Isaacson [:eeejay] 2016-03-08 15:15:32 PST
Created attachment 8728133 [details]
MozReview Request: Bug 1254738 - Fix utterance rate conversion for speech dispatcher. r?smaug

Review commit: https://reviewboard.mozilla.org/r/38809/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/38809/
Comment 2 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2016-03-10 14:38:11 PST
Could you explain the log10 usage here a bit?
Comment 3 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2016-03-11 10:47:09 PST
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
Comment 4 User image Eitan Isaacson [:eeejay] 2016-03-11 16:42:44 PST
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.
Comment 5 User image Eitan Isaacson [:eeejay] 2016-03-11 16:44:03 PST
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.
Comment 6 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2016-03-11 16:59:57 PST
I'm more than happy to review in bugzilla the old way ;)
But up to you. If you prefer MozReview, use that.
Comment 8 User image Eitan Isaacson [:eeejay] 2016-03-15 14:22:08 PDT
Created attachment 8730910 [details] [diff] [review]
Normalize speech rate for speech dispatcher.

These adjustments actually make the speech rate better across all voices.
Comment 10 User image Eitan Isaacson [:eeejay] 2016-03-15 14:29:21 PDT
^ that is after the applied patch
Comment 11 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2016-03-15 14:49:54 PDT
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
Comment 12 User image Eitan Isaacson [:eeejay] 2016-03-16 10:18:04 PDT
Created attachment 8731333 [details] [diff] [review]
Normalize speech rate for speech dispatcher. r=smaug

MozReview-Commit-ID: 79OuII34vz7
Comment 14 User image Carsten Book [:Tomcat] 2016-03-17 03:18:06 PDT
https://hg.mozilla.org/mozilla-central/rev/f7597cb7ff9b
Comment 15 User image Camelia Badau, QA [:cbadau] 2016-06-23 06:55:43 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.