MCC TTS Generator Skill
This skill provides a specialized workflow for generating natural-sounding Thai audiobooks using the MCC academic TTS API. It is optimized for large documents that exceed standard API limits.
Core Features
- High-Quality Voices: Uses Microsoft Neural voices (
th-TH-PremwadeeNeuralandth-TH-NiwatNeural). - Automatic Chunking: Splits large text files into 4,500-character segments to comply with API limits.
- Smart Rate Limiting: Implements a 15-second delay between requests to stay within the 5 requests/minute quota.
- Audio Consolidation: Automatically merges segments into a single high-quality MP3 using
ffmpeg. - Fault Tolerance: Includes a retry system and supports resuming partially completed tasks.
Usage Guide
Prerequisites
ffmpegmust be installed (pkg install ffmpeg).requestsPython library must be available.
Main Workflow
- Preparation: Ensure your text files are cleaned (no OCR artifacts, fixed Sara Am).
- Execution: Run the generation script located in
scripts/generate_mcc_tts.py. - Output: Consolidated audio files will be saved in the
Audio_Completesubfolder.
Configuration
The script in scripts/generate_mcc_tts.py can be customized:
VOICE: Switch betweenPremwadeeNeural(Female) andNiwatNeural(Male).RATE: Adjust playback speed (default is1.1for faster listening).CHUNK_SIZE: Default is4500characters.
Best Practices
- Text Cleaning: Always run a Thai-specific text cleaner (fixing
ํ+า->ำ) before generating audio. - Monitoring: Check
progress_log.txtin the source directory to monitor the generation status. - Background Mode: For very large books, run the script using
nohuportmuxto ensure it continues running even if the CLI session is closed.
Technical Endpoint
https://moodle.mcc.ac.th/tts-api/api/tts
Parameters: text, voice, rate, pitch.