Introduction
Modern "zero-shot" Text-to-Speech (TTS) models, such as VALL-E or GPT-SoVITS, have revolutionized voice cloning by utilizing short audio prompts to guide synthesis via in-context learning. However, a significant bottleneck in these systems is the "random prompt selection" problem. Typically, prompts are chosen arbitrarily from a speaker's dataset, which can lead to stylistic mismatches—for example, pairing a dramatic sentence with a whispered prompt. This paper proposes a Retrieval-Augmented Generation (RAG) framework that leverages a novel Context-Aware Contrastive Language-Audio Pretraining (CA-CLAP) model to intelligently select the most stylistically appropriate prompts based on the target text and its surrounding narrative context.
Methodology
The proposed framework operates through a three-stage pipeline: Indexing, Retrieval, and Generation.
CA-CLAP Architecture
The core innovation is the CA-CLAP model, designed to align textual context with acoustic style. It features:
- Audio Encoder: Extracts style embeddings from speech samples.
- Text Encoder with Cross-Attention: Unlike standard encoders, this module processes both the "current text" and its "context" (neighboring sentences). It uses cross-attention to fuse these inputs into Style-Related Textual Features (STFs).
- Contrastive Learning: The model is trained to minimize the distance between audio embeddings and their corresponding STFs in a shared feature space, ensuring that text with specific narrative "vibes" maps to audio with matching acoustic properties.
The RAG Pipeline
- Indexing: All available audio prompts are processed through the CA-CLAP audio encoder and stored in a speech embedding database.
- Retrieval: For a new sentence, the CA-CLAP text encoder generates a query based on the text and its context (ideally a 5-sentence window). The system retrieves the "Top-K" most similar audio prompts.
- Generation: These retrieved prompts are fed into a backbone TTS model (GPT-SoVITS) to guide the final synthesis.
Experiments and Results
The system was evaluated using a large-scale dataset of 3,254 Chinese audiobooks. Researchers found that narrative context is crucial; retrieval performance peaked with a context window of 5 sentences.
Performance Comparison
The proposed CA-CLAP-based RAG was compared against random selection and text-only embedding baselines (MiniLM, CoROM). As shown in the results table, the proposed method significantly outperformed all baselines in both subjective and objective metrics.
Key findings include:
- Naturalness (NMOS): The proposed method achieved a score of 3.922, compared to 3.624 for random selection.
- Speaker Similarity (SMOS): Scored 3.778, a substantial improvement over the 3.314 baseline.
- Objective Metrics: The system showed lower Mel-cepstral distortion (MCD) and superior F0 (pitch) alignment, indicating that the retrieved prompts provided a more accurate stylistic template for the TTS engine.
Conclusion
By replacing random prompt selection with a context-aware retrieval mechanism, this research significantly enhances the stylistic consistency and naturalness of prompt-based TTS. The CA-CLAP model effectively bridges the gap between narrative context and acoustic style. Future work will focus on extending this framework to other languages and exploring deeper integration of the retrieval process into the initial training of TTS models.
Summary updated