From 9a16b33f001c9981612254bd7785aafc00601b19 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 13 Mar 2025 19:14:54 -0700 Subject: [PATCH] feat: Add speech synthesis for marker labels in transcript --- aider/website/examples/recording.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/aider/website/examples/recording.md b/aider/website/examples/recording.md index 988bfc3a5..2ada9957b 100644 --- a/aider/website/examples/recording.md +++ b/aider/website/examples/recording.md @@ -128,6 +128,25 @@ document.addEventListener('DOMContentLoaded', function() { document.querySelector('.transcript-container').appendChild(container); } + // Function to speak text using the Web Speech API + function speakText(text) { + // Check if speech synthesis is supported + if ('speechSynthesis' in window) { + // Create a new speech synthesis utterance + const utterance = new SpeechSynthesisUtterance(text); + + // Optional: Configure voice properties + utterance.rate = 1.0; // Speech rate (0.1 to 10) + utterance.pitch = 1.0; // Speech pitch (0 to 2) + utterance.volume = 1.0; // Speech volume (0 to 1) + + // Speak the text + window.speechSynthesis.speak(utterance); + } else { + console.warn('Speech synthesis not supported in this browser'); + } + } + // Add event listener with safety checks if (player && typeof player.addEventListener === 'function') { player.addEventListener('marker', function(event) { @@ -135,6 +154,9 @@ document.addEventListener('DOMContentLoaded', function() { const { index, time, label } = event; console.log(`marker! ${index} - ${time} - ${label}`); + // Speak the marker label + speakText(label); + const transcriptContent = document.getElementById('transcript-content'); if (transcriptContent) { const markerElement = document.createElement('div');