Method, device and storage medium for generating audio based on text

By determining the emotional type and pronunciation attribute information of text sentences, the audio synthesis model is used to generate emotional reading audio, which solves the problem of lack of emotional expression in existing reading audio and improves user experience.

CN113192484BActive Publication Date: 2024-09-03TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202110580371.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-26
Publication Date
2024-09-03
Estimated Expiration
2041-05-26

AI Technical Summary

Technical Problem

Existing reading audio lacks emotional expression, resulting in poor user listening experience.

Method used

By determining the emotional type information and pronunciation attribute information of the text sentence, input the pre-trained audio synthesis model to generate emotionally colored reading audio. The method includes determining the emotional type and pronunciation attributes of text sentences, using a spectral synthesis model and vocoder to generate a Mel spectrum sequence, and finally splicing into a complete reading audio.

Benefits of technology

The generated reading audio is emotional and improves the user's listening experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113192484B
    Figure CN113192484B
Patent Text Reader

Abstract

The present application discloses a method, device and storage medium for generating audio based on text, and belongs to the field of computer technology. The method comprises: determining the emotion type information corresponding to each text sentence in the target text; determining the pronunciation attribute information corresponding to each text sentence in the target text; inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into a pre-trained audio synthesis model to obtain the reading audio segment corresponding to each text sentence; splicing the reading audio segment corresponding to each text sentence according to the arrangement order of each text sentence in the target text to obtain the reading audio corresponding to the target text. With the present application, emotion-related information is incorporated into the generation of the reading audio, so that the reading audio has emotional color, which can improve the user's auditory experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for generating audio based on text. Background Art

[0002] People used to read the contents of novels, information and other texts with their eyes. With the development of technology, corresponding reading audio can be generated based on the text, so that users can directly play the reading audio on the terminal to listen to the content of the text.

[0003] In the process of generating reading audio, it is necessary to first generate the audio corresponding to each word according to the pronunciation of each word in the text, and then combine the audio corresponding to each word into a whole reading audio. However, this kind of reading audio does not read the text with emotion according to the content of the text, but just mechanically reads out the words in the text one by one, which will lead to a poor listening experience for users. Summary of the invention

[0004] The embodiment of the present application provides a method for generating audio based on text, which can solve the problem in the prior art that the emotional attribute of the read-aloud audio is single, resulting in a poor user auditory experience.

[0005] In a first aspect, a method for generating audio based on text is provided, the method comprising:

[0006] Determine the emotion type information corresponding to each text sentence in the target text;

[0007] Determining pronunciation attribute information corresponding to each text sentence in the target text;

[0008] Inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence;

[0009] According to the arrangement order of each text sentence in the target text, the reading audio segments corresponding to each text sentence are spliced ​​to obtain the reading audio corresponding to the target text.

[0010] In a possible implementation, determining the emotion type information corresponding to each text sentence in the target text includes:

[0011] Determining an associated context corresponding to each text sentence in the target text, wherein the associated context corresponding to the text sentence consists of at least one associated text sentence corresponding to the text sentence;

[0012] If the associated context corresponding to the text sentence is determined, determining the feature information of the text sentence based on the text paragraph consisting of the text sentence and the associated context corresponding to the text sentence; if the associated context corresponding to the text sentence is not determined, determining the feature information of the text sentence based on the text sentence;

[0013] The feature information of each of the text sentences is input into a pre-trained emotion recognition model to obtain the emotion type information corresponding to the text sentence, wherein the emotion recognition model is trained by a first sample text set, and the first sample text set includes the feature information of the sample text sentence and the emotion type label corresponding to the sample text sentence.

[0014] In a possible implementation manner, the pronunciation attribute information includes at least one of pronunciation unit information, word segmentation information, and prosody information.

[0015] In a possible implementation, the audio synthesis model includes a spectrum synthesis model and a vocoder;

[0016] The emotion type information and pronunciation attribute information corresponding to each text sentence are input into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence, including:

[0017] Inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into the pre-trained spectrum synthesis model to obtain a Mel-spectrogram sequence corresponding to each text sentence; wherein the spectrum synthesis model is trained by a second sample text set, and the second sample text set includes the emotion type information and pronunciation attribute information of the sample text sentence and the Mel-spectrogram sequence label corresponding to the sample text sentence;

[0018] The mel spectrum sequence corresponding to each text sentence is input into the vocoder to generate a reading audio segment corresponding to each text sentence.

[0019] In a possible implementation, the spectrum synthesis model includes an emotion feature extraction module, a pronunciation feature extraction module, an attention network module and a decoding network module;

[0020] The step of inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into the pre-trained spectrum synthesis model to obtain the Mel spectrum sequence corresponding to each text sentence includes:

[0021] Input the emotion type information of each of the text sentences into the pre-trained emotion feature extraction module to obtain an emotion feature vector; input the pronunciation attribute information of each of the text sentences into the pre-trained pronunciation feature extraction module to obtain a pronunciation feature vector;

[0022] The emotion feature vector and the pronunciation feature vector corresponding to each of the text sentences are concatenated and input into the attention network module to obtain a weight coefficient matrix; the weight coefficient matrix of each of the text sentences is input into the decoding network module to obtain a Mel spectrum sequence corresponding to each of the text sentences.

[0023] In one possible implementation, the emotion feature extraction module includes a VAE (Variational Auto-Encoder) submodule and a fully connected network submodule, and the pronunciation feature extraction module includes a pre-net (preprocessing network) submodule and a CBHG (1-D convolution bank+highway network+bidirectionalGRU, a sequence feature extraction network including one-dimensional convolution and bidirectional gated recurrent units) submodule.

[0024] In a possible implementation, the spectrum synthesis model further includes a post-net (post-processing network) module;

[0025] After inputting the weight coefficient matrix of each of the text sentences into the decoding network module, the method further includes:

[0026] Obtaining an initial Mel spectrum sequence corresponding to the text sentence output by the decoding network module;

[0027] Inputting the initial Mel spectrum sequence into the post-net submodule to obtain Mel spectrum correction information;

[0028] The initial Mel spectrum sequence is corrected using the Mel spectrum correction information to obtain a Mel spectrum sequence corresponding to the text sentence.

[0029] In a possible implementation, the audio synthesis model includes multiple groups, and the obtained reading audio segments corresponding to the text sentences are multiple groups, and the reading audio of the target text obtained by splicing the multiple groups of reading audio segments of the text sentences is multiple;

[0030] Different audio synthesis models correspond to different reader types, and a group of reading audio segments output by each of the audio synthesis models has a corresponding relationship with the reader type of the audio synthesis model, and the reading audio obtained by splicing the group of reading audio segments has a corresponding relationship with the reader type;

[0031] After obtaining the reading audio corresponding to the target text, the method further includes:

[0032] The reading audio of each target text and the reader type of the reading audio are stored in correspondence.

[0033] In a possible implementation, after storing the reading audios of the target texts in correspondence with the types of readers of the reading audios, the method further includes:

[0034] A request for obtaining a reading audio corresponding to the target text sent by a receiving terminal, wherein the request for obtaining a reading audio carries a target reader type;

[0035] The reading audio corresponding to the target reader type is returned to the terminal.

[0036] In a possible implementation, the reader types include: a first reader type for dialogue and a second reader type for narration; and the first reader type corresponds to a first audio synthesis model, and the second reader type corresponds to a second audio synthesis model;

[0037] The emotion type information and pronunciation attribute information corresponding to each text sentence are input into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence, including:

[0038] Determining the text type of each text sentence according to punctuation marks in the target text, wherein the text type is dialogue or narration;

[0039] For a text sentence whose text type is dialogue, inputting emotion type information and pronunciation attribute information corresponding to the text sentence into the first audio synthesis model to generate a reading audio segment corresponding to the text sentence;

[0040] For a text sentence whose text type is narration, the emotion type information and pronunciation attribute information corresponding to the text sentence are used according to the second audio synthesis model to generate a reading audio segment corresponding to the text sentence.

[0041] In a second aspect, a device for generating audio based on text is provided, the device comprising:

[0042] A first determination module is used to determine the emotion type information corresponding to each text sentence in the target text;

[0043] A second determination module is used to determine pronunciation attribute information corresponding to each text sentence in the target text;

[0044] A first generation module is used to input the emotion type information and pronunciation attribute information corresponding to each text sentence into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence;

[0045] The second generation module is used to splice the reading audio segments corresponding to each text sentence according to the arrangement order of each text sentence in the target text to obtain the reading audio corresponding to the target text.

[0046] In a possible implementation manner, the first determining module is configured to:

[0047] Determining an associated context corresponding to each text sentence in the target text, wherein the associated context corresponding to the text sentence consists of at least one associated text sentence corresponding to the text sentence;

[0048] If the associated context corresponding to the text sentence is determined, determining the feature information of the text sentence based on the text paragraph consisting of the text sentence and the associated context corresponding to the text sentence; if the associated context corresponding to the text sentence is not determined, determining the feature information of the text sentence based on the text sentence;

[0049] The feature information of each of the text sentences is input into a pre-trained emotion recognition model to obtain the emotion type information corresponding to the text sentence, wherein the emotion recognition model is trained by a first sample text set, and the first sample text set includes the feature information of the sample text sentence and the emotion type label corresponding to the sample text sentence.

[0050] In a possible implementation manner, the pronunciation attribute information includes at least one of pronunciation unit information, word segmentation information, and prosody information.

[0051] In a possible implementation, the audio synthesis model includes a spectrum synthesis model and a vocoder;

[0052] The first generating module is used for:

[0053] Inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into the pre-trained spectrum synthesis model to obtain a Mel-spectrogram sequence corresponding to each text sentence; wherein the spectrum synthesis model is trained by a second sample text set, and the second sample text set includes the emotion type information and pronunciation attribute information of the sample text sentence and the Mel-spectrogram sequence label corresponding to the sample text sentence;

[0054] The mel spectrum sequence corresponding to each text sentence is input into the vocoder to generate a reading audio segment corresponding to each text sentence.

[0055] In a possible implementation, the spectrum synthesis model includes an emotion feature extraction module, a pronunciation feature extraction module, an attention network module and a decoding network module;

[0056] The first generating module is used for:

[0057] Input the emotion type information of each of the text sentences into the pre-trained emotion feature extraction module to obtain an emotion feature vector; input the pronunciation attribute information of each of the text sentences into the pre-trained pronunciation feature extraction module to obtain a pronunciation feature vector;

[0058] The emotion feature vector and the pronunciation feature vector corresponding to each of the text sentences are concatenated and input into the attention network module to obtain a weight coefficient matrix; the weight coefficient matrix of each of the text sentences is input into the decoding network module to obtain a Mel spectrum sequence corresponding to each of the text sentences.

[0059] In a possible implementation, the emotion feature extraction module includes a VAE submodule and a fully connected network submodule, and the pronunciation feature extraction module includes a pre-net submodule and a CBHG submodule.

[0060] In a possible implementation, the spectrum synthesis model further includes a post-net module;

[0061] The first generating module is further used for:

[0062] An acquisition module, used to obtain an initial Mel spectrum sequence corresponding to the text sentence output by the decoding network module;

[0063] Inputting the initial Mel spectrum sequence into the post-net submodule to obtain Mel spectrum correction information;

[0064] The initial Mel spectrum sequence is corrected using the Mel spectrum correction information to obtain a Mel spectrum sequence corresponding to the text sentence.

[0065] In a possible implementation, the audio synthesis model includes multiple groups, and the obtained reading audio segments corresponding to the text sentences are multiple groups, and the reading audio of the target text obtained by splicing the multiple groups of reading audio segments of the text sentences is multiple;

[0066] Different audio synthesis models correspond to different reader types, and a group of reading audio segments output by each of the audio synthesis models has a corresponding relationship with the reader type of the audio synthesis model, and the reading audio obtained by splicing the group of reading audio segments has a corresponding relationship with the reader type;

[0067] The device further comprises:

[0068] The storage module is used to store the reading audio of each target text and the reader type of the reading audio in correspondence.

[0069] In a possible implementation, the device further includes:

[0070] A receiving module, configured to receive a request for obtaining a reading audio corresponding to the target text sent by a terminal, wherein the request for obtaining a reading audio carries a target reader type;

[0071] The sending module is used to return the reading audio corresponding to the target reader type to the terminal.

[0072] In a possible implementation, the reader types include: a first reader type for dialogue and a second reader type for narration; and the first reader type corresponds to a first audio synthesis model, and the second reader type corresponds to a second audio synthesis model;

[0073] The first generating module is used for:

[0074] Determining the text type of each text sentence according to punctuation marks in the target text, wherein the text type is dialogue or narration;

[0075] For a text sentence whose text type is dialogue, inputting emotion type information and pronunciation attribute information corresponding to the text sentence into the first audio synthesis model to generate a reading audio segment corresponding to the text sentence;

[0076] For a text sentence whose text type is narration, the emotion type information and pronunciation attribute information corresponding to the text sentence are used according to the second audio synthesis model to generate a reading audio segment corresponding to the text sentence.

[0077] In a third aspect, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the operations performed by the method for generating audio based on text.

[0078] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the method for generating audio based on text.

[0079] The beneficial effect of the technical solution provided by the embodiment of the present application is: the embodiment of the present application can generate a reading audio segment corresponding to each text sentence according to the determined emotion type information and pronunciation attribute information corresponding to each text sentence in the target text and the audio synthesis model, thereby generating a reading audio corresponding to the target text. It can be seen that emotion-related information is incorporated into the generation of the reading audio, so that the reading audio has emotional color, which can improve the user's auditory experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0081] Figure 1 This is a flow chart of a method for generating audio based on text provided in an embodiment of the present application;

[0082] Figure 2 is a schematic diagram of pronunciation unit information provided by an embodiment of the present application;

[0083] Figure 3 is a schematic diagram of word segmentation information provided by an embodiment of the present application;

[0084] Figure 4 is a schematic diagram of rhythm information provided by an embodiment of the present application;

[0085] Figure 5 is a schematic diagram of pronunciation attribute information provided by an embodiment of the present application;

[0086] Figure 6 is a structural schematic diagram of a spectrum synthesis model provided in an embodiment of the present application;

[0087] Figure 7 It is a structural schematic diagram of a device for generating audio based on text provided in an embodiment of the present application;

[0088] Figure 8 It is a structural block diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0089] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0090] The embodiment of the present application provides a method for generating audio based on text, which can be implemented by a server. The server can be a single server or a server cluster composed of multiple servers.

[0091] The server may be a background server of a website or application, for example, a website or application related to novels, news, information, etc. The server may include a processor, a memory, a communication component, etc. The processor is connected to the memory and the communication component respectively.

[0092] The processor may be a CPU (Central Processing Unit). The processor may be used to read instructions and process data, for example, a process of determining the emotion type information corresponding to each text sentence in the target text, a process of determining the pronunciation attribute information corresponding to each text sentence in the target text, a process of generating a reading audio segment, and the like.

[0093] The memory may include ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic disk, optical data storage device, etc. The memory may be used for data storage, for example, data storage of acquired target text, data storage of pre-stored correspondence between reader types and spectrum synthesis models, storage of intermediate data generated in the process of generating reading audio, etc.

[0094] The communication component may be a wired network connector, a WiFi (Wireless Fidelity) module, a Bluetooth module, a cellular network communication module, etc. The communication component may be used to receive and send signals, for example, to receive a request for obtaining a reading audio corresponding to a target text sent by a terminal, to send a reading audio to a terminal, and so on.

[0095] Figure 1 is a flowchart of a method for generating audio based on text provided in an embodiment of the present application. Figure 1 , the embodiment comprises:

[0096] 101. Determine the emotion type information corresponding to each text sentence in the target text.

[0097] The emotion type information is the emotion expressed by the text sentence, such as anger, happiness, surprise, sadness, fear, boredom, coquettishness, envy, etc.

[0098] In implementation, the target text can be text information such as information or novels that have not been published on some applications, or text information such as information or novels that have published text content. If you want to publish the reading audio corresponding to these text information on the application, you first need to generate the reading audio corresponding to these text information.

[0099] First, the target text is obtained from the backend server, which may be published or unpublished information or novels. Then, the target text can be divided into multiple text sentences by various punctuation marks in the target text, for example, by punctuation marks such as periods, exclamation marks, question marks, and ellipsis marks. The technician can obtain the emotion type information corresponding to each text sentence by using the obtained text sentences in the target text and the emotion recognition model.

[0100] In the target text, some sentences may not have any emotional attributes. In order to ensure that the audio segment corresponding to the sentence in the subsequent reading audio is an audio that connects the context and has emotions, the emotional type information corresponding to the sentence can be determined with the help of the associated context of the sentence. The corresponding processing process can be as follows:

[0101] Determine the associated context corresponding to each text sentence in the target text, wherein the associated context corresponding to the text sentence consists of at least one associated text sentence corresponding to the text sentence. If the associated context corresponding to the text sentence is determined, determine the feature information of the text sentence based on the text paragraph consisting of the text sentence and the associated context corresponding to the text sentence. If the associated context corresponding to the text sentence is not determined, determine the feature information of the text sentence based on the text sentence; input the feature information of each text sentence into a pre-trained emotion recognition model to obtain the emotion type information corresponding to the text sentence.

[0102] Among them, the associated text sentence is one of the preceding text sentences and the following text sentences adjacent to the text sentence, the associated context corresponding to the text sentence is one or more associated text sentences adjacent to the text sentence, and in a text paragraph consisting of a text sentence and all its corresponding associated text sentences, there is no text sentence other than the text sentence and the associated text sentence between any two sentences.

[0103] In implementation, the associated context corresponding to each text sentence in the target text can be determined by natural language processing technology, the target text can be divided into paragraphs, and each paragraph can be input into the text analysis tool in the natural language processing technology, and then the associated context corresponding to each text sentence in the paragraph can be obtained, and then the emotion type information corresponding to each text sentence can be obtained according to the emotion recognition model, each text sentence and the corresponding associated context. For text sentences without associated context, the emotion type information corresponding to each text sentence can be obtained through the text sentence and the emotion recognition model.

[0104] For the associated context of a text sentence, the technician can pre-set a threshold value for the number of associated text sentences of the associated context. There may be adjacent associated text sentences before and after a text sentence, and the number of the associated text sentences before and after can be the threshold value respectively. Therefore, the associated context of a text sentence can include at most twice the number of associated text sentences of the threshold value. For example, if the threshold value for the number of associated text sentences is 3, then the associated context of a text sentence is at most six sentences, namely the first three associated text sentences and the last three associated text sentences of the text sentence. This embodiment does not limit the setting of the threshold value for the number of associated text sentences.

[0105] Regarding the method of determining the associated context corresponding to each text sentence, after setting the threshold of the number of associated text sentences, it can be determined according to various text analysis tools in natural language processing technology. The following takes three of them as examples, and the corresponding methods can be as follows:

[0106] First, the associated context of the text sentence can be determined by part-of-speech tagging. Each word in the text sentence is tagged with part-of-speech, and then the associated context of the text sentence is determined according to the pre-set part-of-speech requirements, for example, each word in the text sentence is classified according to the part-of-speech such as noun, verb, adjective, etc. Then, it can be determined whether it is a valid associated context according to the part-of-speech of the words before and after the text sentence. For example, if the text type of the text sentence is a dialogue, then the last word of a sentence before the text sentence is adjacent to the text sentence, and if the word is a verb, then the previous sentence of the text sentence is defined as the associated context, because the previous word of a dialogue is a verb, then the previous sentence of the text sentence is very likely to be "someone said / answered / replied" (the part of speech of the word "say / answer / reply" is a verb), so the sentence "someone said / answered / reply" can be defined as an associated text sentence of the text sentence. Or, for another example, when the text sentence is a sentence in a dialogue, and the next sentence of the text sentence is a sentence in the same dialogue, the next sentence of the text sentence can be determined as an associated text sentence of the text sentence, and so on. There can be many determination settings in this method, which are not listed here one by one. After determining that the previous sentence of a text sentence is an associated text sentence of the text sentence, it is possible to continue to determine whether the previous sentence of the associated text sentence meets the requirements. If it meets the requirements, the sentence is also an associated text sentence of the text sentence, and the determination is made in sequence until all sentences that meet the threshold of the number of associated text sentences have been determined, and the text sentences that meet the requirements are determined as associated text sentences, and these associated text sentences are the associated contexts of the text sentences.

[0107] The second method is to determine the associated context of a text sentence by using a rule template. A rule template is a commonly used sentence that has been determined. If a dialogue mode in the rule template appears, the sentences other than the text sentence in the rule template are defined as the associated text sentences of the text sentence. The sentences are judged in sequence until all the sentences that meet the threshold of the number of associated text sentences have been judged. The text sentences that meet the requirements are determined as associated text sentences. These associated text sentences are the associated context of the text sentences. For example, if a sentence such as "he said excitedly", "he said", "he said" is followed by a dialogue, then this sentence can be the associated context of the dialogue. There are many forms of rule templates, which are not listed here one by one, and this embodiment does not limit this.

[0108] The third method is to determine the associated context of the text sentence by using a sentiment analysis tool, for example, the sentiment analysis tool may be a Chinese sentiment analysis library. The Chinese sentiment analysis library can determine the words with obvious emotional attributes in the target text, such as excited, happy, sad, crying, etc. The sentences that meet the threshold of the number of associated text sentences are judged to determine the words with obvious emotional attributes, and the sentence with the word with obvious emotional attributes closest to the text sentence and the sentences between it and the text sentence are determined as the associated context of the text sentence.

[0109] For the process of determining the context of the upper link corresponding to the text sentence, one of the above methods can be used, or the above methods can be used together. For example, when the associated context of the text sentence needs to be determined, it can be determined by part-of-speech tagging first. If the associated context of the text sentence can be determined, the subsequent steps can be continued. If it cannot be determined, it can be determined by rule templates. Similarly, if the associated context of the text sentence can be determined, the subsequent steps will be continued. If it cannot be determined, it can be determined by sentiment analysis tools. If it can be determined, the subsequent steps will be continued. If not, it means that the text sentence has no associated context. This method of using multiple methods together is not limited to the above three methods, nor is it limited to the order of use of the multiple methods. It can be set according to actual conditions, and this embodiment does not limit this.

[0110] After determining the associated context of the text sentence, for the text sentence with the determined associated context, the text sentence and the corresponding associated context can be arranged in the target text to form a text paragraph, which is input into the trained feature extraction model to obtain the feature information corresponding to the text paragraph. For example, the feature extraction model can be a BERT (Bidirectional Encoder Representations from Transformers) model in natural language processing technology. The text paragraph composed of the text sentence and the corresponding associated context is input into the BERT model to obtain the feature vector corresponding to the text paragraph, which is the feature information. Then, the feature information of the text paragraph is input into the trained emotion recognition model to obtain the emotion type information corresponding to the text paragraph, which is set as the emotion type information corresponding to the text sentence.

[0111] For text sentences whose associated context has not been determined, the text sentence can be directly input into a trained feature extraction model, which can also be a BERT model, and then the feature information corresponding to the text sentence can be obtained. The feature information corresponding to the text sentence is input into a trained emotion recognition model to obtain the emotion type information corresponding to the text sentence.

[0112] Optionally, the emotion recognition model in the embodiment of the present application can be trained by a first sample text set, where the sample text set includes feature information of sample text sentences and emotion type labels corresponding to the sample text sentences.

[0113] In implementation, when the emotion recognition model is trained, feature information of a sample text sentence and an emotion type label corresponding to the sample text sentence may be selected from the first sample text set each time.

[0114] The characteristic information of the sample text sentences in the first sample text set and the emotion type labels corresponding to the sample text sentences are obtained from a plurality of sample texts. The associated context corresponding to each sample text sentence in the sample text is determined in the sample text. If the associated context corresponding to the sample text sentence is determined, the sample text paragraph composed of the sample text sentence and the corresponding associated context is input into the trained feature extraction model, and the characteristic information of the sample text paragraph can be obtained, that is, as the characteristic information of the sample text sentence; if the associated context corresponding to the sample text sentence is not determined, the sample text sentence is directly input into the trained feature extraction model, and the characteristic information of the sample text sentence can be obtained.

[0115] The feature information of the sample text sentence is input into the emotion recognition model to be trained, and the predicted emotion type information corresponding to the sample text sentence is output. Based on the predicted emotion type information corresponding to the sample text sentence and the emotion type label corresponding to the sample text sentence obtained in advance, the parameters of the emotion recognition model to be trained are adjusted. When the loss value is less than a preset threshold, the adjusted emotion recognition model is determined as the trained emotion recognition model. If the loss value is not less than the preset threshold, the feature information and the corresponding emotion type label of a sample text sentence are continuously obtained from the first sample text set, and the parameters of the emotion recognition model to be trained are continuously adjusted.

[0116] 102. Determine pronunciation attribute information corresponding to each text sentence in the target text.

[0117] In implementation, the pronunciation attribute information in the target text can be determined by natural language processing technology. The pronunciation attribute information can include a single piece of information or multiple pieces of information. Each text sentence can be input into a corresponding machine learning model in the natural language processing technology, and then the information corresponding to different machine learning models can be obtained. The multiple output information can be combined to obtain the pronunciation attribute information corresponding to the text sentence.

[0118] Optionally, the pronunciation attribute information includes at least one of pronunciation unit information, word segmentation information, and prosody information.

[0119] In implementation, the pronunciation attribute information may include one or more. The pronunciation attribute information in the present embodiment may include at least one of pronunciation unit information, segmentation information and prosody information. When the pronunciation unit information of a text sentence needs to be determined, the text sentence may be input into a pronunciation unit model of a natural language processing technology to obtain the pronunciation unit information corresponding to the text sentence, and the pronunciation unit information may include the pinyin, phoneme or English phonetic symbol of each word in the text sentence, etc. When the segmentation information of a text sentence needs to be determined, the text sentence may be input into a segmentation model of a natural language processing technology to obtain the segmentation information corresponding to the text sentence, and the segmentation information includes the division of each word corresponding to the text sentence. When the prosody information of a text sentence needs to be determined, the text sentence may be input into a prosody model of a natural language processing technology to obtain the prosody information corresponding to the text sentence, and the prosody information includes the pause time information between every two adjacent words in the text sentence. Then the obtained multiple information is combined to obtain the pronunciation attribute information corresponding to the text sentence.

[0120] For example, if the text sentence is "Today is great.", and it is input into the pronunciation unit model, we can get the following Figure 2The pronunciation unit vector shown, i.e., the pronunciation unit information corresponding to the text sentence. The first column elements in this pronunciation unit vector are the pinyin of each character in the text sentence, and the pinyin is arranged into vowels and consonants. The second column elements are the tones of the pinyin. '今 (jīn)', '天 (tiān)', and '真 (zhēn)' are all in the first tone, '好 (hǎo)' is in the third tone, and the element corresponding to the punctuation mark '。' is 0.

[0121] Inputting the text sentence "今天真好。(Jīntiān zhēnhǎo.)" into the word segmentation model, one can obtain Figure 3 the word segmentation vector shown, i.e., the word segmentation information. In this word segmentation vector, the first column elements are the pinyin corresponding to each character in the text sentence, and the second column is the word segmentation information. "今天真好 (Jīntiān zhēnhǎo)" can be segmented into two words, namely "今天 (Jīntiān)" and "真好 (zhēnhǎo)". For a word with multiple characters, the pinyin of the first character of the word corresponds to 'B', and the pinyin of the last character corresponds to 'E'. If it is a three-character word, the pinyin of the second character corresponds to 'M'. If it is a four-character word, the pinyin of the third character can correspond to 'N', and so on. For the case of a single character, the element corresponding to the second column can be set to 'S', and the element corresponding to the second column of the punctuation mark can also be set to 'S'.

[0122] Inputting the text sentence "今天真好。(Jīntiān zhēnhǎo.)" into the prosody module, one can obtain Figure 4 the prosody vector shown, i.e., the prosody information. In this prosody vector, the first column elements are the pinyin corresponding to each character in the text sentence, and the second column elements are the pause time levels between every two adjacent words. The pause time level between two adjacent words can be shown on the elements in the second column corresponding to the same row of all the pinyin elements of the last character of the previous word among the two adjacent words. Of course, other settings can also be made here, and this embodiment does not limit this. This pause time level only represents a predicted value of the pause time, and it is not necessarily generated strictly according to the pause time represented by this pause time level when generating the reading audio segment. For example, '1' can represent 20ms, '2' can represent 45ms, '3' can represent 75ms, etc. Since there is no previous word for the first word in the text sentence, the pause time corresponding to its pinyin is all 0. The pause time between the two words "今天 (Jīntiān)" and "真好 (zhēnhǎo)" is 1, that is, it can be 20ms. Then, '1' can be shown on the elements in the second column corresponding to the same row of 't', 'i', and 'an' of '天 (tiān)', while the elements in the second column corresponding to '今 (jīn)', '真 (zhēn)', and '好 (hǎo)' are still 0. The element shown in the second column corresponding to the punctuation mark is the silent pause time corresponding to this text sentence. For the punctuation mark before the text in the text sentence, it represents the time from no sound to having sound, and for the punctuation mark after the text in the text sentence, it represents the time from having sound to no sound.

[0123] For the text sentence "今天真好 (Jīntiān zhēnhǎo)", after determining the above three types of pronunciation attribute information, they can be combined as Figure 5 In the matrix shown, the first and last rows in the matrix represent the silent pause time series. The silent pause time series in the first row represents the time from no sound to sound, and the silent pause time series in the last row represents the time from sound to no sound.

[0124] 103. Input the emotion type information and pronunciation attribute information corresponding to each text sentence into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence.

[0125] In implementation, after determining the emotion type information and pronunciation attribute information corresponding to the text sentence, the pronunciation attribute information and the emotion type information can be combined into a matrix and input into the trained audio synthesis model to obtain the reading audio segment corresponding to the text sentence. The reading audio segment is generated based on the two factors of pronunciation attribute information and emotion type information. When generating the reading audio segment, information related to emotion is incorporated. Therefore, the reading audio segment is an audio with emotional factors and intonation in terms of human hearing.

[0126] Optionally, the audio synthesis model may include a spectrum synthesis model and a vocoder, and the corresponding audio synthesis model may be processed as follows:

[0127] The emotion type information and pronunciation attribute information corresponding to each text sentence are input into the pre-trained spectrum synthesis model to obtain the Mel spectrum sequence corresponding to each text sentence. The Mel spectrum sequence corresponding to each text sentence is input into the vocoder to generate the reading audio segment corresponding to each text sentence.

[0128] In implementation, after the emotion type information and pronunciation attribute information corresponding to the text sentence are combined into a matrix, the matrix is ​​input into the trained spectrum synthesis model, and then the spectrum synthesis model outputs the Mel spectrum sequence corresponding to the text sentence. The Mel spectrum sequence contains audio signal data corresponding to multiple different moments, but the Mel spectrum sequence cannot be used directly for playback, so the obtained Mel spectrum sequence corresponding to the text sentence is input into the vocoder, and the vocoder converts the input Mel spectrum sequence from the frequency domain to the time domain, and outputs an audio signal sequence. The audio signal sequence can then be packaged and other operations can be performed to obtain the reading audio segment corresponding to the text sentence.

[0129] 104. According to the arrangement order of each text sentence in the target text, the reading audio segments corresponding to each text sentence are spliced ​​to obtain the reading audio corresponding to the target text.

[0130] In implementation, after obtaining the reading audio segment corresponding to each text sentence in the target text, the reading audio segments can be spliced ​​together according to the arrangement order of each text sentence in the target text to obtain the reading audio corresponding to the entire target text, and then the target text and the reading audio can be stored in correspondence.

[0131] The user can open the application on the terminal, and then select the information or novel he wants to read on the interface of the application, that is, the target text, and open the reading interface corresponding to the target text. He can select the read aloud option on the reading interface. After the user confirms to play, the terminal will send a reading audio acquisition request corresponding to the target text to the background server of the application. When the server receives the reading audio acquisition request corresponding to the target text sent by the terminal, it can retrieve the reading audio corresponding to the target text in the database according to the target text identifier carried in the reading audio acquisition request, and send it to the user's terminal. The application on the terminal plays the reading audio to the user.

[0132] Optionally, the target text reading audio can also have a variety of timbre options, and there are different types of readers corresponding to different timbre, for example, there can be male timbre and female timbre, and male timbre can also be divided into youth voice, uncle voice and young boy voice, etc. Similarly, female timbre can also be divided into youth voice, mature sister voice and loli voice, etc. For target texts with multiple types of readers to choose from, in the steps of generating the corresponding reading audio, steps 101-102 are the same, and the emotion type information and pronunciation attribute information corresponding to the target text need to be determined. After the emotion type information and pronunciation attribute information are determined, step 103 can correspond to the following:

[0133] The same audio synthesis model can be set for different types of readers. Before generating the corresponding reading audio through the target text, it is necessary to first determine what kind of reading audio you want to generate for the target text, that is, determine the target reader type corresponding to the target text. After determining the emotion type information and pronunciation attribute information corresponding to the text sentence, you can also determine the target reader type, input the emotion type information, pronunciation attribute information and target reader type information into the audio synthesis model, and thus obtain the reader audio segment corresponding to the text sentence.

[0134] Different audio synthesis models can be set for different reader types. One type of reader corresponds to one audio synthesis model. The corresponding processing process can be as follows:

[0135] There are multiple audio synthesis models, and the obtained text sentences correspond to multiple groups of reading audio segments, and the reading audio of the target text obtained by splicing the reading audio segments of the multiple groups of text sentences is multiple. Different audio synthesis models correspond to different types of readers, and the group of reading audio segments output by each audio synthesis model has a corresponding relationship with the reader type of the audio synthesis model, and the reading audio obtained by splicing a group of reading audio segments has a corresponding relationship with the reader type.

[0136] During implementation, the technicians can store the correspondence between each reader type and the corresponding audio synthesis model in advance, and after determining the emotion type information and pronunciation attribute information corresponding to the text sentence, determine the target reader type corresponding to the text sentence, and then determine the corresponding audio synthesis model based on the target reader type and the pre-stored correspondence, and then input the emotion type information and pronunciation attribute information corresponding to the text sentence into the audio synthesis model to generate the reading audio segment corresponding to the text sentence.

[0137] Optionally, in addition to generating reading audio with different timbres, the target text can also be divided into two types: narration and dialogue. These two types are read with different timbres, thereby providing users with a better listening experience. The corresponding processing process can be as follows:

[0138] The reader types include: a first reader type for dialogue and a second reader type for narration, wherein the first reader type corresponds to a first audio synthesis model, and the second reader type corresponds to a second audio synthesis model.

[0139] In implementation, it is first necessary to determine which timbre is used to read the dialogue and narration in the target text, that is, to determine the reader types corresponding to the dialogue and narration, that is, to determine the first reader type corresponding to the dialogue and the second reader type corresponding to the narration, and then determine the audio synthesis models corresponding to the dialogue and the narration, that is, the first audio synthesis model corresponding to the dialogue and the second audio synthesis model corresponding to the narration, according to the pre-stored correspondence between the reader type and the audio synthesis model. For example, after determining that the first reader type of the dialogue in the target text is an uncle voice with a male timbre, and the second reader type of the narration is a lolita voice with a female timbre, when determining the audio synthesis model, the first audio synthesis model of the dialogue can be determined as the audio synthesis model corresponding to the uncle voice with a male timbre, and the second audio synthesis model of the narration can be determined as the audio synthesis model corresponding to the lolita voice with a female timbre according to the pre-stored correspondence between the reader type and the audio synthesis model.

[0140] For the case where the target text is divided into two types of readers, dialogue and narration, the process of generating the reading audio segments corresponding to the text sentences can be as follows:

[0141] The text type of each text sentence is determined according to the punctuation marks in the target text, wherein the text type is dialogue or narration. For a text sentence whose text type is dialogue, the emotion type information and pronunciation attribute information corresponding to the text sentence are input into the first audio synthesis model to generate a reading audio segment corresponding to the text sentence. For a text sentence whose text type is narration, the emotion type information and pronunciation attribute information corresponding to the text sentence are input into the second audio synthesis model to generate a reading audio segment corresponding to the text sentence.

[0142] In implementation, the text type of each text sentence can be determined based on the punctuation marks between each text sentence in the target text. The text type of the text sentence between double quotation marks can be set as dialogue, and the others can be set as narration, or other setting methods can be used, which are not limited in this embodiment. Then, the first reader type corresponding to the dialogue in the target text and the second reader type corresponding to the narration can be determined, and the emotion type information and pronunciation attribute information corresponding to the text sentence with the text type of dialogue are input into the first audio synthesis model to generate the reading audio segment corresponding to the text sentence with the text type of dialogue, and the emotion type information and pronunciation attribute information corresponding to the text sentence with the text type of narration are input into the second audio synthesis model to generate the reading audio segment corresponding to the text sentence with the text type of narration.

[0143] Optionally, after obtaining the reading audio corresponding to the target text, the reading audio of each target text and the reader type of the reading audio may be stored in correspondence.

[0144] In implementation, for a target text, it can generate reading audio corresponding to multiple types of readers according to the above method, and then store these reading audios in the database. If the target text generates reading audios of different types of readers, the target text can be divided into two text types: dialogue and narration, and then the dialogue is generated into reading audio segments of each type of reader, and the narration is generated into reading audio segments of each type of reader, and then the reading audio segments corresponding to these dialogues and narrations are respectively combined to obtain multiple complete reading audios and store them accordingly. For example, there are three types of readers, and the text sentences corresponding to the dialogues in the target text can be respectively generated into reading audio segments corresponding to three different types of readers, and the text sentences corresponding to the narration in the target text can be respectively generated into reading audio segments corresponding to three different types of reader audios, and then the reading audio segments corresponding to the dialogues and narrations are combined to obtain nine types of reading audio corresponding to the target text, and these nine types of reading audios are stored in the database. Among these reading audios, there are reading audios with the same reader type for dialogues and narrations, and there are also reading audios with different reader types for dialogues and narrations. After storing the reading audio generated for a target text according to all reader types, the following processing can be performed:

[0145] A reading audio acquisition request corresponding to the target text sent by the terminal is received, wherein the reading audio acquisition request carries the target reader type, and the reading audio corresponding to the target reader type is returned to the terminal.

[0146] During implementation, the user can open the application on the terminal, and then select the information or novel he wants to read on the interface of the application, that is, the target text, and open the reading interface corresponding to the target text. The user can select the reading option on the reading interface. The user can also select the reading mode on the reading interface, that is, determine the type of reader of the reading audio, and click to play. At this time, the terminal will send a reading audio acquisition request corresponding to the target text to the background server of the application. When the server receives the reading audio acquisition request corresponding to the target text sent by the terminal, the server retrieves the reading audio of the target reader type corresponding to the target text in the database according to the target text identifier and the corresponding target reader type carried in the reading audio acquisition request, and then returns it to the terminal. The application on the terminal plays the reading audio to the user.

[0147] The spectrum synthesis model in this embodiment is a machine learning model based on the Tacotron model (an end-to-end speech synthesis model based on deep learning). Figure 6 As shown, it includes a pronunciation feature extraction module, an emotion feature extraction module, an attention network module and a decoding network module.

[0148] The emotion type information of each text sentence is input into the pre-trained emotion feature extraction module to obtain the emotion feature vector. The pronunciation attribute information of each text sentence is input into the pre-trained pronunciation feature extraction module to obtain the pronunciation feature vector. The emotion feature vector and pronunciation feature vector corresponding to each text sentence are concatenated and input into the attention network module to obtain the weight coefficient matrix. The weight coefficient matrix of each text sentence is input into the decoding network module to obtain the mel spectrum sequence corresponding to each text sentence.

[0149] For the spectrum synthesis model in this embodiment, an emotion feature extraction module is added on the basis of the Tacotron model, and a post-net submodule is added to the decoding network module, wherein the pronunciation feature extraction module includes a pre-net submodule and a CBHG submodule, and the emotion feature extraction module includes a VAE submodule and a fully connected network submodule. It has been experimentally verified that the VAE submodule can make the output of the emotion feature extraction module more stable and more accurate. There are many options for the attention network module, which can be a GMM attention (Gaussian mixture attention network) module or other types of modules, which are not limited in this embodiment. The decoding network module includes a pre-net submodule, an attention RNN submodule, an attention layer submodule, a decoder RNN submodule, a linear project submodule, a gate layer submodule and a post-net submodule. In this embodiment, the post-net submodule in the Tacotron2 model is added on the basis of the Tacotron model, and the corresponding working mechanism of the spectrum synthesis model in this embodiment can be as follows:

[0150] The initial Mel spectrum sequence corresponding to the text sentence output by the decoding network module is obtained. The initial Mel spectrum sequence is input into the post-net submodule to obtain the Mel spectrum correction information. The initial Mel spectrum sequence is corrected using the Mel spectrum correction information to obtain the Mel spectrum sequence corresponding to the text sentence.

[0151] In implementation, the submodules in the decoding network module, such as the pre-net submodule, the attention RNN submodule, the attentionlayer submodule, the decoder RNN submodule, the linear project submodule, and the gate layer submodule, process the weight coefficient matrix input into the decoding network module, as well as the output of other modules or submodules, to obtain an initial Mel spectrum sequence corresponding to the text sentence. The initial Mel spectrum sequence is input into the post-net submodule to obtain Mel spectrum correction information corresponding to the initial Mel spectrum sequence. The Mel spectrum correction information is correction information for correcting the initial Mel spectrum sequence in a direction that is more suitable for human hearing. The initial Mel spectrum sequence and the obtained Mel spectrum correction information are then processed by matrix addition, and finally the Mel spectrum sequence corresponding to the text sentence can be obtained.

[0152] For the training process of the spectrum synthesis model, the corresponding processing process can be as follows:

[0153] The spectrum synthesis model is trained by the second sample text set, and the second sample text set includes emotion type information and pronunciation attribute information of the sample text sentences and Mel spectrum sequence labels corresponding to the sample text sentences.

[0154] In implementation, when training the spectrum synthesis model, the emotion type information and pronunciation attribute information of a sample text sentence and the Mel spectrum sequence label corresponding to the sample text sentence can be selected from the second sample text set each time to adjust the parameters of the spectrum synthesis model.

[0155] For determining the emotion type information and pronunciation attribute information of each text sentence in the second sample text set and the Mel spectrum sequence label corresponding to the sample text sentence, the processing process may be as follows:

[0156] First, the technician needs to obtain the reading audio segment corresponding to each sample text sentence in the sample text. The sample reading audio segment can be the audio segment obtained by dubbing by the dubbing staff according to the sample text sentence and the corresponding emotion type information provided by the technician, or it can be other existing texts and corresponding audio segments, etc. This embodiment does not limit this, so it can be understood that the emotion type information corresponding to each sample text sentence has been determined before obtaining the sample reading audio segment, and the Mel spectrum corresponding to the sample reading audio segment is used as the reference output of the spectrum synthesis model, that is, the Mel spectrum sequence label. Then, according to step 103, the pronunciation attribute information corresponding to each sample text sentence is obtained.

[0157] During training, the pronunciation attribute information of the sample text sentence can be input into the pronunciation feature extraction module to obtain the pronunciation feature information output by the pronunciation feature extraction module, and the Mel spectrum label (i.e., the benchmark output) and the emotion type information corresponding to the sample reading audio segment corresponding to the sample text sentence are input into the emotion feature extraction module to output the emotion feature information, and the pronunciation feature information and the emotion feature information are combined together and input into the subsequent attention network module for processing, and then through the decoding network module, the Mel spectrum sequence corresponding to the text sentence can be output. Then, according to the benchmark output (i.e., the Mel spectrum label corresponding to the sample reading audio segment), the Mel spectrum sequence output by the decoding network module, and the loss function, the parameters in the spectrum synthesis model are adjusted. The technician can obtain the sample text from the second sample text set again, and then adjust the spectrum synthesis model according to each sample text sentence in the sample text, until the loss value is less than the preset threshold, and the spectrum synthesis model after parameter adjustment is determined as the trained spectrum synthesis model.

[0158] When only one spectral synthesis model is used to generate multiple sample reading audio segments of different reader types, the reader type information can also be input into the emotion feature extraction module for training during training. When using the trained spectral synthesis model, the reader type information corresponding to the text sentence is also input into the spectral synthesis model, so that reading audio segments of text sentences corresponding to different reader types can be obtained.

[0159] When different spectral synthesis models are used to generate sample reading audio segments corresponding to different reader types, different reader types can be used to train different spectral synthesis models during training, and one reader type corresponds to one spectral synthesis model. In this way, it is only necessary to store the correspondence between the reader type and the spectral synthesis model in advance, and then determine the reader type corresponding to the text sentence in advance during training or use, so as to determine the corresponding spectral synthesis model for use.

[0160] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0161] The scheme mentioned in the embodiment of the present application can generate a reading audio segment corresponding to each text sentence according to the emotion type information and pronunciation attribute information corresponding to each text sentence in the determined target text, and the spectrum synthesis model, thereby generating a reading audio corresponding to the target text. It can be seen that emotion-related information is incorporated into the generation of the reading audio, so that the reading audio has emotional color, which can improve the user's auditory experience.

[0162] The present application embodiment provides a device for generating audio based on text, which may be the computer device in the above embodiment, such as Figure 7 As shown, the device comprises:

[0163] A first determination module 710 is used to determine the emotion type information corresponding to each text sentence in the target text;

[0164] A second determination module 720 is used to determine pronunciation attribute information corresponding to each text sentence in the target text;

[0165] The first generation module 730 is used to input the emotion type information and pronunciation attribute information corresponding to each text sentence into a pre-trained audio synthesis model to obtain a reading audio segment corresponding to each text sentence;

[0166] The second generating module 740 is used to splice the reading audio segments corresponding to each text sentence according to the arrangement order of each text sentence in the target text, so as to obtain the reading audio corresponding to the target text.

[0167] In a possible implementation, the first determining module 710 is configured to:

[0168] Determining an associated context corresponding to each text sentence in the target text, wherein the associated context corresponding to the text sentence consists of at least one associated text sentence corresponding to the text sentence;

[0169] If the associated context corresponding to the text sentence is determined, determining the feature information of the text sentence based on the text paragraph consisting of the text sentence and the associated context corresponding to the text sentence; if the associated context corresponding to the text sentence is not determined, determining the feature information of the text sentence based on the text sentence;

[0170] The feature information of each of the text sentences is input into a pre-trained emotion recognition model to obtain the emotion type information corresponding to the text sentence, wherein the emotion recognition model is trained by a first sample text set, and the first sample text set includes the feature information of the sample text sentence and the emotion type label corresponding to the sample text sentence.

[0171] In a possible implementation manner, the pronunciation attribute information includes at least one of pronunciation unit information, word segmentation information, and prosody information.

[0172] In a possible implementation, the audio synthesis model includes a spectrum synthesis model and a vocoder;

[0173] The first generating module 730 is used to:

[0174] Inputting the emotion type information and pronunciation attribute information corresponding to each text sentence into the pre-trained spectrum synthesis model to obtain a Mel-spectrogram sequence corresponding to each text sentence; wherein the spectrum synthesis model is trained by a second sample text set, and the second sample text set includes the emotion type information and pronunciation attribute information of the sample text sentence and the Mel-spectrogram sequence label corresponding to the sample text sentence;

[0175] The mel spectrum sequence corresponding to each text sentence is input into the vocoder to generate a reading audio segment corresponding to each text sentence.

[0176] In a possible implementation, the spectrum synthesis model includes an emotion feature extraction module, a pronunciation feature extraction module, an attention network module and a decoding network module;

[0177] The first generating module 730 is used to:

[0178] Input the emotion type information of each of the text sentences into the pre-trained emotion feature extraction module to obtain an emotion feature vector; input the pronunciation attribute information of each of the text sentences into the pre-trained pronunciation feature extraction module to obtain a pronunciation feature vector;

[0179] The emotion feature vector and the pronunciation feature vector corresponding to each of the text sentences are concatenated and input into the attention network module to obtain a weight coefficient matrix; the weight coefficient matrix of each of the text sentences is input into the decoding network module to obtain a Mel spectrum sequence corresponding to each of the text sentences.

[0180] In one possible implementation, the emotion feature extraction module includes a variational autoencoder VAE submodule and a fully connected network submodule, and the pronunciation feature extraction module includes a preprocessing network pre-net submodule and a sequence feature extraction network CBHG submodule including a one-dimensional convolution and a bidirectional gated recurrent unit.

[0181] In a possible implementation, the spectrum synthesis model further includes a post-processing network post-net module;

[0182] The first generating module 730 is further used for:

[0183] An acquisition module, used to obtain an initial Mel spectrum sequence corresponding to the text sentence output by the decoding network module;

[0184] Inputting the initial Mel spectrum sequence into the post-net submodule to obtain Mel spectrum correction information;

[0185] The initial Mel spectrum sequence is corrected using the Mel spectrum correction information to obtain a Mel spectrum sequence corresponding to the text sentence.

[0186] In a possible implementation, the audio synthesis model includes multiple groups, and the obtained reading audio segments corresponding to the text sentences are multiple groups, and the reading audio of the target text obtained by splicing the multiple groups of reading audio segments of the text sentences is multiple;

[0187] Different audio synthesis models correspond to different reader types, and a group of reading audio segments output by each of the audio synthesis models has a corresponding relationship with the reader type of the audio synthesis model, and the reading audio obtained by splicing the group of reading audio segments has a corresponding relationship with the reader type;

[0188] The device also includes:

[0189] The storage module is used to store the reading audio of each target text and the reader type of the reading audio in correspondence.

[0190] In a possible implementation manner, the device further includes:

[0191] A receiving module, configured to receive a request for obtaining a reading audio corresponding to the target text sent by a terminal, wherein the request for obtaining a reading audio carries a target reader type;

[0192] The sending module is used to return the reading audio corresponding to the target reader type to the terminal.

[0193] In a possible implementation, the reader types include: a first reader type for dialogue and a second reader type for narration; and the first reader type corresponds to a first audio synthesis model, and the second reader type corresponds to a second audio synthesis model;

[0194] The first generating module 730 is used to:

[0195] Determining the text type of each text sentence according to punctuation marks in the target text, wherein the text type is dialogue or narration;

[0196] For a text sentence whose text type is dialogue, the emotion type information and pronunciation attribute information corresponding to the text sentence are input into the first audio synthesis model to generate a reading audio segment corresponding to the text sentence; for a text sentence whose text type is narration, the emotion type information and pronunciation attribute information corresponding to the text sentence are input into the second audio synthesis model to generate a reading audio segment corresponding to the text sentence.

[0197] It should be noted that: the device for generating audio based on text provided in the above embodiment only uses the division of the above functional modules as an example when generating audio based on text. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device for generating audio based on text provided in the above embodiment and the method embodiment for generating audio based on text belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0198] Figure 8800 may have relatively large differences due to different configurations or performances, and may include one or more processors 801 and one or more memories 802, wherein the memory 802 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 801 to implement the methods provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.

[0199] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, which can be executed by a processor in a terminal to complete the method of generating audio based on text in the above embodiment. The computer-readable storage medium can be non-transitory. For example, the computer-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0200] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0201] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating audio based on text, It is characterized in that The method comprises: For each text sentence in the target text, a method of part-of-speech tagging, a method of rule templates, and a method of sentiment analysis tools are used to determine whether a threshold number of associated text sentences located in front of the text sentence and a threshold number of associated text sentences located behind the text sentence in the target text are associated text sentences corresponding to the text sentence, so as to determine an associated context corresponding to the text sentence, wherein the associated context corresponding to the text sentence consists of at least one associated text sentence corresponding to the text sentence; If the associated context corresponding to the text sentence is determined, determining the feature information of the text sentence based on the text paragraph consisting of the text sentence and the associated context corresponding to the text sentence; if the associated context corresponding to the text sentence is not determined, determining the feature information of the text sentence based on the text sentence; Inputting feature information of each of the text sentences into a pre-trained emotion recognition model to obtain emotion type information corresponding to the text sentence, wherein the emotion recognition model is trained by a first sample text set, and the first sample text set includes feature information of the sample text sentences and emotion type labels corresponding to the sample text sentences; Determining pronunciation attribute information corresponding to each text sentence in the target text, wherein the pronunciation attribute information includes pronunciation unit information, word segmentation information, and prosody information, and the prosody information includes pause time information between every two adjacent words in the text sentence; Input the emotion type information of each of the text sentences into an emotion feature extraction module in a spectrum synthesis model in a pre-trained audio synthesis model to obtain an emotion feature vector, wherein the spectrum synthesis model is trained by a second sample text set, the second sample text set includes the emotion type information and pronunciation attribute information of the sample text sentences and the Mel spectrum sequence labels corresponding to the sample text sentences, and the emotion feature extraction module includes a variational autoencoder VAE submodule and a fully connected network submodule; Inputting the pronunciation attribute information of each of the text sentences into a pronunciation feature extraction module in a pre-trained spectrum synthesis model to obtain a pronunciation feature vector, wherein the pronunciation feature extraction module includes a pre-processing network pre-net submodule and a sequence feature extraction network CBHG submodule including a one-dimensional convolution and a bidirectional gated recurrent unit; The emotion feature vector and the pronunciation feature vector corresponding to each of the text sentences are concatenated and input into the attention network module in the pre-trained spectrum synthesis model to obtain a weight coefficient matrix; Inputting the weight coefficient matrix of each of the text sentences into a decoding network module in a pre-trained spectrum synthesis model to obtain a Mel spectrum sequence corresponding to each of the text sentences; Inputting the Mel-spectrogram sequence corresponding to each of the text sentences into a vocoder in a pre-trained audio synthesis model to generate a reading audio segment corresponding to each of the text sentences; According to the arrangement order of each text sentence in the target text, the reading audio segments corresponding to each text sentence are spliced ​​to obtain the reading audio corresponding to the target text.

2. The method according to claim 1, It is characterized in that The spectrum synthesis model also includes a post-processing network post-net module; After inputting the weight coefficient matrix of each of the text sentences into the decoding network module in the pre-trained spectrum synthesis model, the method further includes: Obtaining an initial Mel spectrum sequence corresponding to the text sentence output by the decoding network module; Inputting the initial Mel spectrum sequence into the post-net submodule to obtain Mel spectrum correction information; The initial Mel spectrum sequence is modified using the Mel spectrum modification information to obtain a Mel spectrum sequence corresponding to each of the text sentences.

3. The method according to claim 1, It is characterized in that The audio synthesis model includes multiple groups, then the obtained reading audio segments corresponding to the text sentences are multiple groups, and the reading audio of the target text obtained by splicing the reading audio segments of the multiple groups of text sentences is multiple; Different audio synthesis models correspond to different reader types, and a group of reading audio segments output by each of the audio synthesis models has a corresponding relationship with the reader type of the audio synthesis model, and the reading audio obtained by splicing the group of reading audio segments has a corresponding relationship with the reader type; After obtaining the reading audio corresponding to the target text, the method further includes: The reading audio of each target text and the reader type of the reading audio are stored in correspondence.

4. The method according to claim 3, It is characterized in that After storing the reading audios of the target texts in correspondence with the types of readers of the reading audios, the method further includes: A request for obtaining a reading audio corresponding to the target text sent by a receiving terminal, wherein the request for obtaining a reading audio carries a target reader type; The reading audio corresponding to the target reader type is returned to the terminal.

5. The method according to claim 3, It is characterized in that The reader types include: a first reader type for dialogue and a second reader type for narration; and the first reader type corresponds to a first audio synthesis model, and the second reader type corresponds to a second audio synthesis model; The step of inputting the emotion type information of each of the text sentences into the emotion feature extraction module in the spectrum synthesis model in the pre-trained audio synthesis model to obtain the emotion feature vector comprises: Determining the text type of each text sentence according to punctuation marks in the target text, wherein the text type is dialogue or narration; For a text sentence whose text type is dialogue, input the emotion type information corresponding to the text sentence into the emotion feature extraction module in the first audio synthesis model to obtain the emotion feature vector corresponding to the text sentence; for a text sentence whose text type is narration, input the emotion type information corresponding to the text sentence into the emotion feature extraction module in the second audio synthesis model to obtain the emotion feature vector corresponding to the text sentence; The step of inputting the pronunciation attribute information of each of the text sentences into a pronunciation feature extraction module in a pre-trained spectrum synthesis model to obtain a pronunciation feature vector comprises: For a text sentence whose text type is dialogue, inputting pronunciation attribute information corresponding to the text sentence into a pronunciation feature extraction module in the first audio synthesis model to obtain a pronunciation feature vector corresponding to the text sentence; for a text sentence whose text type is narration, inputting pronunciation attribute information corresponding to the text sentence into a pronunciation feature extraction module in the second audio synthesis model to obtain a pronunciation feature vector corresponding to the text sentence; The emotion feature vector and the pronunciation feature vector corresponding to each of the text sentences are concatenated and input into the attention network module in the pre-trained spectrum synthesis model to obtain a weight coefficient matrix, including: For a text sentence whose text type is dialogue, the emotion feature vector and the pronunciation feature vector corresponding to the text sentence are concatenated and input into the attention network module in the first audio synthesis model to obtain a weight coefficient matrix of the text sentence; for a text sentence whose text type is narration, the emotion feature vector and the pronunciation feature vector corresponding to the text sentence are concatenated and input into the attention network module in the second audio synthesis model to obtain a weight coefficient matrix of the text sentence; The step of inputting the weight coefficient matrix of each text sentence into a decoding network module in a pre-trained spectrum synthesis model to obtain a Mel spectrum sequence corresponding to each text sentence includes: For a text sentence whose text type is dialogue, inputting the weight coefficient matrix of the text sentence into the decoding network module in the first audio synthesis model to obtain a Mel spectrum sequence corresponding to the text sentence; for a text sentence whose text type is narration, inputting the weight coefficient matrix of the text sentence into the decoding network module in the second audio synthesis model to obtain a Mel spectrum sequence corresponding to the text sentence; The step of inputting the Mel spectrum sequence corresponding to each of the text sentences into a vocoder in a pre-trained audio synthesis model to generate a reading audio segment corresponding to each of the text sentences comprises: For a text sentence whose text type is dialogue, the Mel-spectrogram sequence corresponding to the text sentence is input into the vocoder in the first audio synthesis model to generate a reading audio segment corresponding to the text sentence; for a text sentence whose text type is narration, the Mel-spectrogram sequence corresponding to the text sentence is input into the vocoder in the second audio synthesis model to generate a reading audio segment corresponding to the text sentence.

6. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for generating audio based on text as described in any one of claims 1 to 5.

7. A computer-readable storage medium, It is characterized in that The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for generating audio based on text as described in any one of claims 1 to 5.

Citation Information

Cited By

  • Timbre selection method and apparatus, electronic device, readable storage medium, and program product

    US12763064B2

  • Timbre selection method and apparatus, electronic device, readable storage medium, and program product

    US20250029594A1