feat: Improve text segmentation for faster playback

Implement a progressive text segmentation strategy. The first few segments are intentionally kept very short to allow playback to start almost immediately, creating a more responsive feel. As more segments are processed, their length gradually increases to optimize audio generation efficiency for the remainder of the article. Additionally, the title is now prepended as the very first segment. The buffer ahead is also increased to 5 segments to ensure content is ready.

Further refinements include:
- Enhanced voice descriptions in constants.
- Improved segment styling in ReaderView for better visual active state indication.
This commit is contained in:
Anthony
2025-11-19 20:15:39 +08:00
parent 78f1e0e93c
commit 417d48ffdf
4 changed files with 85 additions and 79 deletions

View File

@@ -1,15 +1,16 @@
import { VoiceName } from './types';
export const AVAILABLE_VOICES = [
{ name: VoiceName.Puck, label: 'Puck (Male, Standard)' },
{ name: VoiceName.Charon, label: 'Charon (Male, Deep)' },
{ name: VoiceName.Kore, label: 'Kore (Female, Soothing)' },
{ name: VoiceName.Fenrir, label: 'Fenrir (Male, Energetic)' },
{ name: VoiceName.Zephyr, label: 'Zephyr (Female, Clear)' },
{ name: VoiceName.Puck, label: 'Puck (Standard American, Male)' },
{ name: VoiceName.Charon, label: 'Charon (Deep, Authoritative Male)' },
{ name: VoiceName.Kore, label: 'Kore (Soft, Calm Female)' },
{ name: VoiceName.Fenrir, label: 'Fenrir (Energetic, Mid-Atlantic Male)' },
{ name: VoiceName.Zephyr, label: 'Zephyr (Clear, Professional Female)' },
];
export const MIN_SPEED = 0.5;
export const MAX_SPEED = 3.5;
export const SPEED_STEP = 0.5;
export const SAMPLE_RATE = 24000;
export const SAMPLE_RATE = 24000;