Speech generation method and apparatus, and device and medium
By constructing a joint encoding mechanism of characters and pinyin, and combining it with contextual semantic modeling, the problems of TTS systems in handling polyphonic characters and semantic ambiguity are solved, achieving higher fidelity and personalized voice clone output, which is suitable for fintech and healthcare business scenarios.
Patent Information
- Application Number
- PCT/CN2025/136470
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-19
- Filing Date
- 2025-11-20
- Publication Date
- 2026-11-26
AI Technical Summary
Existing TTS systems lack the ability to judge context when dealing with ambiguous financial terms or institution names, leading to pronunciation errors of polyphonic characters or semantic deviations. Furthermore, the voice similarity of voice clones is insufficient, affecting user trust and business consistency. In the healthcare field, they cannot effectively distinguish polyphonic phenomena in medical terms, resulting in misleading patients in pathology broadcasts or voice interactions. Personalized voice cloning technology also has a crude extraction of speaker features in doctor-patient communication, lacking warmth and realism.
By constructing a joint encoding mechanism of characters and pinyin, and modeling in conjunction with contextual semantics, character and pinyin fusion features are generated. A text encoder is used to process text features, determine the codebook generation method and extract speech encoding. The input text is a speech language model, and the speaker feature vector is extracted through the speaker encoder. Generative adversarial decoder is used for decoding to generate the target speech.
It achieves higher fidelity, stronger expressiveness, and lower data dependence in voice cloning output, improving the naturalness, accuracy, and personalized expression of speech synthesis, and is suitable for fintech and healthcare business scenarios.
Smart Images

Figure CN2025136470_26112026_PF_FP_ABST
Abstract
Description
Speech Generation Method, Apparatus, Device and Medium
[0001] This application claims priority to the Chinese patent application filed with the China National Intellectual Property Administration on May 19, 2025, with application number 202510643898.2 and the invention title "Speech Generation Method, Apparatus, Device and Medium", the entire content of which is incorporated herein by reference. Technical Field
[0002] This application relates to the technical fields of artificial intelligence and speech synthesis, and in particular, to a speech generation method, apparatus, device and storage medium. Background Art
[0003] In current Text-to-Speech (TTS) systems, multiple key technical links still fail to meet the actual requirements of complex service speech generation scenarios, showing obvious shortcomings especially in applications that require personalized expression and accurate semantic presentation.
[0004] In the fintech business field, application scenarios such as intelligent customer service, speech risk control, and wealth management voice assistants are highly sensitive to the naturalness, pronunciation accuracy, and personalized user expression of speech synthesis. However, the inventor has realized that existing TTS systems often lack context judgment capabilities when processing ambiguous financial-specific terms or institution names, leading to pronunciation errors of polyphonic characters or semantic deviations. In addition, the insufficient voice similarity of speech cloning makes it difficult to unify the expression style of financial service speech across different role scenarios, affecting user trust and business consistency.
[0005] In the medical and health business field, applications such as electronic medical record broadcasting, doctor-assisted voice interaction, and rehabilitation voice prompts have high requirements for the semantic accuracy and personalized restoration ability of speech synthesis results. Existing TTS systems often cannot effectively distinguish polyphonic phenomena in medical terms, for example, the pronunciation of characters such as "xing" (walk / behavior) or "fa" (inflammation / occurrence) in different contexts, leading to misleading patients in pathology broadcasting or voice interaction. Meanwhile, personalized speech cloning technology also faces the problem of rough speaker feature extraction in scenarios such as doctor-patient communication simulation and elderly companion voice services, resulting in generated speech lacking warmth and realism. Summary of the Invention
[0006] The main purpose of this application is to provide a speech generation method, apparatus, device and storage medium, aiming to solve the technical problem that traditional technologies lack a context-semantic-driven fusion mechanism in character and pinyin information modeling, leading to pronunciation errors of polyphonic characters and inaccurate mapping from text semantics to speech expression.
[0007] To achieve the above purpose, this application provides a speech generation method, including:
[0008] Receive prompt voice containing the target speech features;
[0009] The prompt speech is converted into initial text using a speech recognition module;
[0010] The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features;
[0011] The character pinyin fusion features are processed by a text encoder to generate text features;
[0012] Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method;
[0013] The text features and speech codes are input into a text-speech language model to generate intermediate codes;
[0014] The speaker feature vector in the prompt speech is extracted using a speaker encoder.
[0015] The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
[0016] Furthermore, to achieve the above objectives, this application provides a speech generation apparatus, comprising:
[0017] The voice input module is used to receive prompt voice containing the target voice features;
[0018] A speech recognition module is used to convert the prompt speech into initial text.
[0019] The pinyin encoding module is used to perform joint character and pinyin encoding processing on the initial text to generate character pinyin fusion features;
[0020] The text encoding module is used to process the character pinyin fusion features through a text encoder to generate text features;
[0021] The speech quantization module is used to determine the codebook generation method and extract the speech code from the prompt speech based on the codebook generation method.
[0022] The multimodal fusion module is used to input the text features and speech codes into the text-speech language model to generate intermediate codes;
[0023] The speaker analysis module is used to extract speaker feature vectors from the prompt speech through a speaker encoder;
[0024] The speech synthesis module is used to decode the intermediate code and the speaker feature vector by generating an adversarial decoder to generate the target speech.
[0025] Furthermore, to achieve the above objectives, this application also provides a computer device, the computer device including a memory, a processor, and a speech generation program stored in the memory and executable on the processor, wherein when the speech generation program is executed by the processor, it implements the following steps of the speech generation method as described above:
[0026] Receive prompt voice containing the target speech features;
[0027] The prompt speech is converted into initial text using a speech recognition module;
[0028] The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features;
[0029] The character pinyin fusion features are processed by a text encoder to generate text features;
[0030] Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method;
[0031] The text features and speech codes are input into a text-speech language model to generate intermediate codes;
[0032] The speaker feature vector in the prompt speech is extracted using a speaker encoder.
[0033] The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
[0034] Furthermore, to achieve the above objectives, this application also provides a non-volatile computer-readable storage medium storing a speech generation program, which, when executed by a processor, implements the steps of the speech generation method described above.
[0035] Beneficial Effects: This application relates to the fields of artificial intelligence and speech synthesis technology, and can be applied to business scenarios such as fintech and healthcare. It discloses a speech generation method, including: receiving a prompt speech containing target speech features; converting the prompt speech into initial text; performing joint character and pinyin encoding processing on the initial text to generate character-pinyin fusion features; using a text encoder to process the character-pinyin fusion features to generate text features; determining the codebook generation method and extracting the speech encoding from the prompt speech; inputting the text features and speech encoding into a text-speech language model to generate intermediate encoding; extracting the speaker feature vector from the prompt speech using a speaker encoder; and decoding the intermediate encoding and speaker feature vector using a generative adversarial decoder to generate the target speech. This application achieves higher fidelity, stronger expressive power, and lower data dependency in speech clone output by constructing a joint character and pinyin encoding mechanism, combining it with contextual semantics for modeling, and inputting text features, speech encoding, and speaker features into a multimodal language model and generative decoder for processing. Attached Figure Description
[0036] The present application will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:
[0037] Figure 1 is a schematic diagram of an application environment for a speech generation method according to an embodiment of this application;
[0038] Figure 2 is a flowchart illustrating an embodiment of the speech generation method of this application;
[0039] Figure 3 is a schematic diagram of the functional modules of a preferred embodiment of the speech generation device of this application;
[0040] Figure 4 is a structural schematic diagram of a computer device according to an embodiment of this application;
[0041] Figure 5 is another structural schematic diagram of a computer device according to one embodiment of this application. Detailed Implementation
[0042] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application.
[0043] The speech generation method provided in this application can be applied in the application environment shown in Figure 1, where the user terminal communicates with the server via a network. The server can receive a prompt speech containing target speech features from the user terminal, convert the prompt speech into initial text, perform joint character and pinyin encoding on the initial text to generate character-pinyin fusion features, use a text encoder to process the character-pinyin fusion features to generate text features, determine the codebook generation method and extract the speech encoding from the prompt speech, input the text features and speech encoding into a text-speech language model to generate intermediate encoding, extract the speaker feature vector from the prompt speech using a speaker encoder, and decode the intermediate encoding and speaker feature vector using a generative adversarial decoder to generate the target speech. This application achieves higher fidelity, stronger expressive power, and lower data dependency in speech clone output by constructing a joint character and pinyin encoding mechanism, combining contextual semantics for modeling, and inputting text features, speech encoding, and speaker features into a multimodal language model and generative decoder for processing. The following detailed description of specific embodiments further illustrates this application.
[0044] Please refer to Figure 2, which is a flowchart illustrating an embodiment of the speech generation method provided in this application. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0045] As shown in Figure 2, the speech generation method proposed in this application includes the following steps:
[0046] S10, Receive prompt voice containing target speech features;
[0047] In this embodiment, the prompt voice is an audio data segment containing complete speech features, which must include information such as the speaker's intonation, speech rate, voiceprint, and pronunciation habits. This audio can be a recording of natural speech, reading material, or other representative speech segments. The receiving behavior is not limited to local input devices, such as microphones or other audio sensors; it can also be achieved through remote data transmission protocols such as RTSP, MQTT, or HTTP API to obtain online audio streams or store audio files. To ensure that the collected speech data has sufficient trainability and structural feature integrity, during the receiving phase, a silence detection module is typically used to automatically eliminate non-speech segments, or an audio energy threshold judgment mechanism is used to retain only valid speech. The received speech signal is generally encapsulated in a standard format, currently mainly WAV, FLAC, or PCM encoding. The sampling rate is recommended to be controlled within the range of 16kHz to 48kHz, and the quantization bit depth should not be less than 16 bits to preserve spectral structure details. In addition, the received prompt voice should also include metadata such as a timestamp, source identifier, device model, and user ID. This information can be used for conditional coding, identity matching, or multi-speaker sample management during the training process. To improve processing efficiency, the receiving process can also incorporate a pre-feature extraction module from edge devices. For example, a lightweight convolutional neural network can be deployed to extract Mel-frequency spectra or short-time Fourier transform features, completing initial feature screening and compressing the transmission bandwidth during the receiving stage.
[0048] Raw user speech signals can be acquired via microphone modules deployed on edge terminals and encoded into PCM format data streams in real time. These streams are then uploaded to a model server for further processing via a local bus or asynchronous task. Alternatively, recorded prompt voice files can be transmitted to the backend using the HTTP POST protocol; these files can originate from an existing voice library or be temporarily recorded. In low-resource scenarios, low-power microphone arrays can be used, and the audio reception process can be dynamically started and stopped via a speech activity detection module. In environments with multiple users accessing simultaneously, each prompt voice message must include a unique user identifier and acquisition time information. An identification mechanism is used to establish a mapping relationship between the user's voice message and the speaker's characteristics for subsequent speaker modeling. Furthermore, in scenarios requiring improved noise immunity, a noise reduction preprocessing module can be added before reception, such as a spectral masking-based speech enhancement network or spatial filtering technology, to improve speech signal quality and reduce subsequent recognition and cloning errors.
[0049] By receiving prompts containing complete target speech features, the subsequent text recognition, feature fusion, and speech generation modules have the foundational corpus to construct the target speaker's expression patterns, thus establishing a controllable pronunciation synthesis channel for any speech content. This not only provides a personalized speech sample entry point for the speech cloning system but also improves the overall system's modeling accuracy and cross-scenario deployment capabilities by standardizing audio format, sampling parameters, and speech validity through the receiving module. It effectively solves the bottleneck in existing systems where high-fidelity speech cloning is impossible in the absence of high-quality pronunciation samples.
[0050] S20, the prompt voice is converted into initial text by the voice recognition module;
[0051] In this embodiment, after the prompting speech is received and preprocessed, it first undergoes acoustic modeling and decoding operations through an end-to-end speech recognition module. This module typically employs a deep neural network-based structure, including an input layer, an acoustic feature extraction layer, an encoder layer, an attention alignment module, and an output decoder. The input is the time-domain waveform or frequency-domain transformed feature representation of the prompting speech, such as Mel spectrum, MFCC, or FBANK acoustic feature matrices. The encoder can employ structures such as bidirectional LSTM, Conformer, or Transformer to model the temporal correlation and contextual dependence of the speech. Attention mechanisms or CTC connection temporal prediction structures are used to map speech segments to text segments, thereby recognizing text information without relying on precise alignment. The output layer uses a language modeling module combined with decoding strategies (such as beam search) to generate an initial text result. This text maintains the pronunciation order of the original speech and preserves the linguistic expression structure of polyphonic characters, long-tailed words, and sound change phenomena. To improve recognition accuracy, pinyin modeling, external language model-assisted correction, and contextual vocabulary constraint strategies can be integrated to ensure that the speech recognition result can restore the speaker's intent to the greatest extent possible.
[0052] In one specific embodiment, the speech recognition module adopts an end-to-end deep model structure, where the Conformer-based acoustic model is responsible for extracting temporal and spectral features, and is combined with an externally trained language model to assist in predicting word sequences. The input prompt speech is processed by MFCC before being fed into the Conformer encoder, and an attention module aligns the features to generate a character-level output sequence, which is then restored to Chinese text through dictionary mapping. In another implementation, the speech recognition module may adopt CTC decoding to avoid explicitly modeling alignment paths, thereby enabling the recognition system to have stronger robustness when facing unknown speech rates or sentence segmentation habits. For scenarios involving professional terms or user-customized corpora, a word graph search mechanism may be introduced in the decoding stage to allow concurrent inference of multiple recognition paths, and the optimal recognition result is selected through confidence scoring. A word order error correction strategy based on pinyin reversal may also be implemented after the recognition result is generated. For example, in the scenario where the recognition of "银行" is incorrectly output as "行行", the correct text is restored through pinyin alignment and language model scoring. The multi-module serial structure of the recognition process supports deployment on the server side for large-scale inference, and is also compatible with lightweight terminal models for local fast recognition.
[0053] Converting the prompt speech into initial text not only establishes a linguistic foundation for the joint encoding processing of characters and pinyin, but also avoids the information redundancy and alignment difficulties faced when directly modeling text semantics from acoustic features. This method transforms the original continuous signal into discrete linguistic units, thereby significantly improving the accuracy of subsequent semantic modeling, pinyin ambiguity resolution, and text feature generation. Especially when facing prompt speech with polyphonic characters, long-tail vocabulary, or large intonation variations, it can improve the semantic completeness and controllability of text restoration through context modeling and language correction mechanisms, enhancing the system's adaptability to complex speech inputs.
[0054] S30, performing joint encoding processing on characters and pinyin for the initial text to generate character-pinyin fusion features;
[0055] In this embodiment, the initial text is the linguistic content in text form output by the speech recognition module, which contains a continuous character sequence but does not itself carry explicit speech pronunciation information. Characters are the basic units that constitute linguistic content, while pinyin is a phoneme-level pronunciation encoding representing Chinese speech. The essence of their joint processing lies in fusing semantic and phonological information, thereby enhancing the model's modeling ability for phenomena such as polyphonic characters, long-tail words, and weakly pronounced syllables.
[0056] Joint encoding processing usually starts with establishing a character-pinyin mapping relationship database, which is derived from a many-to-one mapping resource constructed based on the Chinese Pinyin standard, and can be built through open-source pinyin annotation tools such as pypinyin. For each character, the system extracts possible pronunciations based on context, and then determines the most reasonable pronunciation combination in the context through a language model.
[0057] Next, each Chinese character is converted into a dense character encoding vector through a character embedding layer, typically with dimensions ranging from 128 to 512. Simultaneously, a pinyin embedding layer converts the pinyin corresponding to each character into a pronunciation vector representation, which may include sub-components such as initials, finals, and tones, or it may be directly encoded as a complete pinyin representation. To fuse these two embedding representations, the system typically designs a weighted fusion module that dynamically assigns weight coefficients for characters and pinyin in the joint representation based on contextual semantic information. These weights can be linearly predicted through semantic features or automatically learned by an attention mechanism.
[0058] Finally, the character encoding and pinyin encoding are linearly weighted according to their fusion weights, outputting a single fusion vector, which is then input into the subsequent text encoder. This fusion feature not only possesses the expressive power of the semantic dimension of the text but also explicitly models pronunciation attributes, providing control variables for subsequent pronunciation decisions and speech synthesis. The key technical aspect of this process lies in the context-aware fusion weight calculation method and the collaborative modeling capability of semantic-phonological information.
[0059] In one implementation, the joint encoding of characters and pinyin uses a pre-trained Chinese text embedding model as the character encoding source, combined with a custom-constructed pinyin embedding table. The pinyin embedding can be a one-hot vector or a low-dimensional dense representation. Contextual semantics are extracted by a lightweight Transformer model, and the contextual attention weights corresponding to each character are output as a reference for the fusion weights.
[0060] Furthermore, the contribution ratio of character encoding and Pinyin encoding can be dynamically adjusted by introducing a trainable gating mechanism. For example, a sigmoid function can be set as the gating function, which takes a context vector as input and outputs a scalar in the range [0,1] as a retention factor for Pinyin information. This factor can then be weighted and fused with both character encoding and Pinyin encoding.
[0061] In another implementation, the joint encoding structure can also support a pinyin decomposition mechanism, which splits each pinyin into initials, finals and tones and encodes them separately, and then combines them through convolution or attention mechanisms to enhance the system's ability to analyze complex pronunciations, which is especially suitable for modeling problems with blurred syllable boundaries in dialect scenarios.
[0062] By fusing characters and pinyin, the semantic integrity of the original text is preserved, and Chinese pronunciation information is explicitly introduced, thereby enhancing the model's ability to control pronunciation. Especially in the Chinese language environment where polyphonic characters are frequent and pinyin ambiguity is high, this approach can effectively reduce pronunciation errors, significantly improving the naturalness and accuracy of speech cloning.
[0063] S40, The character pinyin fusion features are processed by a text encoder to generate text features;
[0064] In this embodiment, the character-phonetic fusion feature is a multimodal semantic-phonetic representation formed by combining the semantic information of characters with the phonetic information in the initial text. This feature does not yet have a unified semantic encoding form for speech generation models. Therefore, a text encoder is needed to map this fusion feature into a fixed-dimensional text feature that can express sentence semantics, language structure, and contextual dependencies to support subsequent speech encoding matching and speech generation tasks.
[0065] The text encoder in this processing flow is typically built on the Transformer architecture, which has powerful context modeling capabilities. This module first receives character-phonetic fusion features as input. These features have integrated the semantic representation of the text with the phonetic characteristics of the phonetic through joint embedding. They are usually two-dimensional matrices, where rows represent the position of the character sequence and columns represent the dimension of each fusion vector.
[0066] During the input phase, the text encoder introduces positional encoding information through an embedding layer, enabling the model to perceive the relative order between characters and addressing the lack of perception of sequence information in sequence modeling. Subsequently, a multi-layered multi-head self-attention mechanism processes the correlation between each character position and other characters globally, allowing the system to learn complex linguistic features such as word sense disambiguation, context mapping, and sentiment modification. The multi-head attention mechanism allows the model to extract correlations from multiple subspaces in parallel, enhancing its ability to model the implicit hierarchical structure in language modalities.
[0067] After attention processing, the text encoder also includes a feedforward neural network layer for non-linear transformation and dimensionality reconstruction of the encoding at each position. This layer typically employs a two-layer structure: the first layer increases dimensionality for feature expansion, and the second layer reduces dimensionality to return the target feature dimension, combined with activation functions such as GELU to achieve complex feature transformations.
[0068] Throughout the encoding process, each layer incorporates residual connections and layer normalization mechanisms to maintain network gradient stability and improve training efficiency. The final output is a set of text feature vectors with a unified dimension, which retains the semantic and phonetic integration of character pinyin fusion features while also incorporating the contextual structure of the language, providing stable input for subsequent multimodal modeling modules.
[0069] In one implementation, the text encoder is built upon a fine-tuned BERT structure. After inputting character pinyin fusion features, the Transformer module uses multi-head attention and feedforward network layers to extract representations for each character position layer by layer, outputting a text feature vector with a dimension of 768. This approach can leverage existing large-scale corpora to train weight transfer capabilities, improving generalization performance in few-shot tasks.
[0070] Lightweight Transformer structures can also be built, such as a small model architecture with a 4-layer encoder, 4-head attention, and 256 hidden dimensions, to adapt to the deployment requirements of embedded speech synthesis in resource-constrained scenarios. Additionally, a residual suppression module based on a gating mechanism can be introduced, with a gating unit connected after the attention layer to control the degree of preservation of different types of semantic paths, suitable for expressing low-frequency words, long words, or rare pinyin combinations in professional fields.
[0071] In another implementation, the text encoder can use a non-Transformer structure, such as a bidirectional LSTM combined with a convolutional enhancement module, to perform temporal modeling of character pinyin fusion features. This approach is relatively weaker than Transformer in modeling long-range dependencies in sequences, but it has a speed advantage in very low-latency inference systems.
[0072] By processing the character-phonetic fusion features through a text encoder, the input features are not only transformed into representation vectors of uniform length and dimension, but also the linguistic context structure, syntactic dependencies, and pronunciation differences between words are preserved. This transformation effectively solves the problem that character-phonetic fusion features lack controllable modeling capabilities in their original state, enabling the subsequent speech generation system to maintain clear pronunciation and semantic consistency even when faced with polyphonic characters, long-tailed words, and contextual ambiguities. This processing method also improves the model's generalization ability on new words and compound words, enhancing the naturalness and expressiveness of the overall speech output.
[0073] S50, determine the codebook generation method, and extract the speech code from the prompt speech based on the codebook generation method;
[0074] In this embodiment, the codebook is a collection of discrete speech units, representing several cluster centers in the space. The input acoustic features are quantized into the closest codebook vector to represent the audio content. First, the available quantization methods need to be evaluated to determine the optimal codebook generation method. Two commonly used methods are vector quantization and finite scalar quantization. Vector quantization is based on clustering strategies (such as k-means or Product Quantization), encoding multiple dimensions as a whole, thus maintaining global similarity. Finite scalar quantization, on the other hand, quantizes each feature dimension separately, resulting in a simpler structure and faster encoding speed.
[0075] To evaluate the effectiveness of these methods, it is necessary to construct a test dataset containing acoustically labeled samples. This dataset can be used to extract features from a large amount of speech data, such as Mel spectra, cepstral parameters, or continuous features from the Conformer output, by calling a pre-trained acoustic front-end network.
[0076] In the specific implementation, the test data is used to generate two codebooks using vector quantization and finite scalar quantization methods, respectively, and the compression ratio and reconstruction error of each codebook are calculated for the test data. The compression ratio refers to the ratio of the length of the encoded data to the length of the original feature, and the reconstruction error is usually represented by the mean squared error (MSE) or a perceptual distance index (such as Mel-spectrogram distance).
[0077] The system calculates a performance score for each quantization method based on a weighted combination of these two metrics, thereby selecting the optimal codebook generation method. After selecting a method, the same quantization encoding process is performed on the acoustic speech markers extracted from the prompt speech to obtain the final speech code, which serves as the audio representation input for the subsequent generation model.
[0078] In one implementation, the codebook generation method is selected using a VQ-VAE structure. Acoustic features from the training set are input into the encoder module, and k-means clustering is used to obtain a fixed-length codebook. During training, the quantization boundary is optimized based on the criterion of minimizing reconstruction error. This method is suitable for generation tasks requiring high fidelity of audio content, such as medical information broadcasting. Alternatively, FSQ (Finite Scalar Quantization) can be used, where a discrete value set is set for each dimension of the acoustic features, and discretization is performed dimension-wise using the minimum distance principle. This approach is more advantageous in low-resource deployment scenarios, such as local speech cloning systems running on mobile terminals. A dynamic selection strategy can also be introduced, recording the performance of the two quantization methods on different categories of audio in real time during the training phase. During inference, the codebook generation method with higher matching degree is selected based on the timbre features of the input prompt speech, thereby reducing model complexity while ensuring quality.
[0079] By selecting a codebook generation method and encoding the prompt speech based on the optimal method, the compactness and fidelity of speech coding are significantly improved. This strategy not only compresses the amount of data in speech representation but also reduces the computational burden on the downstream decoder, while maintaining the clarity and detail of the timbre in speech synthesis. Furthermore, this approach has stronger adaptability when faced with complex audio content or speaker changes, improving the stability of speech cloning in multi-speaker and multi-context scenarios.
[0080] S60, Input the text features and speech encoding into the text speech language model to generate intermediate encoding;
[0081] In this embodiment, the text-to-speech language model is a multimodal deep network structure that integrates text semantic information and speech feature information. Its main task is to jointly model the input text features and speech encoding to generate intermediate encoding that expresses semantic content and carries pronunciation instructions. This intermediate encoding not only carries information about character semantics and pronunciation order, but also provides clear and structured speech generation guidance signals for speech synthesis in the decoding stage.
[0082] In practical processing, text features are the result of modeling character-phonetic fusion features using a text encoder, typically a fixed-dimensional sequence of context-related vectors. Speech encoding, on the other hand, is a discrete speech representation extracted based on cue speech compression, reflecting audio information such as pronunciation style, prosody, and speech rate. The purpose of jointly inputting these two types of features into a language model is to establish a mapping relationship between pronunciation control and semantic accuracy.
[0083] Joint input can be achieved through simple vector concatenation, weighted fusion, and attention alignment. During the embedding stage, linear transformations can be performed on text features and speech codes separately to match their dimensions before joint processing. Subsequently, a multi-layer Transformer structure or a lightweight multimodal attention module is used to model the interaction between the two, and a positional encoding mechanism is employed to maintain the traceability of the text sequence structure.
[0084] The generated intermediate code is a multi-dimensional vector sequence, where each time step corresponds to a speech frame or sub-word-level speech unit. The code incorporates elements such as semantics, tone, speaking style, and rhythm. This code will serve as the input to the subsequent speech generation decoder, directly determining the controllability and personalization of the generated speech.
[0085] In one implementation, the text-to-speech language model employs a Transformer architecture, where text feature inputs are mapped to a vector dimension with the same dimensionality as the speech encoding through a linear layer, and the speech encoding is then upscaled into a learnable continuous representation through an embedding layer. The two are then fused and fed into a multi-layer self-attention module to perform cross-modal information alignment.
[0086] Alternatively, a two-stream architecture can be used, where text features and speech encoding are input into two separate branches. These branches are then linked through a cross-attention mechanism for modeling, ultimately generating an intermediate encoded sequence in the fusion layer. This architecture is suitable for scenarios where speech encoding has low dimensionality but includes intonation variations, such as generating emotionally rich response speech.
[0087] By inputting text features and speech codes into a language model to generate intermediate codes, a mapping channel between semantics and speech is constructed, greatly improving the comprehensive control over semantic accuracy and timbre reproduction in the speech synthesis stage. This enables the system to output intermediate codes with clear structure, natural rhythm, and consistent speaking style, provided only with prompts and text. This lays the foundation for high-quality speech cloning, especially in maintaining pronunciation coherence and speaker feature consistency even under zero-sample conditions.
[0088] S70, Extract speaker feature vectors from the prompt speech using a speaker encoder;
[0089] In this embodiment, the speaker feature vector extraction process revolves around the prompt speech. The goal is to accurately model the speaker's individual characteristics contained in the prompt speech, so that subsequent speech generation can present parameter features such as timbre, pronunciation, and language rhythm that are highly consistent with the speaker. This process relies on a speaker encoder, which needs to have strong expressive power and temporal modeling capabilities in its structural design, and be able to capture long-term pronunciation characteristics rather than short-term speech content from the original or pre-processed speech.
[0090] Before being input into the encoder, the prompting speech typically undergoes standard preprocessing operations, including framing, windowing, spectral analysis, or filter bank transformation (such as Mel spectrum extraction), generating a structured sequence of speech frames. These frame sequences are then fed into the first-stage module of the speaker encoder, such as a convolutional neural network layer, to extract local acoustic features from the time-frequency dimension, including formant locations, spectral envelopes, short-time energy, and other indicators, forming the low-order perceptual basis of the speech.
[0091] The encoder further models long-term dependencies between speech frames through a multi-head self-attention mechanism, particularly forming encoded representations of speaker stability features across dimensions such as different pronunciation rhythms, intensity distributions, and accent variations. The parallel path structure of the attention module helps capture pronunciation commonalities across time frames, thereby suppressing interference from short-term variations in speech content.
[0092] Local acoustic features and global dependency features are fused through a residual connection module, preserving local details while enhancing global consistency. Finally, a fully connected network compresses the fused features into a fixed-dimensional speaker feature vector. This feature representation is reconstructable, allowing subsequent decoders to generate target speech with timbre style based on it.
[0093] In one implementation, the prompt speech is processed into a sequence of Mel-spectral feature frames and then input into a speaker encoder, which employs a hybrid modeling approach based on a Conformer architecture. Convolutional modules handle local feature extraction, self-attention modules handle long-range dependencies, and the output of each layer is propagated upwards through a residual path. The final output sequence features are compressed into a vector using temporal average pooling, then fed into a multilayer perceptron for dimensionality reduction, outputting a 128-dimensional speaker feature vector.
[0094] In scenarios where speech data changes drastically or the audio noise background is complex, multi-scale convolutional modules can be used to replace traditional convolutional paths, enabling the encoder to extract redundant features under different time windows and improve robustness; or a dual-branch structure can be introduced, with one branch for pronunciation rhythm and the other for intonation, and finally concatenated to form the speaker feature vector.
[0095] A self-supervised training framework can also be introduced to train the encoder using speaker similarity discrimination loss, thereby improving its ability to distinguish speaker features and supporting continuous optimization on unlabeled speech data.
[0096] By performing speaker feature extraction on the prompt speech, the system efficiently compresses the personal features implicit in the original audio, such as timbre, pronunciation habits, and intonation variations, into a structured vector representation. This provides strong personalized control capabilities for subsequent speech cloning. The existence of this vector allows the system to replicate the expression style of a specific speaker even without multiple rounds of samples, improving the individual consistency and naturalness of the synthesized speech and meeting the high requirements for timbre fidelity in real-world scenarios.
[0097] S80, the intermediate code and the speaker feature vector are decoded by generating an adversarial decoder to generate the target speech.
[0098] In this embodiment, during the generation of target speech, the generative adversarial decoder undertakes the crucial mapping task from the representation layer to the perception layer. The input at this stage consists of two core vectors: the intermediate code and the speaker feature vector. The intermediate code mainly carries the semantic and rhythmic information of the synthesized sentence, reflecting "what to say"; while the speaker feature vector defines "who is speaking" and "how to speak," reflecting the individual's timbre, pronunciation style, and intonation characteristics.
[0099] To achieve information fusion, the two vectors are first concatenated to construct a unified decoder input feature. This concatenation operation not only juxtaposes information along the vector dimension but also ensures that semantic information and personalized features are encoded synchronously along the temporal dimension, thus providing sufficient conditions for the generation stage. The generator part of the generative adversarial decoder receives this concatenated vector and performs a forward computation process, mapping the high-dimensional semantic representation into a playable temporal-domain speech signal.
[0100] The generator architecture typically employs a deep convolutional residual network, combined with an upsampling mechanism to progressively reconstruct the complete waveform from low-resolution speech encoding. Internally, it may incorporate techniques such as noise-aware gating and frequency domain feature fusion channels to ensure a balance between naturalness, clarity, and expressiveness in the speech. Simultaneously, to guarantee the perceptual quality of the output speech, the generator's training requires reference to discriminative feedback at multiple scales, thereby gradually approximating the statistical characteristics of real speech samples in the distribution of the generated speech.
[0101] The output of the generative adversarial decoder is a continuous time-domain speech waveform with complete audible speech content and a personalized pronunciation style. This process no longer relies on phase reconstruction algorithms or post-processing modules, but directly outputs a transmittable and playable terminal audio stream.
[0102] In one implementation, the generator network is designed based on the BigVGAN architecture, with its input being a 256-dimensional vector sequence formed by concatenating intermediate codes and speaker feature vectors. This sequence is decoded layer by layer through multiple one-dimensional convolutions, residual connections, and LeakyReLU activation functions, and finally restored to a variable-length audio waveform through an upsampling module and a reconstruction module at the end of the decoder. During the training phase, a multi-scale discriminator provides feedback from the time domain, frequency domain, and perceptual spectrum, ensuring that the synthesized speech not only sounds close to real speech but also possesses a high degree of fidelity in spectral envelope and transition details.
[0103] In another implementation, the decoder can be configured with a dual-channel path. One channel controls the main structure based on semantic rhythm encoding, while the other channel controls fine-tuning paths such as formant center and F0 fundamental frequency using speaker vectors. The dual-channel outputs are then fused to ensure independent control of content and timbre, and to improve cross-speaker generalization.
[0104] The decoder's parameter configuration can also be adjusted according to different deployment platforms (such as mobile devices or edge servers), for example, reducing the depth of convolutional layers or replacing the upsampling mechanism with linear interpolation, in order to reduce the amount of computation while maintaining the generation quality.
[0105] This embodiment generates an adversarial decoder by inputting intermediate encoding and speaker feature vectors, directly outputting personalized, semantically complete, high-fidelity speech waveforms, achieving the goal of end-to-end speech cloning. This processing method eliminates the redundant vocoder module and post-processing operations in traditional TTS, shortens the inference chain, and improves the speech generation speed and overall expressiveness. Furthermore, by introducing speaker feature vectors as control conditions, the system can maintain stable timbre output even under zero-sample conditions, achieving faithful replication of individual voice characteristics.
[0106] In one embodiment, step S30 above includes:
[0107] S301: Obtain at least one pinyin corresponding to each character in the initial text from a preset character-pinyin mapping relation library;
[0108] S302: Convert the characters in the initial text into character embeddings through a character embedding layer;
[0109] S303: Convert the pinyin corresponding to the characters in the initial text into pinyin embeddings through a pinyin embedding layer;
[0110] S304: Extract contextual semantic features of the character embeddings and pinyin embeddings through a pre-trained language model, and determine fusion weights for the character embeddings and pinyin embeddings;
[0111] S305: Perform linear weighting processing on the character embeddings and pinyin embeddings of each character according to the fusion weights, to generate character-pinyin fusion features.
[0112] In this embodiment, the phonetic restoration capability of text input is enhanced, and more controllable and accurately expressed text representations are constructed, especially in language environments where polyphonic characters and semantic ambiguity occur frequently (such as Chinese). Its first operation is to obtain the pinyin of each character in the initial text from the character-pinyin mapping relation library. This relation library pre-organizes one-to-many or many-to-one mapping rules between characters and pinyin, and can adopt a pinyin rule system based on the standards of the National Language Commission, or adaptively adjust according to context, for example, the pinyin of "行" in different semantic structures should be distinguished as "xíng" or "háng". This mapping behavior can be dynamically inferred through a model based on part-of-speech tagging or dependency syntactic analysis.
[0113] Next, each character is sent to the character embedding layer to generate character embeddings. The character embedding layer converts discrete character input into a fixed-dimensional real vector through a lookup table mechanism or a neural network mapping mechanism. The vector can represent the statistical co-occurrence attributes and semantic field positions of the character, and the embedding space can be constructed based on the Token Embedding method in Skip-gram or Transformer.
[0114] In parallel, the pinyin embedding layer also converts the mapped pinyin items into vector form. As phonetic prior information, pinyin often includes components such as initials, finals, and tones. This layer can perform decomposed encoding on the pinyin structure (for example, split embedding into three parts: initial, final, and tone), and then map to a unified embedding space through a multi-layer perceptron to ensure dimensional consistency with the character embeddings.
[0115] Subsequently, a pre-trained language model is used to extract the contextual semantic features of the above encoding pairs, and based on this, the fusion weights between the character encoding and the pinyin encoding at each character position are determined. This model, based on the Transformer architecture, employs a multi-head attention mechanism to capture the semantic context of each character position in the sentence, generating corresponding fusion decision weights. These weights can dynamically adjust the contribution ratio between the character and the pinyin. Particularly for polyphonic characters, technical terms, or written language constructions, the contextual information from the language model can significantly improve the accuracy of pinyin selection.
[0116] Finally, based on the aforementioned fusion weights, the character encoding and pinyin encoding at each character position are linearly weighted to form a character-pinyin fusion feature. The fusion method can employ a weight vector dot product followed by normalization, or enhance contextual fluidity through a residual structure. This fusion feature has the ability to simultaneously carry semantic and phonetic information, serving as the input basis for subsequent text encoders and speech generation networks.
[0117] In one implementation, the character embedding layer and the pinyin embedding layer each construct two embedding matrices. The character embedding matrix has dimensions [V_char,d], and the pinyin embedding matrix has dimensions [V_pinyin,d], where V is the vocabulary size and d is the embedding dimension. The initial input text is mapped to a sequence of character indices, and each index is represented by a corresponding vector in the embedding matrix. After obtaining the mapping relationship, the pinyin part is also converted into a pinyin index sequence, and the pinyin encoding vector is obtained by looking up a table.
[0118] The fusion weights can be determined using a small attention network. The character encoding and the pinyin encoding are concatenated and input into the network. The weights α∈[0,1] are output through a two-layer perceptron, representing the proportion of pinyin. The final fusion feature can be obtained by the formula: F=α*P+(1-α)*C, where C is the character encoding, P is the pinyin encoding, and F is the fusion feature.
[0119] In another implementation, shared positional encoding and a unified encoder model can be used on the character and pinyin embedding vectors to naturally integrate contextual features. This structure effectively reduces parameter size and improves the accuracy of character-pinyin fusion comparison, making it suitable for scenarios requiring lightweight deployment.
[0120] This embodiment enhances the controllability of pronunciation for polyphonic characters and long-tailed words by introducing pinyin embedding on top of character encoding and performing dynamic fusion guided by contextual semantics. It also enables the model to have better language reconstruction capabilities under zero-sample or few-sample speaker conditions. This approach eliminates the pronunciation uncertainty purely based on character shape in traditional character-level modeling, while integrating context-awareness to improve the naturalness and semantic accuracy of generated speech.
[0121] In one embodiment, step S50 above includes:
[0122] S501, Construct a test dataset containing acoustic speech tag samples;
[0123] S502, the acoustic speech marker samples in the test dataset are encoded using vector quantization to generate a first codebook, and the compression rate and reconstruction error of the first codebook are analyzed.
[0124] S503, the acoustic speech marker samples in the test dataset are encoded using finite scalar quantization to generate a second codebook, and the compression rate and reconstruction error of the second codebook are analyzed;
[0125] S504, compare the compression ratio and reconstruction error of the first codebook and the second codebook, and select the optimal quantization method as the codebook generation method based on the comparison results;
[0126] S505, Based on the codebook generation method, generate speech code according to the acoustic speech markers of the prompt speech.
[0127] In this embodiment, to achieve a more efficient and high-fidelity speech coding strategy, it is necessary to generate optional codebooks based on multiple quantization methods before model application, and select the optimal codebook generation method through comparative analysis. In this process, a test dataset containing acoustic speech marker samples must first be constructed. This test dataset should cover a wide range of speaker timbre features, articulation patterns, speech rates, and acoustic variations in different contexts to ensure the universality of the quantization evaluation. Speech marker samples can be obtained by extracting acoustic features from large-scale speech data. Acoustic features generally include Mel spectrum, linear predictive cepstral coefficients (LPCC), fundamental frequency profile, energy envelope, etc. Extraction methods can use sliding window framing, Fourier transform, or convolutional networks.
[0128] Next, vector quantization is used to encode the acoustic speech tags for each speech frame in the test dataset. Vector quantization maps a high-dimensional continuous vector to its nearest neighbor vector in a predefined finite set of vectors, thereby achieving compression. This set is the first codebook, which can be generated using methods such as k-means clustering, perceptual hashing, aggregation self-attention structures, or product quantization. Analyzing the compression ratio of the first codebook requires calculating the ratio between the original vector size and the quantization index size. The reconstruction error can be measured by mean squared error (MSE) or signal-to-noise ratio (SNR) to determine the difference between the reconstructed sample and the original speech tag.
[0129] Simultaneously, a second codebook is generated by encoding the same dataset using finite scalar quantization. Scalar quantization quantizes each acoustic label dimension independently, resulting in a compressed result with lower complexity but potentially lower precision. This codebook is typically constructed based on non-uniform interval partitioning, histogram-based balanced distribution, or entropy encoding mechanisms, making it suitable for deployments sensitive to model inference time.
[0130] The compression ratio and reconstruction error of the first and second codebooks are compared. A weighted scoring function can be used, multiplying the compression ratio and reconstruction error by their respective weights and then summing them to obtain an overall evaluation index. Based on the scoring results, the quantification method that optimizes compression efficiency and reconstruction quality is selected as the final codebook generation method. This method can also consider model adaptation scenarios, such as prioritizing compression ratio for edge devices and prioritizing reconstruction quality for cloud models.
[0131] After selection, the acoustic speech markers of the prompt speech are encoded according to the codebook generation method. The prompt speech first passes through the feature extraction module to obtain an acoustic speech marker representation with the same dimensions as the test dataset. Then, the encoding mapping operation is performed through the selected codebook to obtain the final speech encoding result. This speech encoding will serve as the conditional input to the speech generation model, undertaking the function of compressing speech content information while maintaining the ability to represent speech details.
[0132] In one implementation, the speech tags in the test dataset are extracted using 64-dimensional Mel-frequency coefficients. The k-means algorithm is used to cluster all frame vectors, with 512 cluster centers as the first codebook, encoding each frame as an index. During reconstruction, the index is mapped back to the corresponding center vector. The compression ratio is the ratio of the original 64-dimensional floating-point vector to the 9-bit discrete index, with an error of MSE.
[0133] In another implementation, finite scalar quantization discretizes each Mel-spectrum dimension into eight intervals to form a second codebook. Analysis shows that the first codebook has a lower reconstruction error, while the second codebook has a higher compression ratio. For deployment requirements at edge terminals, the second codebook can be chosen; for high-quality synthesis during the training phase, the first codebook should be selected.
[0134] During speech encoding generation, each frame of the prompt speech is mapped to the closest vector or quantization value in the selected codebook. The compressed information is preserved through codebook index or quantization code string, which can be used as conditional input in subsequent speech synthesis models.
[0135] This embodiment constructs multiple codebooks and performs comparative analysis of metrics during the preprocessing stage. This effectively selects the most suitable quantization method based on the task objective, enabling the speech coding to achieve both high compression rates and low reconstruction errors, thus improving the overall quality of the speech synthesis system. The speech code generated by this method not only has controllable compression effects but also possesses excellent speech reconstruction capabilities.
[0136] In one embodiment, step S70 above includes:
[0137] S701, The speaker encoder performs frame-segmentation and windowing processing on the prompting voice to generate a voice frame sequence;
[0138] S702, Local acoustic features of the speech frame sequence are extracted through the convolutional neural network layer of the speaker encoder;
[0139] S703, The speech frame sequence is processed through the multi-head self-attention mechanism of the speaker encoder to capture the global dependencies of the speech frame sequence;
[0140] S704, through the residual connection module of the speaker encoder, the local acoustic features and global dependencies are processed by residual connection to generate a fused feature vector;
[0141] S705, the fusion feature vector is reduced in dimensionality through the fully connected layer of the speaker encoder to generate the speaker feature vector.
[0142] In this embodiment, to accurately extract speaker-related personality features from the prompt speech, this module designs a speaker coding process consisting of temporal modeling, local structure extraction, and fusion optimization. First, the prompt speech needs to be processed by frame-by-frame windowing. The continuous speech signal is divided into frame segments of uniform length with short-term stationarity. Each frame can be implemented using a 20-25 millisecond window, and a sliding step size is set to control the degree of overlap between frames, such as 10 milliseconds, to retain sufficiently fine-grained temporal structure. Hamming windows or Gaussian windows can be used to reduce spectral leakage, thereby constructing a balanced speech frame sequence.
[0143] The speech frame sequence is then fed into a convolutional neural network layer in the speaker encoder to extract frame-level local acoustic features. The convolution operation extracts short-time spectral patterns, including fundamental frequency variations and formant distributions, by sliding multiple kernels along the time dimension. It typically employs multiple layers of one-dimensional convolutions, activation functions, and batch normalization operations to progressively enhance acoustic representation capabilities and achieve spatial compression and robust modeling.
[0144] To capture long-term dependencies between frames within the global context, the speech frame sequence is simultaneously input into the speaker encoder's multi-head self-attention mechanism module. This mechanism explicitly models the dynamic connections of speech over the overall time axis by constructing multiple attention heads and calculating the relevance weights of each frame vector to other frames. The query-key-value computation structure in the attention mechanism can incorporate long-range speech trends into the encoding model based on position independence, which helps capture long-term features such as speech rate, intonation, and pauses between sentences.
[0145] The residual connection module in the speaker encoder is responsible for fusing the local acoustic features obtained from the convolutional network with the global dependencies generated by the self-attention mechanism. The fusion method preserves the independent expressive power of both features in terms of spatial distribution and global relationships through residual addition operations, and utilizes normalization and nonlinear activation layers to improve the learnability of the fused features, preventing feature degradation or dimensionality mismatch issues. The fused output is the intermediate speech representation that aggregates multi-scale features.
[0146] Finally, the fused feature vector is dimensionality-reduced through a fully connected layer in the speaker encoder. This process compresses the high-dimensional speech frame features into a fixed-length speaker feature vector, representing the individual speech style, vocal tract physiological features, and timbre representation information contained in the current speech. The dimensionality reduction structure may include linear transformation, normalization, and compression layers. The dimension of the output speaker feature vector can be controlled to a standard vector length such as 256 or 512, which is convenient for use by the subsequent speech generation module.
[0147] In one implementation, the window length of the speech frame sequence is set to 25 milliseconds, the frame shift is 10 milliseconds, and the Hamming window function is used for windowing to ensure a balance between temporal stationarity and frequency domain smoothness. The convolutional neural network consists of three one-dimensional convolutional layers with 128, 256, and 512 channels respectively, each with a kernel size of 5 and a stride of 1, using ReLU activation and LayerNorm to extract local features. The multi-head self-attention module is configured with four attention heads, each with a dimension of 64. It constructs a Query-Key-Value matrix based on a Transformer encoding structure, performs attention weighting on the frame dimension, and outputs a global temporal relation vector. The residual connection module element-wise adds the output vectors of the convolutional network and the attention mechanism, then connects them to BatchNorm and ReLU activation. The fused vector is mapped to a 256-dimensional speaker feature vector through a fully connected network with Dropout and linear projection.
[0148] In another implementation, multi-head attention and convolution operations are performed in parallel rather than sequentially. Features are extracted independently and then fused together at the residual connections to improve the model's performance in diverse speaker contexts. Furthermore, the residual-fused vectors can employ an attention-weighted fusion method, adaptively adjusting the weight of local and global features through a learned fusion gating mechanism to achieve more personalized vector compression.
[0149] This embodiment utilizes a combination of local structure modeling and global contextual relationships to stably extract speaker feature information under varying speech rates, accents, and vocal ranges. The residual fusion strategy enhances the effective integration of temporal multi-level features, improving feature representation capabilities. Through final fully connected dimensionality reduction, the generated speaker feature vector possesses high speech identity recognition capabilities and good transferability, providing stable support for maintaining timbre consistency with the speaker in subsequent generation stages.
[0150] In one embodiment, step S80 above includes:
[0151] S801, The intermediate code is concatenated with the speaker feature vector to generate decoder input features;
[0152] S802, the generator network of the generative adversarial decoder performs forward computation on the decoder input features to generate a time-domain speech waveform;
[0153] S803, the time-domain speech waveform is output as the target speech.
[0154] In this embodiment, the intermediate encoding is typically generated by a text-to-speech language model, carrying syllable-level semantic expression, prosodic intent, and other content information, while the speaker feature vector contains static speech style attributes such as pronunciation style, vocal tract structure, and timbre. The goal of concatenating these two features is to construct a unified vector sequence, enabling the subsequent generator network to simultaneously capture both pronunciation content and timbre characteristics. Feature concatenation is generally performed at the vector level, maintaining consistency in the time dimension while extending along the feature dimension. For example, a T-length intermediate encoding sequence, a d₁-dimensional vector sequence, and a d₂-dimensional speaker vector are broadcast and concatenated to form a T×(d₁+d₂) two-dimensional tensor, which serves as the input to the decoder. The generator network is typically implemented based on a Generative Adversarial Network (GAN) architecture, whose structure may include stacked convolutional layers, residual blocks, skip connections, and other modules, responsible for converting the concatenated input features into continuous temporal speech waveforms. The generator network performs a forward computation process, which involves mapping, activating, and convolving the input feature sequence layer by layer, synthesizing complete speech through a multi-scale decoding path. This process is a one-time forward propagation computation, requiring no backpropagation training, and can be used for real-time inference after pre-training. Ultimately, the time-domain speech waveform output by the generator is the target speech, possessing natural intonation, coherent prosody, and the timbre style of the target speaker. This output format is typically 16kHz or 24kHz single-channel floating-point waveform data, which can be directly used for speech playback or subsequent processing systems.
[0155] In one implementation, the intermediate encoding generated by the text-speech language model is set as a tensor of length T and dimension 512, and the speaker feature vector dimension is set to 256. The speaker vector is copied by broadcasting along the time axis to match the time length T, and then concatenated along the feature dimension to form a T×768-dimensional decoder input feature. The generator network structure can adopt a decoder framework based on BigVGAN2, including four upsampling convolutional modules, each layer configured with deconvolution, convolutional residual blocks, and noise injection modules. Each residual block contains a convolutional layer, normalization, and LeakyReLU activation function. Through scale widening and time dimension recovery, the 768-dimensional input feature is finally mapped to a speech waveform with the same duration as the original speech. The generated speech waveform is represented in 32-bit floating-point format with a sampling rate of 22050Hz.
[0156] In another implementation, the UNet structure can be used instead of BigVGAN2, employing skip connections to directly pass low-level semantic information encoded in the intermediate layers to the high-level output, thereby enhancing the local stability of the speech. Simultaneously, to improve model robustness, noise vector perturbations can be added to the decoder input features to enhance generation stability under varying speech rates or semantically repetitive inputs.
[0157] This embodiment achieves personalized and highly natural speech generation by fusing intermediate encoding with speaker features through modeling. This process can restore the target speaker's vocal characteristics while maintaining clear semantic expression. The forward generator structure has strong temporal domain restoration capabilities, enabling the generation of smooth, clear, and distortion-free speech waveforms without relying on post-processing steps.
[0158] In one embodiment, prior to step S80, the method further includes:
[0159] S8001, Construct a training dataset containing real speech waveforms of the target speaker;
[0160] S8002, Generate a random noise vector, and concatenate the random noise vector with the speaker feature vector of the target speaker to generate the generator input feature;
[0161] S8003, through the generator network of the generative adversarial decoder, performs nonlinear transformation on the generator input features to generate a synthesized speech waveform;
[0162] S8004, through the multi-scale discriminator network of the generative adversarial decoder, multi-resolution analysis is performed on the synthesized speech waveform and the real speech waveform in the training dataset to determine the adversarial loss function value;
[0163] S8005, based on the adversarial loss function value, alternately update the parameters of the generator network and the multi-scale discriminator network until the distance between the Mel-Cepstral coefficients of the synthesized speech waveform generated by the generator network and the real speech waveform is lower than a preset threshold, thereby obtaining a pre-trained generative adversarial decoder.
[0164] In this embodiment, to achieve high-quality speech generation using a generative adversarial decoder during the inference phase, a generator network with speech style learning capabilities needs to be constructed through a pre-training process. This process first requires building a training dataset covering the speech style features of the target speaker. Each data point in the training dataset represents a real speech waveform of the target speaker; the sampling rate, bit width, and speech duration must be standardized to ensure consistent feature representation, forming a set of real samples for the training process. The training input is generated by concatenating a random noise vector with the speaker feature vector of the target speaker. The concatenation process connects along the feature dimension, forming a fixed-structure generator input feature. The noise vector, as a latent variable, carries diverse information in the potential speech space, ensuring the generator output has rich speech variation capabilities; the speaker feature vector guides the generator to learn the target speaker's timbre, intonation, and other characteristics. The generator input feature, formed by the combination of these two, drives the speech synthesis process. The generator network performs a nonlinear transformation on the input features, outputting a simulated speech waveform. Its structure typically employs a multi-layer deconvolutional network to progressively recover the time dimension and amplitude features. The generator may include cross-layer connections, attention modules, and spectral transformation modules to enhance modeling capabilities. Synthetic speech waveforms are compared and contrasted with real speech waveforms by a discriminator network. The discriminator network has a multi-scale structure, evaluating the distribution differences between the two types of samples at the original waveform scale, downsampling scale, and frame-level frequency domain scale, thereby improving discrimination capability. The discriminator may include multiple parallel paths, each using different sampling rates, convolutional kernel sizes, and strides, jointly modeling the structural differences between real and fake samples from both global and local dimensions. During training, an adversarial loss function is used as the optimization objective. The generator aims to minimize the difference between synthetic and real samples in the discriminator's output, while the discriminator optimizes its discrimination accuracy. The optimization process employs an alternating update strategy: first, the generator parameters are fixed to optimize the discriminator network to improve its real / fake recognition capability; then, the discriminator parameters are fixed again to optimize the generator network to minimize the possibility of synthetic samples being identified as fake. To quantify the generator's convergence performance, Mel-Cepstral Distance (MCD) is introduced as a quality evaluation metric. This metric measures the spectral fidelity of the speech by calculating the frame-level difference between generated and real speech in the Mel spectrum. When the average MCD value during training is lower than the preset threshold, it means that the generator has been able to perceptually approximate real speech, and the training can be regarded as converged. The current generator network parameters are saved as a pre-trained generator for use in the inference stage.
[0165] In one implementation, the training dataset sampling rate is set to 22050Hz, covering target speaker samples under multiple emotional states and pronunciation scenarios. The random noise vector dimension is set to 128, and the speaker feature vector dimension is set to 256, concatenating them to form a 384-dimensional input. The generator employs a residual-structured fully convolutional network, reconstructing waveform segments of length T through four layers of deconvolution and ReLU activation units. The multi-scale discriminator comprises three parallel networks, processing the original waveform, 2x downsampled waveform, and Mel-spectrum image input respectively, optimized jointly by cross-entropy loss and adversarial loss.
[0166] Another approach involves a two-stage training process. In the first stage, the discriminator structure is fixed, and only the generator's perceptual loss is optimized. In the second stage, adversarial loss is enabled for optimization, and the discriminator network structure parameters are dynamically adjusted. At the end of the training cycle, if the MCD is below 4.5dB for five consecutive rounds, training is stopped and the generator parameters are frozen.
[0167] This embodiment enables the generator network to map random variables and speaker features to high-quality speech waveforms, and improves the naturalness and timbre consistency of the output through discriminator feedback. The multi-scale discriminator structure effectively alleviates the problem of discriminator overfitting to specific patterns and improves the ability to model complex timbre variations. Using Mel-frequency cepstral coefficients as an evaluation metric ensures that the generated results closely approximate real speech in both the spectral domain and perceptual quality, thus providing a stable and high-fidelity decoder model for subsequent inference.
[0168] In one embodiment, step S40 above includes:
[0169] S401, the character pinyin fusion features are mapped into high-dimensional semantic vectors through a pre-trained language model embedding layer;
[0170] S402, The high-dimensional semantic vector is modeled for context dependency through the multi-head self-attention mechanism layer of the text encoder to generate context-related sequence features;
[0171] S403, The text encoder performs a nonlinear transformation on the context-related sequence features to generate a text feature vector.
[0172] S404, Perform layer normalization on the text feature vector to generate the text features.
[0173] In this embodiment, the pre-trained language model embedding layer is an important component in Natural Language Processing (NLP). Located at the input of the language model, it primarily maps discrete symbols (such as characters, words, or pinyin) into a continuous, high-dimensional vector space. These vectors capture semantic information, enabling the model to understand and process words and their context in the language. Pre-trained language models are deep learning models trained on large amounts of text data, aiming to learn language representations (also called "language models"). These models learn relationships between words, grammatical structures, and semantic information from large-scale corpora through unsupervised learning. These models are typically based on the Transformer architecture. The embedding layer is a component of the neural network used to convert discrete words (or characters, pinyin, etc.) into a fixed-size vector. The output of the embedding layer is a high-dimensional vector that carries the semantic information of each input symbol. In traditional NLP, words are typically mapped to a dense vector space using word embeddings (such as Word2Vec or GloVe). However, in modern pre-trained language models, the embedding layer is the first part of the entire model, responsible for mapping input symbols to a high-dimensional space. The embedding layer of a pre-trained language model not only converts input symbols into vectors but also utilizes pre-trained parameters to enhance the semantic expressiveness of these vectors. Specifically, the pre-trained embedding layer uses language knowledge learned from large-scale corpora during training to generate vector representations that can carry grammatical, semantic, and other information. For example, in the BERT model, the input to the embedding layer includes not only word embeddings (e.g., vectors obtained by looking up word IDs in the vocabulary) but also the word's positional information (its location within a sentence) and the relationships between sentences (in the case of multi-sentence input). This information, processed by the pre-trained model parameters, generates semantically rich high-dimensional vectors. Here, "high-dimensional" refers to the higher-dimensional numerical representation generated by mapping the input character pinyin fusion features through the embedding layer. Specifically, high-dimensional vector representations can contain hundreds to thousands of dimensions, accurately describing the semantic relationships and contextual information of character pinyin fusion features in a multi-dimensional space. For example, in the BERT model in natural language processing, each input word or character is converted into a 768-dimensional high-dimensional vector through an embedding layer. This vector can carry rich semantic information, including word meaning, grammatical structure, and contextual information. The advantage of high dimension is that it can simultaneously combine local features (such as the phonological features of pinyin) and global features (such as the influence of other characters in a sentence), improving the model's expressive power. In the multi-head self-attention mechanism layer, the high-dimensional semantic vector is further processed to capture the contextual dependencies between different positions. The multi-head mechanism means that multiple parallel attention heads focus on different subspace information, thereby capturing finer-grained semantic relationships. This mechanism can provide the model with an understanding of different long-range dependencies between characters.High-dimensional semantic vectors are used as input in this process, and the relationships between positions are dynamically adjusted through attention weights. The output sequence features contain rich contextual information, enhancing the ability to handle polyphonic characters and ambiguous words. Through the feedforward neural network layer, the contextual features originally generated by the multi-head self-attention mechanism undergo nonlinear transformation to further learn complex feature relationships and finally compress them into a fixed-dimensional text feature vector. This dimensionality compression step ensures that the features can be effectively used in subsequent tasks and prevents computational efficiency problems caused by excessive feature dimensions. In this layer, the high-dimensional vector is mapped to a vector that better meets the requirements of downstream tasks. The compression process helps reduce redundant information while ensuring that the text features can adapt to specific task requirements. Layer normalization is a regularization method used to ensure that the output of each layer in the neural network remains stable during training. This is crucial for solving the gradient vanishing or gradient exploding problem and can also accelerate the model training process. After being processed by the feedforward network, the high-dimensional vector needs to undergo layer normalization to normalize its feature values and ensure that the model can be better optimized. This step helps stabilize the update of model parameters and improve the convergence speed during training.
[0174] This embodiment effectively transforms character pinyin fusion features into standardized text features usable for downstream speech generation tasks through the aforementioned steps. The introduction of high-dimensional semantic vectors enhances the model's representational capabilities, enabling it to better understand and handle complex linguistic phenomena such as polyphonic characters and ambiguous words. The text encoder effectively captures the contextual relationships between characters through a multi-head self-attention mechanism, thereby improving the naturalness and expressiveness of the speech clone. The use of layer normalization further stabilizes the training process, accelerates model convergence, and provides a good performance guarantee for practical deployment.
[0175] In one embodiment, a speech generation device is provided, which corresponds one-to-one with the speech generation methods in the above embodiments. Referring to Figure 3, Figure 3 is a schematic diagram of the functional modules of a preferred embodiment of the speech generation device of this application. The device includes a speech input module 10, a speech recognition module 20, a pinyin encoding module 30, a text encoding module 40, a speech quantization module 50, a multimodal fusion module 60, a speaker analysis module 70, and a speech synthesis module 80. Detailed descriptions of each functional module are as follows:
[0176] The voice input module 10 is used to receive prompt voice containing the target voice features;
[0177] The speech recognition module 20 is used to convert the prompt speech into initial text.
[0178] The pinyin encoding module 30 is used to perform joint character and pinyin encoding processing on the initial text to generate character pinyin fusion features;
[0179] Text encoding module 40 is used to process the character pinyin fusion features through a text encoder to generate text features;
[0180] The speech quantization module 50 is used to determine the codebook generation method and extract the speech code from the prompt speech based on the codebook generation method.
[0181] The multimodal fusion module 60 is used to input the text features and speech codes into the text speech language model to generate intermediate codes;
[0182] Speaker analysis module 70 is used to extract speaker feature vectors from the prompt speech through a speaker encoder;
[0183] The speech synthesis module 80 is used to decode the intermediate code and the speaker feature vector by generating an adversarial decoder to generate the target speech.
[0184] For specific limitations regarding the speech generation device, please refer to the aforementioned limitations on the speech generation method, which will not be repeated here. Each module in the aforementioned speech generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0185] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 4. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. When the computer program is executed by the processor, it implements the functions or steps of a speech generation method on the server side.
[0186] In one embodiment, a computer device is provided, which may be a user terminal, and its internal structure diagram may be as shown in Figure 5. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. When the computer program is executed by the processor, it implements the functions or steps of a speech generation method on the user terminal side.
[0187] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0188] Receive prompt voice containing the target speech features;
[0189] The prompt speech is converted into initial text using a speech recognition module;
[0190] The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features;
[0191] The character pinyin fusion features are processed by a text encoder to generate text features;
[0192] Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method;
[0193] The text features and speech codes are input into a text-speech language model to generate intermediate codes;
[0194] The speaker feature vector in the prompt speech is extracted using a speaker encoder.
[0195] The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
[0196] In one embodiment, a non-volatile computer-readable storage medium is provided, which may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, it performs the following steps:
[0197] Receive prompt voice containing the target speech features;
[0198] The prompt speech is converted into initial text using a speech recognition module;
[0199] The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features;
[0200] The character pinyin fusion features are processed by a text encoder to generate text features;
[0201] Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method;
[0202] The text features and speech codes are input into a text-speech language model to generate intermediate codes;
[0203] The speaker feature vector in the prompt speech is extracted using a speaker encoder.
[0204] The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
[0205] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and user side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0206] It should be noted that any software tools or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application is authorized (with the knowledge and consent) by the relevant parties or fully authorized by all parties, and the executing entity may obtain it through various public, legal, and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with the relevant laws and regulations of the relevant countries and regions, and do not violate public order and good morals.
Claims
1. A speech generation method, wherein, Includes the following steps: Receive prompt voice containing the target speech features; The prompt speech is converted into initial text using a speech recognition module; The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features; The character pinyin fusion features are processed by a text encoder to generate text features; Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method; The text features and speech codes are input into a text-speech language model to generate intermediate codes; The speaker feature vector in the prompt speech is extracted using a speaker encoder. The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
2. The speech generation method as described in claim 1, wherein, Perform joint character and pinyin encoding processing on the initial text to generate character-pinyin fusion features, including: Obtain at least one pinyin corresponding to each character in the initial text from a preset character pinyin mapping database; The characters in the initial text are converted into character encoding through a character embedding layer; The pinyin corresponding to the characters in the initial text is converted into pinyin encoding through a pinyin embedding layer; The contextual semantic features of the character encoding and pinyin encoding are extracted by a pre-trained language model, and the fusion weights of the character encoding and pinyin encoding are determined. Based on the fusion weights, the character encoding and pinyin encoding of each character are linearly weighted to generate character-pinyin fusion features.
3. The speech generation method as described in claim 2, wherein, Converting characters in the initial text to character encoding via a character embedding layer includes: A character embedding matrix is constructed as a character embedding layer, and the dimension of the character embedding matrix is determined by the total number of characters in the vocabulary and the preset embedding dimension. Convert the characters in the initial text into a character index sequence; Based on the character index sequence, the character code corresponding to each character is found and obtained from the character embedding matrix.
4. The speech generation method as described in claim 2, wherein, The pinyin corresponding to the characters in the initial text is converted into pinyin encoding through a pinyin embedding layer, including: The pinyin corresponding to the characters in the initial text is decomposed into three components: initial consonant, final vowel, and tone. Through the Pinyin embedding layer, the three components of initial consonant, final vowel and tone are mapped to corresponding initial consonant embedding vector, final vowel embedding vector and tone embedding vector, respectively. The initial consonant embedding vector, final vowel embedding vector, and tone embedding vector belonging to the same pinyin are combined in the order of initial consonant, final vowel, and tone to generate a pinyin embedding vector sequence. The pinyin embedding vector sequence is subjected to local feature extraction using a one-dimensional convolutional neural network to generate pinyin codes.
5. The speech generation method as described in claim 1, wherein, Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method, including: Construct a test dataset containing acoustically labeled speech samples; The acoustic speech marker samples in the test dataset are encoded using vector quantization to generate a first codebook, and the compression rate and reconstruction error of the first codebook are analyzed. The acoustic speech marker samples in the test dataset are encoded using finite scalar quantization to generate a second codebook, and the compression ratio and reconstruction error of the second codebook are analyzed. By comparing the compression ratio and reconstruction error of the first codebook and the second codebook, the optimal quantization method is selected as the codebook generation method based on the comparison results; Based on the codebook generation method, a speech code is generated according to the acoustic speech markers of the prompt speech.
6. The speech generation method as described in claim 5, wherein, The acoustic speech marker samples in the test dataset are encoded using vector quantization to generate a first codebook, and the compression ratio and reconstruction error of the first codebook are analyzed, including: Clustering algorithms are used to perform cluster analysis on the acoustic speech marker samples in the test dataset to generate a first codebook composed of multiple cluster center vectors; Determine the compression ratio of the first codebook, wherein the compression ratio is the ratio of the data size of the original acoustic speech tag to the data size of the quantized index; The reconstruction error of the first codebook is determined, wherein the value of the reconstruction error is the mean square error between the acoustic speech tag sample reconstructed from the first codebook and the original acoustic speech tag sample.
7. The speech generation method as described in claim 5, wherein, The acoustic speech marker samples in the test dataset are encoded using finite scalar quantization to generate a second codebook. The compression ratio and reconstruction error of the second codebook are then analyzed, including: The Mel spectrum of each acoustic speech tag sample in the test dataset is subjected to dimensional scalar quantization, and each dimension is independently mapped to a finite set of predefined level levels to complete the scalar quantization and generate the second codebook. Based on the amount of data in the original acoustic speech tag samples and the amount of data in the quantized second codebook, the compression rate of the second codebook is determined. The reconstruction error of the second codebook is determined by comparing the acoustic features reconstructed by the second codebook with the original acoustic speech tag samples.
8. The speech generation method as described in claim 1, wherein, The speaker feature vector in the prompt speech is extracted using a speaker encoder, including: The speaker encoder performs frame-segmentation and windowing processing on the prompting speech to generate a speech frame sequence. Local acoustic features of the speech frame sequence are extracted through the convolutional neural network layer of the speaker encoder; The speech frame sequence is processed by the speaker encoder's multi-head self-attention mechanism to capture the global dependencies of the speech frame sequence; The speaker encoder's residual connection module performs residual connection processing on the local acoustic features and global dependencies to generate a fused feature vector. The fused feature vector is reduced in dimensionality by the fully connected layer of the speaker encoder to generate the speaker feature vector.
9. The speech generation method as described in claim 8, wherein, The prompt speech is processed by the speaker encoder to perform frame segmentation and windowing to generate a speech frame sequence, including: The speaker encoder uses a preset-length analysis window and a preset-step frame shift to perform frame segmentation on the prompting speech, thereby obtaining framed speech segments. The speaker encoder applies a window function to window each frame of speech in the segmented speech segment to generate a windowed speech frame. The speaker encoder arranges the windowed speech frames in chronological order to generate a speech frame sequence.
10. The speech generation method as described in claim 8, wherein, The speech frame sequence is processed through the speaker encoder's multi-head self-attention mechanism to capture the global dependencies of the speech frame sequence, including: The speaker encoder inputs the speech frame sequence into a self-attention module containing multiple attention heads. The self-attention module determines the attention weight of each frame vector in the speech frame sequence as a query vector relative to all other frame vectors as key vectors. The self-attention module performs weighted fusion of the frame vectors that serve as value vectors in the speech frame sequence according to the attention weights to generate a representation that includes global dependencies.
11. The speech generation method as described in claim 1, wherein, The intermediate code and the speaker feature vector are decoded by a generative adversarial decoder to generate the target speech, including: The intermediate code is concatenated with the speaker feature vector to generate the decoder input features; The generator network of the generative adversarial decoder performs forward computation on the decoder input features to generate a time-domain speech waveform. The time-domain speech waveform is output as the target speech.
12. The speech generation method as described in claim 1, wherein, Before generating the target speech, the process includes decoding the intermediate code and the speaker feature vector using a generative adversarial decoder, and then further including: Construct a training dataset containing real speech waveforms of the target speaker; A random noise vector is generated, and the random noise vector is concatenated with the speaker feature vector of the target speaker to generate the generator input feature; By using a generator network that generates a generative adversarial decoder, the generator input features are nonlinearly transformed to generate a synthesized speech waveform. The multi-scale discriminator network of the generative adversarial decoder is used to perform multi-resolution analysis on the synthesized speech waveform and the real speech waveform in the training dataset to determine the adversarial loss function value. The parameters of the generator network and the multi-scale discriminator network are alternately updated based on the adversarial loss function value until the distance between the Mel-frequency cepstral coefficients of the synthesized speech waveform generated by the generator network and the real speech waveform is lower than a preset threshold, thereby obtaining a pre-trained generative adversarial decoder.
13. The speech generation method as described in claim 1, wherein, The character pinyin fusion features are processed by a text encoder to generate text features, including: The character pinyin fusion features are mapped into high-dimensional semantic vectors through a pre-trained language model embedding layer; The high-dimensional semantic vector is modeled for context dependence by a multi-head self-attention mechanism layer of a text encoder to generate context-related sequence features. The text encoder performs a nonlinear transformation on the context-associated sequence features to generate a text feature vector. The text feature vector is subjected to layer normalization to generate the text features.
14. A speech generation apparatus, wherein, The speech generation device includes: The voice input module is used to receive prompt voice containing the target voice features; A speech recognition module is used to convert the prompt speech into initial text. The pinyin encoding module is used to perform joint character and pinyin encoding processing on the initial text to generate character pinyin fusion features; The text encoding module is used to process the character pinyin fusion features through a text encoder to generate text features; The speech quantization module is used to determine the codebook generation method and extract the speech code from the prompt speech based on the codebook generation method. The multimodal fusion module is used to input the text features and speech codes into the text-speech language model to generate intermediate codes; The speaker analysis module is used to extract speaker feature vectors from the prompt speech through a speaker encoder; The speech synthesis module is used to decode the intermediate code and the speaker feature vector by generating an adversarial decoder to generate the target speech.
15. A computer device, wherein, The computer device includes a memory, a processor, and a speech generation program stored in the memory and executable on the processor. When the speech generation program is executed by the processor, it implements the following steps of the speech generation method: Receive prompt voice containing the target speech features; The prompt speech is converted into initial text using a speech recognition module; The initial text is subjected to joint character and pinyin encoding processing to generate character and pinyin fusion features; The character pinyin fusion features are processed by a text encoder to generate text features; Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method; The text features and speech codes are input into a text-speech language model to generate intermediate codes; The speaker feature vector in the prompt speech is extracted using a speaker encoder. The target speech is generated by decoding the intermediate code and the speaker feature vector using a generative adversarial decoder.
16. The computer device as claimed in claim 15, wherein, Perform joint character and pinyin encoding processing on the initial text to generate character-pinyin fusion features, including: Obtain at least one pinyin corresponding to each character in the initial text from a preset character pinyin mapping database; The characters in the initial text are converted into character encoding through a character embedding layer; The pinyin corresponding to the characters in the initial text is converted into pinyin encoding through a pinyin embedding layer; The contextual semantic features of the character encoding and pinyin encoding are extracted by a pre-trained language model, and the fusion weights of the character encoding and pinyin encoding are determined. Based on the fusion weights, the character encoding and pinyin encoding of each character are linearly weighted to generate character-pinyin fusion features.
17. The computer device as claimed in claim 15, wherein, Determine the codebook generation method, and extract the speech encoding from the prompt speech based on the codebook generation method, including: Construct a test dataset containing acoustically labeled speech samples; The acoustic speech marker samples in the test dataset are encoded using vector quantization to generate a first codebook, and the compression rate and reconstruction error of the first codebook are analyzed. The acoustic speech marker samples in the test dataset are encoded using finite scalar quantization to generate a second codebook, and the compression ratio and reconstruction error of the second codebook are analyzed. By comparing the compression ratio and reconstruction error of the first codebook and the second codebook, the optimal quantization method is selected as the codebook generation method based on the comparison results; Based on the codebook generation method, a speech code is generated according to the acoustic speech markers of the prompt speech.
18. The computer device as claimed in claim 15, wherein, The speaker feature vector in the prompt speech is extracted using a speaker encoder, including: The speaker encoder performs frame-segmentation and windowing processing on the prompting speech to generate a speech frame sequence. Local acoustic features of the speech frame sequence are extracted through the convolutional neural network layer of the speaker encoder; The speech frame sequence is processed by the speaker encoder's multi-head self-attention mechanism to capture the global dependencies of the speech frame sequence; The speaker encoder's residual connection module performs residual connection processing on the local acoustic features and global dependencies to generate a fused feature vector. The fused feature vector is reduced in dimensionality by the fully connected layer of the speaker encoder to generate the speaker feature vector.
19. The computer device as claimed in claim 15, wherein, The intermediate code and the speaker feature vector are decoded by a generative adversarial decoder to generate the target speech, including: The intermediate code is concatenated with the speaker feature vector to generate the decoder input features; The generator network of the generative adversarial decoder performs forward computation on the decoder input features to generate a time-domain speech waveform. The time-domain speech waveform is output as the target speech.
20. A non-volatile computer-readable storage medium, wherein, The storage medium stores a speech generation program, which, when executed by a processor, implements the steps of the speech generation method as described in any one of claims 1-13.
