Turn off Google Translate slow down text-to-speech on second listen

google-translate

How can I turn off Google Translate's "slow down text-to-speech on second listen"? It's nothing but hugely irritating.

Best Answer

You can use this javascript code to turn it off:

const orig_setAttribute = HTMLElement.prototype.setAttribute;

Audio.prototype.setAttribute = function(key, value) {
    if (key === 'src') {
        value = value.replace(/([?&])ttsspeed=[0-9.]+($|&)/, (match, s1, s2) => {
            return s2 ? s1 : '';
        });
    }

    orig_setAttribute.call(this, key, value);
};

You need to paste it to the console every time you open the Google Translator site or just use Greasemonkey or somethink that executes it automatically.

Here is Greasemonkey version with added header:

// ==UserScript==
// @name        translate.google.com   —   Turn off slowing down text-to-speech
// @namespace   vitaliylag
// @match       *://translate.google.com/*
// @version     
// @grant       none
// ==/UserScript==



const orig_setAttribute = HTMLElement.prototype.setAttribute;

Audio.prototype.setAttribute = function(key, value) {
    if (key === 'src') {
        value = value.replace(/([?&])ttsspeed=[0-9.]+($|&)/, (match, s1, s2) => {
            return s2 ? s1 : '';
        });
    }

    orig_setAttribute.call(this, key, value);
};

Maybe someday I will create a browser extension for easy use but if I will it will not be soon.