Streaming voice conversion method based on block masking
Through the streaming voice conversion method based on block masking, the problem of low speech conversion accuracy in traditional technology is solved. Through the combination of block masking and streaming codec, the speaker-related information is eliminated, and higher speech conversion accuracy is achieved sex.
Patent Information
- Application Number
- CN202411029879.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-07-30
AI Technical Summary
The data characteristics of offline training and online inference in traditional speech conversion technology are inconsistent, resulting in poor speech conversion results and affecting the accuracy.
Using a streaming voice conversion method based on block masking, divide the voice segments by preset window lengths, determine the block masking information, and use a streaming encoder and decoder to encode and decode based on the voice content information and the target voice object identity information to eliminate Information related to the speaker improves conversion accuracy.
It improves the accuracy of speech conversion, reduces the impact of speaker-related information on the encoding process, and ensures that the converted speech matches the identity information of the target speech object.
Smart Images

Figure CN119132321A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, computer-readable storage medium and computer program product for streaming speech conversion based on block masking. Background Art
[0002] Voice Conversion (VC) is a technical means to change the identity of the speaker without changing the language content. It is widely used in speech coding and speech output devices. Voice conversion can convert the voice style (such as speaker identity, rhythm, emotion, etc.) of the source speech to the target style while ensuring that the language content remains unchanged, thereby achieving the change of speaker identity.
[0003] Traditional technology mainly uses speech conversion models completed through offline training to perform online speech conversion. However, the offline training and online inference solutions used in traditional technology have the problem of asynchronous training and inference. The features or types of data during offline training are inconsistent with those of data in the actual inference process. The offline trained model may regard information related to the speaker as part of the speech content, resulting in poor speech conversion results, which is not conducive to improving the accuracy of speech conversion. Summary of the invention
[0004] Based on this, it is necessary to provide a block masking-based streaming speech conversion method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the accuracy of speech conversion in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a streaming speech conversion method based on block masking, comprising:
[0006] Dividing the speech to be converted according to a preset window length to obtain at least one speech segment, and determining block masking information of the speech to be converted according to the speech segment;
[0007] Determining, by a streaming encoder, speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted; the speech content information is independent of the speech object identity information corresponding to the speech to be converted;
[0008] The speech content information is decoded by a streaming decoder according to the target speech object identity information to obtain a converted speech corresponding to the speech to be converted.
[0009] In one of the embodiments, determining the block masking information of the speech to be converted according to the speech segment includes:
[0010] Filtering out a segment to be masked from the speech segment according to the preset window length, and determining block-level mask information according to the segment to be masked;
[0011] Using speech segments other than the to-be-masked segments in the speech segments as dynamic masking segments, and determining dynamic distribution mask information according to the dynamic masking segments;
[0012] The block masking information is determined according to the block level mask information and the dynamically distributed mask information.
[0013] In one embodiment, determining the speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted by a streaming encoder includes:
[0014] Determining, by the streaming encoder, masking information corresponding to the speech to be converted according to the length masking information of the streaming encoder and the block masking information;
[0015] Determining attention weight information by the streaming encoder according to the attention weight matrix corresponding to the streaming encoder and the masking information;
[0016] According to the attention weight information and the speech to be converted, speech content information corresponding to the speech to be converted is determined.
[0017] In one embodiment, the method further comprises:
[0018] Acquiring, by means of the streaming encoder, speech content information corresponding to a first speech segment in the speech to be converted;
[0019] Using the voice content information corresponding to the first voice segment as cache data, and splicing the cache data with the second voice segment in the voice to be converted to obtain a splicing result; the second voice segment is located before the first voice segment in the voice to be converted;
[0020] The streaming encoder determines the speech content information corresponding to the second speech segment according to the second speech segment and the splicing result.
[0021] In one embodiment, the decoding of the voice content information according to the target voice object identity information by a streaming decoder to obtain the converted voice corresponding to the voice to be converted includes:
[0022] Decoding the voice content information according to the target voice object identity information by the streaming decoder to obtain a decoding result corresponding to the voice to be converted;
[0023] Obtaining a speech object identity classification result corresponding to the decoding result;
[0024] In the case where the speech object identity classification result matches the target speech object identity information, the decoding result is converted into a converted speech corresponding to the speech to be converted.
[0025] In one embodiment, the method further comprises:
[0026] Acquire a first sample voice and a second sample voice; the first sample voice and the second sample voice have the same voice content; the voice object identity information of the first sample voice and the voice object identity information of the second sample voice are different;
[0027] The streaming encoder and the streaming decoder are trained according to the first sample speech and the second sample speech.
[0028] In a second aspect, the present application further provides a streaming speech conversion device based on block masking, comprising:
[0029] An information acquisition module, used for dividing the speech to be converted according to a preset window length to obtain at least one speech segment, and determining the block masking information of the speech to be converted according to the speech segment;
[0030] A content analysis module, configured to determine, through a streaming encoder, speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted; the speech content information is independent of speech object identity information corresponding to the speech to be converted;
[0031] The speech decoding module is used to decode the speech content information according to the target speech object identity information through a streaming decoder to obtain the converted speech corresponding to the speech to be converted.
[0032] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above method are implemented.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0034] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0035] The above-mentioned streaming speech conversion method, device, computer equipment, computer-readable storage medium and computer program product based on block masking divide the speech to be converted according to a preset window length to obtain at least one speech segment, and determine the block masking information of the speech to be converted according to the speech segment, so as to gradually analyze the speech to be converted according to the preset window length to obtain accurate block masking information; the streaming encoder determines the speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted, so as to analyze the characteristic information irrelevant to the speaker in the speech to be converted on the basis of the block masking information, and obtain the speech content information irrelevant to the speech object identity information corresponding to the speech to be converted; the streaming decoder decodes the speech content information according to the target speech object identity information to obtain the converted speech corresponding to the speech to be converted, so as to decode the speech content information in combination with the target speech object identity information to obtain the converted speech with the target speech object identity information as the speaker, and can reduce the influence of the information related to the speaker on the encoding process by masking based on block masking and the streaming codec, and avoid the information related to the speaker from being adopted, so as to improve the accuracy of speech conversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A diagram of an application environment of a streaming speech conversion method based on block masking in one embodiment;
[0038] Figure 2 A flow chart of a method for streaming speech conversion based on block masking in one embodiment;
[0039] Figure 3 A schematic diagram of a process for determining masking information in one embodiment;
[0040] Figure 4 A schematic diagram of a flow chart of performing streaming reasoning based on a streaming encoder in one embodiment;
[0041] Figure 5 A schematic diagram of a process for generating converted speech in one embodiment;
[0042] Figure 6 A structural block diagram of a streaming speech conversion device based on block masking in one embodiment;
[0043] Figure 7The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] The block masking-based streaming speech conversion method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 divides the speech to be converted according to the preset window length, obtains at least one speech segment, and determines the block masking information of the speech to be converted according to the speech segment; the server 104 determines the speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted through the streaming encoder; the speech content information is irrelevant to the speech object identity information corresponding to the speech to be converted; the server 104 decodes the speech content information according to the target speech object identity information through the streaming decoder to obtain the converted speech corresponding to the speech to be converted. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0046] In an exemplary embodiment, Figure 2 As shown, a method for streaming speech conversion based on block masking is provided, and the method is applied to a server as an example for explanation, including the following steps S202 to S206. Among them:
[0047] Step S202: dividing the speech to be converted according to a preset window length to obtain at least one speech segment, and determining block masking information of the speech to be converted according to the speech segment.
[0048] The preset window length may refer to the length of a window function that is preset and used to analyze the speech signal of the speech to be converted. In practical applications, the preset window length may be expressed as W.
[0049] The speech to be converted may refer to speech that needs to be converted. In practical applications, the speech to be converted may refer to speech containing human voice.
[0050] The speech segment may refer to the speech obtained by dividing the speech to be converted according to a preset window length.
[0051] Among them, block masking information can refer to information that characterizes the degree of influence of each speech segment on speech conversion. In practical applications, block masking information can be used to identify or distinguish irrelevant information in the speech to be converted, and the irrelevant information may include speaker identity information (i.e., speech object identity information).
[0052] As an example, when speech conversion is required for the speech to be converted, the server can input the speech to be converted into a pre-trained block masking-based streaming speech conversion acoustic model. The block masking-based streaming speech conversion acoustic model can adopt a block masking-based streaming speech conversion method to first divide the speech to be converted according to a preset window length to obtain at least one speech segment. Then the server uses the block masking-based streaming speech conversion acoustic model to analyze the speech segment and determine the block masking information of the speech to be converted.
[0053] Step S204, determining the speech content information corresponding to the speech to be converted by the streaming encoder according to the block masking information and the speech to be converted; the speech content information is irrelevant to the speech object identity information corresponding to the speech to be converted.
[0054] The streaming encoder may refer to a model used to encode / model the speech to be converted.
[0055] The speech content information may refer to information representing the speech content of the speech to be converted. In practical applications, the speech content information may include information describing the speech content. In specific implementations, the speech content information may be independent of the speech object identity information corresponding to the speech to be converted.
[0056] The voice object identity information corresponding to the speech to be converted may refer to information representing the identity of the speaker corresponding to the speech to be converted. For example, if the audio of person A reading a text is recorded as the speech to be converted, person A may be the speaker of the speech to be converted.
[0057] As an example, the server uses the streaming encoder in the block masking-based streaming speech conversion acoustic model to analyze and model the speech to be converted in combination with the block masking information, and determines the speech content information corresponding to the speech to be converted. Since the streaming encoder is pre-trained, it can be considered that the speech content information output by the streaming encoder is irrelevant to the speech object identity information corresponding to the speech to be converted. In a specific implementation, the streaming encoder can adopt an attention mechanism to determine the information related to the speaker in the speech to be converted as irrelevant information based on the block masking information, ignore the impact of the irrelevant information on the encoding results / modeling results during the encoding / modeling process, and focus on considering the feature information other than the irrelevant information in the speech to be converted, so as to obtain speech content information that is irrelevant to the speech object identity information corresponding to the speech to be converted.
[0058] Step S206: decode the voice content information according to the target voice object identity information through a streaming decoder to obtain a converted voice corresponding to the voice to be converted.
[0059] The streaming decoder may refer to a model that decodes / converts voice content information into voice.
[0060] Among them, the target speech object identity information may refer to information representing the identity of the speaker of the converted speech. In practical applications, speech conversion may convert the speaker of the speech to be converted from the original speaker A0 to the target speaker A1. The identity information of the original speaker A0 may be used as the speech object identity information of the speech to be converted, and the identity information of the target speaker A1 may be used as the target speech object identity information. In a specific implementation, the target speech object identity information may be specified by the user.
[0061] The converted speech may refer to speech obtained after performing speech conversion on the speech to be converted. In practical applications, the speech object identity information of the converted speech may include the target speech object identity information.
[0062] As an example, the server can use the streaming decoder in the block masking-based streaming speech conversion acoustic model to obtain the target speech object identity information of the speech conversion character corresponding to the speech to be converted, and then the server uses the streaming decoder to decode the speech content information according to the target speech object identity information to obtain the converted speech corresponding to the speech to be converted. In actual applications, the streaming decoder can refer to the generative adversarial network and use the discriminator to obtain the accuracy of the speaker identity corresponding to the converted speech. During the decoding process of the streaming decoder, when the discriminator determines that the speaker identity corresponding to the converted speech is accurate enough, the server uses the converted speech at this time as the final output speech.
[0063] In the above-mentioned streaming speech conversion method based on block masking, the speech to be converted is divided according to a preset window length to obtain at least one speech segment, and the block masking information of the speech to be converted is determined according to the speech segment, so that the speech to be converted is gradually analyzed according to the preset window length to obtain accurate block masking information; the streaming encoder determines the speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted, so that on the basis of the block masking information, the characteristic information irrelevant to the speaker in the speech to be converted is analyzed to obtain the speech content information irrelevant to the speech object identity information corresponding to the speech to be converted; the streaming decoder decodes the speech content information according to the target speech object identity information to obtain the converted speech corresponding to the speech to be converted, so that the speech content information is decoded in combination with the target speech object identity information to obtain the converted speech with the target speech object identity information as the speaker, and the block masking and streaming codec can be used to reduce the influence of the information related to the speaker on the encoding process by using a masking method, and avoid the information related to the speaker from being adopted, thereby improving the accuracy of speech conversion.
[0064] In an exemplary embodiment, block masking information of a speech to be converted is determined based on a speech segment, including: screening out segments to be masked from the speech segment according to a preset window length, and determining block-level masking information based on the segments to be masked; taking speech segments other than the segments to be masked in the speech segment as dynamic masking segments, and determining dynamic distribution masking information based on the dynamic masking segments; and determining block masking information based on the block-level masking information and the dynamic distribution masking information.
[0065] The segment to be masked may refer to any speech segment with a length of the preset window length among a plurality of speech segments obtained by dividing the speech to be converted according to the preset window length.
[0066] The block-level mask information may refer to information used to control the influence of a speech segment located after any segment (such as the current speech segment) among several speech segments corresponding to the speech to be converted on the speech content information.
[0067] The dynamic masking segment may refer to a speech segment other than the segment to be masked in the speech to be converted.
[0068] The dynamically distributed mask information may refer to information used to control the degree of influence of speech segments other than the to-be-masked segment in the speech to be converted on the speech content information.
[0069] As an example, the server can use the block masking-based streaming speech conversion acoustic model to divide the speech to be converted into several speech segments according to the preset window length, the speech segments with the length of the preset window length in the speech segments can be used as the segments to be masked, and the speech segments other than the segments to be masked in the speech segments can be used as dynamic masked segments. The server can analyze the segments to be masked one by one as the current research object. Specifically, the server can use the block masking-based streaming speech conversion acoustic model to determine the block-level mask information mask according to the segments to be masked that currently need to be analyzed. chunk , the block level mask information mask chunk The voice segment after the masked segment that needs to be analyzed can be masked, and the server can determine the dynamic distribution mask information mask according to the dynamic masked segment seq , the dynamic distribution mask information mask seq Dynamic masking segments can be masked. The server can mask based on block-level mask information. chunk And dynamically distributed mask information mask seq , determine the block mask information mask dynamic In practical applications, block mask information dynamic The calculation expression can be expressed as:
[0070] .
[0071] In this embodiment, segments to be masked are screened out from speech segments according to a preset window length, and block-level mask information is determined according to the segments to be masked; speech segments other than the segments to be masked in the speech segments are used as dynamic mask segments, and dynamic distribution mask information is determined according to the dynamic mask segments; block masking information is determined according to the block-level mask information and the dynamic distribution mask information. It is possible to analyze each speech segment in the speech to be converted one by one, determine accurate block-level mask information and dynamic distribution mask information, and thus obtain accurate block masking information, which provides a data basis for subsequently determining the speech content information of the speech to be converted by using the block masking information through a streaming encoder, thereby improving the accuracy of speech conversion.
[0072] In some embodiments, the speech content information corresponding to the speech to be converted is determined by a streaming encoder based on block masking information and the speech to be converted, including: determining the masking information corresponding to the speech to be converted by the streaming encoder based on the length masking information and block masking information of the streaming encoder; determining the attention weight information by the streaming encoder based on the attention weight matrix and masking information corresponding to the streaming encoder; determining the speech content information corresponding to the speech to be converted based on the attention weight information and the speech to be converted.
[0073] The length masking information may refer to information used to control the degree of influence of the length of the segment to be masked on the voice content information.
[0074] The masking information may refer to information used to control the influence of any information / any data (such as a voice segment) in the speech to be converted on the speech content information.
[0075] The attention weight matrix may refer to information representing the importance of any information / any data in the speech to be converted.
[0076] The attention weight information may refer to information representing the importance of any information / any data (such as a speech segment) in the speech to be converted to the speech content information.
[0077] As an example, the server may mask the information mask according to the length of the streaming encoder through the streaming encoder length And block mask information mask dynamic , determine the mask information corresponding to the speech to be converted final In practical applications, masking information final The calculation expression can be expressed as:
[0078] .
[0079] The server can then use the streaming encoder to generate the attention weight matrix and mask information mask corresponding to the streaming encoder. final , determine the attention weight information, and determine the speech content information corresponding to the speech to be converted based on the attention weight information and the speech to be converted.
[0080] In this embodiment, the streaming encoder determines the masking information corresponding to the speech to be converted according to the length masking information and block masking information of the streaming encoder; the streaming encoder determines the attention weight information according to the attention weight matrix and masking information corresponding to the streaming encoder; the speech content information corresponding to the speech to be converted is determined according to the attention weight information and the speech to be converted. It is possible to obtain accurate masking information based on the length masking information and block masking information of the streaming encoder, and accurately generate speech content information in combination with the attention weight matrix and the attention weight information, thereby improving the accuracy of the speech content information, providing a data basis for subsequent decoding of the speech content information to realize speech conversion, thereby improving the accuracy of speech conversion.
[0081] In some embodiments, the above method also includes: obtaining speech content information corresponding to a first speech segment in the speech to be converted through a streaming encoder; using the speech content information corresponding to the first speech segment as cache data, and splicing the cache data with the second speech segment in the speech to be converted to obtain a splicing result; the position of the second speech segment in the speech to be converted is before the first speech segment; determining the speech content information corresponding to the second speech segment through the streaming encoder based on the second speech segment and the splicing result.
[0082] The first speech segment may refer to any speech segment having a length of the preset window length among a plurality of speech segments obtained by dividing the speech to be converted according to the preset window length.
[0083] The splicing result may refer to data obtained by splicing the buffered data with the second voice segment in the voice to be converted.
[0084] Among them, the second voice segment can refer to a voice segment located after the first voice segment in the voice to be converted. In actual applications, when the voice to be converted is divided according to a preset window length, the positional relationship / arrangement order between the several voice segments obtained by division corresponds to the position of the voice segments in the voice to be converted. For example: the voice to be converted with a total length of 25 seconds is divided every 10 seconds, then three voice segments can be obtained, the first voice segment corresponds to the content from the 1st second to the 10th second in the voice to be converted, the second voice segment corresponds to the content from the 11th second to the 20th second in the voice to be converted, and the third voice segment corresponds to the content from the 21st second to the 25th second in the voice to be converted. The first voice segment can be used as the first voice segment, and the second voice segment can be used as the second voice segment.
[0085] As an example, the server can adopt a caching mechanism and use a streaming encoder to obtain the voice content information corresponding to the first voice segment in the voice to be converted, and use the voice content information corresponding to the first voice segment as cache data, and then splice the cache data with the second voice segment in the voice to be converted to obtain a splicing result. The splicing result can be used as a key vector K and a value vector V. The streaming encoder determines the voice content information corresponding to the second voice segment based on the second voice segment and the splicing result.
[0086] In this embodiment, the speech content information corresponding to the first speech segment in the speech to be converted is obtained through the streaming encoder; the speech content information corresponding to the first speech segment is used as cache data, and the cache data is spliced with the second speech segment in the speech to be converted to obtain a splicing result; the second speech segment is located before the first speech segment in the speech to be converted; the speech content information corresponding to the second speech segment is determined by the streaming encoder based on the second speech segment and the splicing result, and a cache mechanism can be used to splice the speech content information corresponding to the first speech segment as cache data with the second speech segment in the speech to be converted, thereby ensuring the causal coherence of the reasoning process, thereby obtaining accurate speech content information, and further improving the accuracy of speech conversion.
[0087] In some embodiments, the speech content information is decoded according to the target speech object identity information by a streaming decoder to obtain a converted speech corresponding to the speech to be converted, including: decoding the speech content information according to the target speech object identity information by a streaming decoder to obtain a decoding result corresponding to the speech to be converted; obtaining a speech object identity classification result corresponding to the decoding result; and when the speech object identity classification result matches the target speech object identity information, converting the decoding result into a converted speech corresponding to the speech to be converted.
[0088] The decoding result may refer to information obtained after decoding the voice content information. In practical applications, the decoding result may include audio features such as Mel spectrum.
[0089] Among them, the speech object identity classification result may refer to information representing the identity of the speaker corresponding to the decoding result. In practical applications, the speech object identity classification result may be generated by a speaker classifier / discriminator based on the decoding result. The speech object identity classification result may reflect / describe the authenticity and conversion effect of the speech conversion.
[0090] As an example, the server can decode the voice content information according to the target voice object identity information through a streaming decoder to obtain a decoding result corresponding to the voice to be converted, and then the server can use a preset speaker classifier / discriminator to obtain a voice object identity classification result corresponding to the decoding result. The server can compare the voice object identity classification result with the target voice object identity information. When the voice object identity classification result matches the target voice object identity information, the server can determine that the speaker identity feature of the decoding result at this time is sufficiently real, and the server can convert the decoding result into a converted voice corresponding to the voice to be converted. When the voice object identity classification result does not match the target voice object identity information, the server can determine that the speaker identity feature of the decoding result at this time does not meet the corresponding voice conversion requirements. The server can use a streaming voice conversion acoustic model based on block masking to divide the voice to be converted according to the new window length, and use a streaming encoder and a streaming decoder to obtain a new decoding result until the speaker identity feature of the new decoding result is sufficiently real.
[0091] In this embodiment, the speech content information is decoded according to the target speech object identity information by a streaming decoder to obtain a decoding result corresponding to the speech to be converted; a speech object identity classification result corresponding to the decoding result is obtained; and when the speech object identity classification result matches the target speech object identity information, the decoding result is converted into a converted speech corresponding to the speech to be converted, and whether the speech object identity classification result corresponding to the decoding result matches the target speech object identity information can be timely analyzed to ensure that the converted speech has accurate target speech object identity information, thereby improving the accuracy of speech conversion.
[0092] In some embodiments, the above method also includes: obtaining a first sample speech and a second sample speech; the first sample speech and the second sample speech have the same speech content; the speech object identity information of the first sample speech and the speech object identity information of the second sample speech are different; and training the streaming encoder and the streaming decoder according to the first sample speech and the second sample speech.
[0093] As an example, in order to optimize the block masking-based streaming speech conversion acoustic model to achieve accurate speech conversion, the server can use training samples to train the block masking-based streaming speech conversion acoustic model. Specifically, the server can obtain a first sample speech and a second sample speech, wherein the first sample speech and the second sample speech have the same speech content, and the speech object identity information of the first sample speech and the speech object identity information of the second sample speech are different. Then, the server can train the streaming encoder and the streaming decoder in the block masking-based streaming speech conversion acoustic model according to the first sample speech and the second sample speech until the model loss function value corresponding to the block masking-based streaming speech conversion acoustic model meets the preset loss function requirements, thereby obtaining a pre-trained block masking-based streaming speech conversion acoustic model.
[0094] In this embodiment, by obtaining a first sample speech and a second sample speech; the first sample speech and the second sample speech have the same speech content; the speech object identity information of the first sample speech and the speech object identity information of the second sample speech are different; the streaming encoder and the streaming decoder are trained according to the first sample speech and the second sample speech, and the training samples can be used to train a block masking-based streaming speech conversion acoustic model, thereby ensuring the model performance of the block masking-based streaming speech conversion acoustic model, and then improving the accuracy of speech conversion.
[0095] In some embodiments, the server can implement speech conversion with the help of a block-masking based streaming speech conversion acoustic model. The block-masking based streaming speech conversion acoustic model can pass the input speech (such as the speech to be converted) through a dynamic block-masked streaming Transformer speech recognition model as a streaming encoder combined with offline and online training to extract speaker-independent feature information, and then use the feedforward Transformer structure in FastSpeech as a streaming decoder to extract Mel features. In addition, the block-masking based streaming speech conversion acoustic model can also include a speaker adversarial network (such as a speaker classifier / discriminator) to further remove residual speaker information.
[0096] First, the server can randomly sample the window length W from the uniform distribution U (1, max_length), and divide the speech to be converted into blocks according to the window size W. The speech segments obtained by the block / division can be regarded as a block. The end of the speech to be converted that cannot be divided into W will be dynamically distributed mask information mask seq Masking, block-level mask information mask chunkThe blocks after the current block can be masked so that only the attention weight between the current block and the previous block is calculated. The current block will not be affected by future input information. Since the attention calculated within the block is non-causal, some outputs can see some future input information. This method can improve the quality of speech conversion. In practical applications, the server can use a cross-attention mechanism when obtaining masking information. At the same time, the server can also flexibly adjust the size of the window length W (such as the inference block) according to specific needs. The length masking information mask length It can be used in batch training and inference applications of neural networks to mask the length of each batch of data, such as Figure 3 As shown, a schematic diagram of the process of determining block mask information is provided. The server can use the block level mask information mask chunk And dynamically distributed mask information mask seq , determine the block mask information mask dynamic , and combined with the length mask information mask of the streaming encoder length , determine the mask information corresponding to the speech to be converted final , Figure 3 In the figure, the white blocks represent the masked parts, and their tensor data are usually set to 0 in the computational neural network. It can be understood that the training process of the streaming speech conversion acoustic model based on block masking is similar to the above-mentioned reasoning application process.
[0097] As an example, the streaming encoder can be composed of multiple stacked Transformer encoder layers, and the online and offline systems share the same encoder. Dynamic block masking is applied to the shared encoder, and the training loss of the streaming encoder can include the joint loss L of CTC and attention encoder-decoder. combine (x, y), joint loss L combine The calculation expression of (x, y) can be expressed as:
[0098] .
[0099] Among them, x can represent the acoustic feature, y can be the text annotation corresponding to the acoustic feature, and L CTC (x, y) can refer to the ctc loss, L AED (x, y) can refer to the attention encoder-decoder loss, and λ can be a preset hyperparameter used to balance the CTC and attention mechanism losses.
[0100] The streaming encoder can model the input audio (such as the speech to be converted) into intermediate features (such as speech content information), and then the streaming decoder generates a Mel spectrum based on the intermediate features, and then generates the converted speech based on the Mel spectrum, such as Figure 4As shown, a flow chart of streaming reasoning based on a streaming encoder is provided. In order to ensure that the streaming speech conversion acoustic model based on block masking is causal and speed up the reasoning speed, the server can adopt a caching mechanism in the streaming encoder. In the encoder layer of the streaming encoder, for the output of the historical encoder layer at the last moment, the streaming encoder uses the output of the historical encoder layer at the last moment as cache data, and concatenates it with the input of the current encoder layer as the key vector K and the value vector V, and the query vector Q is still the input of the current encoder layer.
[0101] The streaming decoder can adopt the feedforward Transformer structure in FastSpeech. The feedforward layer consists of two layers of one-dimensional convolutional neural networks with ReLU activation functions. At the same time, in order to ensure the causality of streaming reasoning, the server can add dynamic block masking during the training of the streaming decoder. The one-dimensional convolution in the feedforward layer is replaced by a one-dimensional causal convolution, such as Figure 5 As shown, a flow chart of generating converted speech is provided, the streaming decoder may include several streaming decoder layers, the speaker adversarial network is added to the streaming speech conversion acoustic model based on block masking, the speaker adversarial network may include a speaker classifier and a gradient reversal layer, the speaker classifier is a simple convolution structure, and speaker adversarial classification is performed on each frame input (such as decoding result) in the time dimension, the gradient reversal layer is added between each decoder layer output and the speaker classification network, and the speaker label (such as the identity information of the target speech object) is sent to the next decoder layer together with the output of each decoder layer.
[0102] When training the block masking-based streaming speech conversion acoustic model, the training loss formula of the block masking-based streaming speech conversion acoustic model can be expressed as:
[0103] .
[0104] Among them, X real Can represent the real Mel spectrum, X gen can represent the generated Mel spectrum, V out It can represent the speech object identity classification result output by the speaker classifier, V spk can represent the real label (such as the identity information of the target speech object), L mel can represent the Mel spectrum loss, L spk Can represent speaker loss and L total It can represent the total training loss. When the total training loss L totalWhen the value of is less than the preset threshold, the server determines that the training of the block masking-based streaming speech conversion acoustic model is completed at this time, and the server can use the block masking-based streaming speech conversion acoustic model at this time as the pre-trained block masking-based streaming speech conversion acoustic model.
[0105] In this embodiment, the streaming speech conversion model based on block masking is improved from the perspective of input delay and processing delay. By setting a dynamic masking method, a pre-trained speech recognition joint model is used as an encoder, and an offline speech conversion model based on dynamic block masking is used as a decoder. It is possible to achieve online speech conversion from any speaker to multiple speakers within a delay of less than 200ms, thereby improving the accuracy of speech conversion.
[0106] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0107] Based on the same inventive concept, the embodiment of the present application also provides a block masking-based streaming voice conversion device for implementing the block masking-based streaming voice conversion method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the block masking-based streaming voice conversion device provided below can refer to the above limitations on the block masking-based streaming voice conversion method, which will not be repeated here.
[0108] In an exemplary embodiment, Figure 6 As shown, a block masking-based streaming speech conversion device is provided, comprising: an information acquisition module 602, a content analysis module 604 and a speech decoding module 606, wherein:
[0109] The information acquisition module 602 is used to divide the speech to be converted according to a preset window length to obtain at least one speech segment, and determine the block masking information of the speech to be converted according to the speech segment.
[0110] The content analysis module 604 is used to determine the speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted through a streaming encoder; the speech content information is independent of the speech object identity information corresponding to the speech to be converted.
[0111] The speech decoding module 606 is used to decode the speech content information according to the target speech object identity information through a streaming decoder to obtain the converted speech corresponding to the speech to be converted.
[0112] In one of the exemplary embodiments, the above-mentioned information acquisition module 602 is specifically used to filter out the to-be-masked segments from the speech segments according to the preset window length, and determine the block-level mask information according to the to-be-masked segments; use the speech segments other than the to-be-masked segments in the speech segments as dynamic masking segments, and determine the dynamic distribution mask information according to the dynamic masking segments; determine the block masking information according to the block-level mask information and the dynamic distribution mask information.
[0113] In one of the exemplary embodiments, the content analysis module 604 is further used to determine the masking information corresponding to the speech to be converted through the streaming encoder according to the length masking information and the block masking information of the streaming encoder; determine the attention weight information through the streaming encoder according to the attention weight matrix corresponding to the streaming encoder and the masking information; determine the speech content information corresponding to the speech to be converted according to the attention weight information and the speech to be converted.
[0114] In one of the exemplary embodiments, the above-mentioned content analysis module 604 is also specifically used to obtain the voice content information corresponding to the first voice segment in the speech to be converted through the streaming encoder; use the voice content information corresponding to the first voice segment as cache data, and splice the cache data with the second voice segment in the speech to be converted to obtain a splicing result; the position of the second voice segment in the speech to be converted is before the first voice segment; and determine the voice content information corresponding to the second voice segment through the streaming encoder based on the second voice segment and the splicing result.
[0115] In one of the exemplary embodiments, the above-mentioned speech decoding module 606 is specifically used to decode the speech content information according to the target speech object identity information through the streaming decoder to obtain a decoding result corresponding to the speech to be converted; obtain a speech object identity classification result corresponding to the decoding result; and when the speech object identity classification result matches the target speech object identity information, convert the decoding result into a converted speech corresponding to the speech to be converted.
[0116] In one of the exemplary embodiments, the above-mentioned device also includes a training module, which is specifically used to obtain a first sample speech and a second sample speech; the first sample speech and the second sample speech have the same speech content; the speech object identity information of the first sample speech and the speech object identity information of the second sample speech are different; the streaming encoder and the streaming decoder are trained according to the first sample speech and the second sample speech.
[0117] Each module in the above-mentioned block masking-based streaming speech conversion device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0118] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a streaming speech conversion method based on block masking is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0119] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0120] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0121] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0122] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0123] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0124] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0125] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0126] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A streaming speech conversion method based on block masking, characterized in that: The method comprises: Dividing the speech to be converted according to a preset window length to obtain at least one speech segment, and determining block masking information of the speech to be converted according to the speech segment; Determining, by a streaming encoder, speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted; the speech content information is independent of the speech object identity information corresponding to the speech to be converted; The speech content information is decoded by a streaming decoder according to the target speech object identity information to obtain a converted speech corresponding to the speech to be converted.
2. The method according to claim 1, characterized in that The step of determining the block masking information of the speech to be converted according to the speech segment comprises: Filtering out a segment to be masked from the speech segment according to the preset window length, and determining block-level mask information according to the segment to be masked; Using speech segments other than the to-be-masked segments in the speech segments as dynamic masking segments, and determining dynamic distribution mask information according to the dynamic masking segments; The block masking information is determined according to the block level mask information and the dynamically distributed mask information.
3. The method according to claim 1, characterized in that The step of determining, by a streaming encoder according to the block masking information and the speech to be converted, speech content information corresponding to the speech to be converted comprises: Determining, by the streaming encoder, masking information corresponding to the speech to be converted according to the length masking information of the streaming encoder and the block masking information; Determining attention weight information by the streaming encoder according to the attention weight matrix corresponding to the streaming encoder and the masking information; According to the attention weight information and the speech to be converted, speech content information corresponding to the speech to be converted is determined.
4. The method according to claim 3, characterized in that The method further comprises: Acquiring, by means of the streaming encoder, speech content information corresponding to a first speech segment in the speech to be converted; Using the voice content information corresponding to the first voice segment as cache data, and splicing the cache data with the second voice segment in the voice to be converted to obtain a splicing result; the second voice segment is located before the first voice segment in the voice to be converted; The streaming encoder determines the speech content information corresponding to the second speech segment according to the second speech segment and the splicing result.
5. The method according to claim 1, characterized in that The method of decoding the voice content information according to the target voice object identity information by a streaming decoder to obtain a converted voice corresponding to the voice to be converted includes: Decoding the voice content information according to the target voice object identity information by the streaming decoder to obtain a decoding result corresponding to the voice to be converted; Obtaining a speech object identity classification result corresponding to the decoding result; In the case where the speech object identity classification result matches the target speech object identity information, the decoding result is converted into a converted speech corresponding to the speech to be converted.
6. The method according to claim 1, characterized in that The method further comprises: Acquire a first sample voice and a second sample voice; the first sample voice and the second sample voice have the same voice content; the voice object identity information of the first sample voice and the voice object identity information of the second sample voice are different; The streaming encoder and the streaming decoder are trained according to the first sample speech and the second sample speech.
7. A streaming speech conversion device based on block masking, characterized in that: The device comprises: An information acquisition module, used for dividing the speech to be converted according to a preset window length to obtain at least one speech segment, and determining the block masking information of the speech to be converted according to the speech segment; A content analysis module, configured to determine, through a streaming encoder, speech content information corresponding to the speech to be converted according to the block masking information and the speech to be converted; the speech content information is independent of speech object identity information corresponding to the speech to be converted; The speech decoding module is used to decode the speech content information according to the target speech object identity information through a streaming decoder to obtain the converted speech corresponding to the speech to be converted.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Voice conversion method, device and equipment
CN114882894A
Voice masking method and device, electronic equipment and storage medium
CN115731944A
Voice reconstruction method and device, computer equipment and storage medium
CN115798453A
Real-time voice conversion method and device, electronic equipment and medium
CN115910083A
Speech conversion method based on speaker adversarial sub-network
CN116778937A
Cited By
Voice information generation method and device, storage medium and electronic equipment
CN119864017A
Dynamic online handwritten flow chart identification method and device
CN120976606A
