Skip to content

Commit

Permalink
better pronounce "A takes"
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 1, 2019
1 parent 581b6f4 commit ce18044
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/speech/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce18044

Please sign in to comment.