#1654·DeepTutor

feat(reading): add material-scoped natural read-aloud audio

Author: evan188199-techCreated Sep 29, 2026Updated Sep 29, 2026

Problem

The Immersive Reading read-aloud extension returns server-verified text and relies on browser speech synthesis. Browser voices vary widely and often sound robotic, especially for young learners. The existing server TTS endpoint cannot safely be exposed to restricted learning accounts because it accepts arbitrary text.

Proposal

Add a material-scoped read-aloud audio route under /api/reading that:

  • accepts only a material id, locator, and locale;
  • verifies the caller can read that material and has the read_aloud extension enabled;
  • synthesizes only the stored unit text with the active server TTS provider;
  • returns browser-playable audio, wrapping PCM as WAV;
  • leaves arbitrary /api/voice/tts access unchanged.

The reader should prefer this server audio and fall back to browser speech only when server TTS is unavailable. Stop and navigation cleanup should continue to work.

Non-goals

  • No new TTS provider or voice-management UI.
  • No change to unrestricted users existing generic voice API.