Audio synthesis method, electronic device and storage medium

By obtaining text feature vectors and codebook information to generate audio, combined with VQGAN and MelGAN technology, it solves the problem of difficulty in generating diverse natural sounds in audio synthesis in the existing technology, and achieves efficient and natural audio synthesis, which is suitable for different contexts and scene.

CN115083386BActive Publication Date: 2024-09-06AISPEECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210656027.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-10
Publication Date
2024-09-06
Estimated Expiration
2042-06-10

AI Technical Summary

Technical Problem

Existing audio synthesis technology is difficult to generate diverse natural sounds, especially based on text description, which cannot effectively complicate audio content and randomness. Moreover, existing technology is mainly limited to specific sound categories and cannot generate multiple sound events simultaneously.

Method used

By obtaining the text feature vector, determine its corresponding codebook information, use the preset codebook decoder to generate the target spectrogram, thereby generating the corresponding synthetic audio, using vector quantization generative adversarial network (VQGAN) and Mel spectrum to generate adversarial neural The method combined with network (MelGAN) reduces the feature dimension of spectrum construction and improves the efficiency and quality of audio synthesis.

Benefits of technology

It achieves the generation of natural, vivid and diverse audio from unconstrained text input, improves the reliability and quality of audio synthesis, and can generate diverse audio in different contexts, showing greater randomness and flexibility. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115083386B
    Figure CN115083386B
Patent Text Reader

Abstract

The present invention discloses an audio synthesis method, an electronic device and a storage medium. In the method, a text feature vector corresponding to a target sentence to be synthesized is obtained; target codebook information corresponding to the text feature vector is determined; based on a preset codebook decoder, a target frequency spectrum corresponding to the target codebook information is determined; and according to the target frequency spectrum, a synthesized audio corresponding to the target sentence is generated. Thus, by reconstructing the frequency spectrum using the codebook information corresponding to the text feature vector of the sentence, the frequency spectrum construction operation can be completed in a more lightweight and efficient manner, thereby ensuring the reliability and high quality of speech synthesis; in addition, by directly generating audio based on unconstrained text input, natural and vivid audio can be generated, achieving better quantitative results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of audio processing, and in particular relates to an audio synthesis method, electronic equipment and storage medium. Background Art

[0002] With the increasing popularity of audio technology, various audio synthesis needs are constantly penetrating into all aspects of people's lives and work, such as voice navigation, news TTS broadcasting, and so on.

[0003] Currently, the common sound generation technologies on the market mainly focus on generating specific types of sounds such as text-based speech generation or score-based music generation.

[0004] However, previous audio generation techniques have mainly focused on specific sound classes, such as speech or music, and their form and content are greatly restricted. Recent research has taken visual cues as conditions for synthesizing general audio.

[0005] In addition, there is little research in the industry on generating diverse natural sounds directly using natural language descriptions as clues. Unlike visual information, text descriptions are concise in nature, but they hide rich meanings and place higher demands on the possibility and complexity of generating audio.

[0006] The industry has not yet provided a better solution to the above problems. Summary of the invention

[0007] The embodiments of the present invention provide an audio synthesis method, an electronic device and a storage medium, which are used to solve at least one of the above technical problems.

[0008] In a first aspect, an embodiment of the present invention provides an audio synthesis method, comprising: obtaining a text feature vector corresponding to a target sentence to be synthesized; determining a target codebook information corresponding to the text feature vector; based on a preset codebook decoder, determining a target spectrum graph corresponding to the target codebook information; and generating a synthesized audio corresponding to the target sentence according to the target spectrum graph.

[0009] In a second aspect, an embodiment of the present invention provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the above method.

[0010] In a third aspect, an embodiment of the present invention provides a storage medium, in which one or more programs including execution instructions are stored, and the execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute the steps of the above-mentioned method of the present invention.

[0011] In a fourth aspect, an embodiment of the present invention further provides a computer program product, wherein the computer program product comprises a computer program stored on a storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes the steps of the above method.

[0012] The beneficial effects of the embodiments of the present invention are:

[0013] When performing the corresponding audio synthesis operation on a sentence, the codebook information corresponding to the text feature vector of the sentence is used to reconstruct the spectrum, which can complete the spectrum construction operation more lightweight and efficiently, ensuring the reliability and high quality of speech synthesis. In addition, directly generating audio based on unconstrained text input can generate natural and vivid audio, achieving better quantitative results. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0015] Figure 1 A flowchart of an example of an audio synthesis method according to an embodiment of the present application is shown;

[0016] Figure 2 Shows Figure 1 A flowchart of an example of an implementation process of step 110;

[0017] Figure 3 Shows Figure 2 A flowchart of an example of an implementation process of step 230;

[0018] Figure 4 A flowchart of an example of an audio synthesis method according to an embodiment of the present application is shown;

[0019] Figure 5 A schematic diagram showing an example of the architecture of a natural audio synthesis system according to an embodiment of the present application;

[0020] Figure 6 A flowchart of an example of extracting text features according to an embodiment of the present application is shown;

[0021] Figure 7 A detailed information chart of the AudioCaps data set used according to an embodiment of the present application is shown;

[0022] Figure 8 A spectrum simulation diagram of an audio sample generated by text according to an embodiment of the present application is shown;

[0023] Fig. 9 A comparison table of model performance indicators under different configurations according to an embodiment of the present application is shown;

[0024] Fig.10 shows a table of human evaluations for different generated audios;

[0025] Fig.11 The spectrum comparison diagram between the generated spectrum diagram under different input conditions and the actual spectrum diagram is shown;

[0026] Fig.12 It is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION

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

[0028] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0029] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0030] In the present invention, "module", "system" and the like refer to related entities applied to computers, such as hardware, a combination of hardware and software, software or software in execution, etc. In detail, for example, an element can be, but is not limited to, a process, a processor, an object, an executable element, an execution thread, a program and / or a computer running on a processor. In addition, an application program or a script program, a server running on a server can be an element. One or more elements can be in the process and / or thread of execution, and an element can be localized on a computer and / or distributed between two or more computers, and can be operated by various computer-readable media. An element can also communicate by a local and / or remote process according to a signal with one or more data packets, for example, a signal from a local system, another element interacting in a distributed system, and / or a signal of data interacting with other systems through a signal on a network of the Internet.

[0031] Finally, it should be noted that, in this article, the terms "include" and "comprise" include not only those elements, but also other elements not explicitly listed, or elements inherent to such processes, methods, articles or equipment. In the absence of further restrictions, the elements defined by the sentence "include..." do not exclude the existence of other identical elements in the process, method, article or equipment that includes the elements.

[0032] It should be noted that for the types of generated sounds, such as speech generation, the common approach is the text-to-speech (TTS) method, which involves current end-to-end deep learning-based methods such as Tacotron and non-autoregressive FastSpeech2. In addition, for music generation, the commonly used technology is Music VAE, etc., to generate corresponding music from music scores.

[0033] However, these technologies are committed to generating audio that strongly corresponds to the input, resulting in at least the following technical defects:

[0034] On the one hand, it is often only possible to generate audio containing a single sound event, whether it is speech or music, and in fact it cannot escape the limitations of its type. However, audio in real life often contains multiple sound events, such as speech, noise, and background music, which may appear simultaneously or alternately. However, the above technology cannot generate such rich audio.

[0035] On the other hand, the generated audio has great limitations in content. For example, in speech generation, even though there may be some stylistic changes in the generated audio, the generated content completely corresponds to the input text without any randomness.

[0036] Generally speaking, in order to generate audio containing multiple types of sounds, the best way is to build an end-to-end correspondence between text and audio. That is, for two sets of corresponding text and audio in the training set, use the model to learn the correspondence, but this method is actually very ineffective, because for a long audio (10s+), the model parameters and calculation amount of directly building its spectrum are very huge, and because the audio before and after usually has a strong correlation, if the audio is generated directly from the text, the synthesized audio will be very jerky and there will be a big difference from the sound in nature.

[0037] Currently, generating vivid audio with less input constraints has been achieved through visual clues (images or videos) or onomatopoeia. However, there is little research on how to generate diverse audio from free text descriptions.

[0038] Figure 1 A flowchart of an example of an audio synthesis method according to an embodiment of the present application is shown.

[0039] like Figure 1 As shown, in step 110, a text feature vector corresponding to the target sentence to be synthesized is obtained. It should be understood that the sentence can be a diverse text composed of various random words, which should not be limited here.

[0040] Specifically, the target sentence may be input into a preset language model to extract a text feature vector or feature sequence corresponding to the target sentence.

[0041] In step 120, target codebook information corresponding to the text feature vector is determined.

[0042] Specifically, a text feature vector is a text feature sequence composed of multiple text feature points. By inputting the text feature sequence into a pre-trained model, the codebook information corresponding to the text feature vector can be quickly obtained.

[0043] In step 130, a target spectrum graph corresponding to the target codebook information is determined based on a preset codebook decoder. Exemplarily, the codebook decoder is pre-configured or pre-trained, and can quickly and accurately parse out the spectrum points corresponding to each codebook segment.

[0044] It should be noted that due to the diversity of different sound categories, one of the biggest challenges is to effectively reduce the sampling space of the generation algorithm, and the use of codebooks can effectively solve this problem.

[0045] In step 140, a synthesized audio corresponding to the target sentence is generated according to the target spectrogram. Here, various non-limiting types of vocoders can be used to encode the spectrum to obtain the corresponding synthesized audio.

[0046] In the synthesis process from text to audio in the embodiment of the present application, the codebook is relayed to convert to the spectrum, and a shorter representation is used to construct the internal global relationship in the spectrum. Compared with directly generating the spectrum from the text, the feature dimension of constructing the spectrum is reduced, and the efficiency and quality of audio synthesis are improved.

[0047] It should be noted that the audio synthesis method provided in the embodiment of the present application is different from the traditional TTS technology (i.e., synthesized speech or synthesized music). Specifically, synthesized speech or synthesized music has a strong correspondence. For example, voice TTS is to synthesize speech with a specific timbre corresponding to the text. However, these synthesized audios lack randomness. The speech corresponding to the same sentence in different contexts or contexts should be variable to be more in line with the real scene. In contrast, through the embodiment of the present application, the text feature vector of the sentence is considered as a whole, rather than calculating each feature point, so that the generated audio can be more natural and vivid.

[0048] Hearing is one of the most important senses for humans to perceive the world. We can easily imagine the specific sound of an object just by its name. However, due to the countless sound categories in nature and their complex symbiotic relationships, it is currently difficult to imagine that a piece of audio corresponds to a long sentence containing multiple sound events. For example, for the sentence "food is frying, women are talking", the uncertainty of the temporal order and duration of the two sounds greatly affects the possible audio content.

[0049] In some business scenarios of the embodiments of the present application, it is possible to generate diversified audio for the same text in different contexts. For example, the synthesized audio corresponding to the "sound of a violin" in different contexts is differentiated. In addition, the "audio" in the embodiments of the present application may also be other content data different from "speech". For example, the synthesized audio corresponding to the text "sound of a violin" may be the sound of a natural violin, and the violin sounds generated for different contextual scenarios are different from each other, and will also show stronger randomness, which can generate an audio clip with various sound sources based on natural language input.

[0050] In addition, an emerging field is music generation, the most direct way of which is to read the combination of notes from the sheet music. However, similar to text-to-speech, generating music from sheet music greatly limits the content of the results, which is closely related to the input conditions and lacks flexibility and randomness.

[0051] With the development of general sound research, an emerging research focuses on audio generation given text as input, using onomatopoeia to synthesize environmental sounds. However, the diversity of sound types is also limited because onomatopoeia is limited and sometimes has poor expressiveness. Through the embodiments of the present application, a cross-modal approach is used to generate diverse and comprehensive audio content under different input conditions, expanding the flexibility and diversity of audio generation.

[0052] From this, it can be seen that generating flexible sounds is a trend in audio generation research. This paper aims to generate more diverse audio content with different sound categories and complex relationships based on free text descriptions.

[0053] Figure 2 Shows Figure 1 A flowchart of an example of an implementation process of step 110 in FIG.

[0054] like Figure 2 As shown, in step 210, the target sentence is segmented and marked according to a preset word list to determine a corresponding marked word sequence.

[0055] In step 220, position indicating tokens (or, position indicating symbols) are respectively set at the head and the tail of the tag word sequence to generate a token sequence.

[0056] In step 230, a text feature vector corresponding to the token sequence is extracted based on the language model.

[0057] Therefore, through token identification, the language model can quickly identify the beginning and end positions of the target sentence and perform feature processing on the sentence as a whole.

[0058] It should be noted that the lengths of different sentences are diverse, and the length of the feature sequence input to the model needs to be consistent. Figure 3 Shows Figure 2 A flowchart of an example of an implementation process of step 230 in FIG.

[0059] like Figure 3 As shown, in step 310, the token sequence is filled into the maximum number sequence with a fixed length, so that the maximum number sequence includes the token sequence and at least one placeholder. It should be understood that the fixed length of the maximum number sequence should be set large enough, which should be greater than the length of the token sequence corresponding to various sentences, and the empty position can be represented by a placeholder, so as to ensure the consistency of the feature length input to the language model.

[0060] In step 320, the maximum number sequence and the attention mask are input to the language model so that the language model extracts the text feature vector corresponding to the token sequence. Here, the attention mask is used to make the language model ignore each placeholder, for example, to identify each placeholder as an invalid character. In this way, the number of input features can be kept constant, and the language model can successfully extract valid information from the input features.

[0061] Figure 4 A flowchart of an example of an audio synthesis method according to an embodiment of the present application is shown.

[0062] In an embodiment of the present application, a text-to-audio generation system is proposed, and high-quality text-related audio can be generated. In order to effectively extract spectrograms from fixed-dimensional representations, a vector-quantized Generative Adversarial Network (VQGAN) is used to train a reference codebook. Specifically, a spectrogram can be constructed by training a Transformer based on text features extracted from a pre-trained language model. The generated spectrogram is finally converted into a waveform by a MelGAN vocoder.

[0063] like Figure 4 As shown, in step 410, a text feature vector corresponding to a target sentence to be subjected to audio synthesis is obtained.

[0064] In step 420, the codebook index corresponding to the text feature vector is determined.

[0065] Specifically, a machine learning model with a self-attention mechanism can be used to parse the text feature vector to obtain the codebook index (or codebook sequence number) corresponding to the text feature vector.

[0066] In some examples of the embodiments of the present application, a Transformer may be used to parse the relationship between a text feature vector and a codebook index.

[0067] In step 430, a matching target codebook representation is searched from a preset reference codebook according to the codebook index. Here, the reference codebook includes multiple codebook indexes and corresponding codebook representations.

[0068] In step 440, based on the vector quantization generative adversarial network VQGAN, a target spectrum graph corresponding to the target codebook representation is determined.

[0069] Here, a vector quantization generative adversarial network is used to train a codebook to learn the spectral characteristics of real audio, which can effectively reduce the feature dimensions of constructing the spectrum.

[0070] Specifically, each codebook representation in the reference codebook is determined by a vector quantization generative adversarial network based on natural audio samples. In addition, the natural audio samples contain audio-text pairs with annotations, and the annotations are used to describe the differentiated information of the text corresponding to the audio in the audio-text pairs. For example, through annotations, the task of defining sentences can be better defined, and complex audio can be generated based on free text descriptions, so that the generated audio can maintain high quality and naturalness, and fully reflect the sound categories and their relationships described in the sentence, so as to realize diversified synthetic audio of the same text in different contexts or contexts.

[0071] It should be noted that, despite the complexity of obtaining useful information from text to generate audio, training also requires text describing the audio. Unlike audio-video or audio-image pairs that can be naturally obtained from the original video source, audio-text pairs require additional annotations. Annotations describing the same audio may vary greatly in word choice, overall style, and writing order.

[0072] In some embodiments, the audio-text pairs in the natural audio sample are determined based on audio caption data. Audio captioning is a task that aims to summarize audio in a sentence, which also requires audio-text pairs for training, and various types of third-party benchmark audio caption datasets can be selected, such as AudioCaps, Clotho, and Mac, etc. For example, each audio clip in AudioCaps is 10 seconds long and has at least one text annotation, which is suitable as a ready-made dataset for text-to-generated audio.

[0073] In step 450, a synthetic audio waveform signal corresponding to the mel-spectrogram is generated based on a preset mel-spectrogram generative adversarial neural network (MelGAN).

[0074] In the embodiment of the present application, a vector quantization generative adversarial network is used to train the codebook, so that the codebook can learn the spectrum characteristics of real audio and reduce the feature dimensions of the constructed spectrum. Then, a Transformer is used to construct the relationship between the original text and the spectrum, and finally MelGAN is used to generate the corresponding audio waveform signal from the spectrum.

[0075] Figure 5 A schematic diagram of the architecture of an example of a natural audio synthesis system according to an embodiment of the present application is shown.

[0076] like Figure 5 As shown, the natural audio synthesis system is composed of multiple parts, including a feature extraction part A, an index prediction part B, a reference codebook part C, and an audio waveform generation part D.

[0077] Specifically, in the feature extraction part A, a pre-trained language model is used to parse the text into corresponding feature vectors.

[0078] It should be noted that currently in audio spectrum generation technology, a simple approach is to predict the best value for each pixel in the spectrum. Specifically, by calculating the method of flattening the two-dimensional array, we can convert the spectrogram into a one-dimensional array and use the Transformer model to automatically regress and generate the value of each position. However, the scale of pixels in the original spectrum may be very large (a 10-second audio clip is far more than 10,000), making the Transformer unable to effectively participate.

[0079] In addition, before training the Transformer model to sample the codebook index, the text description needs to be extracted to provide the information required to generate the audio clip. For a given sentence, the text feature extraction process is as follows: Figure 6 As shown, the sentence “Aman speaks as birds chirp and dog barks” is first fed into a tokenizer and segmented into tokens based on the prepared word list. The [CLS] token and [SEP] token are placed at the beginning and end of the token sequence respectively and then sent to the language model.

[0080] In order to fix the length of the tokens input to the language model, the sequence can also be padded to a preset number MaxNum. Along with a token sequence, an attention mask is also input to the language model in the sequence [0, 1] MaxNum. If the corresponding token is not [pad], the value of this attention mask is 1, which can cause the language model to ignore the placeholder. The token sequence is then sent to the pre-trained language model to extract the features F that are subsequently used for index prediction. text .

[0081] In the index prediction part B, the Transformer structure is used to gradually generate spectral features from the text vector obtained in A.

[0082] In the reference codebook part C, the features in the natural audio need to be summarized using the reference codebook beforehand, so that smaller features can be used to parse out larger-sized spectral features.

[0083] In the embodiment of the present application, in order to more effectively express the mel spectrogram, a discrete codebook is used to represent the spectrogram. Specifically, the codebook is trained by using VQGAN (an autoencoder), which is commonly used to decode images. In the embodiment of the present application, a given spectrum x∈R is reconstructed by using VQGAN M×T to x^∈R M×T , M is the number of mel-spectrogram groups, and T represents the time dimension.

[0084] Specifically, during training, the spectrogram is encoded into a smaller Z ∈ R m×t×nz , where nz acts as the encoding dimension. The small-scale representation can then be flattened to m×t, determining the order of entries selected from the learned codebook Here, each individual z^ is plotted in z^ using the quantization element q ij To the closest codebook index z l , which can be described as:

[0085]

[0086] z q is a quantized representation, which can be further decoded into a spectrogram x^ by a decoder:

[0087]

[0088] In the audio waveform generation part D, the feature vectors generated in B are rearranged and restored to spectral features with reference to the codebook, and the audio generator of MelGAN (Mel Spectrum Generative Adversarial Network) is used to generate the final audio.

[0089] Specifically, the spectrogram can be converted into a waveform by a vocoder, and in order to maintain the fidelity and quality of the final audio, a vocoder is needed to bridge the gap between the predicted spectrogram and the waveform. In the embodiment of the present application, a vocoder of the MelGAN architecture with a hinge loss target is adopted, and in addition to the signal of the discriminator, an additional feature for matching the target is implemented for generator training.

[0090] Here, in order to minimize the difference between x and x^, although the quantization process in equation (1) is non-differentiable, the back-propagated gradient in equation (2) can be copied from the encoder to the decoder through the gradient estimator. Specifically, the loss function of equation (2) can be described as:

[0091]

[0092] in, and sg[·] represent the backpropagation and stop gradient operation with zero gradient during backpropagation, and β is the weight factor.

[0093] Furthermore, VQGAN extends the loss function in Equation (3) with a discriminator and a perceptual loss. VQGAN is adjusted on the spectrogram and the original perceptual loss is replaced by the learned perceptual audio block similarity. The final loss function of VQGAN on the spectrum is:

[0094]

[0095] Where C is a compensation-based discriminator, x s and x^ s is the characteristic of the ground truth and The scale of the VGGish model trained on the audio set.

[0096] Specifically, through the text feature F text , it is possible to generate a spectrum with a latent converter. Given the text feature F text , the Transformer model can predict the distribution of the next index si and the index s<i. The probability p(s) of the sequence is:

[0097]

[0098] The Transformer model is trained by maximizing the log-likelihood of the conditional sequence:

[0099]

[0100] During inference, the codebook index s^ i Sample p from the provided distribution until i=m×t, these indices are unshaped (m, t), and look up the codebook by replacing each code with its index in the codebook Z:

[0101] (z q ) ij =z l if s ij =l Equation (7)

[0102] When i∈{1, 2, 3, ..., m} and j∈{1, 2, 3, ..., t}, by mapping the index back to the codebook representation z^q∈R m ×t×nz , the generated spectrogram can be recovered by the decoder:

[0103]

[0104] In the embodiment of the present application, by adjusting the MelGAN data set, better encoded sound can be achieved, and text-audio pairs can be used as training data. Compared with vocoders such as WaveNet, MelGAN greatly speeds up the reconstruction process and maintains good quality.

[0105] In some examples of the implementation of the embodiments of the present application, AudioCaps can be used as the main data set. AudioCaps is a subset of the complete AudioSet data set, which is subtitles with human markings. In operation, 49,501 audio clips can be downloaded in the training set, 495 for verification, and 964 for testing. Each audio clip is about 10 seconds long, and the training audio clips have a corresponding text description. Since each audio clip in the verification and test sets has five reference descriptions, for convenience, when evaluating the performance of the generated model, you can choose to evaluate it in units of sentences.

[0106] In addition to the text title, each audio clip has a corresponding sound event label in AudioSet. Although these referenced sound labels are not used during training, they can be used as a reference to determine whether the generated spectrum is similar to the original spectrum at the classification level. Figure 7 The chart shown.

[0107] According to statistics, the average number of words per title is 8.71. In order to balance the length of the token and the model size, the final maximum token length MaxNum is set to meet most cases. The reference sound tags of the audio clips of Audiocaps average 2.73, indicating that most clips have two or more sound events in a 10-second clip. Unlike sound generation of a single sound category such as speech and music synthesis, generating diverse and vivid sounds from conditional text requires the model to be familiar with a variety of sound types and have the ability to parse natural language into an actionable form. Therefore, the text-to-audio generation task is more challenging and complicates the fine-grained generation criteria.

[0108] It should be noted that the sound generation in the embodiments of the present application is conditioned on the text description. Therefore, its representativeness mainly affects the quality of speech synthesis. In order to observe the impact of input text features on generation performance, several representation methods are used for comprehensive comparison. Specifically, a pre-trained BERTbased-based model can be used as a standard text feature extractor. In addition, a smaller BERT-medium model can be used instead of it to weaken the interpretability of the input features and ultimately reduce the number of input features.

[0109] Specifically, we use the output embedding of the first hidden state of the language model, which represents the features from the [CLS] token. Thanks to BERT’s pre-training task, this feature has shown effectiveness and operability in classification tasks.

[0110] Therefore, the above MaxNum is reduced to 1, so that there are five groups of comparison results:

[0111] (a) Without features, we can first use unconditional sampling to replace the text features with random embeddings of the same shape. In this way, the generated spectrogram has no relationship with the input text.

[0112] (b) Feature 1 is extracted through a smaller language model.

[0113] (c) Feature 1 is extracted through the standard language model.

[0114] (d) Extracting complete features through a smaller language model.

[0115] (e) Extract complete features through standard language model.

[0116] In order to objectively evaluate the performance of the text-to-audio generation system, it is necessary to analyze the generated spectrogram and the reconstructed audio clip (waveform). Specifically, testing the quality of the generated spectrogram involves three indicators: FID, PSNR, and MMKL, which are introduced as follows.

[0117] Since the spectrogram is a single-channel image, the FID metric can be used to measure the similarity of the generated spectrogram to the original spectrogram. FID requires a classifier to calculate the Fréchet distance between the features and the intermediate layers. However, by assuming that the features conform to the multivariate normal distribution, FID performs well in measuring the overall quality of the generated spectrograms, but rarely pays attention to how a single spectrogram matches the original spectrogram and the conditional text.

[0118] The Peak Signal-to-Noise Ratio (PSNR) represents the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation. By introducing PSNR, it is possible to calculate the average mathematical difference between the generated spectrogram and the original spectrogram.

[0119] MMKL is an improved version of MKL. MKL calculates the output distribution distance between the generated spectrogram and the true spectrogram under given input conditions. Since the original Melception was trained on VGSOUND, each clip has only one sound label, but most sound clips in AudioCaps have more than two sound categories, the Softmax activation layer is replaced with Sigmoid, and Melception is trained on AudioSet for evaluation. Therefore, the MKL here is promoted to M (Multicalss, multi-classification) MKL.

[0120] On the other hand, the embodiment of the present application implements a vocoder to generate a waveform of a given spectrogram, where the quality of the waveform can be further evaluated by subjective evaluation, that is, the quality and relevance of the generated waveform are manually evaluated. For each given text description, the scorer will score according to the "relevance" and the "quality" of the generated audio. Here, "relevance" measures the degree of match between the audio and the text description, including whether the audio covers all sound events in the given text, and whether these sounds occur reasonably (for example, if the text claims that the dog barks after the male speaks, but the two sounds are reversed in the given audio, this will result in a discount in the "relevance" score). In addition, "quality" indicates that the sounds in the generated audio are similar to the sounds in real life, and the difficulty of identifying them (for example, if the text contains a noisy description, the noise in the audio will not directly lead to a low "quality" score. However, the fuzzy sound of a dog barking may result in a low "quality" even if it matches the description).

[0121] For data preprocessing, each audio clip is about 10 seconds long and 32000Hz, extracted every 12.5ms, with a window size of 50ms. The number of Mel groups is 80. The Mel spectrogram is finally cut into a shape of (80, 800). The pre-trained language model is BERT, which extracts the text description as a feature taken from all hidden states (30768).

[0122] When training the codebook, the length of the codebook |Z| is set to 1024. The codebook encoder consists of two residual blocks with a 2D convolution stack and converts the spectrogram into (5, 50), that is, the encoded representation z^ and the codebook representation z q shape; in addition, the decoder is vice versa. The adversarial part of the loss in Equation (4) is zeroed at the initial stage of the codebook training process to stabilize the model. For the Transformer part, a GPT2-based architecture with a hidden dimension of 1024 is used. The codebook index embedding layer as well as the text features are converted to 1024 through a fully connected (FC) layer. The output of the transformer passes through a 1024-way classifier ending with Softmax, which learns the distribution of the next codebook token. During inference, the distribution of the next codebook token is clipped to Top-K probabilities to achieve control over sample diversity; where K ranges from K = |Z| = 1024 to K = 1, and is selected as K = 512 in the experiment.

[0123] The perceptual adaptation model is trained on the audio set using binary cross entropy loss, achieving an audio calibration accuracy of 33.4%.

[0124] Furthermore, the inventors also conducted quantitative and qualitative evaluations on the performance of the text-to-audio generation system proposed in this application.

[0125] Figure 8 The effect simulation diagram of the audio sample generated by text according to the embodiment of the present application is shown. By selecting some generated samples from the text descriptions in the test set, the quality and fidelity are higher than the average level.

[0126] In terms of quantitative results, how the conditional features affect the performance of the generated audio. Specifically, the final results can be calculated to evaluate the similarity between the generated spectrogram and the ground truth spectrogram. Since there is no previous work on text-to-audio generation, the best model (e) can be compared with the models under different configurations mentioned above in this application. Fig. 9 As shown in the charts in , (a) lists the results without any input conditions, which is set as the lower limit of PSNR and the upper limit of MMKL; (b, c) compare the impact of feature size under 1 feature condition; similarly, (d, e) mainly illustrate the overall performance with 30 different feature sizes.

[0127] from Fig. 9 From the chart data, the following conclusions can be drawn: (1) If sampling is performed without input text conditions, the upper limits of the peak signal-to-noise ratio (PSNR) and mean peak signal-to-noise ratio (MMKL) in (a) are 13.69 and 15.80, respectively. (2) Adding at least one text feature will cause these two indicators to significantly change to 14.78↑ and 10.43↓, illustrating the importance of input text information to generated audio. (3) As can be seen from (c, e), an increase in the number of text features will increase the correlation (higher PSNR and lower MMKL) and the overall generation quality (lower FID). Therefore, it can be inferred that as the input information increases, the audio generation model provided by the embodiment of the present application can better distinguish the sound sources in the input sentence and the relationship between the two (earlier, later or simultaneous), thereby producing more reasonable audio output. (4) As can be seen from (d, e) and (b, c), using text features with smaller feature sizes extracted from smaller language models will have a slight negative impact on the generation quality. However, this is not a critical factor, because generating audio from a sentence mainly focuses on the mentioned sound categories and the temporal relationship between their occurrence. Furthermore, slight changes in presentation style do not usually result in noticeable changes in spectrogram (audio) levels.

[0128] It should also be noted that in Fig. 9The FID scores in the chart shown are abnormally low, which may be caused by two factors: (1) The Melception classifier was trained on the AudioSet dataset. In the embodiment of the present application, the last layer of the Melception model was replaced from Softmax to Sigmoid to adapt to the multi-class classification task in the AudioSet date (audio samples have one or more labels). This may cause the embedding of the second-to-last layer to not meet the strong assumption that such embedding conforms to the multivariate normal distribution. (2) FID is not a metric that is very suitable for datasets whose samples vary greatly in different time periods. However, the changes in FID values ​​under different configurations still demonstrate the effectiveness of the text conditional generation model provided in the embodiment of the present application.

[0129] Therefore, when generating corresponding audio from text, the audio generated by the model provided in the embodiment of the present application is better than generating audio without using text features or local text features.

[0130] In addition to the above-mentioned quantitative analysis results to demonstrate the superiority of the system provided by the embodiments of the present application, the inventors also organized multiple scorers to score and evaluate the performance of the generated audio to better determine whether the audio generation is of high quality and relevance.

[0131] Specifically, 200 samples were randomly selected from the 964 samples generated in the AudioCaps test set. For each text description, four audios (provided by raters) were included: (1) the original audio from the AudioCaps test set; (2) the generated audio without given text features; (3) the audio conditioned on one feature; and (4) the audio conditioned on the full features (with the best quantitative results). Each sample (one text description and four audios) was scored by four raters and the average was taken. Fig.10 A manual evaluation table for different generated audios is shown, with 10 being the full score.

[0132] The manual evaluation results show that the relevance and quality of the generated audio increase with the number of conditional text features. The text feature setting significantly affects the relevance, but has a smaller contribution to the quality, which is consistent with the quantitative results. Fig.10 The chart shows that the audio generated by the model provided by the embodiment of the present application exceeds the baseline in terms of text relevance (Relevance) and audio quality (Quality).

[0133] Furthermore, when sampling using only one text feature, the quality of the generated audio is differentiated if only one voice is mentioned in the conditional text.

[0134] On the other hand, when the input text involves different sound categories, sampling with more text features will lead to a higher relevance score, and two samples can be selected to visualize the difference in the generated spectrograms. Specifically, Fig.11 As shown, it shows the comparison between the spectrograms generated under different input conditions and the actual situation. For sentence (a), the sound quality corresponding to the spectrogram of 30Feats is not as good as that of 1Feat; while for sentence (b), the spectrogram of 30Feats has better sound quality than that of 1Feat.

[0135] Additionally, by manually locating the locations of expected sounds in two spectrograms (snoring in (a) and sewing machine stitching in (b). When the text description is simple and contains only one sound category (a), conditioning on only one feature will improve the clarity of the generated sound clips. When the sentence is more complex and involves more sound categories (b), using the full number of features will produce a more comprehensive audio (the audio is no longer limited to the stitching sound of only one feature). This means that adding more features will help the model to extract different information from the text, but will pay less attention to each sound event during sampling.

[0136] In the embodiment of the present application, what is concerned is a new but challenging task, namely, generating high-quality and diverse audio content given a text description. By using the reference codebook trained by VQGAN, the audio model in the embodiment of the present application can efficiently reconstruct the mel spectrogram from a smaller representation, realizing a Transformer-based method to bridge the gap between input text features and predicted representations during sampling. The average values ​​of the quantitative indicators PSNR, FID and MMKL of the best model are 14.92, 0.851 and 10.05, respectively. In addition, based on manual evaluation and verification, the overall quality and relevance of the generated audio clips to the given text are also confirmed. The evaluation results of both aspects show that the method proposed in the embodiment of the present application can generate natural and diverse audio corresponding to sound events in the text.

[0137] In an embodiment of the present application, the limitation of specific audio generation is broken through to use natural language description as clues to generate diverse sounds. Unlike visual information, although the text description looks brief, it hides rich meanings behind it, which makes the audio have higher possibilities and complexity. Specifically, VQGAN is used to train the codebook to learn the discrete representation of the spectrum. For a given text description, the features are sent to a pre-trained Transformer to generate feature indexes. The index is then decoded into a spectrogram and further transformed into a waveform through a MelGAN-based vocoder. As a result, the generated waveform has high quality and fidelity, while being able to describe the given text well.

[0138] Through the embodiment of the present application, it is realized for the first time that audio is directly generated from unconstrained text input. Various experimental data show that the solution of the embodiment of the present application can generate natural and vivid audio and achieve better quantitative results.

[0139] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of combined actions, but those skilled in the art should be aware that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention. In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0140] In some embodiments, an embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores one or more programs including execution instructions, and the execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any of the above-mentioned audio synthesis methods of the present invention.

[0141] In some embodiments, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes any one of the above-mentioned audio synthesis methods.

[0142] In some embodiments, an embodiment of the present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute an audio synthesis method.

[0143] Fig.12 FIG. 1 is a schematic diagram of the hardware structure of an electronic device for executing an audio synthesis method provided by another embodiment of the present invention. Fig.12 As shown, the device includes:

[0144] One or more processors 1210 and memory 1220, Fig.12 A processor 1210 is taken as an example.

[0145] The apparatus for executing the audio synthesis method may further include: an input device 1230 and an output device 1240 .

[0146] The processor 1210, the memory 1220, the input device 1230 and the output device 1240 may be connected via a bus or other means. Fig.12 The example of connecting through bus is taken in the following.

[0147] The memory 1220 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the audio synthesis method in the embodiment of the present invention. The processor 1210 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 1220, that is, the audio synthesis method of the above method embodiment is implemented.

[0148] The memory 1220 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the voice interaction device, etc. In addition, the memory 1220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 1220 may optionally include a memory remotely arranged relative to the processor 1210, and these remote memories may be connected to the audio synthesis device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0149] The input device 1230 may receive input digital or character information and generate signals related to user settings and function control of the audio synthesis device. The output device 1240 may include a display device such as a display screen.

[0150] The one or more modules are stored in the memory 1220, and when executed by the one or more processors 1210, perform the audio synthesis method in any of the above method embodiments.

[0151] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0152] The electronic devices of the embodiments of the present invention exist in various forms, including but not limited to:

[0153] (1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions and its main purpose is to provide voice and data communications. This type of terminal includes: smart phones, multimedia phones, functional phones, and low-end phones.

[0154] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, etc.

[0155] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players, handheld game consoles, e-books, smart toys, and portable car navigation devices.

[0156] (4) Other onboard electronic devices with data interaction functions, such as on-board devices installed in vehicles.

[0157] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units 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.

[0158] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

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

Claims

1. An audio synthesis method, comprising: Obtaining a text feature vector corresponding to a target sentence to be synthesized for audio; Determining target codebook information corresponding to the text feature vector; Based on a preset codebook decoder, determining a target spectrum graph corresponding to the target codebook information; Generating a synthesized audio corresponding to the target sentence according to the target spectrogram; Wherein, the determining the target codebook information corresponding to the text feature vector includes: Determine the codebook index corresponding to the text feature vector; Querying a matching target codebook representation from a preset reference codebook according to the codebook index; the reference codebook includes a plurality of codebook indexes and corresponding codebook representations; Determining target codebook information based on the target codebook representation; The codebook decoder adopts a vector quantization generative adversarial network, and each codebook representation in the reference codebook is determined by the vector quantization generative adversarial network based on natural audio samples; the natural audio samples include audio-text pairs with annotations, and the annotations are used to describe the differentiated information of the text corresponding to the audio in the audio-text pairs.

2. The method according to claim 1, wherein: The step of obtaining a text feature vector corresponding to a target sentence to be synthesized for audio includes: Segment and mark the target sentence according to a preset word list to determine a corresponding marked word sequence; Setting position indicating tokens at the head and tail of the marked word sequence respectively to generate a token sequence; Based on the language model, a text feature vector corresponding to the token sequence is extracted.

3. The method according to claim 2, wherein: The extracting the text feature vector corresponding to the token sequence based on the language model includes: Filling the token sequence into a maximum number sequence with a fixed length, so that the maximum number sequence contains the token sequence and at least one placeholder; The maximum number sequence and the attention mask are input into a language model, so that the language model extracts a text feature vector corresponding to the token sequence; wherein the attention mask is used to make the language model ignore each of the placeholders.

4. The method according to claim 1, wherein the target spectrogram is a Mel-spectrogram. in, Generating the synthesized audio corresponding to the target sentence according to the target spectrogram includes: Based on a preset mel-spectrogram generative adversarial neural network, a synthetic audio corresponding to the mel-spectrogram is generated.

5. The method according to claim 1, wherein: The determining the codebook index corresponding to the text feature vector includes: The text feature vector is parsed using a machine learning model with a self-attention mechanism to obtain a codebook index corresponding to the text feature vector.

6. The method according to claim 1, wherein: The audio-text pairs in the natural audio sample are determined based on the audio subtitle data.

7. An electronic device, comprising: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the method described in any one of claims 1 to 6.

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