Speech synthesis method and device, electronic equipment and storage medium

By training the speech synthesis model and adding gender, age and emotional information, the problem of traditional speech synthesis systems being unable to generate natural and smooth speech is solved, and efficient speech synthesis without the need to build a speech library in advance is achieved.

CN118609540APending Publication Date: 2024-09-06BEIJING YUANJIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410784996.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Traditional speech synthesis systems cannot convert into speech when there is no speech corresponding to text, and waveform splicing synthesis technology cannot generate natural and smooth speech.

Method used

By obtaining the feature data and text data of the speech sample data provided by the voice provider, the feature extraction model and the speech synthesis model are trained, and the feature adapter, phoneme encoding unit and mel spectrum decoding unit are used to add gender, age and emotion information to generate natural And smooth voice.

Benefits of technology

There is no need to build a speech library in advance, it can effectively synthesize natural and smooth speech, avoid the situation where text cannot be converted into speech, and improve the quality and accuracy of speech synthesis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609540A
    Figure CN118609540A
Patent Text Reader

Abstract

The invention provides a voice synthesis method and device, electronic equipment and a storage medium, and the method comprises the steps: inputting voice feature data corresponding to voice sample data provided by each voice provider into a feature extraction model, and obtaining voice provider feature data corresponding to each voice provider; taking the voice provider feature data and the text data corresponding to each voice provider as sample data, taking voice sample data provided by each voice provider as a label, and training a voice synthesis model corresponding to each voice provider; and performing voice synthesis according to the trained voice synthesis models corresponding to the voice providers. The speech synthesis model is trained through the speech provider feature data corresponding to each speech provider, so that natural and smooth speech is synthesized through the trained speech synthesis model, a speech library does not need to be established in advance, and the situation that a text cannot be converted into speech is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of speech synthesis technology, and in particular to a speech synthesis method, device, electronic equipment and storage medium. Background Art

[0002] Speech synthesis, also known as text-to-speech technology, can convert any text into speech. Traditional speech synthesis systems usually consist of two modules: the front-end and the back-end. The front-end module is mainly used to analyze the input text information and extract linguistic information. The back-end module generates speech based on the waveform splicing synthesis technology method according to the front-end analysis results. In the waveform splicing synthesis technology, the speech corresponding to the text is selected from the speech library by using a dynamic programming algorithm, and the selected speech is energy regularized and waveform spliced.

[0003] However, when there is no speech corresponding to the text in the speech library, the text cannot be converted into speech. In addition, the waveform splicing synthesis technology simply connects the selected speech in series, resulting in the inability to obtain natural and fluent speech. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a speech synthesis method, device, electronic device and storage medium, which can synthesize natural and fluent speech without establishing a speech library in advance, avoiding the situation where text cannot be converted into speech.

[0005] In a first aspect, an embodiment of the present application provides a speech synthesis method, the speech synthesis method comprising:

[0006] Acquire voice feature data and text data corresponding to the voice sample data provided by each voice provider;

[0007] Inputting speech feature data corresponding to speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider;

[0008] The feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data;

[0009] The voice provider feature data and text data corresponding to each voice provider are used as sample data, and the voice sample data provided by each voice provider is used as a label to train the speech synthesis model corresponding to each voice provider;

[0010] Speech synthesis is performed according to the speech synthesis models corresponding to each speech provider that has been trained.

[0011] In a possible implementation, the voice provider feature data includes the gender, age and emotion of the voice provider; the speech synthesis model includes a feature adapter, a phoneme encoding unit, and a mel spectrum decoding unit; the voice provider feature data and text data corresponding to each voice provider are used as sample data, and the voice sample data of each voice provider is used as a label to train the speech synthesis model, including:

[0012] Inputting the gender, age and emotion in the voice provider feature data corresponding to the voice provider into the feature adapter respectively, and updating the gender parameter, age parameter and emotion parameter in the feature adapter;

[0013] The phonemes corresponding to the text data are input into the phoneme coding unit in the speech synthesis model to obtain the initial phoneme coding features corresponding to the text data;

[0014] Inputting the initial phoneme coding feature into the feature adapter, so that the feature adapter adds gender information, age information and emotion information to the initial phoneme coding feature according to the gender parameter, age parameter and emotion parameter, and obtains the target phoneme coding feature;

[0015] The target phoneme encoding feature is position-encoded and then input into the Mel spectrum decoding unit for decoding to obtain the synthesized speech corresponding to the text data;

[0016] The speech synthesis model is updated according to the synthesized speech and speech sample data to obtain the final speech synthesis model.

[0017] In a possible implementation, performing speech synthesis according to the speech synthesis models corresponding to the trained speech providers includes:

[0018] Obtain the text to be synthesized and the voice provider input by the user;

[0019] The text to be synthesized is input into the speech synthesis model corresponding to the speech provider to obtain the speech corresponding to the text to be synthesized.

[0020] In a possible implementation, the voice sample data is time domain data, and acquiring voice feature data corresponding to the voice sample data provided by each voice provider includes:

[0021] Pre-emphasize the speech sample data;

[0022] According to a preset time interval, the pre-emphasized voice sample data is framed to obtain a voice sample frame; wherein the duration of the voice sample frame is greater than the preset time interval;

[0023] Convert each speech sample frame into frequency domain data to obtain speech sample frequency domain data;

[0024] The Mel-frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame are extracted to obtain speech feature data corresponding to the speech sample data.

[0025] In a possible implementation, extracting Mel-frequency cepstral coefficient MFCC features of speech sample frequency domain data corresponding to each speech sample frame includes:

[0026] Input the speech sample frequency domain data corresponding to each speech sample frame into the following formula to obtain the Mel frequency cepstral coefficient MFCC feature;

[0027]

[0028] Among them, C(n) is the nth order Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame, M is the number of speech sample frequency domain data corresponding to each speech sample frame, s(m) is the logarithm of the mth speech sample frequency domain data corresponding to each speech sample frame, and L is the preset order of the Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame.

[0029] In a possible implementation, the method further includes:

[0030] Obtain the fundamental frequency, energy, and duration of the voice sample data provided by each voice provider;

[0031] The voice provider feature data, text data, fundamental frequency, energy and duration corresponding to each voice provider are used as sample data, and the voice sample data of each voice provider is used as a label to train the speech synthesis model corresponding to each voice provider.

[0032] In a second aspect, an embodiment of the present application further provides a speech synthesis device, the speech synthesis device comprising:

[0033] An acquisition module, used to acquire voice feature data and text data corresponding to the voice sample data provided by each voice provider;

[0034] An input module, used to input the voice feature data corresponding to the voice sample data provided by each voice provider into the feature extraction model to obtain the voice provider feature data corresponding to each voice provider;

[0035] The feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data;

[0036] A training module, used to train a speech synthesis model corresponding to each speech provider by using speech provider feature data and text data corresponding to each speech provider as sample data and speech sample data provided by each speech provider as a label;

[0037] The synthesis module is used to perform speech synthesis according to the speech synthesis models corresponding to each speech provider that has been trained.

[0038] In a possible implementation, the speech provider feature data includes the gender, age and emotion of the speech provider; the speech synthesis model includes a feature adapter, a phoneme encoding unit, and a mel-spectrogram decoding unit; a training module is specifically used to input the gender, age and emotion in the speech provider feature data corresponding to the speech provider into the feature adapter respectively, and update the gender parameter, age parameter and emotion parameter in the feature adapter; and input the phonemes corresponding to the text data into the phoneme encoding unit in the speech synthesis model to obtain the initial phoneme encoding features corresponding to the text data; input the initial phoneme encoding features into the feature adapter so that the feature adapter adds gender information, age information and emotion information to the initial phoneme encoding features according to the gender parameter, age parameter and emotion parameter to obtain the target phoneme encoding features; the target phoneme encoding features are position-encoded and input into the mel-spectrogram decoding unit for decoding to obtain the synthesized speech corresponding to the text data; the speech synthesis model is updated according to the synthesized speech and speech sample data to obtain the final speech synthesis model.

[0039] In a possible implementation, the synthesis module is specifically used to obtain the text to be synthesized and the voice provider input by the user; input the text to be synthesized into the voice synthesis model corresponding to the voice provider to obtain the voice corresponding to the text to be synthesized.

[0040] In a possible implementation, the speech sample data is time domain data, and the acquisition module 301 is specifically used to pre-emphasize the speech sample data; frame the pre-emphasized speech sample data according to a preset time interval to obtain a speech sample frame; wherein the duration of the speech sample frame is greater than the preset time interval; convert each speech sample frame into frequency domain data to obtain speech sample frequency domain data; extract the Mel frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame to obtain speech feature data corresponding to the speech sample data.

[0041] In a possible implementation, the acquisition module is further used to:

[0042] Input the speech sample frequency domain data corresponding to each speech sample frame into the following formula to obtain the Mel frequency cepstral coefficient MFCC feature;

[0043]

[0044] Among them, C(n) is the nth order Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame, M is the number of speech sample frequency domain data corresponding to each speech sample frame, s(m) is the logarithm of the mth speech sample frequency domain data corresponding to each speech sample frame, and L is the preset order of the Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame.

[0045] In a possible implementation manner, the acquisition module is further used to acquire the fundamental frequency, energy, and duration corresponding to the voice sample data provided by each voice provider;

[0046] The training module is also used to train the speech synthesis model corresponding to each speech provider by using the speech provider feature data, text data, fundamental frequency, energy and duration corresponding to each speech provider as sample data and the speech sample data of each speech provider as labels.

[0047] In a third aspect, an embodiment of the present application further provides an electronic device comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of any speech synthesis method as described in the first aspect.

[0048] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any speech synthesis method in the first aspect are executed.

[0049] The embodiment of the present application provides a speech synthesis method, device, electronic device and storage medium, the method comprising: obtaining speech feature data and text data corresponding to speech sample data provided by each speech provider; inputting the speech feature data corresponding to the speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider; wherein the feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data; using the speech provider feature data and text data corresponding to each speech provider as sample data and the speech sample data provided by each speech provider as a label to train the speech synthesis model corresponding to each speech provider; and performing speech synthesis according to the speech synthesis model corresponding to each speech provider that has been trained. The present application trains the speech synthesis model through the speech provider feature data corresponding to each speech provider, so as to synthesize natural and fluent speech through the trained speech synthesis model, without the need to establish a speech library in advance, to avoid the situation where text cannot be converted into speech. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A flow chart of a speech synthesis method provided by an embodiment of the present application is shown;

[0052] Figure 2 A flowchart of another speech synthesis method provided by an embodiment of the present application is shown;

[0053] Figure 3 A schematic diagram of the structure of a speech synthesis device provided in an embodiment of the present application is shown;

[0054] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0055] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme 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. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0056] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0057] In order to enable those skilled in the art to use the contents of this application, the following implementation is provided in conjunction with a specific application scenario, "the field of speech synthesis technology". For those skilled in the art, the general principles defined herein may be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is mainly described around the "field of speech synthesis technology", it should be understood that this is only an exemplary embodiment.

[0058] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0059] The following is a detailed description of a speech synthesis method provided in an embodiment of the present application.

[0060] Reference Figure 1 As shown, it is a flowchart of a speech synthesis method provided in an embodiment of the present application. The specific execution process of the speech synthesis method is as follows:

[0061] S101. Acquire voice feature data and text data corresponding to voice sample data provided by each voice provider.

[0062] S102: Input the speech feature data corresponding to the speech sample data provided by each speech provider into a feature extraction model to obtain the speech provider feature data corresponding to each speech provider.

[0063] S103: Use the voice provider feature data and text data corresponding to each voice provider as sample data, and the voice sample data provided by each voice provider as a label to train the speech synthesis model corresponding to each voice provider.

[0064] S104: Perform speech synthesis according to the speech synthesis models corresponding to the trained speech providers.

[0065] The embodiment of the present application provides a speech synthesis method, which includes: inputting speech feature data corresponding to speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider; using speech provider feature data and text data corresponding to each speech provider as sample data, and the speech sample data provided by each speech provider as a label, to train a speech synthesis model corresponding to each speech provider; and performing speech synthesis according to the speech synthesis model corresponding to each speech provider that has been trained. The present application trains the speech synthesis model through the speech provider feature data corresponding to each speech provider, so as to synthesize natural and fluent speech through the trained speech synthesis model, without the need to establish a speech library in advance, to avoid the situation where text cannot be converted into speech.

[0066] The following is a description of the exemplary steps of the present application embodiment:

[0067] S101. Acquire voice feature data and text data corresponding to voice sample data provided by each voice provider.

[0068] In the implementation manner of the present application, each voice provider provides multiple voices corresponding to various emotions (such as happiness, sadness, calmness, excitement) to obtain voice sample data (the voice sample data is time domain data); and the text data corresponding to each voice sample data and the voice feature data corresponding to each voice sample data are obtained through the voice provider providing or software recognition. The voice feature data can be Mel-frequency cepstral coefficient MFCC features, or other features that can characterize the voice sample data, without limiting the specific features used.

[0069] Among them, MFCC means Mel frequency cepstral coefficient. As the name suggests, MFCC feature acquisition includes two key steps: converting the speech signal into Mel frequency and then performing cepstral analysis. Mel spectrum is a spectrum that can be used to represent short-term audio, and Mel scale is a nonlinear frequency scale determined based on the human ear's sensory judgment of equally spaced pitch changes.

[0070] For example, a voice provider provides multiple voices corresponding to happiness, multiple voices corresponding to sadness, multiple voices corresponding to calmness, and multiple voices corresponding to excitement, and obtains multiple voice sample data; obtains text data corresponding to each voice corresponding to happiness, text data corresponding to each voice corresponding to sadness, text data corresponding to each voice corresponding to calmness, and text data corresponding to each voice corresponding to excitement; obtains voice feature data corresponding to each voice corresponding to happiness, voice feature data corresponding to sadness, voice feature data corresponding to calmness, and voice feature data corresponding to excitement.

[0071] Furthermore, if the speech feature data is a Mel-frequency cepstral coefficient MFCC feature, the speech feature data corresponding to the speech sample data provided by each speech provider is obtained through the following steps:

[0072] Step 1: pre-emphasize the speech sample data.

[0073] In the implementation mode of the present application, a high-pass filter is used to implement pre-emphasis of the speech sample data, and the calculation formula is as follows:

[0074] y(t)=x(t)-αx(t-1);

[0075] Among them, y(t) is the pre-emphasized value of the sampling point at time t in the speech sample data, x(t) is the value of the sampling point at time t in the speech sample data, x(t-1) is the value of the sampling point at time t-1 in the speech sample data, and α is the preset weight of pre-emphasis.

[0076] Here, usually the high-frequency energy in the speech sample data is smaller than the low-frequency energy. The pre-emphasis is mainly used to amplify the high frequency and eliminate the effects of the vocal cords and lips during the phonation process to compensate for the high-frequency part of the speech signal suppressed by the pronunciation system. α is usually taken as 0.97.

[0077] Step 2: according to a preset time interval, the pre-emphasized speech sample data is divided into frames to obtain speech sample frames; wherein the duration of the speech sample frame is greater than the preset time interval.

[0078] In an implementation manner of the present application, starting from the sampling point corresponding to the value of the integer multiple of the preset time interval in the pre-emphasized speech sample data, the speech sample data of the preset frame duration is intercepted backward to obtain a speech sample frame; wherein the integer multiple includes 0.

[0079] For example, the duration of the pre-emphasized speech sample data is 29s, the preset duration interval is 10s, and the preset frame duration is 15s. The sampling points corresponding to the values ​​of the integer multiples of the preset duration interval in the pre-emphasized speech sample data are the sampling point of the 0th s, the sampling point of the 10th s, and the sampling point of the 20th s; the speech sample data from the 0th to the 15th s, the speech sample data from the 10th to the 25th s, and the speech sample data from the 20th to the 29th s in the pre-emphasized speech sample data are determined as speech sample frames.

[0080] Here, the present application limits the duration of the speech sample frame to be greater than the preset duration interval, so that there is an overlapping part between two adjacent frames, avoiding too large a difference between consecutive frames, improving the accuracy of the subsequent feature extraction model, and then improving the accuracy of speech synthesis, so that text can be converted into natural and fluent speech.

[0081] In addition, the basic principle of this step is that the frequency in the speech signal changes with time. In most cases, it is meaningless to perform feature extraction on the entire signal because the speech signal loses the frequency contour of the signal as the duration increases. To avoid this, we can safely assume that the frequency in the signal is fixed in a short time. Therefore, the pre-emphasized speech sample data is framed and feature extracted to obtain a good approximation of the signal frequency contour.

[0082] Step 3: Convert each speech sample frame into frequency domain data to obtain speech sample frequency domain data.

[0083] In the implementation manner of the present application, each speech sample frame is windowed; each windowed speech sample frame is sequentially Fourier transformed; the power spectrum corresponding to each transformed speech sample frame is calculated to obtain initial speech sample frequency domain data; the initial speech sample frequency domain data is filtered to obtain final speech sample frequency domain data.

[0084] Furthermore, a window function, such as a Hamming Window, is applied to each speech sample frame. The Hamming Window has the following form:

[0085]

[0086] Wherein, w is the window of the speech sample frame, 0≤j≤N-1, N is the window length, and N can be 400.

[0087] Furthermore, the power spectrum corresponding to each transformed speech sample frame is calculated by the following formula:

[0088]

[0089] Among them, p is the frequency domain data of the initial speech sample, FFT(x i ) is each speech sample frame x after Fourier transformation i .

[0090] Furthermore, the frequency domain data of the initial speech samples are filtered through a set of triangular filters with a Mel scale (usually 40 filters) to extract the frequency bands. The purpose of the Mel scale is to simulate the nonlinear perception of sound by the human ear, which is more discriminating at lower frequencies and less discriminating at higher frequencies. Calculation method: For each filter, each frequency of the frequency domain data of each initial speech sample is multiplied and added with each filter respectively. The obtained value is the energy value of the frequency domain data of each initial speech sample in the frequency band corresponding to the filter, that is, the final frequency domain data of the speech sample.

[0091] Step 4: extract the Mel-frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame to obtain speech feature data corresponding to the speech sample data.

[0092] Specifically, the speech sample frequency domain data corresponding to each speech sample frame is input into the following formula to obtain the Mel frequency cepstral coefficient MFCC feature;

[0093]

[0094] Among them, C(n) is the nth order Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame, M is the number of speech sample frequency domain data corresponding to each speech sample frame, s(m) is the logarithm of the mth speech sample frequency domain data corresponding to each speech sample frame, and L is the preset order of the Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame.

[0095] Here, the filter bank coefficients in the previous step are highly correlated, and we can apply discrete cosine transform (DCT) to decorrelate the filter bank coefficients and produce a compressed representation of the filter bank.

[0096] S102: Input the speech feature data corresponding to the speech sample data provided by each speech provider into a feature extraction model to obtain the speech provider feature data corresponding to each speech provider.

[0097] In the implementation mode of the present application, the voice provider feature data includes the gender (male, female, etc.), age (child, youth, elderly, etc.) and emotions (happy, sad, calm, excited, etc.) of the voice provider; wherein the feature extraction model is obtained by training the voice sample feature data corresponding to the various voice provider feature data and the corresponding voice provider feature data. The Transformer model includes a gender branch, an age branch and an emotion branch, each of which has a specific dimension; the gender branch is used to output the gender of the voice provider of the voice sample data; the age branch is used to output the age of the voice provider of the voice sample data; and the emotion branch is used to output the emotion of the voice provider of the voice sample data.

[0098] Furthermore, when the model is updated, the gender branch, age branch, and emotion branch output the losses of gender characteristics, age characteristics, and emotion characteristics respectively, and continuously update the Transformer parameters through gradient feedback to train the Transformer model.

[0099] Here, the Transformer model is a deep learning model based entirely on the self-attention mechanism, which was first proposed by Google Brain in the paper "Attention is all you need". It is suitable for parallel computing, and due to the complexity of the model itself, it is higher in accuracy and performance than the previously popular RNN recurrent neural network. The Transformer model is essentially an Encoder-Decoder architecture, consisting of an encoding component and a decoding component. Among them, the encoding component consists of multiple layers of encoders (6 layers of encoders are used in the paper), and the decoding component is also composed of decoders with the same number of layers. Each encoder contains two sub-layers, namely the Self-Attention layer and the Feed Forward Network (abbreviated as FFN). The focus of the Transformer model is the Self-Attention structure, in which the Q (query), K (key value), and V (value) matrices used are obtained by linear transformation of the output. There are multiple Self-Attention structures in the model, which can capture the correlation coefficient attention score between words in multiple dimensions.

[0100] S103: Use the voice provider feature data and text data corresponding to each voice provider as sample data, and the voice sample data provided by each voice provider as a label to train the speech synthesis model corresponding to each voice provider.

[0101] In the implementation mode of the present application, each voice provider corresponds to a speech synthesis model; the voice provider feature data of each voice provider is different. The speech synthesis model is constructed based on Fastspeech2, including a feature adapter, a phoneme encoding unit, and a mel spectrum decoding unit. Fastspeech2 is a fast and high-quality end-to-end text-to-speech technology that does not require external alignment models and tools.

[0102] Specifically, the speech synthesis model is trained through the following steps:

[0103] Step 1: input the gender, age and emotion in the voice provider feature data corresponding to the voice provider into the feature adapter respectively, and update the gender parameter, age parameter and emotion parameter in the feature adapter.

[0104] In an embodiment of the present application, the feature adapter includes a gender predictor, an age predictor and an emotion predictor; the gender in the voice provider feature data corresponding to the voice provider is input into the gender predictor in the feature adapter to update the gender parameter in the gender predictor; the age in the voice provider feature data corresponding to the voice provider is input into the age predictor in the feature adapter to update the age parameter in the age predictor; the emotion in the voice provider feature data corresponding to the voice provider is input into the emotion predictor in the feature adapter to update the emotion parameter in the emotion predictor.

[0105] Step 2: Input the phonemes corresponding to the text data into the phoneme coding unit in the speech synthesis model to obtain the initial phoneme coding features corresponding to the text data.

[0106] In an embodiment of the present application, the phoneme encoding unit includes a phoneme embedding layer and an encoder; the phonemes of the text data are positionally encoded and input into the phoneme embedding layer in the speech synthesis model to convert the phonemes into a high-dimensional direction to obtain a phoneme embedding sequence; the phoneme embedding sequence is input into the encoder to convert the input phoneme embedding sequence into a hidden phoneme sequence to obtain the initial phoneme encoding features corresponding to the text data.

[0107] Among them, phonemes are the smallest units of speech. For example, the sound fā in “fa” is a syllable, which can be further analyzed into two phonemes, f and a. Phonemes include two categories: vowels (also called vowels) and consonants (also called consonants).

[0108] Step 3: Input the initial phoneme coding features into the feature adapter, so that the feature adapter adds gender features, age features and emotion features to the initial phoneme coding features according to the gender parameters, age parameters and emotion parameters to obtain the target phoneme coding features.

[0109] In the implementation mode of the present application, the function of the feature adapter is to add gender information, age information, and emotion information to the initial phoneme coding features. Specifically, the gender predictor in the feature adapter adds gender information to the initial phoneme coding features; the age predictor in the feature adapter adds age information to the initial phoneme coding features; and the emotion predictor in the feature adapter adds emotion information to the initial phoneme coding features.

[0110] Step 4: After position encoding of the target phoneme encoding feature, the feature is input into the Mel spectrum decoding unit for decoding to obtain the synthesized speech corresponding to the text data.

[0111] In the implementation manner of the present application, the function of the Mel spectrum decoding unit is to convert the target phoneme coding feature into a Mel spectrum sequence. The Mel spectrum is a way to identify an audio signal. The target phoneme coding feature is position-encoded and input into the Mel spectrum decoding unit for decoding. The Mel spectrum obtained is the synthesized speech corresponding to the text data.

[0112] Step 5: Update the speech synthesis model based on the synthesized speech and speech sample data to obtain the final speech synthesis model.

[0113] S104: Perform speech synthesis according to the speech synthesis models corresponding to the trained speech providers.

[0114] In the implementation manner of the present application, the text to be synthesized and the voice provider input by the user are obtained; the text to be synthesized is input into the speech synthesis model corresponding to the voice provider to obtain the speech corresponding to the text to be synthesized.

[0115] Reference Figure 2 As shown, it is a flowchart of another speech synthesis method provided in an embodiment of the present application. The contents repeated in steps S201 to S204 and steps S101 to S104 are not repeated here. The exemplary steps of the embodiment of the present application are described below:

[0116] S201. Acquire speech feature data, text data, fundamental frequency, energy, and duration corresponding to speech sample data provided by each speech provider.

[0117] Among them, voiced sounds are produced by the vibration of the vocal cords, which will produce a sound wave. We call this sound wave the fundamental wave, and the frequency of this fundamental wave is called the fundamental frequency. The fundamental frequency can correspond to the pitch we usually say. The high and low pitch of singing corresponds to the high and low fundamental frequency of the sound. Energy usually refers to the energy of each frame of speech in the time domain, the square of the amplitude.

[0118] S202: Input the speech feature data corresponding to the speech sample data provided by each speech provider into a feature extraction model to obtain the speech provider feature data corresponding to each speech provider.

[0119] The feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data.

[0120] S203: Use the voice provider feature data, text data, fundamental frequency, energy and duration corresponding to each voice provider as sample data, and the voice sample data of each voice provider as a label to train the speech synthesis model corresponding to each voice provider.

[0121] In an embodiment of the present application, the gender, age, emotion, fundamental frequency, energy and duration in the voice provider feature data corresponding to the voice provider are respectively input into the feature adapter, and the gender parameters, age parameters, emotion parameters, fundamental frequency parameters, energy parameters and duration parameters in the feature adapter are updated; and the phonemes corresponding to the text data are input into the phoneme coding unit in the speech synthesis model to obtain the initial phoneme coding features corresponding to the text data; the initial phoneme coding features are input into the feature adapter so that the feature adapter adds gender information, age information, emotion information, fundamental frequency information, energy information and duration information to the initial phoneme coding features according to the gender parameters, age parameters, emotion parameters, fundamental frequency parameters, energy parameters and duration parameters to obtain the target phoneme coding features; the target phoneme coding features are position-encoded and then input into the Mel-spectrogram decoding unit for decoding to obtain the synthesized speech corresponding to the text data; the speech synthesis model is updated according to the synthesized speech and speech sample data to obtain the final speech synthesis model.

[0122] Among them, the feature adapter in the speech synthesis model includes not only the gender predictor, age predictor and emotion predictor, but also the fundamental frequency predictor, energy predictor and duration predictor; the fundamental frequency predictor, energy predictor and duration predictor are the same as the gender predictor, age predictor and emotion predictor; the fundamental frequency corresponding to the speech sample data is used to update the fundamental frequency parameters in the fundamental frequency predictor; the energy corresponding to the speech sample data is used to update the energy parameters in the energy predictor; the duration corresponding to the speech sample data is used to update the duration parameters in the duration predictor.

[0123] S204: Perform speech synthesis according to the speech synthesis models corresponding to the trained speech providers.

[0124] An embodiment of the present application provides another speech synthesis method, which can add gender information, age information, emotion information, fundamental frequency information, energy information and duration information to text information to obtain a more natural and fluent speech.

[0125] Based on the same inventive concept, a speech synthesis device corresponding to the speech synthesis method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned speech synthesis method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0126] Reference Figure 3 FIG. 1 is a schematic diagram of a speech synthesis device provided in an embodiment of the present application, wherein the speech synthesis device comprises:

[0127] An acquisition module 301 is used to acquire voice feature data and text data corresponding to the voice sample data provided by each voice provider;

[0128] An input module 302, used to input speech feature data corresponding to speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider;

[0129] The feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data;

[0130] A training module 303 is used to train the speech synthesis model corresponding to each speech provider by using the speech provider feature data and text data corresponding to each speech provider as sample data and the speech sample data provided by each speech provider as a label;

[0131] The synthesis module 304 is used to perform speech synthesis according to the trained speech synthesis models corresponding to the speech providers.

[0132] In a possible implementation, the speech provider feature data includes the gender, age and emotion of the speech provider; the speech synthesis model includes a feature adapter, a phoneme encoding unit, and a mel-spectrogram decoding unit; the training module 303 is specifically used to input the gender, age and emotion in the speech provider feature data corresponding to the speech provider into the feature adapter respectively, and update the gender parameter, age parameter and emotion parameter in the feature adapter; and input the phonemes corresponding to the text data into the phoneme encoding unit in the speech synthesis model to obtain the initial phoneme encoding features corresponding to the text data; input the initial phoneme encoding features into the feature adapter so that the feature adapter adds gender information, age information and emotion information to the initial phoneme encoding features according to the gender parameter, age parameter and emotion parameter to obtain the target phoneme encoding features; position-encode the target phoneme encoding features and input them into the mel-spectrogram decoding unit for decoding to obtain the synthesized speech corresponding to the text data; update the speech synthesis model according to the synthesized speech and speech sample data to obtain the final speech synthesis model.

[0133] In a possible implementation, the synthesis module 304 is specifically used to obtain the text to be synthesized and the voice provider input by the user; input the text to be synthesized into the voice synthesis model corresponding to the voice provider to obtain the voice corresponding to the text to be synthesized.

[0134] In a possible implementation, the speech sample data is time domain data, and the acquisition module 301 is specifically used to pre-emphasize the speech sample data; frame the pre-emphasized speech sample data according to a preset time interval to obtain a speech sample frame; wherein the duration of the speech sample frame is greater than the preset time interval; convert each speech sample frame into frequency domain data to obtain speech sample frequency domain data; extract the Mel frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame to obtain speech feature data corresponding to the speech sample data.

[0135] In a possible implementation, the acquisition module 301 is further configured to:

[0136] Input the speech sample frequency domain data corresponding to each speech sample frame into the following formula to obtain the Mel frequency cepstral coefficient MFCC feature;

[0137]

[0138] Among them, C(n) is the nth order Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame, M is the number of speech sample frequency domain data corresponding to each speech sample frame, s(m) is the logarithm of the mth speech sample frequency domain data corresponding to each speech sample frame, and L is the preset order of the Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame.

[0139] In a possible implementation, the acquisition module 301 is further used to acquire the fundamental frequency, energy, and duration corresponding to the voice sample data provided by each voice provider;

[0140] The training module 303 is also used to train the speech synthesis model corresponding to each speech provider by using the speech provider feature data, text data, fundamental frequency, energy and duration corresponding to each speech provider as sample data and the speech sample data of each speech provider as a label.

[0141] The present application provides a speech synthesis device, which includes: an acquisition module 301, which is used to acquire speech feature data and text data corresponding to speech sample data provided by each speech provider; an input module 302, which is used to input the speech feature data corresponding to the speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider; wherein the feature extraction model is obtained by training the speech sample feature data and the corresponding speech provider feature data; a training module 303, which is used to train the speech synthesis model corresponding to each speech provider by using the speech provider feature data and text data corresponding to each speech provider as sample data and the speech sample data provided by each speech provider as a label; and a synthesis module 304, which is used to perform speech synthesis according to the speech synthesis model corresponding to each speech provider after training. The present application trains the speech synthesis model through the speech provider feature data corresponding to each speech provider, so as to synthesize natural and fluent speech through the trained speech synthesis model, without the need to establish a speech library in advance, to avoid the situation where text cannot be converted into speech.

[0142] like Figure 4 As shown, an electronic device 400 provided in an embodiment of the present application includes: a processor 401, a memory 402 and a bus, wherein the memory 402 stores machine-readable instructions executable by the processor 401. When the electronic device is running, the processor 401 communicates with the memory 402 through the bus, and the processor 401 executes the machine-readable instructions to perform the steps of the above-mentioned speech synthesis method.

[0143] Specifically, the memory 402 and the processor 401 can be general-purpose memories and processors, which are not specifically limited here. When the processor 401 runs the computer program stored in the memory 402, the speech synthesis method can be executed.

[0144] Corresponding to the above-mentioned speech synthesis method, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned speech synthesis method are executed.

[0145] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0146] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0148] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the information processing method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0149] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A speech synthesis method, It is characterized in that The method comprises: Acquire voice feature data and text data corresponding to the voice sample data provided by each voice provider; Inputting speech feature data corresponding to speech sample data provided by each speech provider into a feature extraction model to obtain speech provider feature data corresponding to each speech provider; Wherein, the feature extraction model is obtained by training with speech sample feature data and corresponding speech provider feature data; The voice provider feature data and text data corresponding to each voice provider are used as sample data, and the voice sample data provided by each voice provider is used as a label to train the speech synthesis model corresponding to each voice provider; Speech synthesis is performed according to the speech synthesis models corresponding to each speech provider that has been trained.

2. The speech synthesis method according to claim 1, It is characterized in that The voice provider feature data includes the gender, age and emotion of the voice provider; the speech synthesis model includes a feature adapter, a phoneme encoding unit, and a mel spectrum decoding unit; The method uses the voice provider feature data and text data corresponding to each voice provider as sample data and the voice sample data of each voice provider as a label to train the speech synthesis model, including: Inputting the gender, age and emotion in the voice provider feature data corresponding to the voice provider into the feature adapter respectively, and updating the gender parameter, age parameter and emotion parameter in the feature adapter; and inputting the phonemes corresponding to the text data into the phoneme coding unit in the speech synthesis model to obtain initial phoneme coding features corresponding to the text data; Inputting the initial phoneme coding feature into a feature adapter, so that the feature adapter adds gender information, age information and emotion information to the initial phoneme coding feature according to the gender parameter, age parameter and emotion parameter to obtain a target phoneme coding feature; The target phoneme encoding feature is position-encoded and then input into the mel spectrum decoding unit for decoding to obtain the synthesized speech corresponding to the text data; The speech synthesis model is updated according to the synthesized speech and the speech sample data to obtain a final speech synthesis model.

3. The speech synthesis method according to claim 2, It is characterized in that The performing speech synthesis according to the speech synthesis model corresponding to each speech provider after training includes: Obtain the text to be synthesized and the voice provider input by the user; The text to be synthesized is input into a speech synthesis model corresponding to the speech provider to obtain a speech corresponding to the text to be synthesized.

4. The speech synthesis method according to claim 3, It is characterized in that The voice sample data is time domain data, and the step of obtaining voice feature data corresponding to the voice sample data provided by each voice provider includes: Pre-emphasize the speech sample data; According to a preset time interval, the pre-emphasized voice sample data is framed to obtain a voice sample frame; wherein the duration of the voice sample frame is greater than the preset time interval; Convert each speech sample frame into frequency domain data to obtain speech sample frequency domain data; Extract the Mel-frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame to obtain speech feature data corresponding to the speech sample data.

5. The speech synthesis method according to claim 4, It is characterized in that The extracting of Mel-frequency cepstral coefficient MFCC features of the speech sample frequency domain data corresponding to each speech sample frame includes: Input the speech sample frequency domain data corresponding to each speech sample frame into the following formula to obtain the Mel frequency cepstral coefficient MFCC feature; Among them, C(n) is the nth order Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame, M is the number of speech sample frequency domain data corresponding to each speech sample frame, s(m) is the logarithm of the mth speech sample frequency domain data corresponding to each speech sample frame, and L is the preset order of the Mel-frequency cepstral coefficient MFCC feature corresponding to each speech sample frame.

6. The speech synthesis method according to any one of claims 1 to 5, It is characterized in that The method further comprises: Obtain the fundamental frequency, energy, and duration of the voice sample data provided by each voice provider; The voice provider feature data, text data, fundamental frequency, energy and duration corresponding to each voice provider are used as sample data, and the voice sample data of each voice provider is used as a label to train the speech synthesis model corresponding to each voice provider.

7. A speech synthesis device, It is characterized in that The device comprises: An acquisition module, used to acquire voice feature data and text data corresponding to the voice sample data provided by each voice provider; An input module, used to input the voice feature data corresponding to the voice sample data provided by each voice provider into the feature extraction model to obtain the voice provider feature data corresponding to each voice provider; Wherein, the feature extraction model is obtained by training with speech sample feature data and corresponding speech provider feature data; A training module, used to train a speech synthesis model corresponding to each speech provider by using speech provider feature data and text data corresponding to each speech provider as sample data and speech sample data provided by each speech provider as a label; The synthesis module is used to perform speech synthesis according to the speech synthesis models corresponding to each speech provider that has been trained.

8. The speech synthesis device according to claim 7, It is characterized in that The voice provider feature data includes the gender, age and emotion of the voice provider; the speech synthesis model includes a feature adapter, a phoneme encoding unit, and a mel spectrum decoding unit; the training module is specifically used for: Inputting the gender, age and emotion in the voice provider feature data corresponding to the voice provider into the feature adapter respectively, and updating the gender parameter, age parameter and emotion parameter in the feature adapter; and inputting the phonemes corresponding to the text data into the phoneme coding unit in the speech synthesis model to obtain initial phoneme coding features corresponding to the text data; Inputting the initial phoneme coding feature into a feature adapter, so that the feature adapter adds gender information, age information and emotion information to the initial phoneme coding feature according to the gender parameter, age parameter and emotion parameter to obtain a target phoneme coding feature; The target phoneme encoding feature is position-encoded and then input into the mel spectrum decoding unit for decoding to obtain the synthesized speech corresponding to the text data; The speech synthesis model is updated according to the synthesized speech and the speech sample data to obtain a final speech synthesis model.

9. An electronic device, It is characterized in that include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the speech synthesis method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the speech synthesis method according to any one of claims 1 to 6 are executed.