Speech synthesis method, device, speech synthesis model training method, device

Through semantic emotion extraction and feature fusion of the target text, combined with random duration prediction and standardized flow model, the VITS model is optimized to solve the problem of insufficient speech naturalness and emotional expressiveness in speech synthesis, and achieve higher quality speech synthesis.

CN117877460BActive Publication Date: 2024-10-29HANVON CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410052370.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2024-10-29
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

Existing speech synthesis methods based on the VITS model have shortcomings in speech naturalness and emotional expressiveness, and lack expressiveness and emotional color.

Method used

By performing word-to-phoneme conversion, semantic emotion extraction, multi-head attention encoding and feature fusion on the target text, combined with random duration prediction and standardized flow models, the speech synthesis model is optimized to improve the naturalness and emotional expressiveness of speech.

Benefits of technology

The speech and emotional expressiveness of speech synthesis are significantly improved, and the generated speech is more expressive and emotional, with improved quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117877460B_ABST
    Figure CN117877460B_ABST
Patent Text Reader

Abstract

The present application discloses a speech synthesis method, device, speech synthesis model training method, device, and electronic equipment, and belongs to the field of computer technology. The method comprises: performing word-to-phoneme conversion processing on the target text to obtain the target phoneme; performing semantic emotion extraction on the target text to obtain the emotional semantic feature vector of the target text; performing multi-head attention encoding processing on the target phoneme to obtain the phoneme feature vector; performing fusion processing on the emotional semantic feature vector and the phoneme feature vector to obtain the fusion vector; performing random duration prediction on the fusion vector to obtain the duration information of each target phoneme; obtaining the mean and variance of the fusion vector; encoding audio data according to the mean, variance, and duration information. The method introduces the emotional and semantic information of the text to be synthesized, improves the complexity of the text prior distribution, shortens the distance between the prior distribution and the posterior distribution, and finally synthesizes more expressive and emotional speech.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a speech synthesis method, device, speech synthesis model training method, device, electronic device, and computer-readable storage medium. Background Art

[0002] With the development of deep learning, the end-to-end speech synthesis method based on neural network has replaced the statistical parameter synthesis method and become the basic direction of speech synthesis. The end-to-end speech synthesis method can be divided into two-stage training method and single-stage training method. In the single-stage end-to-end speech synthesis, the entire synthesis system is trained in one stage, which can directly optimize the mapping of text to audio in a completely end-to-end manner. According to different generation methods, the single-stage speech synthesis method includes the VITS (Variational Inference with adversariallearning for end-to-end Text-to-Speech) model with VAE (Variational AutoEncoder) as the framework, the Glow-TTS model based on Normalizing Flow, and the Grad-TTS model based on DPM (Diffusion Probabilistic Model). Among them, the VITS model adopts variational inference and adversarial training process with normalized flow, which greatly improves the quality of the generated audio. At the same time, the random duration predictor based on normalized flow is introduced to realize the synthesis of speech with different rhythms. However, in actual use, it was found that when using the VITS model for speech synthesis, there are still defects such as the synthesized speech is not natural enough, lacks expressiveness, and lacks emotional color.

[0003] It can be seen that the speech synthesis method using the VITS model in the prior art still needs to be improved. Summary of the invention

[0004] The embodiments of the present application provide a speech synthesis method, device, speech synthesis model training method, device, electronic device and storage medium, which can improve the expressiveness of speech synthesis in terms of voice and emotion, and improve the quality of synthesized speech.

[0005] In a first aspect, an embodiment of the present application provides a speech synthesis method, which is applied to a speech synthesis model, and the method includes:

[0006] Performing word-to-phoneme conversion processing on the target text to obtain target phonemes;

[0007] Performing semantic sentiment extraction on the target text to obtain a sentiment semantic feature vector of the target text;

[0008] Performing multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector;

[0009] Fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector;

[0010] Performing random duration prediction on the fusion vector to obtain duration information of each target phoneme;

[0011] Obtaining the mean and variance of the fused vector;

[0012] The audio data corresponding to the target text is obtained according to the mean, the variance, and the duration information.

[0013] In a second aspect, an embodiment of the present application provides a speech synthesis device, which is applied to a speech synthesis model, and the device includes:

[0014] A target phoneme acquisition module is used to perform word-to-phoneme conversion processing on the target text to obtain the target phoneme;

[0015] An emotional semantic feature vector acquisition module is used to extract the semantic emotion of the target text to obtain the emotional semantic feature vector of the target text;

[0016] A phoneme feature vector acquisition module is used to perform multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector;

[0017] A fusion vector acquisition module, used for fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector;

[0018] A duration information acquisition module, used for performing random duration prediction on the fusion vector to obtain duration information of each target phoneme;

[0019] A mean and variance acquisition module, used to acquire the mean and variance of the fusion vector;

[0020] The audio data acquisition module is used to acquire the audio data corresponding to the target text according to the mean, the variance, and the duration information.

[0021] In a third aspect, an embodiment of the present application provides a method for training a speech synthesis model, wherein the speech synthesis model includes: a posterior encoder, a decoder, a monotone alignment search module, a standardized flow model, a random duration predictor, a local attention encoder, a phoneme conversion module, and an emotional semantic feature extraction module, wherein the method includes:

[0022] For each training sample, the phoneme conversion module performs word-to-phoneme conversion processing on the sample text in the training sample to obtain the target phoneme;

[0023] Performing multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector;

[0024] The sentiment semantic feature extraction module is used to extract the sentiment semantics of the sample text to obtain the sentiment semantic feature vector of the sample text;

[0025] By using the local attention encoder, the emotional semantic feature vector and the phoneme feature vector are fused to obtain a fusion vector;

[0026] Obtaining the mean and variance of the fusion vector through the local attention encoder;

[0027] Obtaining, through a posteriori encoder, a first hidden layer vector obtained by performing posteriori encoding processing on a true audio value corresponding to the sample text;

[0028] Processing the first hidden layer vector by the standardized flow model to obtain a second hidden layer vector;

[0029] By using the monotone alignment search module, searching for duration information according to the mean, the variance and the second hidden layer vector;

[0030] Obtaining a standardized stream input vector according to the mean, the variance, and the duration information;

[0031] Using the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model;

[0032] Decoding the third hidden layer vector by the decoder to obtain an audio synthesis value;

[0033] Obtaining a model loss of the speech synthesis model, wherein the model loss includes at least: an absolute value loss of a linear spectrum of the audio synthesis value and the audio true value, and a reverse flow loss of the standardized flow model, wherein the reverse flow loss is calculated based on the difference between the following first conditional distribution and second conditional distribution: a first conditional distribution of a third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and a second conditional distribution of a fourth hidden layer vector output by the posterior encoder under the condition of given audio;

[0034] The speech synthesis model is iteratively trained with the goal of optimizing the model loss.

[0035] In a fourth aspect, an embodiment of the present application provides a speech synthesis model training device, wherein the speech synthesis model includes: a posterior encoder, a decoder, a monotone alignment search module, a normalized flow model, a random duration predictor, a local attention encoder, a phoneme conversion module, and an emotional semantic feature extraction module, wherein the device includes:

[0036] A target phoneme acquisition module is used to perform word-to-phoneme conversion processing on the sample text in the training sample through the phoneme conversion module for each training sample, so as to obtain the target phoneme;

[0037] A phoneme feature vector acquisition module, used to perform multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector;

[0038] An emotional semantic feature vector acquisition module is used to extract the semantic emotion of the sample text through the emotional semantic feature extraction module to obtain the emotional semantic feature vector of the sample text;

[0039] A fusion vector acquisition module, used to fuse the emotion semantic feature vector and the phoneme feature vector through the local attention encoder to obtain a fusion vector;

[0040] A mean and variance acquisition module, used to obtain the mean and variance of the fusion vector through the local attention encoder;

[0041] A first hidden layer vector acquisition module is used to obtain, through a posteriori encoder, a first hidden layer vector obtained by performing a posteriori encoding processing on the audio true value corresponding to the sample text;

[0042] A second hidden layer vector acquisition module, used for processing the first hidden layer vector through the standardized flow model to obtain a second hidden layer vector;

[0043] A duration information acquisition module, configured to search for duration information according to the mean, the variance and the second hidden layer vector through the monotone alignment search module;

[0044] A standardized stream input vector acquisition module, used to obtain a standardized stream input vector according to the mean, the variance, and the duration information;

[0045] A third hidden layer vector acquisition module, used for taking the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model;

[0046] An audio synthesis module, used for decoding the third hidden layer vector through the decoder to obtain an audio synthesis value;

[0047] A loss calculation module, used to obtain the model loss of the speech synthesis model, wherein the model loss includes at least: the absolute value loss of the linear spectrum of the audio synthesis value and the audio true value, and the reverse flow loss of the standardized flow model, and the reverse flow loss is calculated according to the difference between the following first conditional distribution and second conditional distribution: the first conditional distribution of the third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and the second conditional distribution of the fourth hidden layer vector output by the posterior encoder under the condition of given audio;

[0048] An iterative training module is used to iteratively train the speech synthesis model with the goal of optimizing the model loss.

[0049] In the fifth aspect, an embodiment of the present application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the speech synthesis method and / or speech synthesis model training method described in the embodiment of the present application when executing the computer program.

[0050] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the speech synthesis method and / or speech synthesis model training method disclosed in the embodiment of the present application are performed.

[0051] The speech synthesis method disclosed in the embodiment of the present application obtains target phonemes by performing word-to-phoneme conversion processing on the target text; performs semantic emotion extraction on the target text to obtain the emotion semantic feature vector of the target text; performs multi-head attention encoding processing on the target phonemes to obtain phoneme feature vectors; performs fusion processing on the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector; performs random duration prediction on the fusion vector to obtain the duration information of each target phoneme; obtains the mean and variance of the fusion vector; obtains the audio data corresponding to the target text based on the mean, the variance, and the duration information, and increases the complexity of the text prior distribution by introducing the emotion and semantic information of the text to be synthesized, shortens the distance between the prior distribution and the posterior distribution, and finally synthesizes more expressive and emotional speech.

[0052] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] Figure 1 is a flow chart of the speech synthesis method disclosed in the embodiment of the present application;

[0055] Figure 2 is a schematic diagram of the structure of the speech synthesis model used in the embodiments of the present application;

[0056] Figure 3 Schematic diagram of the structure of the emotion semantic feature extraction module used in the embodiment of the present application;

[0057] Figure 4 It is a schematic diagram of the structure of a local attention encoder in a speech synthesis model in an embodiment of the present application;

[0058] Figure 5 yes Figure 4 Schematic diagram of the structure of the local attention layer in the local attention encoder;

[0059] Figure 6 is a flow chart of the speech synthesis model training method disclosed in the embodiments of the present application;

[0060] Figure 7 It is a schematic diagram of the speech synthesis model training principle disclosed in the embodiment of the present application;

[0061] Figure 8 is a schematic diagram of the structure of a speech synthesis device disclosed in an embodiment of the present application;

[0062] Fig. 9 It is a structural schematic diagram of a speech synthesis model training device disclosed in an embodiment of the present application;

[0063] Fig.10 A block diagram schematically shows an electronic device for executing the method according to the present application; and

[0064] Fig.11 A storage unit for holding or carrying a program code for implementing the method according to the present application is schematically shown. DETAILED DESCRIPTION

[0065] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0066] A speech synthesis method disclosed in the embodiment of the present application is applied to a speech synthesis model, referring to Figure 2 The speech synthesis model includes: a decoder 210, a standardized flow model 220, a random duration predictor 230, a local attention encoder 240, a phoneme conversion module 250, and an emotional semantic feature extraction module 260. The speech synthesis model is built based on the Bert model and the VITS model. The specific implementation of the decoder 210, the standardized flow model 220, the random duration predictor 230 and the phoneme conversion module 250 can refer to the VITS model in the prior art.

[0067] In the embodiment of the present application, by improving the structure of the local attention encoder 240 and introducing the emotional semantic feature extraction module 260, the text-based semantic information and emotional information are added to the text prior distribution, further improving the representation ability of the text prior distribution, which helps to improve the expressiveness and emotional color of the synthesized speech and improve the quality of the synthesized speech. At the same time, by introducing the reverse flow loss in the training stage of the speech synthesis model, the complexity of the audio posterior distribution can be reduced, thereby improving the expressiveness of the synthesized speech of the trained speech synthesis model.

[0068] The structures of the components of the speech synthesis model and the model training method are described in the following embodiments.

[0069] Reference Figure 1 , a speech synthesis method disclosed in an embodiment of the present application includes: steps 110 to 160.

[0070] The speech synthesis method is applied to a pre-trained speech synthesis model, and the training loss function of the speech synthesis model includes at least: the absolute value loss of the linear spectrum of the audio synthesis value and the audio true value, and the reverse flow loss of the standardized flow model, and the reverse flow loss is calculated according to the difference between the following first conditional distribution and second conditional distribution: the first conditional distribution of the third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and the second conditional distribution of the fourth hidden layer vector output by the posterior encoder under the condition of given audio.

[0071] Combine the following Figure 2The structure of the voice synthesis model shown is used to perform the voice synthesis method on the voice synthesis model obtained through training, and specific implementation manners of performing voice synthesis on the target text are exemplified.

[0072] Step 110: Perform a word-to-phoneme conversion process on the target text to obtain target phonemes.

[0073] For example, the word-to-phoneme conversion process on the target text can be performed through the phoneme conversion module 250 in the voice synthesis model to obtain target phonemes. The phoneme conversion module 250 completes the text-to-phoneme conversion process based on word segmentation and table lookup. For example, first, the text in the specified database is segmented to construct word-phoneme pairs and stored in the dictionary. Then, in the conversion stage, the input text is segmented. If the obtained segmentation appears in the constructed dictionary, the corresponding phoneme in the dictionary is used as the phoneme of the word; otherwise, the pinyin of the word is used as the phoneme of the word. When using the pinyin of the word as the phoneme of the word, the tones of the pinyin of the word also need to be corrected according to preset rules. For example, for consecutive third tones, except for the last one, the previous third tones are pronounced as second tones, such as "hotel", and the pinyin is corrected to "lv2 guan3"; for the pronunciation of "bu" and "yi", their tones are adjusted according to the characters following them, such as "bu2 xing2" and "bu2 xing4". Taking the target text as the Chinese word "art" as an example, the input of the phoneme conversion module 250 is: "art", and the output target phonemes are: "i4 sh u4".

[0074] Specific implementation manners of performing a word-to-phoneme conversion process on the target text to obtain target phonemes can be referred to the prior art and will not be elaborated in the embodiments of the present application.

[0075] Step 120: Perform semantic emotion extraction on the target text to obtain an emotional semantic feature vector of the target text.

[0076] In some optional embodiments, the emotional semantic feature extraction module 260 can be used to perform semantic emotion extraction on the target text to obtain an emotional semantic feature vector of the target text.

[0077] In some optional embodiments, as Figure 3 shown, the emotional semantic feature extraction module 260 can be composed of a Bert model, a one-dimensional convolutional layer, and an upsampling layer. Among them, the Bert model can adopt the BERT-base structure. BERT-Base includes: 12 encoding layers, 12 self-attention heads, and 768 hidden layer sizes, with a total of approximately 110M parameters.

[0078] In some optional embodiments, semantic sentiment extraction is performed on the target text to obtain an emotional semantic feature vector of the target text, including: performing semantic sentiment extraction on the target text to obtain a word-level embedding vector that carries emotional information and semantic information of the target text; based on the distribution of the phoneme feature vector, fine-tuning the distribution of the word-level embedding vector to obtain a fine-tuning vector; aligning the fine-tuning vector to the length of the target phoneme to obtain the emotional semantic feature vector of the target text.

[0079] For example, the target text may be subjected to semantic sentiment extraction through the Bert model in the speech synthesis model to obtain a word-level embedding vector of the target text that carries sentiment information and semantic information.

[0080] In some optional embodiments, semantic sentiment extraction is performed on the target text to obtain a word-level embedding vector of the target text that carries sentiment information and semantic information, including: performing word segmentation on the target text to obtain a subword sequence of the target text; adding tags and vectorizing the subword sequence to obtain a subword-level vector sequence; performing multi-level semantic encoding on the vector sequence, and adaptively weighted summing the hierarchical encoding results obtained by the multi-level semantic encoding to obtain the encoding result; fusing the encoding result corresponding to the tag added at the starting position of the subword sequence with the encoding result of each subword in the subword sequence to obtain a vector representation of each subword; and obtaining a word-level embedding vector of the target text based on the vector representation of each subword, wherein the word-level embedding vector carries sentiment information and semantic information.

[0081] The following example illustrates the data processing process of the Bert model.

[0082] First, the sentence input to the model is segmented. The Bert model uses the WordPiece segmenter, which breaks down a word into smaller fragments or characters. For example, for the target text: "Little Red Riding Hood returned home happily", after the segmentation process, the subword sequence obtained is: "small", "red", "hat", "high", "high", "happy", "happy", "land", "return", "have", "home", where each subword represents a Chinese character. For another example, for the target text: "Let me turnyour imagination into imagery", after the segmentation process, the subword sequence obtained is: "Let", "me", "turn", "your", "imagi", "nation", "into", "image", "ry". For the target text in Chinese, each segmentation is a Chinese character after the segmentation process, while for the English text, each subword obtained after the segmentation process can be an English word or a root.

[0083] By performing word segmentation on the target text, the model can be helped to process words that have not appeared in the training corpus.

[0084] Next, add special tags. Add a special tag "[CLS]" at the beginning of each sentence in the input text, and a special tag "[SEP]" at the end.

[0085] The output of the Bert model is a vector representation. For each input word or word sequence, the Bert model generates a corresponding vector. This vector captures the semantic information of the input in context. For example, suppose the target text is "art". First, the sentence will be segmented and special tags "[CLS]" and "[SEP]" will be added to become: "[CLS]", "art", "art", "[SEP]". Then, these subwords are converted into corresponding embedding vectors (i.e. tokens) and input into the Bert model.

[0086] The Bert model performs hierarchical encoding on the input embedding vector, and each level outputs a corresponding hidden vector. In the embodiment of the present application, the corresponding hidden vector output by each level of the Bert model is used as the hierarchical encoding result, and the hierarchical encoding results of all levels are adaptively weighted and summed to obtain the encoding result finally output by the Bert model. The 12-layer output of the Bert model is respectively expressed as:

[0087] H1,H2…H 12 For example, the following formula can be used to obtain the encoding result output by the Bert model:

[0088] H=α1H1+α2H2+…+α12 H 12 ;

[0089] where α1, α2…α 12 represent the learnable weight parameters of each layer, and α1 + α2 + … + α 12 = 1. The outputs of different layers of the Bert model can represent different levels of information. By introducing the method of adaptive summation in this application, the outputs of each layer of the Bert model can be flexibly fused, adding different levels of information such as semantics, grammar, and syntax to the text distribution, thereby improving the quality of speech synthesis.

[0090] After passing through the Bert model, each sub-word will have a new vector representation. In particular, the output vector corresponding to the token "[CLS]" is usually used as the aggregated representation of the entire sentence.

[0091] The Bert model is used to obtain the semantics of each character in the target text and the sentiment information of the entire sentence, enhancing the representational ability of the prior distribution of text rich in sentiment and semantics.

[0092] Next, split the output of the Bert model: Add the encoded output corresponding to the special token at the first position, that is, the token "[CLS]", to the encoded output corresponding to each sub-word as the sentiment information of the target text; Use the encoded outputs of each sub-word in the sub-word sequence as the semantic information of the target text, and discard the output result of the special token "[SEP]" at the end position to obtain the vector representation of each sub-word. Still taking the target text as "art" as an example, the token sequence at the sub-word level 2 represents the length of the token sequence (i.e., the number of sub-words in the target text), and the output length of the Bert model is where 4 represents the output length of the Bert model, and 768 represents the dimension of the output encoded vector. In the output of length 4, discard the output at the fourth position of the token series (i.e., the token "[SEP]"), and add the encoded result at the first position (i.e., the token "[CLS]") to the encoded results of the second and third tokens (i.e., the sub-words "art" and "technique") respectively. The added results are used as the vector representation of each sub-word of the target text. The sequence of the vector representations of each sub-word of the target text can be used as the sub-word level vector representation of the target text.

[0093] From the tokenization method described in the previous text, for the case where the target text is in Chinese, the sub-words and words in the target text are the same. Therefore, the sub-word level vector representation of the target text is the word level embedding vector of the target text. For the case where the target text is in English, the sub-words and words in the target text may be different. Therefore, it is necessary to perform downsampling on the sub-word level vector representation to obtain the word level embedding vector of the target text.

[0094] In some alternative embodiments, the Bert model can downsample the sub-word level vector representation of the target text to a word-level embedding vector through an average pooling layer, ensuring a one-to-one correspondence between sub-words and words. For example, the average pooling method expressed by the following formula 1 can be used to downsample the sub-word level vector representation to a word-level vector representation:

[0095]

[0096] where i1 to i k represents the sub-word index of the i-th word, that is represents the embedding vector of the k-th sub-word of the i-th word, v i represents the embedding vector of the i-th word.

[0097] After that, the distribution of the word-level embedding vector is fine-tuned to obtain a fine-tuned vector, so that the distribution of the fine-tuned vector is consistent with the distribution of the phoneme feature vector, facilitating subsequent feature fusion. For example, the word-level embedding vector output by the Bert model can be fed into a one-dimensional convolutional layer for convolutional operation to obtain a fine-tuned vector.

[0098] The pre-trained Bert model is trained based on text data, while the speech synthesis model in the embodiments of the present application is built based on the VITS model, and its input is phoneme data. For Chinese, phoneme data refers to pinyin, and for English, phoneme data refers to phonetic symbols. In order to better fuse the two distributions of phoneme data and text data, it is necessary to fine-tune the data distribution output by the Bert model so that after fine-tuning, the distribution of text features is consistent with the phoneme features.

[0099] After that, the fine-tuned vector is fed into an upsampling layer for alignment processing to align the fine-tuned vector to the phoneme length, facilitating the combination of emotional semantic features and phoneme features. Optionally, aligning the fine-tuned vector to the length of the target phoneme to obtain the emotional semantic feature vector of the target text includes: determining the phoneme length and position corresponding to each word in the target text; copying the fine-tuned vector corresponding to the corresponding word according to the phoneme length and splicing it according to the position to obtain the emotional semantic feature vector of the target text. Taking the target text as: "art" as an example, the target phoneme obtained by performing phoneme conversion processing on the target text is: [i4][sh][u4], with a length of 3. The word-level embedding vector output by the Bert model has a length of 2. After fine-tuning, the length of the obtained fine-tuned vector is 2×256. The phoneme of the character "术" is: [sh][u4], so the hidden variable corresponding to the second character of the fine-tuned vector is copied and spliced after the fine-tuned vector to obtain an alignment vector The obtained alignment vector is the emotional semantic feature vector of the target text, which is denoted as: in the embodiments of the present application

[0100] Step 130, performing multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector.

[0101] Furthermore, the target phoneme is input into a local attention encoder for encoding to obtain a phoneme feature vector.

[0102] In some optional embodiments, the target phoneme is subjected to multi-head attention encoding processing to obtain a phoneme feature vector, including: in the process of encoding the target phoneme using a multi-head attention mechanism, obtaining a first vector obtained by performing a dot product operation on a Q vector and a K vector; normalizing the first vector to obtain a weight matrix; and obtaining a phoneme feature vector based on the product of the weight matrix and the V vector.

[0103] During the attention encoding process, the attention mechanism calculates the similarity of the character encodings at the global position in the Q vector and the K vector to obtain a weight matrix. Then, the phoneme feature vector is obtained based on the product of the weight matrix and the V vector.

[0104] The VITS model uses the Transformer structure to calculate the mean and variance of the prior distribution of phonemes. The advantage of the stacked multi-head attention mechanism in the Transformer structure is that global context information is obtained through the multi-head attention mechanism. The most basic problem in the field of speech synthesis is the monotonic alignment of phoneme or character sequences with audio sequences. The monotonic alignment problem implies an assumption of local correlation: a phoneme is strongly correlated with the corresponding consecutive audio frames and weakly correlated with other audio frames. In other words, the global correlation assumption implied by the multi-head attention mechanism does not match the local correlation assumption of speech synthesis. As a result, the output distribution obtained when the same character is calculated independently is far from the output distribution obtained in a short sentence, which ultimately leads to incorrect pronunciation. Specifically, a single Chinese character or letter will synthesize incorrect speech, while the same single character placed in a short sentence will produce correct speech.

[0105] In order to solve the problem of single-word speech synthesis errors, a local prior knowledge penalty is introduced in the implementation of this application to control the scope of the attention mechanism to extract contextual information.

[0106] In some optional embodiments, the target phoneme is subjected to multi-head attention encoding processing to obtain a phoneme feature vector, including: in the process of encoding the target phoneme using a multi-head attention mechanism, obtaining a first vector obtained by performing a dot product operation on a Q vector and a K vector; performing a penalty processing based on a relative position window on the first vector to suppress information outside a specified position window in the first vector to obtain a second vector; normalizing the second vector to obtain a weight matrix; and obtaining a phoneme feature vector based on the product of the weight matrix and the V vector.

[0107] Reference Figure 4 The local attention encoder includes: a local attention module 410 and an emotional semantic fusion module 420, wherein the local attention module 410 is used to perform multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector, and the emotional semantic fusion module 420 is used to fuse the phoneme feature vector and the emotional semantic feature vector extracted by the emotional semantic feature extraction module 260 to obtain a fusion vector.

[0108] The local attention module 410 further includes: a local attention layer and a feedforward layer. The local attention layer is used to encode the target phoneme in combination with the input relative position information. The specific implementation of the feedforward layer and the encoding method of the relative position encoding refer to the relevant implementation of the multi-head attention network in the prior art, which will not be repeated here.

[0109] In the embodiments of the present application, Figure 5 As shown, in the structure of the local attention layer, a penalty for a specified window size is added before the Softmax layer (i.e., the normalization layer). Based on the fact that speech synthesis has local correlation reasoning, in the embodiments of the present application, this local correlation reasoning is explicitly added to the speech synthesis model as a priori knowledge to reduce the cost of attention learning and avoid the possibility of learning errors in the attention mechanism. Among them, Q, K, V represent query vectors, key-value vectors, and real-value vectors, respectively, u and v represent learnable parameters in relative position encoding, and R represents relative position encoding. In the embodiments of the present application, a penalty for a specified window size is added before the Softmax operation of the present invention to suppress information outside the specified position window in the vector encoded by the local attention layer, thereby reducing the influence of irrelevant global information on the character encoding in the target text.

[0110] In some optional embodiments, the step of performing a relative position window-based penalty processing on the first vector to suppress information outside the specified position window in the first vector to obtain a second vector includes: performing a relative position window-based penalty processing on the first vector by superimposing a preset priori knowledge vector on the first vector to obtain the second vector, wherein the preset priori knowledge vector is an L×L matrix, and the value of the element in the i-th column and the j-th row in the preset priori knowledge vector is calculated by the following method: when the distance between i and j is less than or equal to the size of the specified position window, the value of the element is -(ij) 2 / L; when the distance between i and j is greater than the size of the specified position window, the element value is 1, and L is the length of the first vector.

[0111] For example, the preset prior knowledge vector A localatt It can be calculated by the following formula 2:

[0112]

[0113] Wherein, C represents the size of the window at the specified position, L is the length of the first vector, i represents the current column position, and j represents the current row position. In some optional embodiments, the value of C can be set to 4. By penalizing the first vector based on the window size at the relative position, the information of the position in the window can be simply and effectively expressed without introducing other parameters.

[0114] Afterwards, the preset prior knowledge vector can be superimposed with the first vector to obtain a second vector, and then the second vector is layer-normalized by Softmax operation to obtain a weight matrix. According to the principle of Softmax operation, when the positions of two characters are close (such as less than or equal to the window length), the correlation weights of the two characters will increase, and when the positions of the two characters are far away (such as greater than the window length), the correlation weights of the two characters will decrease. In this way, after multiplying the weight matrix with the V vector, the emotional and semantic information of the adjacent characters in the phoneme feature vector is enhanced, thereby improving the accuracy of single-character speech synthesis in a sentence.

[0115] Next, the phoneme feature vector is obtained by multiplying the weight matrix by the V vector, which is denoted as “x transformer ”.

[0116] Step 140, fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector.

[0117] Furthermore, in the local attention module, the emotional semantic feature vector and the phoneme feature vector are fused to obtain a fused vector.

[0118] In some optional embodiments, the emotional semantic feature vector and the phoneme feature vector are fused to obtain a fused vector, including: performing layer normalization on the emotional semantic feature vector and the phoneme feature vector to obtain a normalized vector; and performing linear projection on the normalized vector to obtain a fused vector. For example, the emotional semantic feature vector and the phoneme feature vector may be layer normalized by a layer normalization layer to limit the variance of the data and ensure training stability. Afterwards, the normalized vector is linearly projected by a linear layer to obtain a fused vector.

[0119] The method of fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector can be expressed by the following formula 3:

[0120] x duration =Linear(LayerNorm(x semantic +x transformer )); Formula 3

[0121] Among them, x semantic represents the sentiment semantic feature vector, x transformer represents the phoneme feature vector, LayerNorm() represents the layer normalization function, and Linear() represents the linear projection function.

[0122] In some optional embodiments, the emotional semantic feature vector and the phoneme feature vector may be fused by simple addition fusion, concatenation fusion, or complex attention fusion to obtain a fusion vector. In the embodiment of the present application, feature fusion is performed by using addition combined with a linear projection method.

[0123] Complex feature fusion methods are often used for data of different modalities, such as text and image, text and speech, etc. In the embodiment of the present application, the emotional semantic feature vector and the phoneme feature are both text modalities, and the method of addition combined with linear projection is sufficient to achieve feature fusion, and the fusion algorithm requires relatively few parameters and calculations.

[0124] After the phoneme feature vector and the sentiment semantic feature vector are fused in this step, the obtained fusion vector has two uses: predicting the duration of the phoneme and calculating the variance and mean of the distribution.

[0125] Step 150: Perform random duration prediction on the fusion vector to obtain duration information of each target phoneme.

[0126] Next, the fusion vector is input into the random duration predictor, and the random duration predictor is waited for to output the duration information of each target phoneme.

[0127] The specific implementation method of performing random duration prediction on the fusion vector to obtain the duration information of each target phoneme can refer to the prediction process of the duration of the phoneme by the random duration predictor in the prior art, which will not be repeated here.

[0128] Step 160, obtaining the mean and variance of the fused vector.

[0129] In some optional embodiments, the obtaining of the mean and variance of the fused vector includes: linearly projecting the fused vector to obtain a projection vector; and evenly dividing the projection vector from the feature dimension direction to obtain the mean and variance. For example, the fused vector can be input into a linear layer and linearly projected to obtain a projection vector with doubled length; then, the projection vector is evenly divided from the feature dimension direction, and half is regarded as the mean μ of the fused feature, and the other half is regarded as the variance σ of the fused feature. Taking the fused vector length of 3×256 as an example, where 3 represents the vector dimension, after linear projection, a projection vector with a length of 6×256 can be obtained. Furthermore, the vector data of the first three dimensions of the projection vector are used as the mean of the fused feature, and the vector data of the last three dimensions of the projection vector are used as the variance of the fused feature, to obtain a mean and variance of 3×256 in length.

[0130] Step 170: Acquire the audio data corresponding to the target text according to the mean, the variance, and the duration information.

[0131] In some optional embodiments, the audio data corresponding to the target text is obtained according to the mean, the variance, and the duration information, including: sampling from a normal distribution according to the mean and the variance to obtain a sampling vector; copying and splicing the sampling vector according to the duration to obtain a standardized stream input vector; performing standardized stream processing on the standardized stream input vector through a standardized stream model of the speech synthesis model to obtain a coding vector; and inputting the coding vector into a decoder of the speech synthesis model for decoding conversion to obtain the audio data corresponding to the target text.

[0132] For the specific implementation of obtaining the sampling vector by sampling from the normal distribution according to the mean and the variance, please refer to the prior art and will not be described in detail here.

[0133] Still taking the target text as "art" as an example, the output of the local attention encoder includes two directions: one direction is: mean μ, for example, expressed as: and variance σ, for example, expressed as: Another direction is: random duration predictor, that is, fusion vector, for example, expressed as: The random duration predictor will be based on the input fusion vector x duration Predict the duration of each phoneme in the target text, and round down the predicted result to get the duration of each phoneme, for example: [2][1][2]. Then, according to the mean x inference_μ and variance x inference_σ Sampling from a normal distribution yields a sampling vector, for example, denoted as "x inference_sample ”, After that, the sampling vector x is combined with the duration inference_sample Copy the normalized stream input vector, for example, denoted as "x inference_flow_input ”, normalized stream input vector After the normalized flow input vector is input into the normalized flow model for normalization, the normalized flow model will output the hidden layer vector as the encoding vector Z′. Afterwards, the encoding vector z is sent to the decoder for decoding conversion to obtain the output of the speech synthesis model, that is, the audio data corresponding to the target text.

[0134] In summary, the speech synthesis method disclosed in the embodiment of the present application obtains target phonemes by performing word-to-phoneme conversion processing on the target text; performs semantic emotion extraction on the target text to obtain the emotional semantic feature vector of the target text; performs multi-head attention encoding processing on the target phonemes to obtain phoneme feature vectors; fuses the emotional semantic feature vectors and the phoneme feature vectors to obtain fusion vectors; performs random duration prediction on the fusion vector to obtain duration information of each target phoneme; obtains the mean and variance of the fusion vector; obtains the audio data corresponding to the target text based on the mean, the variance, and the duration information, and increases the complexity of the text prior distribution by introducing the emotional and semantic information of the text to be synthesized, shortens the distance between the prior distribution and the posterior distribution, and finally synthesizes more expressive and emotional speech.

[0135] In the prior art, in order to improve the fitting ability of the model, the VITS model uses a normal distribution to model the audio posterior distribution, and uses a normal distribution and a dot product of the determinant output by the standardized flow model to model the text prior distribution, that is, the complexity of the text prior distribution is improved by the standardized flow model. The audio posterior distribution and the text prior distribution are two cross-modal data distributions. There is a phenomenon that the audio posterior distribution is far more complex than the text prior distribution. Although the standardized flow model is used to increase the representation ability of the text prior distribution, it is limited by the nonlinearity of the flow model. There is still a problem of too large a difference between the audio posterior distribution and the text prior distribution, resulting in a loss in the quality of speech synthesis. In the embodiment of the present application, by adding text-based semantic information and emotional information to the text prior distribution, the representation ability of the text prior distribution is further improved, the complexity of the text prior distribution is improved, and the distance between the prior distribution and the posterior distribution is shortened, thereby improving the quality of the synthesized speech. On the other hand, by introducing reverse flow loss in the training stage of the speech synthesis model, the complexity of the audio posterior distribution is reduced, thereby improving the expressiveness of the speech.

[0136] In order to implement the above-mentioned speech synthesis method, a speech synthesis model training method is disclosed in the embodiment of the present application, which is used to train the speech synthesis model for implementing the above-mentioned speech synthesis method. In the embodiment of the present application, the speech synthesis model to be trained is an improvement on the VITS model in the prior art and is built in combination with the Bert model.

[0137] Reference Figure 6 The speech synthesis model to be trained includes: a posterior encoder 610, a decoder 620, a monotone alignment search module 630, a standardized flow model 640, a random duration predictor 650, a local attention encoder 660, a phoneme conversion module 670, and an emotional semantic feature extraction module 680. The specific structures and implementation methods of the posterior encoder 610, the decoder 620, the monotone alignment search module 630, the standardized flow model 640, the random duration predictor 650, and the phoneme conversion module 670 refer to the corresponding structures in the VITS model in the prior art. The structure of the local attention encoder 660 is as shown in FIG. Figure 4 As shown, the structure of the sentiment semantic feature extraction module 680 is as follows Figure 3 shown.

[0138] Reference Figure 7 , the speech synthesis model training method includes: steps 701 to 713.

[0139] Step 701: for each training sample, the phoneme conversion module performs word-to-phoneme conversion processing on the sample text in the training sample to obtain target phonemes.

[0140] The training sample includes: a sample text and a sample label, and the sample label is the true value of the audio corresponding to the sample text.

[0141] For the specific implementation of performing word-to-phoneme conversion processing on the sample text in the training sample by the phoneme conversion module 670, refer to the relevant description in the previous embodiment, which will not be repeated here.

[0142] Step 702: Perform multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector.

[0143] The local attention encoder 660 is used to perform multi-head attention encoding processing on the target phoneme to obtain a specific implementation method of the phoneme feature vector. Please refer to the relevant description in the previous embodiment and will not be repeated here.

[0144] Step 703: perform semantic sentiment extraction on the sample text through the sentiment semantic feature extraction module to obtain a sentiment semantic feature vector of the sample text.

[0145] The specific implementation method of performing semantic sentiment extraction on the sample text through the sentiment semantic feature extraction module 680 to obtain the sentiment semantic feature vector of the sample text refers to the relevant description of performing semantic sentiment extraction on the target text to obtain the sentiment semantic feature vector of the target text in the previous embodiment, which will not be repeated here.

[0146] Step 704: fusing the emotion semantic feature vector and the phoneme feature vector through the local attention encoder to obtain a fusion vector.

[0147] The emotion semantic feature vector and the phoneme feature vector are fused by the local attention encoder 660 to obtain a specific implementation method of the fused vector. Please refer to the relevant description in the previous embodiment and will not be repeated here.

[0148] Step 705: Obtain the mean and variance of the fusion vector through the local attention encoder.

[0149] The specific implementation method of obtaining the mean and variance of the fusion vector through the local attention encoder 660 refers to the relevant description in the previous embodiment and will not be repeated here.

[0150] Step 706: Obtain, through a posteriori encoder, a first hidden layer vector obtained by performing a posteriori encoding processing on the true audio value corresponding to the sample text.

[0151] The sample text in the training sample is represented as c, and the true value of the audio is represented as x linFor example, we can first obtain the true value of the audio as x lin The linear spectrum is then encoded by the a posteriori encoder 610 to obtain the true audio value x lin The corresponding first hidden layer vector is, for example, denoted as “Z”.

[0152] The specific implementation of obtaining the first hidden layer vector by performing a posteriori encoding processing on the true audio value corresponding to the sample text through the posteriori encoder 610 is referred to the prior art and will not be described in detail here.

[0153] Step 707: Process the first hidden layer vector through the standardized flow model to obtain a second hidden layer vector.

[0154] Afterwards, the first hidden layer vector is input as a forward flow into the standardized flow model 640, and the first hidden layer vector is processed by the forward flow module of the standardized flow model 640 to obtain a second hidden layer vector.

[0155] The specific implementation of processing the first hidden layer vector by the standardized flow model 640 to obtain the second hidden layer vector is referred to the prior art and will not be described in detail here.

[0156] Step 708: Search and obtain duration information according to the mean, the variance and the second hidden layer vector through the monotone alignment search module.

[0157] The specific implementation method of searching for the duration information according to the mean, the variance and the second hidden layer vector by the monotone alignment search module 630 is referred to the prior art and will not be described in detail here.

[0158] Step 709: Obtain a standardized stream input vector according to the mean, the variance, and the duration information.

[0159] For example, a sampling vector is obtained by sampling from a normal distribution according to the mean and the variance, and then the sampling vector is copied and spliced ​​according to the duration to obtain a standardized stream input vector.

[0160] For a specific implementation of obtaining a standardized stream input vector according to the mean, the variance, and the duration information, refer to the prior art and will not be described in detail here.

[0161] Step 710: Use the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model.

[0162] For a specific implementation of using the standardized flow input vector as the reverse flow input of the standardized flow model 640 to obtain the third hidden layer vector output by the standardized flow model 640, refer to the prior art and will not be described in detail here.

[0163] Step 711: Decode the third hidden layer vector through the decoder to obtain an audio synthesis value.

[0164] The decoder 620 is used to decode the third hidden layer vector to obtain the audio synthesis value. For a specific implementation method, refer to the prior art and will not be described again here.

[0165] In some preferred embodiments, the decoder decodes the third hidden layer vector to obtain an audio synthesis value, including: randomly slicing the third hidden layer vector to obtain a vector representation of each slice; splicing the vector representation of each slice into a vector to be decoded; and decoding the vector to be decoded by the decoder to obtain an audio synthesis value. For example, the third hidden layer vector can be randomly sliced ​​to obtain a preset number of slices, and then the vector representations of some of the slices are randomly selected and spliced ​​as the vector to be decoded.

[0166] By using random slicing on the third hidden layer vector to reduce the input of the decoder, the training time can be reduced and the model training efficiency can be improved without affecting the training effect.

[0167] Step 712, obtaining the model loss of the speech synthesis model, wherein the model loss includes at least: the absolute value loss of the linear spectrum of the audio synthesis value and the audio true value, and the reverse flow loss of the standardized flow model, and the reverse flow loss is calculated according to the difference between the following first conditional distribution and second conditional distribution: the first conditional distribution of the third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and the second conditional distribution of the fourth hidden layer vector output by the posterior encoder under the condition of given audio.

[0168] In an embodiment of the present application, the model loss of the speech synthesis model further introduces the reverse flow loss of the standardized flow model on the basis of the training loss function of the VITS model in the prior art.

[0169] Optionally, the model loss of the speech synthesis model may be calculated by the following formula 4:

[0170] L total =L recon +L kl +L dur +L adv (G)+L fm (G)+Linf_flow ; Formula 4

[0171] In the above formula 5, L recon represents the reconstruction loss, that is, the absolute value loss of the linear spectrum of the true audio value and the linear spectrum of the audio prediction value; L kl represents the forward flow loss, that is, the conditional distribution q(z|c) and p(z|x lin )’s KL loss; L dur represents the duration loss, i.e., the mean square error loss between the phoneme duration of the true audio value and the phoneme duration of the audio prediction value; L adv (G) and L fm (G) represents the prediction loss and intermediate feature map loss of the discriminator in adversarial training; L inf_flow Indicates reverse flow loss.

[0172] Among them, the reconstruction loss L recon , forward flow loss L kl , duration loss L dur , L adv (G) and L fm The specific calculation method of (G) can be found in the prior art and will not be described in detail here.

[0173] The reverse flow loss can be calculated by the following formula 5:

[0174] L inf_flow =log p(z′|c)-log q(z′|x lin ); Formula 5

[0175] In the above formula 4, z′ represents the three hidden layer vectors of the reverse flow output of the standardized flow model, c represents the sample text, and x lin represents the true value of the audio corresponding to the sample text c. Among them, p(z′|c) represents the conditional distribution (i.e., the first conditional distribution) of the reverse flow output z′ under the condition of the given text c, q(z′|x lin ) represents the conditional distribution (i.e., the second conditional distribution) of the output of the posterior encoder under given audio conditions.

[0176] Step 713, iteratively training the speech synthesis model with the goal of optimizing the model loss.

[0177] Afterwards, the model parameters are updated using the stochastic gradient descent method to optimize the model loss until the number of iterations reaches the set value or the model loss converges, and the model is saved. Afterwards, the trained model is pruned to obtain Figure 2 Speech synthesis model with the structure shown.

[0178] In summary, the speech synthesis model training method disclosed in the embodiment of the present application improves the structure of the speech synthesis model, introduces an emotional semantic feature extraction module, performs semantic emotional extraction on the text input to the model, and fuses the extracted emotional semantic feature vector into the phoneme feature vector to obtain the mean and variance of the fused vector for coding prediction. The emotional and semantic information of the introduced text increases the complexity of the text prior distribution, shortens the distance between the prior distribution and the posterior distribution, and makes the final synthesis more expressive and emotional speech. On the other hand, in order to solve the problem that the audio is not natural enough and the expression is not enough due to the large gap between the audio prior distribution and the text posterior distribution, the present application introduces reverse flow loss in the training stage, sends the text prior distribution into the reverse flow module, calculates the KL distance between the output of the reverse flow module and the audio posterior distribution, and further shortens the gap between the prior distribution and the posterior distribution. Compared with the forward flow loss, the reverse flow loss focuses more on reducing the complexity of the audio posterior distribution. The reverse flow loss does not require the addition of model parameters, but only requires the addition of a calculation flow to the original model, which can be quickly implemented and has obvious optimization effect.

[0179] Reference Figure 8 The present application also discloses a speech synthesis device, which includes:

[0180] The target phoneme acquisition module 810 is used to perform word-to-phoneme conversion processing on the target text to obtain the target phoneme;

[0181] The emotional semantic feature vector acquisition module 820 is used to extract the semantic emotion of the target text to obtain the emotional semantic feature vector of the target text;

[0182] A phoneme feature vector acquisition module 830 is used to perform multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector;

[0183] A fusion vector acquisition module 840 is used to fuse the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector;

[0184] The duration information acquisition module 850 is used to perform random duration prediction on the fusion vector to obtain the duration information of each target phoneme;

[0185] A mean and variance acquisition module 860, used to acquire the mean and variance of the fusion vector;

[0186] The audio data acquisition module 870 is used to acquire the audio data corresponding to the target text according to the mean, the variance, and the duration information.

[0187] Optionally, the emotional semantic feature vector acquisition module 820 is further used to:

[0188] Performing semantic sentiment extraction on the target text to obtain a word-level embedding vector of the target text that carries sentiment information and semantic information;

[0189] Based on the distribution of the phoneme feature vector, fine-tune the distribution of the word-level embedding vector to obtain a fine-tuned vector;

[0190] The fine-tuning vector is aligned to the length of the target phoneme to obtain the emotional semantic feature vector of the target text.

[0191] Optionally, performing semantic sentiment extraction on the target text to obtain a word-level embedding vector of the target text carrying sentiment information and semantic information includes:

[0192] Performing word segmentation processing on the target text to obtain a subword sequence of the target text;

[0193] Add tags and vectorize the subword sequence to obtain a subword level vector sequence;

[0194] Performing multi-level semantic coding on the vector sequence, and performing adaptive weighted summation on hierarchical coding results obtained by the multi-level semantic coding to obtain the coding result;

[0195] The encoding result corresponding to the mark added at the starting position of the subword sequence is respectively merged with the encoding result of each subword in the subword sequence to obtain a vector representation of each subword;

[0196] According to the vector representation of each subword, a word-level embedding vector of the target text is obtained.

[0197] Optionally, the phoneme feature vector acquisition module 830 is further used to:

[0198] In the process of encoding the target phoneme using a multi-head attention mechanism, a first vector is obtained by performing a dot product operation on the Q vector and the K vector;

[0199] Performing a penalty process based on a relative position window on the first vector to suppress information outside a specified position window in the first vector, thereby obtaining a second vector;

[0200] Normalizing the second vector to obtain a weight matrix;

[0201] The phoneme feature vector is obtained according to the product of the weight matrix and the V vector.

[0202] Optionally, the fusion vector acquisition module 840 is further used to:

[0203] Performing layer normalization processing on the emotion semantic feature vector and the phoneme feature vector to obtain a normalized vector;

[0204] Perform linear projection on the normalized vector to obtain a fused vector.

[0205] Optionally, the mean and variance acquisition module 860 is further used to:

[0206] Performing linear projection on the fusion vector to obtain a projection vector;

[0207] The projection vector is evenly divided in the feature dimension direction to obtain the mean and variance.

[0208] The speech synthesis device disclosed in the embodiment of the present application is used to implement the speech synthesis method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here. Please refer to the specific implementation methods of the corresponding steps in the method embodiment.

[0209] The speech synthesis device disclosed in the embodiment of the present application obtains target phonemes by performing word-to-phoneme conversion processing on the target text; performs semantic emotion extraction on the target text to obtain the emotion semantic feature vector of the target text; performs multi-head attention encoding processing on the target phonemes to obtain phoneme feature vectors; performs fusion processing on the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector; performs random duration prediction on the fusion vector to obtain the duration information of each target phoneme; obtains the mean and variance of the fusion vector; obtains the audio data corresponding to the target text based on the mean, the variance, and the duration information, and increases the complexity of the text prior distribution by introducing the emotion and semantic information of the text to be synthesized, shortens the distance between the prior distribution and the posterior distribution, and finally synthesizes more expressive and emotional speech.

[0210] In the prior art, in order to improve the fitting ability of the model, the VITS model uses a normal distribution to model the audio posterior distribution, and uses a normal distribution and a dot product of the determinant output by the standardized flow model to model the text prior distribution, that is, the complexity of the text prior distribution is improved by the standardized flow model. The audio posterior distribution and the text prior distribution are two cross-modal data distributions. There is a phenomenon that the audio posterior distribution is far more complex than the text prior distribution. Although the standardized flow model is used to increase the representation ability of the text prior distribution, it is limited by the nonlinearity of the flow model. There is still a problem of too large a difference between the audio posterior distribution and the text prior distribution, resulting in a loss in the quality of speech synthesis. In the embodiment of the present application, by adding text-based semantic information and emotional information to the text prior distribution, the representation ability of the text prior distribution is further improved, the complexity of the text prior distribution is improved, and the distance between the prior distribution and the posterior distribution is shortened, thereby improving the quality of the synthesized speech. On the other hand, by introducing reverse flow loss in the training stage of the speech synthesis model, the complexity of the audio posterior distribution is reduced, thereby improving the expressiveness of the speech.

[0211] Reference Fig. 9 The embodiment of the present application also discloses a speech synthesis model training device, the speech synthesis model includes: a posterior encoder, a decoder, a monotone alignment search module, a normalized flow model, a random duration predictor, a local attention encoder, a phoneme conversion module, and an emotional semantic feature extraction module, the device includes:

[0212] The target phoneme acquisition module 901 is used to perform word-to-phoneme conversion processing on the sample text in the training sample through the phoneme conversion module for each training sample, so as to obtain the target phoneme;

[0213] A phoneme feature vector acquisition module 902 is used to perform multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector;

[0214] The emotional semantic feature vector acquisition module 903 is used to extract the semantic emotion of the sample text through the emotional semantic feature extraction module to obtain the emotional semantic feature vector of the sample text;

[0215] A fusion vector acquisition module 904 is used to fuse the emotion semantic feature vector and the phoneme feature vector through the local attention encoder to obtain a fusion vector;

[0216] A mean and variance acquisition module 905, used to obtain the mean and variance of the fusion vector through the local attention encoder;

[0217] A first hidden layer vector acquisition module 906 is used to obtain, through a posteriori encoder, a first hidden layer vector obtained by performing a posteriori encoding processing on the audio true value corresponding to the sample text;

[0218] A second hidden layer vector acquisition module 907, configured to process the first hidden layer vector through the standardized flow model to obtain a second hidden layer vector;

[0219] A duration information acquisition module 908, configured to search for duration information according to the mean, the variance and the second hidden layer vector through the monotone alignment search module;

[0220] A standardized stream input vector acquisition module 909, configured to obtain a standardized stream input vector according to the mean, the variance, and the duration information;

[0221] A third hidden layer vector acquisition module 910 is used to use the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model;

[0222] An audio synthesis module 911, configured to decode the third hidden layer vector through the decoder to obtain an audio synthesis value;

[0223] The loss calculation module 912 is used to obtain the model loss of the speech synthesis model, wherein the model loss includes at least: the absolute value loss of the linear spectrum of the audio synthesis value and the audio true value, and the reverse flow loss of the standardized flow model, and the reverse flow loss is calculated according to the difference between the following first conditional distribution and second conditional distribution: the first conditional distribution of the third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and the second conditional distribution of the fourth hidden layer vector output by the posterior encoder under the condition of given audio;

[0224] The iterative training module 913 is used to iteratively train the speech synthesis model with the goal of optimizing the model loss.

[0225] The speech synthesis model training device disclosed in the embodiment of the present application is used to implement the speech synthesis model training method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here, and reference can be made to the specific implementation methods of the corresponding steps in the method embodiment.

[0226] The speech synthesis model training device disclosed in the embodiment of the present application improves the structure of the speech synthesis model, introduces an emotional semantic feature extraction module, performs semantic emotional extraction on the text input into the model, and fuses the extracted emotional semantic feature vector into the phoneme feature vector, which is used to obtain the mean and variance of the fused vector for coding prediction. The emotional and semantic information of the introduced text increases the complexity of the text prior distribution, shortens the distance between the prior distribution and the posterior distribution, and makes the final synthesis more expressive and emotional speech. On the other hand, in order to solve the problem that the audio is not natural enough and the expression is not enough due to the large gap between the audio prior distribution and the text posterior distribution, the present application introduces the reverse flow loss in the training stage, sends the text prior distribution into the reverse flow module, calculates the KL distance between the output of the reverse flow module and the audio posterior distribution, and further shortens the gap between the prior distribution and the posterior distribution. Compared with the forward flow loss, the reverse flow loss focuses more on reducing the complexity of the audio posterior distribution. The reverse flow loss does not require the addition of model parameters, but only requires the addition of a calculation flow to the original model, which can be quickly implemented and has obvious optimization effect.

[0227] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0228] The above is a detailed introduction to a speech synthesis method and device, and a speech synthesis model training method and device provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0229] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0230] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiment of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0231] For example, Fig.10 An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device traditionally includes a processor 1010 and a memory 1020 and a program code 1030 stored on the memory 1020 and can be run on the processor 1010, and the processor 1010 implements the method described in the above embodiment when executing the program code 1030. The memory 1020 can be a computer program product or a computer-readable medium. The memory 1020 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 1020 has a storage space 10201 for the program code 1030 of the computer program for executing any method step in the above method. For example, the storage space 10201 for the program code 1030 can include various computer programs for implementing the various steps in the above method respectively. The program code 1030 is a computer-readable code. These computer programs can be read from one or more computer program products or written into the one or more computer program products. These computer program products include a program code carrier such as a hard disk, a compact disk (CD), a memory card or a floppy disk. The computer program includes a computer readable code, which, when executed on an electronic device, causes the electronic device to execute the method according to the above embodiments.

[0232] The embodiment of the present application also discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the speech synthesis method described in the embodiment of the present application are implemented.

[0233] Such a computer program product may be a computer-readable storage medium, which may have a computer-readable storage medium having a Fig.10The memory 1020 in the electronic device shown in the figure is similarly arranged as a storage segment, storage space, etc. The program code can be compressed and stored in the computer-readable storage medium in an appropriate form, for example. The computer-readable storage medium is generally a storage medium such as the reference Fig.11 The portable or fixed storage unit. Generally, the storage unit includes computer readable code 1030', which is a code read by a processor. When the code is executed by the processor, each step in the method described above is implemented.

[0234] The term "one embodiment", "embodiment" or "one or more embodiments" herein means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. In addition, please note that the examples of the term "in one embodiment" here do not necessarily all refer to the same embodiment.

[0235] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0236] In the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0237] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A speech synthesis method, characterized in that: Applied to a speech synthesis model, the method comprises: Performing word-to-phoneme conversion processing on the target text to obtain target phonemes; Performing semantic sentiment extraction on the target text to obtain a sentiment semantic feature vector of the target text; Performing multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector; Fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector; Performing random duration prediction on the fusion vector to obtain duration information of each target phoneme; Obtaining the mean and variance of the fused vector; Acquire audio data corresponding to the target text according to the mean, the variance, and the duration information; The step of performing semantic emotion extraction on the target text to obtain the emotional semantic feature vector of the target text includes: Performing semantic sentiment extraction on the target text to obtain a word-level embedding vector of the target text that carries sentiment information and semantic information; Based on the distribution of the phoneme feature vector, fine-tune the distribution of the word-level embedding vector to obtain a fine-tuned vector; The fine-tuning vector is aligned to the length of the target phoneme to obtain the emotional semantic feature vector of the target text.

2. The method according to claim 1, characterized in that The step of performing semantic sentiment extraction on the target text to obtain a word-level embedding vector of the target text that carries sentiment information and semantic information includes: Performing word segmentation processing on the target text to obtain a subword sequence of the target text; Add tags and vectorize the subword sequence to obtain a subword level vector sequence; Performing multi-level semantic coding on the vector sequence, and performing adaptive weighted summation on hierarchical coding results obtained by the multi-level semantic coding to obtain the coding result; The encoding result corresponding to the mark added at the starting position of the subword sequence is respectively merged with the encoding result of each subword in the subword sequence to obtain a vector representation of each subword; According to the vector representation of each subword, a word-level embedding vector of the target text is obtained.

3. The method according to claim 1, characterized in that The multi-head attention encoding process is performed on the target phoneme to obtain a phoneme feature vector, including: In the process of encoding the target phoneme using a multi-head attention mechanism, a first vector is obtained by performing a dot product operation on the Q vector and the K vector; Performing a penalty process based on a relative position window on the first vector to suppress information outside a specified position window in the first vector, thereby obtaining a second vector; Normalizing the second vector to obtain a weight matrix; The phoneme feature vector is obtained according to the product of the weight matrix and the V vector.

4. The method according to claim 1, characterized in that: The step of fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector includes: Performing layer normalization processing on the emotion semantic feature vector and the phoneme feature vector to obtain a normalized vector; Perform linear projection on the normalized vector to obtain a fused vector.

5. The method according to claim 1, characterized in that: The obtaining the mean and variance of the fusion vector includes: Performing linear projection on the fusion vector to obtain a projection vector; The projection vector is evenly divided in the feature dimension direction to obtain the mean and variance.

6. A speech synthesis model training method, characterized in that: The speech synthesis model includes: a posterior encoder, a decoder, a monotone alignment search module, a standardized flow model, a random duration predictor, a local attention encoder, a phoneme conversion module, and an emotional semantic feature extraction module. The method includes: For each training sample, the phoneme conversion module performs word-to-phoneme conversion processing on the sample text in the training sample to obtain the target phoneme; Performing multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector; The sentiment semantic feature extraction module is used to extract the sentiment semantics of the sample text to obtain the sentiment semantic feature vector of the sample text; By using the local attention encoder, the emotional semantic feature vector and the phoneme feature vector are fused to obtain a fusion vector; Obtaining the mean and variance of the fusion vector through the local attention encoder; Obtaining, through a posteriori encoder, a first hidden layer vector obtained by performing posteriori encoding processing on a true audio value corresponding to the sample text; Processing the first hidden layer vector by the standardized flow model to obtain a second hidden layer vector; By using the monotone alignment search module, searching for duration information according to the mean, the variance and the second hidden layer vector; Obtaining a standardized stream input vector according to the mean, the variance, and the duration information; Using the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model; Decoding the third hidden layer vector by the decoder to obtain an audio synthesis value; Obtaining a model loss of the speech synthesis model, wherein the model loss includes at least: an absolute value loss of a linear spectrum of the audio synthesis value and the audio true value, and a reverse flow loss of the standardized flow model, wherein the reverse flow loss is calculated based on the difference between the following first conditional distribution and second conditional distribution: a first conditional distribution of a third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and a second conditional distribution of a fourth hidden layer vector output by the posterior encoder under the condition of given audio; Iteratively training the speech synthesis model with the goal of optimizing the model loss; The step of extracting semantic sentiment from the sample text by the sentiment semantic feature extraction module to obtain the sentiment semantic feature vector of the sample text includes: Performing semantic sentiment extraction on the sample text to obtain a word-level embedding vector of the sample text that carries sentiment information and semantic information; Based on the distribution of the phoneme feature vector, fine-tune the distribution of the word-level embedding vector to obtain a fine-tuned vector; The fine-tuning vector is aligned to the length of the target phoneme to obtain the sentiment semantic feature vector of the sample text.

7. A speech synthesis device, characterized in that: Applied to a speech synthesis model, the device comprises: A target phoneme acquisition module is used to perform word-to-phoneme conversion processing on the target text to obtain the target phoneme; An emotional semantic feature vector acquisition module is used to extract the semantic emotion of the target text to obtain the emotional semantic feature vector of the target text; A phoneme feature vector acquisition module is used to perform multi-head attention encoding processing on the target phoneme to obtain a phoneme feature vector; A fusion vector acquisition module, used for fusing the emotion semantic feature vector and the phoneme feature vector to obtain a fusion vector; A duration information acquisition module, used for performing random duration prediction on the fusion vector to obtain duration information of each target phoneme; A mean and variance acquisition module, used to acquire the mean and variance of the fusion vector; An audio data acquisition module, used to acquire the audio data corresponding to the target text according to the mean, the variance, and the duration information; Among them, the emotional semantic feature vector acquisition module is also used to perform semantic emotion extraction on the target text to obtain a word-level embedding vector carrying emotional information and semantic information of the target text; based on the distribution of the phoneme feature vector, fine-tune the distribution of the word-level embedding vector to obtain a fine-tuning vector; align the fine-tuning vector to the length of the target phoneme to obtain the emotional semantic feature vector of the target text.

8. A speech synthesis model training device, characterized in that: The speech synthesis model includes: a posterior encoder, a decoder, a monotone alignment search module, a standardized flow model, a random duration predictor, a local attention encoder, a phoneme conversion module, and an emotional semantic feature extraction module. The device includes: A target phoneme acquisition module is used to perform word-to-phoneme conversion processing on the sample text in the training sample through the phoneme conversion module for each training sample, so as to obtain the target phoneme; A phoneme feature vector acquisition module, used to perform multi-head attention encoding processing on the target phoneme through the local attention encoder to obtain a phoneme feature vector; An emotional semantic feature vector acquisition module is used to extract the semantic emotion of the sample text through the emotional semantic feature extraction module to obtain the emotional semantic feature vector of the sample text; A fusion vector acquisition module, used to fuse the emotion semantic feature vector and the phoneme feature vector through the local attention encoder to obtain a fusion vector; A mean and variance acquisition module, used to obtain the mean and variance of the fusion vector through the local attention encoder; A first hidden layer vector acquisition module is used to obtain, through a posteriori encoder, a first hidden layer vector obtained by performing a posteriori encoding processing on the audio true value corresponding to the sample text; A second hidden layer vector acquisition module, used for processing the first hidden layer vector through the standardized flow model to obtain a second hidden layer vector; A duration information acquisition module, configured to search for duration information according to the mean, the variance and the second hidden layer vector through the monotone alignment search module; A standardized stream input vector acquisition module, used to obtain a standardized stream input vector according to the mean, the variance, and the duration information; A third hidden layer vector acquisition module, used for taking the standardized flow input vector as the reverse flow input of the standardized flow model to obtain a third hidden layer vector output by the standardized flow model; An audio synthesis module, used for decoding the third hidden layer vector through the decoder to obtain an audio synthesis value; A loss calculation module, used to obtain the model loss of the speech synthesis model, wherein the model loss includes at least: the absolute value loss of the linear spectrum of the audio synthesis value and the audio true value, and the reverse flow loss of the standardized flow model, and the reverse flow loss is calculated according to the difference between the following first conditional distribution and second conditional distribution: the first conditional distribution of the third hidden layer vector of the reverse flow output of the standardized flow model under the condition of given text, and the second conditional distribution of the fourth hidden layer vector output by the posterior encoder under the condition of given audio; An iterative training module, used for iteratively training the speech synthesis model with the goal of optimizing the model loss; Among them, the emotional semantic feature vector acquisition module is also used to perform semantic emotion extraction on the sample text to obtain a word-level embedding vector carrying emotional information and semantic information of the sample text; based on the distribution of the phoneme feature vector, fine-tune the distribution of the word-level embedding vector to obtain a fine-tuning vector; align the fine-tuning vector to the length of the target phoneme to obtain the emotional semantic feature vector of the sample text.

9. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, characterized in that: When the processor executes the program code, the method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium having program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Voice synthesis method and device, computer equipment and computer readable storage medium

    CN111108549A

  • Speech synthesis model training method, speech synthesis method and related device

    CN116129863A

  • Speech synthesis method, speech synthesis device, electronic equipment and storage medium

    CN116665639A