Speech synthesis method, device, electronic device and storage medium

By using position vector coding, pitch and duration projection, filtering processing and loss function adjustment in the neural speech synthesis system, the problem of insufficient semantic information in the text is solved, and the accuracy of speech synthesis and the robustness of the model are improved.

CN112466273BActive Publication Date: 2024-11-08PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011433981.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-10
Publication Date
2024-11-08
Estimated Expiration
2040-12-10

AI Technical Summary

Technical Problem

The existing neural speech synthesis system has high temporal resolution of the character audio signal in the text and parallel calculation of Mel frame generation, resulting in a single input text lacking sufficient semantic information, affecting the accuracy of speech synthesis, and the pronunciation of the same speech unit is different.

Method used

Position vector encoding and sound spectrum encoding are performed through the pre-constructed speech synthesis model, the pitch recognition module and the sound duration recognition module are used for projection, the residual sound spectrum is generated, and the model parameters are adjusted through the filter function and the loss function until the loss value is Less than the preset threshold, improving the accuracy of speech synthesis.

Benefits of technology

Effectively identify and process each word position and semantic information in the training text, avoiding different pronunciations from the voice unit, and improving the accuracy of speech synthesis and the robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112466273B_ABST
    Figure CN112466273B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence, and discloses a speech synthesis method, including: obtaining a training text, using a pre-built speech synthesis model to perform position vector encoding and sound spectrum encoding on the training text to generate a sound spectrum; performing pitch projection and duration projection on the sound spectrum to obtain a pitch spectrum and a duration spectrum, performing residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum; summarizing and smoothing the duration spectrum and the residual sound spectrum to obtain a target sound spectrum; calculating the loss value of the target sound spectrum and the corresponding label value, and adjusting the parameters of the speech synthesis model according to the loss value to obtain a trained speech synthesis model; using the trained speech synthesis model to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result. In addition, the present invention also relates to blockchain technology, and the target sound spectrum can be stored in a blockchain. The present invention can improve the accuracy of speech synthesis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Speech synthesis refers to the technology of converting text information generated by the computer itself or input externally into understandable and fluent speech output. In recent years, the neural speech synthesis (Text-to-Speech, TTS) system has developed rapidly, getting rid of the cumbersome synthesis process of the traditional pipeline and no longer relying on highly professional grammar and lexical feature extraction. Instead, the original text is converted into Mel spectrum through a neural network, and then the Mel spectrum is converted into a sound waveform, realizing an end-to-end speech synthesis system, and the synthesized speech quality is close to that of human voice. However, since the character audio signals in the text usually have a high temporal resolution, and the Mel frame generation in the character text is calculated in parallel and is independent of each other, this unification leads to a lack of sufficient semantic information in a single input text, resulting in different pronunciations of the same speech unit, which in turn affects the accuracy of speech synthesis. Summary of the invention

[0003] The present invention provides a speech synthesis method, device, electronic equipment and computer-readable storage medium, the main purpose of which is to improve the accuracy of speech synthesis.

[0004] To achieve the above object, the present invention provides a speech synthesis method, comprising:

[0005] Obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the training text by position vector to obtain a text vector;

[0006] Performing sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum;

[0007] Using the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, and performing residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum;

[0008] Summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum;

[0009] Using the filter function in the speech synthesis model to smooth the sound duration spectrum to obtain a target sound spectrum;

[0010] Calculating the loss value of the target sound spectrum and the corresponding label value using the loss function in the speech synthesis model, and adjusting the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model;

[0011] The trained speech synthesis model is used to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result.

[0012] Optionally, the step of encoding the training text by using an encoding layer in a pre-built speech synthesis model to obtain a text vector comprises:

[0013] Obtaining a text sentence in the training text, and using the encoding layer to index and encode the words in the text sentence to obtain a word encoding index;

[0014] A vector matrix is ​​constructed for the word encoding index to generate a word vector, and a text vector is generated based on the word vector.

[0015] Optionally, the utilizing the feedforward attention mechanism in the speech synthesis model to perform sound spectrum encoding on the text vector to generate a sound spectrum includes:

[0016] Querying the word vector of the text vector using the self-attention module in the feedforward attention mechanism;

[0017] Using the convolution module in the feedforward attention mechanism to extract features from the word vector to obtain a feature word vector;

[0018] Extracting the phoneme information sequence of the feature word vector using the encoder in the feedforward attention mechanism;

[0019] The decoder in the feedforward attention mechanism is used to convert the phoneme information sequence into a spectrum information sequence to obtain the sound spectrum.

[0020] Optionally, the using the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum includes:

[0021] Using the convolution layer in the pitch recognition module to extract the sound frequency from the sound spectrum to obtain the sound frequency, and using the fully connected layer in the pitch recognition module to perform matrix mapping on the sound frequency to obtain the pitch spectrum;

[0022] The convolutional layer in the sound duration recognition module is used to extract the duration of the sound spectrum to obtain the sound duration, and the fully connected layer in the sound duration recognition module is used to perform matrix mapping on the sound duration to obtain the duration spectrum.

[0023] Optionally, the step of aggregating the duration spectrum and the residual sound spectrum to obtain the sound duration spectrum includes:

[0024] The time dimension of the duration spectrum is obtained, and the time dimension is loaded into each pitch in the residual sound spectrum to obtain the sound duration spectrum.

[0025] Optionally, the filtering function includes:

[0026]

[0027] in, represents the target sound spectrum, represents the sound duration spectrum, and Represents the sound frequency and duration in the sound duration spectrum. and Represents the filter coefficient.

[0028] Optionally, the loss function includes:

[0029]

[0030] in, represents the loss value, Indicates the number of target sound spectra, represents the label value of the i-th target sound spectrum, Represents the i-th target sound spectrum.

[0031] In order to solve the above problem, the present invention further provides a speech synthesis device, the device comprising:

[0032] An encoding module, used to obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the training text by position vector to obtain a text vector;

[0033] The encoding module is further used to perform sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum;

[0034] A projection module is used to perform pitch projection and duration projection on the sound spectrum respectively by using the pitch recognition module and the sound duration recognition module in the speech synthesis model to obtain a pitch spectrum and a duration spectrum, and perform residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum;

[0035] A summarizing module, used for summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum;

[0036] A smoothing module, used for smoothing the sound duration spectrum using the filter function in the speech synthesis model to obtain a target sound spectrum;

[0037] An adjustment module, used to calculate the loss value of the target sound spectrum and the corresponding label value by using the loss function in the speech synthesis model, and adjust the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model;

[0038] The synthesis module is used to perform speech synthesis on the speech text to be synthesized using the trained speech synthesis model to obtain a synthesis result.

[0039] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0040] at least one processor; and,

[0041] a memory communicatively connected to the at least one processor; wherein,

[0042] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to implement the speech synthesis method described above.

[0043] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned speech synthesis method.

[0044] The embodiment of the present invention firstly uses a pre-built speech synthesis model to perform position vector encoding and sound spectrum encoding on the training text to generate a sound spectrum, and performs pitch projection and duration projection on the sound spectrum to obtain a pitch spectrum and a duration spectrum, and performs residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum, so as to determine the position information of each word in the training text; secondly, the embodiment of the present invention aggregates and smoothes the duration spectrum and the residual sound spectrum to obtain a target sound spectrum, so as to identify the semantic information of each word in the training text, and avoid the situation where the pronunciation of the same speech unit is different, thereby improving the accuracy of speech synthesis; further, the embodiment of the present invention calculates the loss value of the target sound spectrum and the corresponding label value, and adjusts the parameters of the speech synthesis model according to the loss value to obtain a trained speech synthesis model, and uses the trained speech synthesis model to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result. Therefore, a speech synthesis method, device, electronic device and storage medium proposed by the present invention can improve the accuracy of speech synthesis. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A flowchart of a speech synthesis method provided by an embodiment of the present invention;

[0046] Figure 2 In the first embodiment of the present invention Figure 1 A detailed flowchart of one step of the provided speech synthesis method;

[0047] Figure 3 A schematic diagram of a module of a speech synthesis device provided by an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the internal structure of an electronic device for implementing a speech synthesis method provided by an embodiment of the present invention;

[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0051] The embodiment of the present application provides a speech synthesis method. The execution subject of the speech synthesis method includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the speech synthesis method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.

[0052] Reference Figure 1 FIG. 1 is a flow chart of a speech synthesis method provided by an embodiment of the present invention. In the embodiment of the present invention, the speech synthesis method includes:

[0053] S1. Obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the position vector of the training text to obtain a text vector.

[0054] In the embodiment of the present invention, the training text includes different types of text, such as news text, financial text and medical text, etc. Optionally, the training text is downloaded from a professional website. The pre-built speech synthesis model includes a FastSpeech network for converting text into speech.

[0055] Furthermore, it should be understood that a text may contain a large number of sentences and words, and a neural network can only accept numerical input and cannot support word character input. If the constructed speech synthesis model is trained directly using the text, the text phoneme sequence cannot be recognized, so that the trained speech synthesis model cannot support text speech synthesis. Therefore, the embodiment of the present invention uses the encoding layer in the speech synthesis model to encode the position vector of the training text to determine the position information of each word in the training text, thereby realizing subsequent model training. Wherein, the encoding layer includes Embedding.

[0056] For details, see Figure 2 As shown, the position vector encoding of the training text is performed using the encoding layer in the pre-built speech synthesis model to obtain a text vector, including:

[0057] S20, obtaining a text sentence in the training text, and using the encoding layer to index and encode the words in the text sentence to obtain a word encoding index;

[0058] S21. Construct a vector matrix for the word encoding index to generate a word vector, and generate a text vector based on the word vector.

[0059] Among them, the text sentence is obtained according to the punctuation marks of the training text, for example, a paragraph corresponding to a period is regarded as a text sentence; the index coding is set based on different user needs, for example, the text sentence is: deep in learning, and the words in the deep in learning are indexed and coded with 0 1 2, and the deep coding index is 0, the in coding index is 1, and the learning coding index is 2; the construction of the vector matrix is ​​determined according to the latent factor data of the corresponding words, for example, if the word has 3 latent factors, the corresponding vector matrix can be a 1*3 vector matrix, and the latent factor refers to the characteristic node value of the word, for example, if the word is deep, the corresponding latent factors include: height, depth and thickness, etc.

[0060] S2. Utilize the feedforward attention mechanism in the speech synthesis model to perform sound spectrum encoding on the text vector to generate a sound spectrum.

[0061] In an embodiment of the present invention, the text vector is encoded with sound mel spectrum by using the feedforward attention mechanism in the speech synthesis model, so as to convert the phoneme sequence in the text vector into mel spectrum, thereby ensuring the premise of subsequent text speech synthesis. The feedforward attention mechanism is composed of N identical Feed Forward Transformer blocks (FFT for short), each of which includes an encoder, a decoder, a self-attention module and a convolution module.

[0062] In detail, S2 includes: using the self-attention module in the feedforward attention mechanism to query the word vector of the text vector, using the convolution module in the feedforward attention mechanism to perform feature extraction on the word vector to obtain a feature word vector, using the encoder in the feedforward attention mechanism to extract the phoneme information sequence of the feature word vector, and using the decoder in the feedforward attention mechanism to convert the phoneme information sequence into a spectrum information sequence to obtain the sound spectrum.

[0063] In an optional embodiment, the sound spectrum is a Mel spectrum.

[0064] S3. Use the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, and perform residual connection on the pitch spectrum and the sound spectrum to generate a residual sound spectrum.

[0065] It should be understood that the sound spectrum generated by S2 above directly converts the phoneme sequence in the text vector into a corresponding spectrum sequence without considering the sound frequency and duration in the sound spectrum. This may easily lead to different pronunciations of the speech units, thereby affecting the accuracy of subsequent model training and further affecting the accuracy of subsequent generated speech. Therefore, the embodiment of the present invention utilizes the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, and performs a residual connection between the pitch spectrum and the sound spectrum to identify the sound frequency and duration in the sound spectrum.

[0066] In detail, the pitch recognition module and the sound duration recognition module in the speech synthesis model are used to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, including: using the convolutional layer in the pitch recognition module to extract the sound frequency from the sound spectrum to obtain the sound frequency, and using the fully connected layer in the pitch recognition module to perform matrix mapping on the sound frequency to obtain the pitch spectrum; using the convolutional layer in the sound duration recognition module to extract the duration of the sound spectrum to obtain the sound duration, and using the fully connected layer in the sound duration recognition module to perform matrix mapping on the sound duration to obtain the duration spectrum.

[0067] Furthermore, to avoid the gradient vanishing problem of the pitch spectrum, the embodiment of the present invention generates a residual sound spectrum by performing a residual connection between the pitch spectrum and the sound spectrum. Furthermore, the residual connection is a relatively mature technology and will not be further elaborated here.

[0068] S4. Summarize the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum.

[0069] In an embodiment of the present invention, the duration spectrum and the residual sound spectrum are summarized to identify the duration of each pitch in the residual sound spectrum, so that the sound length of the corresponding sound spectrum can be identified to better train the model and improve the robustness of the model.

[0070] In detail, the duration spectrum and the residual sound spectrum are aggregated to obtain the sound duration spectrum, including: obtaining the time dimension of the duration spectrum, loading the time dimension to each pitch in the residual sound spectrum, and obtaining the sound duration spectrum. The time dimension refers to the vector matrix dimension in the duration spectrum.

[0071] S5. Use the filter function in the speech synthesis model to smooth the sound duration spectrum to obtain a target sound spectrum.

[0072] In the embodiment of the present invention, the sound duration spectrum is smoothed using the filter function in the speech synthesis model to obtain a target sound spectrum, so as to reduce noise in the sound duration spectrum and improve the speech signal quality of the sound duration spectrum.

[0073] In an optional embodiment of the present invention, the filtering function includes:

[0074]

[0075] in, represents the target sound spectrum, represents the sound duration spectrum, and Represents the sound frequency and duration in the sound duration spectrum. and Represents the filter coefficient.

[0076] Furthermore, in order to ensure the privacy and reusability of the target sound spectrum, the target sound spectrum can also be stored in a blockchain node.

[0077] S6. Calculate the loss value of the target sound spectrum and the corresponding label value using the loss function in the speech synthesis model, and adjust the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model.

[0078] In the embodiment of the present invention, the loss value between the target sound spectrum and the corresponding label value is calculated using the loss function in the speech synthesis model, and the parameters of the speech synthesis model are adjusted according to the loss value until the loss value is less than a preset threshold value, thereby obtaining a trained speech synthesis model. The label value refers to the real speech pre-annotated in the training text, and the parameters of the speech synthesis model include weight and bias, and the preset threshold value is 0.1.

[0079] In an optional embodiment, the loss function includes:

[0080]

[0081] in, represents the loss value, Indicates the number of target sound spectra, represents the label value of the i-th target sound spectrum, Represents the i-th target sound spectrum.

[0082] S7. Perform speech synthesis on the speech text to be synthesized using the trained speech synthesis model to obtain a synthesis result.

[0083] The embodiment of the present invention firstly uses a pre-built speech synthesis model to perform position vector encoding and sound spectrum encoding on the training text to generate a sound spectrum, and performs pitch projection and duration projection on the sound spectrum to obtain a pitch spectrum and a duration spectrum, and performs residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum, so as to determine the position information of each word in the training text; secondly, the embodiment of the present invention aggregates and smoothes the duration spectrum and the residual sound spectrum to obtain a target sound spectrum, so as to identify the semantic information of each word in the training text, and avoid the situation where the pronunciation of the same speech unit is different, thereby improving the accuracy of speech synthesis; further, the embodiment of the present invention calculates the loss value of the target sound spectrum and the corresponding label value, and adjusts the parameters of the speech synthesis model according to the loss value to obtain a trained speech synthesis model, and uses the trained speech synthesis model to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result. Therefore, the present invention can improve the accuracy of speech synthesis.

[0084] like Figure 3 The figure shows a functional module diagram of the speech synthesis device of the present invention.

[0085] The speech synthesis device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the speech synthesis device may include an encoding module 101, a projection module 102, a summarization module 103, a smoothing module 104, an adjustment module 105 and a synthesis module 106. The module described in the present invention may also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0086] In this embodiment, the functions of each module / unit are as follows:

[0087] The encoding module 101 is used to obtain training text, and use the encoding layer in the pre-built speech synthesis model to perform position vector encoding on the training text to obtain a text vector;

[0088] The encoding module 101 is further used to perform sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum;

[0089] The projection module 102 is used to perform pitch projection and duration projection on the sound spectrum respectively by using the pitch recognition module and the sound duration recognition module in the speech synthesis model to obtain a pitch spectrum and a duration spectrum, and perform residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum;

[0090] The summarizing module 103 is used to summarize the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum;

[0091] The smoothing module 104 is used to smooth the sound duration spectrum using the filter function in the speech synthesis model to obtain a target sound spectrum;

[0092] The adjustment module 105 is used to calculate the loss value of the target sound spectrum and the corresponding label value by using the loss function in the speech synthesis model, and adjust the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model;

[0093] The synthesis module 106 is used to perform speech synthesis on the speech text to be synthesized using the trained speech synthesis model to obtain a synthesis result.

[0094] In detail, the modules in the speech synthesis device 100 in the embodiment of the present invention are used in the same manner as described above. Figure 1 and Figure 2 The present invention has the same technical means as the speech synthesis method described in , and can produce the same technical effects, which will not be repeated here.

[0095] like Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing the speech synthesis method of the present invention.

[0096] The electronic device 1 may include a processor 10 , a memory 11 , and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a speech synthesis program 12 .

[0097] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device 1, such as speech synthesis code, etc., but also be used to temporarily store data that has been output or is to be output.

[0098] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules stored in the memory 11 (for example, performing speech synthesis, etc.), and calling data stored in the memory 11.

[0099] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0100] Figure 4 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0101] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0102] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0103] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.

[0104] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0105] The speech synthesis 12 stored in the memory 11 in the electronic device 1 is a combination of multiple computer programs, and when running in the processor 10, it can achieve:

[0106] Obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the training text by position vector to obtain a text vector;

[0107] Performing sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum;

[0108] Using the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, and performing residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum;

[0109] Summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum;

[0110] Using the filter function in the speech synthesis model to smooth the sound duration spectrum to obtain a target sound spectrum;

[0111] Calculating the loss value of the target sound spectrum and the corresponding label value using the loss function in the speech synthesis model, and adjusting the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model;

[0112] The trained speech synthesis model is used to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result.

[0113] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0114] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0115] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0116] Obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the training text by position vector to obtain a text vector;

[0117] Performing sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum;

[0118] Using the pitch recognition module and the sound duration recognition module in the speech synthesis model to perform pitch projection and duration projection on the sound spectrum respectively to obtain a pitch spectrum and a duration spectrum, and performing residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum;

[0119] Summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum;

[0120] Using the filter function in the speech synthesis model to smooth the sound duration spectrum to obtain a target sound spectrum;

[0121] Calculating the loss value of the target sound spectrum and the corresponding label value using the loss function in the speech synthesis model, and adjusting the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model;

[0122] The trained speech synthesis model is used to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result.

[0123] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0124] 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 modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0125] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0126] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0127] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0128] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0129] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.

[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A speech synthesis method, characterized in that: The method comprises: Obtain training text, obtain text sentences in the training text, use the encoding layer in the pre-built speech synthesis model to index and encode the words in the text sentences to obtain word encoding indexes, construct a vector matrix for the word encoding indexes, generate word vectors, and generate text vectors based on the word vectors; Using the self-attention module in the feedforward attention mechanism in the speech synthesis model to query the word vector of the text vector, using the convolution module in the feedforward attention mechanism to perform feature extraction on the word vector to obtain a feature word vector, using the encoder in the feedforward attention mechanism to extract the phoneme information sequence of the feature word vector, and using the decoder in the feedforward attention mechanism to convert the phoneme information sequence into a spectrum information sequence to obtain a sound spectrum; Using the convolution layer in the pitch recognition module in the speech synthesis model to extract the sound frequency from the sound spectrum to obtain the sound frequency, using the fully connected layer in the pitch recognition module to perform matrix mapping on the sound frequency to obtain the pitch spectrum, using the convolution layer in the sound duration recognition module in the speech synthesis model to extract the duration of the sound spectrum to obtain the sound duration, using the fully connected layer in the sound duration recognition module to perform matrix mapping on the sound duration to obtain the duration spectrum, and performing residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum; Summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum; Using the filter function in the speech synthesis model to smooth the sound duration spectrum to obtain a target sound spectrum; Calculating the loss value of the target sound spectrum and the corresponding label value using the loss function in the speech synthesis model, and adjusting the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model; The trained speech synthesis model is used to perform speech synthesis on the speech text to be synthesized to obtain a synthesis result.

2. The speech synthesis method according to claim 1, characterized in that: The step of summing up the duration spectrum and the residual sound spectrum to obtain the sound duration spectrum includes: The time dimension of the duration spectrum is obtained, and the time dimension is loaded into each pitch in the residual sound spectrum to obtain the sound duration spectrum.

3. The speech synthesis method according to claim 1, characterized in that: The filtering function comprises: in, represents the target sound spectrum, represents the sound duration spectrum, and Represents the sound frequency and duration in the sound duration spectrum. and Represents the filter coefficient.

4. The speech synthesis method according to claim 1, wherein: The loss function includes: in, represents the loss value, Indicates the number of target sound spectra, Represents the label value of the i-th target sound spectrum, Represents the i-th target sound spectrum.

5. A speech synthesis device, used to implement the speech synthesis method according to any one of claims 1 to 4, characterized in that: The device comprises: An encoding module, used to obtain training text, and use the encoding layer in the pre-built speech synthesis model to encode the training text by position vector to obtain a text vector; The encoding module is further used to perform sound spectrum encoding on the text vector using the feedforward attention mechanism in the speech synthesis model to generate a sound spectrum; A projection module is used to perform pitch projection and duration projection on the sound spectrum respectively by using the pitch recognition module and the sound duration recognition module in the speech synthesis model to obtain a pitch spectrum and a duration spectrum, and perform residual connection between the pitch spectrum and the sound spectrum to generate a residual sound spectrum; A summarizing module, used for summarizing the duration spectrum and the residual sound spectrum to obtain a sound duration spectrum; A smoothing module, used for smoothing the sound duration spectrum using the filter function in the speech synthesis model to obtain a target sound spectrum; An adjustment module, used to calculate the loss value of the target sound spectrum and the corresponding label value by using the loss function in the speech synthesis model, and adjust the parameters of the speech synthesis model according to the loss value until the loss value is less than a preset threshold, thereby obtaining a trained speech synthesis model; The synthesis module is used to perform speech synthesis on the speech text to be synthesized using the trained speech synthesis model to obtain a synthesis result.

6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the speech synthesis method according to any one of claims 1 to 4.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the speech synthesis method according to any one of claims 1 to 4 is implemented.