Update 2025-04-13_17:31:30

This commit is contained in:
root
2025-04-13 17:31:30 +02:00
parent 06fb52f574
commit 3013631fd7
19 changed files with 1043 additions and 130 deletions

14
static/sound.js Normal file
View File

@ -0,0 +1,14 @@
export function playSound(name) {
const text = name === "correct" ? "Correct" : name === "wrong" ? "Wrong" : name;
const utterance = new SpeechSynthesisUtterance(text);
utterance.lang = "en-US";
const voices = speechSynthesis.getVoices();
const robotVoice = voices.find(v =>
v.name.toLowerCase().includes("google") || v.name.toLowerCase().includes("robot")
);
if (robotVoice) utterance.voice = robotVoice;
speechSynthesis.speak(utterance);
}