Multi-target Voice Conversion without Parallel Data by Adversarially Learning Disentangled Audio Representations
Ju-chieh Chou, Cheng-chieh Yeh, Hung-yi Lee, Lin-shan Lee
Introduction
Speech signals inherently carry both linguistic and acoustic information. Voice conversion (VC) aims to convert the speech signals from a certain acoustic domain to another while keeping the linguistic content unchanged. Examples of acoustic domains may include speaker identity , speaking style, accent, emotion or some other properties orthogonal to the linguistic content. Voice conversion (VC) can be used for various tasks such as speech enhancement , language learning for non-native speakers , to name a few . This work focuses on the conversion of speaker identity.
In general, among the difficult problems for VC approaches, the need of aligned data , and over-smoothing of signals are two examples carefully studied. Due to the difficulties in obtaining aligned corpora, approaches utilizing generative models such as Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs) were studied because they can be trained with non-parallel data. With VAEs, the encoder learns the speaker-independent linguistic content, which can then be used by the decoder to generate the voice with a specified speaker id . Cycle-consistent adversarial network (Cycle-GAN) was also used to learn the mapping from the source speaker to the target speaker in an unsupervised way .
Some prior works successfully used VAEs for VC, but generated the voice frame-by-frame . Some other prior works were able to disentangle the linguistic content from the speaker characteristics when learning the representations, but based on some heuristic assumptions . Cycle-GAN was used for VC without parallel data, but an individual model is needed for each target speaker . In this paper, we propose an autoencoder architecture which is able to deal with several frames at a time, leading to better results because in this way information carried by neighboring frames can be considered. This approach also uses jointly trained speaker classifier to remove the need for heuristic assumptions made previously. This approach is able to train a single model to convert the voice to many different speakers, all without parallel data, by separating the speaker characteristics from the linguistic content. This is similar to some degree to some works in computer vision which learned disentangled representation , or shared generator with conditional input .
The proposed approach includes two stages of training as in Fig. 1 The in Fig. 1 indicates element-wise addition.. In stage 1, we train an autoencoder. The encoder encodes the input spectra into a latent representation for the linguistic content but without speaker characteristics based on the adversarial training concept. This is achieved by training a classifier to classify the speaker based on the latent representation, while the encoder is trained adversarially to fool the classifier. On the other hand, the decoder merges the speaker identity with the latent representation to reconstruct the original spectra.
In stage 2, we train another generator to generate the residual signal (or fine structure) of the decoder output. The decoder output is patched with the residual signal to be the final output. The generator is in turn learned with a discriminator which outputs a scalar to indicate whether the input signal is realistic. The discriminator is further trained with an auxiliary classifier, predicting the speaker for the input signal. This helps the generator to produce signals carrying more characteristics of the target speaker.
Proposed approach
Let be an acoustic feature sequence where is the collection of all such sequences, and be a speaker where is the group of all speakers who produce the sequence collection . The training set contains m pairs of , where the sequence is produced by speaker . During training, is a fixed-length segment randomly sampled from . During testing, can have variable length because the model here is built with recurrent-based components. The whole framework includes two stages of training as shown in Fig. 1 and explained below.
This stage is to learn an autoencoder plus classifier-1.
The encoder (Block(A)) is trained to map an input sequence to a latent representation . The decoder (Block(B)) is trained to generate which is a reconstruction of from given the speaker identity .
The Mean Absolute Error (MAE) is minimized in training the autoencoder because this generates sharper output than mean square error . So the reconstruction loss is given as in (2)
where and are the parameters of the encoder and decoder respectively. This autoencoder alone can achieve VC as below. Given an utterance produced by a source speaker , the decoder can generate the voice of a target speaker using the linguistic content of ,
During training, the decoder input is and , but during voice conversion, we replace with the target speaker . is the output of stage 1, which has the linguistic content of , but the identity of .
Classifier-1: The autoencoder itself learned with (2) cannot make the latent representation speaker-independent. The speaker characteristics of the original speaker existing in inevitably degrades the performance of VC. This is why we train classifier-1 (Block(C)) in addition to regularize the autoencoder to make speaker-independent. For each training pair , the classifier takes as input and outputs the probability , which is the probability that is produced by speaker . The classifier-1 is trained to minimize the negative log-probability to differentiate the different speakers, as in (4),
On the other hand, however, the encoder is trained to maximize (4) in order to remove the speaker identity in . So the full objective for the autoencoder regularized by clasifier-1 is
which integrates (2) and (4) and is a hyper-parameter. The autoencoder and the classifier are trained alternatively.
2 Stage 2: GAN
If we simply perform VC with stage 1 as mentioned above, even with the help of classifier-1, the reconstruction loss tends to generate blurry spectra and artifact. This is why in stage 2, we train another pair of generator and discriminator to guide the output spectra to be more realistic .
Based on the concept of decoupled learning , which stabilize GAN training by decoupling decoder and generator, we separately train another generator (Block(D)) taking and the speaker identity , which is a uniformly sampled speaker out of all speakers in , as the input and generate the residual (or fine structure of the signal) of the output of the decoder (Block(B)). The parameters of the encoder (Block(A)) and the decoder (Block(B)) are fixed in this training stage, which stabilizes the training procedure.
As shown in Fig. 1, the generator here is trained with the help of a ”discriminator plus classifier-2” (Block(E)), and the final output during VC test for a selected target speaker is the addition of the output of the decoder (Block(B)) and the generator (Block(D)), or in Fig. 1,
In (6), is the input speech, the encoder output, the selected target speaker, is the converted voice obtained in the stage 1, the output of the generator, and is the VC result for stage 2.
The generator is learned with a discriminator (in Block(E)) in an adversarial network. This discriminator is trained to distinguish whether an input acoustic feature sequence, , is real or generated by machine. The output of the discriminator is a scalar indicating how real is, the larger , the more possible is real. This adversarial network is trained with the loss in (7), where and are the parameters for the generator and the discriminator.
The discriminator gives larger values to real speech from the dataset in the first term on the right of (7), while assigns lower score to the converted speech in the second term, where is a speaker sampled uniformly from . So the discriminator is trained to distinguish real voice and the generated data by maximizing in (7), while on the other hand the generator is trained to fool the discriminator by minimizing in (7).
In addition, the ”discriminator plus classifier-2” also includes a classifier-2 which learns to predict the speaker for the speech by generating a distribution of speakers based on the training data . This classifier-2 is trained by minimizing the loss in (8),
This classifier-2 and the discriminator share all layers except with separated last layer. On the other hand, the generator should learn to generate the voice for a uniformly sampled speaker which can be predicted as the voice of by the classifier-2, which implies preserves more speaker characteristics of . So the generator should be trained to minimize the loss in (9),
Here (8) and (9) are exactly the same, except (8) is for real data and correct speakers in the data set, while (9) for generated voice and sampled target speakers.
So the complete loss function in stage 2 is given as (10) and (11) respectively for the generator and the discriminator , trained alternatively, where the first terms on the right of (10) (11) are in (7), and the second terms of (10) (11) are in (8) (9).
Implementation
We adopted the model architecture from CBHG module . The detailed network architecture is listed in Table 1. We did not use fully-connected layer across time-steps in order to deal with variable-length input. The convolution-bank aimed to capture local information about the acoustic features. We used the pixel shuffle layer to generate higher resolution spectra . indicates the speaker embedding in the l-th layer since the network may need different information in each layer. We plugged the embedding by adding it on the feature map. We used 1d convolution for every network except for the discriminator, which was built with 2d convolution to better capture the texture.
Dropout: We provided the required noise in training with dropout in encoder as suggested . We found it useful to add dropout in the classifier to improve the robustness of the model. We use 0.5 dropout rate in the encoder, and 0.3 in the classifier.
WGAN-GP: GAN is notoriously hard to train. So we applied a different objective function, Wasserstein GAN with gradient penalty (WGAN-GP), to stabilize the training process of GAN .
Hyper-parameters: In training stage 1, if we add the classification loss in (5) at the beginning of the training process, the autoencoder will have problems to reconstruct the spectra well. So we linearly increase the hyper-parameter from 0 to 0.01 in the first 50000 mini-batches to make sure the latent representation became speaker-independent gradually. Source code: https://github.com/jjery2243542/voice_conversion
Experiments
We evaluated our VC model on CSTR VCTK Corpus . The audio data were produced by 109 speakers in English with different accents, such as English, American, and India. Each speaker uttered different sets of sentences. We selected a subset of 20 speakers, 10 females and 10 males, as mentioned above. The dataset was randomly split to training and testing sets by the percentage 90% and 10%.
We used log-magnitude spectrogram as the acoustic features. The detailed spectral analysis and synthesis setting was the same as the previous work . The detailed setting is in Table 2.
Training details: We trained the network using Adam optimizer with learning rate , . Batch size was 32. We randomly sampled 128 frames of spectrogram with overlap. We trained classifier/discriminator for 5 iterations and 1 iteration for encoder/generator.
We first pretrained the encoder and decoder with in (2) for mini-batches, then pretrained the classifier-1 in with in (4) for mini-batches. Stage 1 was trained for mini-batches, and stage 2 another mini-batches.
Diversified distribution over all frequencies is a highly desired property of speech signals, and the over-smoothed spectra generated by many conventional approaches has been a major problem of voice conversion . This property can be observed by calculating the Global Variance (GV) over the spectrum. Higher global variance indicates sharpness of the converted speech. We evaluated the global variance for each of the frequency index for 4 conversion examples: male to male, male to female, female to male, and female to female. The results are in Fig. 3. In each example 3 curves for 3 cases are plotted: (a) autoencoder of stage 1 alone without classifier-1, (b) complete stage 1 with classifier-1 and (c) proposed approach with stage 1 and stage 2. We can see in all cases the proposed approach (curves (c)) offered the best sharpness. Averages over all frequencies for those curves in Fig. 3 are listed in Table 3, from which it is clear the proposed approach (row(c)) offered the highest global variance. A set of example spectrogram is in Fig. 2 for the original voice (a) and converted (b) (c) (d), where the sharpness offered by the proposed approach can be observed.
2 Subjective evaluation
We also performed subjective human evaluation for the converted voice. 20 subjects were given pairs of converted voice in random order and asked which one they preferred in terms of two measures: the naturalness and the similarity in speaker characteristics to a referenced target utterance produced by the target speaker. Average of examples including intra-gender and inter-gender conversion are shown in Fig. 4. The ablation experiment on the left of Fig. 4 compared two method: the proposed approach including stages 1 and 2, and complete stage 1 with classfier-1 but not stage 2. We can see stage 2 has significantly improved the voice quality in terms of both naturalness and similarity in speaker characteristics. Here we also compared the proposed approach with a re-implementation of Cycle-GAN-VC , a previous work comparable to methods utilizing parallel data. The result is on the right of Fig. 4. As the result shows, the proposed approach is comparable in terms of the naturalness and the similarity in speaker characteristics, while considering to multi-speakers without parallel data. Demo webpage: https://jjery2243542.github.io/voice_conversion_demo/
3 Degree of disentanglement
To evaluate the degree of disentanglement of our model with respect to speaker characteristics, we trained another speaker verification network that takes the latent representation as input to predict the speaker identity . The speaker verification network has the same architecture as the classifier-1 in stage 1. The verification accuracy was 0.916 without the classifier-1, but dropped significantly to 0.451 when classifier-1 was added. This verified that the classifier-1 successfully disentangled the speaker characteristics from the latent representation.
Conclusion
We proposed an approach for voice conversion by extracting the speaker-independent representation. No parallel data are needed and conversion to multiple target speakers can be achieved by a single model. We show that adding a residual signal can improve significantly the quality of converted speech. Objective evaluation metrics of global variance show that sharp voice spectra can be produced with this approach. This is also verified with subjective human evaluation.