HybridVC: Efficient Voice Style Conversion with Text and Audio Prompts
Xinlei Niu Jing Zhang Charles Patrick Martin



    Noise Variance Optimization in Differential Privacy: 

    A Game-Theoretic Approach Through Per-Instance Differential Privacy

    Sehyun Ryu*,
        Jonggyu Jang*, Member, IEEE,
        Hyun Jong Yang, Member, IEEE
        
    
    S. Ryu, J. Jang, and H. J. Yang are with the Department of Electrical Engineering at Pohang University of Science and Technology (POSTECH) (Email: {sh.ryu, jgjang, hyunyang}@postech.ac.kr).
    The corresponding author is Hyun Jong Yang.
    
    (^*): These authors are equally contributed.

    April 29, 2024
=================================================================================================================================================================================================================================================================================================================================================================================================================






We introduce HybridVC, a voice conversion (VC) framework built upon a pre-trained conditional variational autoencoder (CVAE) that combines the strengths of a latent model with contrastive learning. HybridVC supports text and audio prompts, enabling more flexible voice style conversion. HybridVC models a latent distribution conditioned on speaker embeddings acquired by a pretrained speaker encoder and optimises style text embeddings to align with the speaker style information through contrastive learning in parallel. Therefore, HybridVC can be efficiently trained under limited computational resources. Our experiments demonstrate HybridVC's superior training efficiency and its capability for advanced multi-modal voice style conversion. This underscores its potential for widespread applications such as user-defined personalised voice in various social media platforms. A comprehensive ablation study further validates the effectiveness of our method.
























§ INTRODUCTION




Voice conversion (VC) entails the process of modifying the vocal characteristics of a source speech to align with those of a target speaker. The key objective of VC is to alter the vocal identity, such as accent, tone, and timbre, to resemble the target speaker's voice style, while meticulously retaining the linguistic content of the source speech <cit.>. 





Traditional VC techniques rely on parallel training data <cit.>,

which constrains their applicability for adapting to the voice styles of unseen speakers. 
To diversify the utilization of VC models, recent works focus on non-parallel any-to-any (A2A) VC models, so-called one-shot VC, that convert any speech to any voice style according to a few seconds of the target voice <cit.>. 
The key idea of A2A VC is learning disentangled feature representations of content and speaker style identity.

To disentangle content and speaker information, existing works focus on methods including instance normalization <cit.>,
vector quantization <cit.>, transfer learning from ASR and TTS models  <cit.>, and adversarial training <cit.>.






With the development of large language models (LLMs), leveraging natural language prompts for generating images <cit.>, sound <cit.>, and speech <cit.> has gained popularity. A notable development in VC is the introduction of voice style transfer using text prompts, as proposed by <cit.>. Building on this concept, <cit.> introduced Text-guidedVC,

diverging from traditional VC techniques using natural language instructions, rather than an audio reference, to guide the VC process. This shift enhances the framework's flexibility and allows for a wider range of conversion styles by incorporating descriptors in natural language. Concurrently, PromptVC <cit.> proposed an A2A text prompt-based VC model, following VITS <cit.> structure, that employs a latent diffusion model (LDM) <cit.> to generate style vectors by text prompts.



We observe two limitations in Text-guidedVC <cit.>. Firstly, it relies on parallel training data, where effectiveness is heavily dependent on the size and quality of the dataset. This requirement can pose challenges, as accumulating extensive parallel data is often resource-intensive. Secondly, unlike conventional VC models that use audio reference, <cit.> may struggle with achieving precise voice conversions. In practical scenarios, text descriptions may fall short in accurately capturing and conveying specific voice styles, a gap that is readily bridged when using actual target voice samples. This limitation is crucial, as it affects the framework's ability to replicate exact voice styles based solely on text guidance. Therefore, an A2A VC model with hybrid prompts can be developed to combine the strengths of flexibility of text guidance and precision of voice guidance.



VC models <cit.> based on VITS <cit.> framework may suffer from slow training due to decoding raw waveforms directly.

A straightforward solution is to avoid the decoding step during training but maintain its advantages on performance.


PromptVC <cit.> trains an LDM jointly with a VITS framework to learn textual information. Although <cit.> doesn't provide experimental setup details, jointly training an LDM and a CVAE with adversarial training requires a large volume of training data, powerful computational resources, and long training time that potentially limits its extension on practical applications. 
In image editing tasks, Imagic <cit.> proposes text embedding optimisation,



which focuses on optimising text embeddings under pre-trained language models. This method offers a more flexible solution that avoids retraining the entire model, thereby providing an easier and more efficient way to extend the model through few-shot learning.





























In this work, we introduce HybridVC, an efficient A2A VC model that supports text prompts and audio prompts of target style voice to achieve better flexibility. 
HybridVC is a latent model with contrastive learning, 
which models the latent distribution conditioned on speaker style information and optimises the alignment of corresponding text embedding in parallel. 
Our experiments prove HybridVC achieves significant training efficiency under limited computational resources and achieves a flexible VC system that supports hybrid prompts. HybridVC supports small-scale training which can be easily adapted to applications such as user-defined personalised voice.
























§ METHODOLOGY





 §.§ HybridVC

HybridVC, shown in Figure <ref>, is a conditional latent model that relies on a pre-trained CVAE backbone. 
We denote a text-speech pair (y,t), where y is an utterance and t is the corresponding style text description. 
Similarly to LDM <cit.>, the first stage of HybridVC obtains a compact latent representation z from the pre-trained CVAE conditioned on speaker style information s by a pre-trained speaker encoder, as z ∼ q(z|x_lin,s).


HybridVC models the distribution p_θ(z|y,s) conditioned on speaker embedding s and raw waveform y. Following <cit.>, the architecture of HybridVC is straightforward, using a pre-trained WavLM <cit.> and a bottleneck extractor to disentangle text-free content information c from waveform y, a pre-trained speaker encoder to obtain speaker style information s, and a normalizing flow conditioned on s to transform the distribution to a more complex distribution. This method enables HybridVC to encapsulate the content c and speaker style information s within a compact latent space, facilitating efficient manipulation and generation of speech.

To enable HybridVC to support audio and text prompts, the model incorporates a text encoder to optimise a text embedding g through contrastive learning, as detailed in Section <ref>. The contrastive learning fine-tunes the text encoder, thereby, refining text embedding g to be well-aligned with speaker style embedding s obtained by the pre-trained speaker encoder.


CVAE backbone
The CVAE backbone compresses the input waveform y into a latent variable z conditioned on a speaker-style embedding s. In our experiments, we use the posterior encoder and decoder of a pre-trained FreeVC <cit.> as the CVAE backbone which is augmented with GAN training.

Speaker Encoder
The speaker encoder extracts the vocal identity (i.e., speaker style embedding s) from y. We follow FreeVC <cit.> that adopt a pre-trained verification model <cit.> as speaker encoder. The model is trained on a large amount of speakers. The speaker encoder embeds Mel-spectrogram of waveform y into a speaker style embedding s, as s∈ℝ^256. 

Text Encoder

The text encoder extracts stylistic features from text prompt t. We fine-tune a pre-trained text encoder to refine the text embeddings g, ensuring they are closely aligned with the corresponding speaker style information s. The text encoder contains a RoBERTa <cit.> model from a pre-trained CLAP <cit.> that encodes a text prompt t into an embedding g∈ℝ^512, and a linear layer further compress g to a lower feature dimension g ∈ℝ^256 to discard irrelevant textual information.







 §.§ PromptSpeech + Text Embedding Optimisation


We use the PromptSpeech dataset <cit.>, which pairs over 26,000 real speech samples from LibriTTS <cit.> with free-text style prompts involving categories of gender, pitch, energy, and speed. 
However, text style prompts in PromptSpeech do not guarantee comprehensive coverage of information across these four categories. 
For instance, a prompt like “he said loudly” specifies gender and energy but not pitch or speed. 
This inconsistency presents a challenge to ensure comprehensive representations of all stylistic attributes, particularly when attempting to precisely map these free-form textual prompts to a predefined set of labels for speaker embedding s.

To address this, we augment the data with N negative samples on text embeddings g extracted by the text encoder. Inspired by <cit.>, we propose a negative sampling method for text embeddings g that randomly shuffle g into N negative samples G' = {g^1,...,g^N} as in Figure <ref>. Given the ground truth text embedding g, we construct G' by dividing g into K randomly ordered chunks. 
As illustrated in Figure <ref>,

HybridVC fine-tunes the text encoder through contrastive learning to optimise text embedding.





















 §.§ Training

As in Figure <ref>(a), the loss function of HybridVC contains two parts: a KL-divergence between the latent distributions of HybridVC and CVAE, and a contrastive loss between text embedding with negative samples {g, G'} and speaker embedding s.
Following <cit.>, the KL loss ℒ_kl between a Gaussian and normalising flow optimises the latent distribution of HybridVC,




    ℒ_kl    = logq(z|x_lin,s)-logp_θ(z|y,s)

where f is the normalising flow, x_lin is the linear spectrogram, 

    p_θ(z|y,s)     =N(f_θ(z,s);μ_θ,σ_θ)|∂ f_θ(z,s)/∂ z| 
    
        q(z|x_lin,s)     = N(z;μ_q,σ_q)

The contrastive loss ℒ_contrastive is used to optimise the text encoder aligning the text embedding g with the speaker embedding s. Given a set of negative sample G' = {g^1, ..., g^N}, the contrastive loss is defined as

    ℒ_contrastive =logexp(cos(g,s)/τ)/∑_g_i ∈{g,G'} exp(cos(g_i,s)/τ)

where τ is a learnable temperature parameter.

The overall loss function ℒ in HybridVC is defined as 

    ℒ =  (1-α)ℒ_kl + αℒ_contrastive

where α is a weight-scaling hyper-parameter parameter.




















 §.§ Inference


As in Figure <ref>(b), given a source speech y_src, and a prompt embedding g_tgt obtained from either the speaker encoder or the text encoder, the inference phase of HybridVC is

    ŷ_src → tgt = Decoder(z, g_tgt)

where z ∼ p_θ(z|y_src,g_tgt).











§ EXPERIMENTS AND RESULTS


Datasets
We conduct experiments on VCTK <cit.> and PromptSpeech <cit.> datasets. PromptSpeech includes over 26000 real utterances from LibriTTS <cit.> with corresponding text style prompts, it is used for training HybridVC only. For VCTK, we follow the train/test separation as in <cit.> which involves 107 speakers in total, 314 utterances for validation, 1070 utterances for testing and the rest for training[<https://github.com/OlaWod/FreeVC>]. VCTK is used to train HybridVC for a model comparison experiment. The VCTK testing set is used to verify models' performance as source speeches.


Experimental setups
All the audio samples are downsampled to 16kHz. The short-term Fourier transform (STFT) with a 1280 window size and 25% overlapping is performed to extract linear and 80-bin Mel-spectrograms. 
Following <cit.>, we use SR-based data augmentation during training, where the resize ratio r ranges from 0.85 to 1.15. 
A HiFi-GAN v1 vocoder <cit.> is used for the data augmentation. 
The negative sample size N is 10 and the number of shuffle chunks K is 8. 
We use the posterior encoder and decoder of a FreeVC <cit.> trained on the VCTK training set as the CVAE backbone.
All experiments were performed on 2 Nvidia RTX3090 GPUs. 
The model is trained with up to 80k training steps, where the batch size is 256 and initial learning rate is 2e-4.
The RoBERTa model is initialized by weights from a CLAP checkpoint [<https://github.com/LAION-AI/CLAP>].




Models for comparison
Since HybridVC is proposed to improve the flexibility and training efficiency compared to the VITS-like VC models, we select the following models for comparison[Since the closest methods mentioned previously, Text-guidedVC <cit.> and PromptVC <cit.>, do not release their implementation code and training datasets, we cannot use them for direct comparison.]:
1) FreeVC <cit.>, an official checkpoint trained with SR data argumentation and a pre-trained speaker encoder on the VCTK training set, 2) FreeVC⋆: a retrained 900k steps FreeVC with SR data argumentation and a pre-trained speaker encoder on the VCTK training set under the official training configuration[1], 3) YourTTS-VC <cit.>[<https://github.com/Edresson/YourTTS>], officially released checkpoint on VCTK trained with pre-trained speaker encoder. 

Two versions of the proposed models are tested:
1) HybridVC♢, the proposed model trained with KL loss ℒ_kl, and 2) HybridVC, the proposed model trained with the total loss ℒ.


Evaluation metrics
We use nine objective evaluation metrics to verify the proposed method in diverse aspects including voice similarity, content error rates, speech naturalness, audio quality, and style prompt consistency. 
We calculate word error rate (WER) and character error rate (CER) between source and converted voice by an ASR model [<https://huggingface.co/facebook/hubert-large-ls960-ft>]. We verify the voice similarity by Pearson correlation coefficient of fundamental frequency (F_0-PCC) between source and converted voice, structural similarity index measure (SSIM) between target and converted voice. F_0-PCC measures the similarity of pitch contours between converted voices and source voices. We then make use of speech quality and naturalness assessment (NISQA) <cit.>, Fréchet audio distance (FAD) <cit.> and Fréchet distance (FD) <cit.> to verify the naturalness of converted voice and audio quality. The NISQA is a deep learning framework to predict speech quality and naturalness <cit.>, and FAD/FD measures audio quality. We calculate the cosine similarity (COS) between text embeddings extracted by the text encoder and audio embeddings of converted speeches extracted by the speaker encoder to verify the voice style consistency. Referring to <cit.>, we calculate the classification accuracy between converted voice and source voice given single-factor text prompts. Sample audios demonstration of HybridVC are provided in supplement.







 §.§ Speech Intelligibility, Naturalness and Audio Quality


Following experimental design in <cit.>, we randomly select 9 unseen speakers as target voices and the test set of VCKT as source speeches. 
We aim to verify whether HybridVC improves training efficiency and maintains similar performance on audio prompt voice style conversion compared to baseline models, which only support audio prompt voice conversion.
We train HybridVC♢ and FreeVC⋆ on the VCTK training set under the same configuration. 
Table <ref> shows that HybridVC can achieve competitive performance on speech intelligibility, naturalness, and audio quality with only 15 hours of training on limited computational resources.
Extending the experiment to include training on the PromptSpeech dataset, HybridVC maintains overall performance without noticeable degradation, despite the backbone CVAE only being pre-trained on the VCTK training set. This underscores the robustness of HybridVC and highlights its capability to adapt to new datasets with minimal training resources and time, further explaining the advantage of HybridVC on extensions of practical application.







 §.§ Consistency Test


We then conduct a consistency test between converted voice and style prompts for both audio and text prompts. We randomly select 9 unseen speakers as audio prompts and the VCTK testing set as source speeches to test consistency between converted voices and style audio prompts. 
To test the text-style voice conversion consistency, we randomly selected 10 speakers (5 female and 5 male) including 5 utterances for each speaker as source speech and 5 style text prompts from the PromptSpeech.
As in Table <ref>, HybridVC effectively maintains the prosody of source speech and audio quality but accurately converts the voice characteristics given audio and text prompts. Text prompts typically offer less information compared to audio prompts, resulting in a slight drop in F_0-PCC and FAD values.
The COS between converted voice and text prompt, and SSIM between converted voice and audio prompt indicate the style of the converted voice is consistent with the provided prompts.







We then explore the congruence between source and converted voices using single-factor text prompts. 
Figure <ref> provides an example of a visualization comparison of a converted voice by a single-factor text prompt.
In Table <ref>, we calculate the accuracy percentage between the absolute average value of the converted voices and the source voices according to the text prompts. For instance, we count the number of converted voices with higher pitch under the “higher pitch” text prompt by comparing the average pitch value between converted voices and source voices.
Despite these prompts containing only single style factors, HybridVC successfully adapts voices to match the specified style text prompts. 
However, we observe that HybridVC demonstrates less sensitivity to text prompts that include words such as “lower”, leading to a future improvement.












 §.§ Ablation Study


Latent model 
We conduct an ablation study to verify whether the proposed latent model improves training efficiency while maintaining a similar performance as the baseline <cit.>. 
As shown in Table <ref>, HybridVC♢ has great training efficiency, achieving competitive performance in only 15 hours of training. Adding the negative sampling method to HybridVC increases the training time while maintaining HybridVC's performance. This presents a reasonable trade-off between reducing training efficiency and enabling support for flexible hybrid prompts.

Negative sampling method To verify the proposed negative sampling method, we train the HybridVC augmented with: 1) construct negative samples within a training batch as in <cit.>; 2) classify text embeddings into 54 labels across four categories in PromptSpeech. Figure <ref> shows the cosine similarity between text embedding and speaker embedding before and after optimisation with different negative samples. Only HybridVC trained with the proposed negative sampling method effectively refines text embeddings well-aligned to speaker embeddings.





Hyper-parameter α
We conduct convergence analysis against α values. Figure <ref> shows that the loss convergence is not sensitive to α values although smaller α values (greater weighting on ℒ_kl) lead to slightly faster convergence.














































§ CONCLUSION


We propose HybridVC, a flexible VC model supporting audio and text prompts that can be efficiently trained under limited computational resources. 
HybridVC is a latent model that 

models the latent distribution of a pre-trained CVAE backbone conditioned on speaker embeddings, and refines the text embedding to better align with information of speaker style in parallel. 
Our experiments show that HybridVC can achieve great training efficiency while maintaining robustness, flexibility, and performance compared to baseline models. 
Our model could be extended easily to applications, such as personalised voice on social media.
However, as the first VC model supporting hybrid text/audio prompts, one limitation is that the optimised text embedding appears to be less sensitive to text prompts including words such as “lower”. 
Future work could improve text-speaker embedding alignments by techniques such as prompt tuning.
IEEEtran


