Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a full TTS pipeline that converts math content to audio, letting students listen to problem bodies, steps, and hints read aloud.
Changes
New backend pipeline (
src/math-to-speech/):autoTTSProcessor.js— main script that scans all content and generatespacedSpeechfields in hint/step/problem JSON files. Supports incremental updates (skips unchanged content via hash),--force,--dry-run, and per-type filtering (--types hints,steps,problems)hintProcessor.js— handles LaTeX → MathML (Python/SRE) → readable speech text conversion, with a process pool (4 Python + 8 SRE workers) for fast parallel processing (~39s for 54k hints)latexToMathML.py,sreNode.js— persistent worker processes for LaTeX conversionNew frontend components:
TTSPlayer— fetches audio from Lambda and handles play/pause/replay/segment chainingTTSButtons— play/pause/replay button grouplatexToReadable.js— lightweight LaTeX → readable text fallback when nopacedSpeechis availableModified frontend (
Problem.js,ProblemCard.js,HintSystem.js):enableTTSpropConfig (
config.js):TTS_API_URLread fromREACT_APP_TTS_AWS_ENDPOINTenvironment variable (mirrors howDYNAMIC_HINT_URLworks for the LLM agent)How to enable
Add
"allowTTS": trueto a lesson incoursePlans.json— same pattern asallowDynamicHint. TTS is off by default everywhere. Default to be False now, making no change to current website.Current impact
None on existing pages. All courses' configuration are False now. The content submodule is untouched —
pacedSpeechfields don't exist yet, so all lessons behave exactly as before. The Lambda env var is also not configured in production yet, so no AWS calls will be made.To generate speech text locally: