Method and device for improving speech synthesis naturalness based on transferable monotone aligner
Patent Information
- Application Number
- CN202410950888.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-15
Smart Images

Figure CN118782014A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text-to-speech synthesis, and in particular to a method and a device for improving the naturalness of speech synthesis based on a transferable monotone aligner. Background Art
[0002] In order to solve the problem of word swallowing and missing in speech synthesizers, current text-to-speech synthesis technology often introduces the duration information of each character in the current audio to alleviate or even solve the problem of word swallowing and missing in speech synthesis. There are currently two mainstream methods: external alignment and internal alignment. External alignment refers to the introduction of an external speech endpoint detection model to provide the duration information of each character in the current audio. In addition, in order to be able to reason smoothly, a model that can provide the duration information of each character based on character information will be trained based on the external speech endpoint detection model. Internal alignment is a method based on monotone alignment search (MAS) to find the alignment between input (text) and output (such as speech). The basic idea is to assume that the alignment relationship between input and output is monotonic, which is true for text-to-speech conversion. The way it works is to find the best alignment through a monotonic attention mechanism. It assigns an attention score to each element in the input sequence, which indicates where the element corresponds to in the output sequence. Then, it generates the output sequence based on these scores.
[0003] Among them, external alignment: introduces an external speech endpoint detection model. In the training stage, because there is original audio, relatively accurate character duration information can be obtained, so the evaluation results of training are always good. However, in the inference stage, because there is no longer audio information, it is necessary to train a model based on text information based on the labels provided by the external speech endpoint detection model to output the duration information of each character. Therefore, this method has high error sensitivity and is too dependent on external high-quality endpoint detection models. If the performance of the endpoint detection model is poor, it will lead to inaccurate prediction of character duration. In addition, due to the high inconsistency of information used in the training stage and the inference stage, during inference, due to improper alignment information, there is a certain probability that the speech synthesis model will swallow or miss words. Although the shortcomings are obvious, this method generally generates more diverse alignment information, which can improve the naturalness of the synthesized audio of the speech synthesis model to a certain extent.
[0004] Internal alignment: Based on the monotone alignment search algorithm MAS, during the training phase, the most likely alignment result A* is obtained based on the current prior statistics (the output of the prior encoder) using a dynamic programming algorithm (usually Viterbi). This alignment result can be regarded as a monotone attention mechanism, which provides the model with alignment information of text and speech. Back propagation is used to update the model parameters to maximize the likelihood, for example . On the other hand, the duration label can be extracted from the alignment result A*, and a duration prediction model can be trained internally during the training phase for use in the inference phase. This method basically solves the problem of word swallowing and word omission in the model, and has strong constraints on the model. However, it is easy to overfit in the training data, that is, the covariate shift between the training and inference data, resulting in poor alignment, reducing the naturalness of speech synthesis, and the mechanical feeling may be heavier than external alignment. In addition, for the same text, the diversity of the generated alignment information is low, and the voice intonation is relatively simple.
[0005] In view of this, this application is filed. Summary of the invention
[0006] The present invention provides a method and device for improving the naturalness of speech synthesis based on a transferable monotone aligner, which can at least partially improve the above-mentioned problem.
[0007] To achieve the above object, the present invention adopts the following technical solutions: A method for improving the naturalness of speech synthesis based on a transferable monotone aligner, comprising: Obtaining the phonemes Text and Mel spectrum of the text to be processed, and preprocessing the text Text to be processed using a text encoder to generate a representation result text_encode; The characterization result text_encode is input into the duration prediction module of the pre-trained speech synthesis model for synthesis processing, and the duration information of each phoneme is output. The duration information and the characterization result text_encode are preprocessed to generate normal synthesized audio, wherein the speech synthesis model needs to be trained twice. The first is a 50%-50% training strategy for selecting s2s_attn or s2s_attn_mono, so that the model can make the same sound as the training sample audio based on the alignment result of aligner A. The second is iterative audio replacement training, so that the audio synthesized by the model based on the prediction information of the duration prediction module is basically consistent with the audio synthesized based on the prediction information of aligner A.
[0008] The present invention also provides a device for improving the naturalness of speech synthesis based on a transferable monotone aligner, which comprises: A text encoder unit, used to obtain the phonemes Text and Mel spectrum of the text to be processed, and use the text encoder to preprocess the text Text to be processed to generate a representation result text_encode; A speech synthesis unit is used to input the characterization result text_encode into the duration prediction module of the pre-trained speech synthesis model, perform synthesis processing, output the duration information of each phoneme, pre-process the duration information and the characterization result text_encode, and generate normal synthesized audio, wherein the speech synthesis model needs to be trained twice, the first time is to select s2s_attn or s2s_attn_mono for a 50%-50% training strategy, so that the model can make the same sound as the training sample audio based on the alignment result of the aligner A, and the second time is iterative audio replacement training, so that the model can synthesize audio based on the prediction information of the duration prediction module and the audio synthesized based on the prediction information of the aligner A is basically consistent. The synthesis unit is used to combine the alignment result and the duration prediction information to generate synthesized speech.
[0009] In summary, the method for improving the naturalness of speech synthesis based on a transferable monotonic aligner proposes a method based on a transferable monotonic aligner, which combines the advantages of different methods of external alignment and internal alignment to further improve the naturalness of text-to-speech synthesis audio, and solve the problems of swallowing and missing words in external alignment and the problem of low naturalness of speech in internal alignment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a flow chart of a method for improving the naturalness of speech synthesis based on a transferable monotone aligner provided in a first embodiment of the present invention; Figure 2 It is a first-stage training flow chart of a method for improving the naturalness of speech synthesis based on a transferable monotone aligner provided by a first embodiment of the present invention; Figure 3 It is a second-stage training flow chart of the method for improving the naturalness of speech synthesis based on a transferable monotone aligner provided in the first embodiment of the present invention; Figure 4 It is a model architecture diagram of a pre-trained aligner A of a method for improving the naturalness of speech synthesis based on a transferable monotonic aligner provided in the first embodiment of the present invention; Figure 5 It is a module diagram of an apparatus for improving the naturalness of speech synthesis based on a transferable monotonic aligner provided in the second embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0012] refer to Figure 1As shown, the first embodiment of the present invention discloses a method for improving the naturalness of speech synthesis based on a transferable monotone aligner, which can be performed by a device for improving the naturalness of speech synthesis based on a transferable monotone aligner (hereinafter referred to as a naturalness device), and in particular, is performed by one or more processors in the naturalness device to implement the following method: S101, obtaining a text phoneme Text and a Mel spectrum to be processed, and using a text encoder to pre-process the text Text to be processed to generate a representation result text_encode; S102, input the characterization result text_encode into the duration prediction module of the pre-trained speech synthesis model, perform synthesis processing, output the duration information of each phoneme, pre-process the duration information and the characterization result text_encode, and generate normal synthesized audio, wherein the speech synthesis model needs to be trained twice, the first is to select s2s_attn or s2s_attn_mono for a 50%-50% training strategy, so that the model can make the same sound as the training sample audio based on the alignment result of aligner A, and the second is iterative audio replacement training, so that the model can synthesize audio based on the prediction information of the duration prediction module and the audio synthesized based on the prediction information of aligner A is basically consistent.
[0013] Preferably, before inputting the representation result text_encode into the duration prediction module of the pre-trained speech synthesis model, the method further includes: Based on the automatic speech recognition task ASR, an aligner A is trained as follows: Obtain training data and a monotone aligner A, and train the monotone aligner A on an automatic speech recognition ASR task; The monotone aligner A and the text-to-speech synthesis model are fine-tuned together to obtain a pre-trained monotone aligner A.
[0014] Preferably, the monotone aligner A is composed of an ASRS2S module, a convolution module, and a fully connected layer, and includes two loss functions, CTC loss and cross entropy loss; The loss formula for CTC loss is:
[0015] Among them, x is the input audio, z is the label corresponding to x, and S represents the set of training samples.
[0016] In this embodiment, it is necessary to first train an aligner A based on the existing data and the automatic speech recognition task ASR. The trained aligner A can generate an attention alignment matrix s2s_attn between the Mel spectrum and the text phonemes, and provide the Mel frames that the text should be aligned at each time step. Then, the aligner A will be added to the speech synthesis model, fine-tuned and trained together with the model, and provide alignment labels for the duration prediction module inside the model. While training the speech synthesis model, an internal aligner is trained so that the duration information of the text can be obtained during reasoning. Therefore, it is called a transferable monotonic aligner A, and is collectively referred to as aligner A below.
[0017] The network structure of aligner A is as follows Figure 4 As shown in the figure, its network architecture mainly consists of ASRS2S module, convolution module and fully connected layer, among which ASRS2S module consists of text embedding layer and decoding module. We hope that the model can optimize time alignment and character prediction at the same time, thereby improving the ability of ASR and obtaining a more accurate attention alignment matrix s2s_attn.
[0018] Therefore, there are two loss functions for the aligner A model, namely CTC (Connectionist Temporal Classification) loss and cross entropy loss. Minimizing the CTC loss allows the model to correctly align the time steps of the input audio sequence and the output sequence, because the CTC loss can handle the situation where the length of the input and output sequences do not match; minimizing the cross entropy loss allows the model to correctly predict the characters that should be output at each time step, because the cross entropy loss measures the gap between the probability distribution predicted by the model and the actual probability distribution. The calculation of CTC loss is relatively complicated. Its essence is to maximize the probability of the model generating the target output z under the condition of a given input x. Its loss formula can be summarized as:
[0019] Where x is the input audio, z is the label corresponding to x, that is, what is said in x, and S represents the set of training samples.
[0020] Preferably, before inputting the representation result text_encode into the duration prediction module of the pre-trained speech synthesis model, the method further includes: The trained monotone aligner A is added to the initial speech synthesis model and fine-tuned together with the initial speech synthesis model. The training includes two training stages, wherein the first training stage is specifically as follows: Assume that there is an input sequence and spectrum ; The sequence T and spectrum X are used as the input of the monotone aligner A to obtain the attention alignment matrix s2s_attn ; Use the monotone alignment search MAS algorithm to get another alignment matrix s2s_attn_mono ; Randomly select s2s_attn or s2s_attn_mono and text_encode with a probability of 50% Perform matrix multiplication to obtain the alignment result asr in the hidden space angle , where d represents the dimension of the hidden layer; At this time, the monotone aligner A includes two loss functions, and L1 loss .
[0021] Loss Function The calculation formula is:
[0022] Where n represents the length of the current phoneme sequence T, is the ith phoneme of T, is the i-th phoneme tag of the predicted sequence text_pred, X represents the input audio spectrum, represents expectation, CE represents cross entropy loss function; Loss Function The calculation formula is: .
[0023] The second training phase is as follows: Adding a duration prediction module, wherein the duration prediction module is used to generate duration information of the text; Set an iteration threshold , when the number of training iterations is less than the iteration threshold When , the true audio is replaced by the audio synthesized based on the s2s_attn_mono information; When the number of training iterations is greater than the iteration threshold When the duration prediction module outputs correct duration information, the model can synthesize audio substantially consistent with the output of the monotone aligner based on the output of the duration prediction module; Until the model converges and the training is completed, a trained speech synthesis model is obtained.
[0024] Among them, there are two losses in the duration prediction module, namely L1 loss and binary cross entropy loss, and the formulas are:
[0025] in, Obtained by adding the s2s_attn_mono time step dimension, d_gt = s2s_attn_mono.sum(axis=-1), is the output pred_attn of the duration prediction module, added in the time step dimension;
[0026] Among them, BCE represents the binary cross entropy loss function.
[0027] In this embodiment, once the aligner A is trained, it can be added as a module of the text-to-speech synthesis model to a training block of the model. The text-to-speech synthesis model needs to undergo two stages of training. The goal of the first stage of training is to enable the model to produce the same sound as the training sample audio based on the alignment results of the aligner A. At this stage, the aligner A also needs to update its parameters. The goal of the second stage of training is to enable the model to synthesize audio based on the prediction information of the duration prediction module that is basically consistent with the audio synthesized based on the prediction information of the aligner A. At this stage, the parameters of the aligner A are frozen.
[0028] The first stage of training process is as follows Figure 2 As shown, assuming there is an input sequence and spectrum ,in Represents phonemes, represents the number of Mel filters, Represents the number of audio Mel frames. T and X are used as the input of the aligner A to obtain the attention alignment matrix s2s_attn In order to combine the advantages of soft alignment and hard alignment, another alignment matrix s2s_attn_mono can be obtained by using the monotone alignment search MAS algorithm , with a probability of 50% to choose s2s_attn or s2s_attn_mono to text_encode (d represents the dimension of the hidden layer.) Perform matrix multiplication to obtain the alignment result asr in the hidden space angle Finally, it is sent to the speech synthesis module to synthesize speech. Here, according to different speech synthesis models, it is not necessary to perform matrix multiplication with the text encoding.
[0029] It should be noted that in the first stage of training, a 50%-50% training strategy was used to train the speech synthesis model, that is, at each step of the training, s2s_attn or s2s_attn_mono was randomly selected to provide alignment information. The motivation for adopting this strategy is that monotone alignment search is non-differentiable, and using the soft attention alignment matrix s2s_attn alone will cause the model to overfit the soft alignment and fail to synthesize speech normally in hard alignment, because the soft alignment is neither 0 nor 1, and the decoder needs to use the exact value of the alignment to generate speech. If s2s_attn_mono is used alone, it will degenerate into the same as other MAS-based internal alignment models. Because of the difference between the test set and the training set, the naturalness of the speech is reduced. Therefore, we adopt a 50%-50% training strategy to train the speech synthesis model.
[0030] At this stage, the optimization objectives of the aligner A, i.e., the loss function, are two: , which ensures that the correct attention alignment is continuously produced during the one-stage end-to-end training.
[0031]
[0032] Where n represents the length of the current phoneme sequence T, is the ith phoneme of T, is the i-th phoneme tag of the predicted sequence text_pred, X represents the input audio spectrum, represents the expectation, and CE represents the cross entropy loss function. If only , the resulting alignment information is not necessarily monotonic. Therefore, a simple L1 loss is used , to force the aligner A to output the soft attention alignment s2s_attn during training, which can be close to its non-differentiable monotonic version s2s_attn_mono
[0033] The loss of the speech synthesis model depends on the specific model, and generally includes Mel loss, etc.
[0034] After the text-to-speech synthesis model is trained in the first stage, the second stage training can be carried out, such as Figure 3 As shown in Figure 2. At this stage, a duration prediction module needs to be added. The function of this module is to obtain the duration information of the text during inference, so that the model can synthesize audio normally in the absence of aligner A.
[0035] The duration prediction module also has two losses, namely L1 loss and binary cross entropy loss, and their formulas are as follows:
[0036] in, It is obtained by adding the s2s_attn_mono time step dimension, that is, d_gt = s2s_attn_mono.sum(axis=-1), and It is the output pred_attn of the duration prediction module, added in the time step dimension.
[0037]
[0038] Among them, BCE represents the binary cross entropy loss function.
[0039] Because the text-to-speech synthesis model in the first stage is already able to reconstruct the audio based on s2s_attn_mono, a threshold number of iterations is set in the second stage of training. , when the number of training iterations is less than , the true audio is replaced by the audio synthesized based on the s2s_attn_mono information. This is done to allow the model to perfectly transfer the ability to reconstruct audio from the s2s_attn_mono information to the Information! After the second stage of training, in the actual inference stage, the text encoding result text_encode is input to the duration prediction module, which can output the duration information of each phoneme to synthesize audio normally.
[0040] Specifically, the goals of the second stage are: first, let the aligner A "teach" the duration module to output the correct duration information; second, the model can synthesize audio based on the output of the duration module that is basically consistent with the output of the aligner A. Therefore, in the second training stage, in addition to the normal speech synthesis loss (specifically determined by the respective speech synthesis module), the aligner A provides labels for the duration prediction module to learn. The specific learning method loss function is shown above. During training, a special training strategy was adopted, and a threshold x was set. When the number of training iterations is less than the iteration number threshold s2s attn mono 信息合成的音频替代,大于该阈值,采用样本的原音频继续训练,直到模型收敛,完成训练。
[0041] 综上,所述基于可迁移的单调对齐器提高语音合成自然度的方法采用可迁移的预训练对齐器A(包括模型架构和引入的两个优化目标)和50%-50%的训练策略,基于此训练的文本语音合成模型,在解决吞字、漏字的基础上,有效提高了语音自然度。
[0042] 请参阅 图5,本发明第二实施例公开了一种基于可迁移的单调对齐器提高语音合成自然度的装置,其包括: 文本编码器单元201,用于获取待处理的文本音素Text和梅尔频谱,并使用文本编码器对所述待处理的文本Text进行预处理,生成表征结果text_encode; 语音合成单元202,用于将所述表征结果text_encode输入至预训练好的语音合成模型的持续时间预测模块中,进行合成处理,输出每个音素的持续时间信息,将所述持续时间信息与表征结果text_encode进行预处理,生成正常合成音频,其中,所述语音合成模型需要进行两次训练,第一次是针对选择s2s_attn或者s2s_attn_mono进行50%-50%的训练策略,以使得模型能够基于对齐器A的对齐结果,发出跟训练样本音频一样的声音,第二次为迭代音频替换训练,以使得模型能够基于持续时间预测模块的预测信息合成的音频跟基于对齐器A的预测信息合成音频基本一致合成单元,用于结合所述对齐结果和所述持续时间预测信息,生成合成语音。
[0043] 以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。
Claims
1. A method for improving the naturalness of speech synthesis based on a transferable monotone aligner, characterized in that: include: Obtain the phoneme Text and Mel spectrum of the text to be processed, and use a text encoder to preprocess the text Text to be processed to generate a representation result text_encode; The characterization result text_encode is input into the duration prediction module of the pre-trained speech synthesis model for synthesis processing, and the duration information of each phoneme is output. The duration information and the characterization result text_encode are preprocessed to generate normal synthesized audio, wherein the speech synthesis model needs to be trained twice. The first is a 50%-50% training strategy for selecting s2s_attn or s2s_attn_mono, so that the model can make the same sound as the training sample audio based on the alignment result of aligner A. The second is iterative audio replacement training, so that the audio synthesized by the model based on the prediction information of the duration prediction module is basically consistent with the audio synthesized based on the prediction information of aligner A.
2. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 1, characterized in that: Before inputting the representation result text_encode into the duration prediction module of the pre-trained speech synthesis model, the method further includes: Based on the automatic speech recognition task ASR, an aligner A is trained as follows: Obtain training data and a monotone aligner A, and train the monotone aligner A on an automatic speech recognition ASR task; The monotone aligner A and the text-to-speech synthesis model are fine-tuned together to obtain a pre-trained monotone aligner A.
3. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 2, characterized in that: The monotone aligner A consists of an ASRS2S module, a convolution module, and a fully connected layer, and includes two loss functions, CTC loss and cross entropy loss; The loss formula for CTC loss is: Among them, x is the input audio, z is the label corresponding to x, and S represents the set of training samples.
4. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 2, characterized in that: Before inputting the representation result text_encode into the duration prediction module of the pre-trained speech synthesis model, the method further includes: The trained monotone aligner A is added to the initial speech synthesis model and fine-tuned together with the initial speech synthesis model. The training includes two training stages, wherein the first training stage is specifically as follows: Assume that there is an input sequence and spectrum ; in, Represents phonemes, represents the number of Mel filters, Indicates the number of audio mel frames; The sequence T and spectrum X are used as the input of the monotone aligner A to obtain the attention alignment matrix s2s_attn ; Use the monotone alignment search MAS algorithm to get another alignment matrix s2s_attn_mono ; Randomly select s2s_attn or s2s_attn_mono and text_encode with a probability of 50% Perform matrix multiplication to obtain the alignment result asr in the hidden space angle , where d represents the dimension of the hidden layer; At this time, the monotone aligner A includes two loss functions, and L1 loss .
5. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 4, characterized in that: Loss Function The calculation formula is: Where n represents the length of the current phoneme sequence T, is the ith phoneme of T, is the i-th phoneme tag of the predicted sequence text_pred, X represents the input audio spectrum, represents expectation, CE represents cross entropy loss function; Loss Function The calculation formula is: .
6. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 4, characterized in that: Before inputting the representation result text_encode into the duration prediction module of the pre-trained speech synthesis model, the method further includes: The second training phase is as follows: Adding a duration prediction module, wherein the duration prediction module is used to generate duration information of the text; Set an iteration threshold , when the number of training iterations is less than the iteration threshold When , the true audio is replaced by the audio synthesized based on the s2s_attn_mono information; When the number of training iterations is greater than the iteration threshold When the duration prediction module outputs correct duration information, the model can synthesize audio substantially consistent with the output of the monotone aligner based on the output of the duration prediction module; Until the model converges and the training is completed, a trained speech synthesis model is obtained.
7. The method for improving the naturalness of speech synthesis based on a transferable monotone aligner according to claim 6, characterized in that: There are two losses in the duration prediction module, namely L1 loss and binary cross entropy loss, and the formulas are: in, Obtained by adding the s2s_attn_mono time step dimension, d_gt = s2s_attn_mono.sum(axis=-1), is the output pred_attn of the duration prediction module, added in the time step dimension; Among them, BCE represents the binary cross entropy loss function.
8. A device for improving the naturalness of speech synthesis based on a transferable monotone aligner, characterized in that: include: A text encoder unit, used to obtain the phonemes Text and Mel spectrum of the text to be processed, and use the text encoder to preprocess the text Text to be processed to generate a representation result text_encode; A speech synthesis unit is used to input the characterization result text_encode into the duration prediction module of the pre-trained speech synthesis model, perform synthesis processing, output the duration information of each phoneme, pre-process the duration information and the characterization result text_encode, and generate normal synthesized audio, wherein the speech synthesis model needs to be trained twice, the first time is to select s2s_attn or s2s_attn_mono for a 50%-50% training strategy, so that the model can make the same sound as the training sample audio based on the alignment result of the aligner A, and the second time is iterative audio replacement training, so that the model can synthesize audio based on the prediction information of the duration prediction module and the audio synthesized based on the prediction information of the aligner A is basically consistent. The synthesis unit is used to combine the alignment result and the duration prediction information to generate synthesized speech.
Citation Information
Cited By
Phoneme alignment model training and speech synthesis method and device, equipment and medium
CN120748366A
