feat(study): synchronized RSVP + audio reader (--study mode)#3
Open
DavidTbilisi wants to merge 1 commit into
Open
feat(study): synchronized RSVP + audio reader (--study mode)#3DavidTbilisi wants to merge 1 commit into
DavidTbilisi wants to merge 1 commit into
Conversation
Adds a dual-channel reading mode that flashes one word at a time in a Tk window while the same text plays through pygame, driven by the per-word timing list `fast_audio.generate_audio_with_subs` already emits. Intended for use on a stationary bike or other hands-free session where eyes and ears can be paced together. Architecture (no rewrite of existing TTS paths): - study_session.StudySession: pure-logic timing model; O(log n) bisect_right lookup over a precomputed start_ms array so the 30 Hz sync loop stays cheap. - study_player.StudyPlayer: Tk + lazy-imported pygame; excluded from coverage same as gui.py. - quiz.QuizProvider Protocol with RuleBasedProvider (zero-dep, _generate_for_chunk left as the single TODO slot) and a LLMQuizProvider stub so a cloud/local model can swap in later without touching the player. - session_log.SessionRecord: append-only JSONL at ~/.tts_ka_study.jsonl (env override TTS_KA_STUDY_LOG); malformed lines are skipped, not raised. CLI: `tts-ka --study --study-chunk-words 200 -l en file.txt` Extra: pip install -e ".[study]" (adds pygame). 30 new tests pass; UI module excluded from the 70 percent coverage floor, matching the existing gui.py / native_hotkeys.py convention. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
tts-ka --study— a synchronized RSVP word-flash + audio playback window driven by the per-word timing listfast_audio.generate_audio_with_subsalready emits.QuizProviderProtocol; the defaultRuleBasedProvider._generate_for_chunkis aTODO(human)slot left for a follow-up commit.Architecture
study_session.pybisect_rightlookup over a precomputedstart_msarray → O(log n) inside the 30 Hz sync loop.study_player.pygui.py).quiz.pyQuizProviderProtocol,RuleBasedProvider(zero-dep,_generate_for_chunkis the TODO slot),LLMQuizProviderstub for future swap.session_log.py~/.tts_ka_study.jsonl(env overrideTTS_KA_STUDY_LOG); malformed lines skipped, not raised.main.pypatch--studyand--study-chunk-wordsflags; lazy import so non-study users do not pay the pygame cost.CLI
Why this exists
Reading speed for non-fiction is bottlenecked by two independent axes — language-processing speed and eye mechanics. This mode trains the language-processing axis by pairing RSVP visual flash with audio playback of the same text, so the bottleneck cannot hide behind the other channel. The session log gives a longitudinal WPM trajectory for later analysis.
Test plan
pytest tests/test_study_session.py tests/test_quiz.py tests/test_session_log.py— 30 new tests passtts-ka --study cb -l enwith a paragraph of English in the clipboard; verify audio plays and the big-word label tracksNotImplementedErrorcleanly (until the TODO is filled)~/.tts_ka_study.jsonltts-ka --study cb -l kawith Georgian text to verify the cross-language pathRuleBasedProvider._generate_for_chunkand updatetest_calls_into_todo_slotto assert realQuestionshape🤖 Generated with Claude Code