better pronounce "A takes"

v2
Thibault Duplessis 2019-05-01 13:11:58 +07:00
parent 581b6f4c9c
commit ce18044845
1 changed files with 7 additions and 1 deletions

View File

@ -20,8 +20,14 @@ function renderSan(san: San) {
return move;
}
function hackFix(msg: string): string {
return msg
.replace("A takes", "A, takes"); // "a takes" is mispronounced
}
export function say(text: string, cut: boolean) {
const msg = new SpeechSynthesisUtterance(text);
const msg = new SpeechSynthesisUtterance(hackFix(text));
msg.rate = 1.2;
if (cut) speechSynthesis.cancel();
window.lichess.sound.say(msg);