From a86976ea0eb19f3c8d2d8baa13faffa1176e7962 Mon Sep 17 00:00:00 2001 From: Pierre Le Fevre Date: Sat, 14 Mar 2026 09:44:32 +0100 Subject: [PATCH] Add sound effects for correct/incorrect answers and lesson completion Synthesize short tones via Web Audio API - no external audio files needed. Correct answers play an ascending two-note ding, incorrect answers play a gentle descending tone, and lesson completion plays a four-note fanfare. Co-Authored-By: Claude Opus 4.6 (1M context) --- web/src/components/feedback/CorrectBanner.tsx | 7 ++- .../components/feedback/IncorrectBanner.tsx | 7 ++- web/src/pages/ReviewPage.tsx | 3 + web/src/utils/sounds.ts | 56 +++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 web/src/utils/sounds.ts diff --git a/web/src/components/feedback/CorrectBanner.tsx b/web/src/components/feedback/CorrectBanner.tsx index 436eba3..6a10d7b 100644 --- a/web/src/components/feedback/CorrectBanner.tsx +++ b/web/src/components/feedback/CorrectBanner.tsx @@ -1,8 +1,9 @@ -import { useMemo } from 'react'; +import { useEffect, useMemo } from 'react'; import { keyframes } from '@emotion/react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { Rambi } from '../mascot/Rambi'; +import { playCorrectSound } from '../../utils/sounds'; const slideUp = keyframes` from { transform: translateY(100%); opacity: 0; } @@ -24,6 +25,10 @@ export function CorrectBanner() { [], ); + useEffect(() => { + playCorrectSound(); + }, []); + return ( { + playIncorrectSound(); + }, []); + return (