Skip to content

Add pregenerated chapter TTS support (audio field, player, generator script) - #4

Open
Ruofei-personal wants to merge 1 commit into
masterfrom
codex/add-tts-functionality-to-book-chapters-ag8mp3
Open

Add pregenerated chapter TTS support (audio field, player, generator script)#4
Ruofei-personal wants to merge 1 commit into
masterfrom
codex/add-tts-functionality-to-book-chapters-ag8mp3

Conversation

@Ruofei-personal

Copy link
Copy Markdown
Owner

Motivation

  • Enable per-chapter pregenerated TTS audio playback and a workflow to generate audio files so chapters can include optional audio players without runtime TTS dependencies.

Description

  • Added an optional audio field to chapter schemas in backend/app/models/schemas.py and to frontend types in frontend/src/lib/types.ts to carry audio URLs.
  • Updated content loading in backend/app/services/content.py to include audio when building chapter listings.
  • Render an inline audio player in the chapter page at frontend/src/app/books/[bookId]/chapters/[chapterSlug]/page.tsx when chapter.meta.audio is present.
  • Documented the new content/books/<book-id>/audio/ directory and the workflow in README.md, including usage examples.
  • Added a new script scripts/generate_tts.py that uses edge-tts to synthesize .mp3 files from chapter Markdown, writes them to content/books/<book-id>/audio/, and updates meta/<chapter>.json with the audio field; the script supports --chapter, --all, --voice, and --overwrite options.

Testing

  • No automated tests were added or run as part of this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant