Text to speech method and apparatus

By caching voice files in terminal devices and business servers, and reducing interaction with the voice conversion server, the problems of high resource consumption and long processing time in existing technologies are solved, and more efficient voice synthesis is achieved.

WO2026067199A1PCT designated stage Publication Date: 2026-04-02BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

Existing speech synthesis technology requires interaction with speech conversion servers, resulting in high resource consumption, long processing time, and low efficiency.

Method used

The target speech file generated by pre-configured speech synthesis parameters is cached in terminal devices and business servers. The target speech file is searched or generated in local storage space or storage space, reducing the interaction with the server.

Benefits of technology

It improves the efficiency of speech synthesis, reduces resource consumption and time costs, and increases the speed of speech synthesis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025122231_02042026_PF_FP_ABST
    Figure CN2025122231_02042026_PF_FP_ABST
Patent Text Reader

Abstract

A text to speech method and apparatus. The text to speech method comprises: receiving a speech conversion operation inputted by a user on a first text in a video editing interface (S101); on the basis of a pre-configured speech synthesis parameter and the first text, determining whether a target speech file is stored in a first storage space (S102); if yes, reading the target speech file from the first storage space (S103); if not, generating the target speech file on the basis of the pre-configured speech synthesis parameter and the first text, and storing the target speech file in the first storage space (S104); and on the basis of the target speech file, adding a first audio clip in a time interval corresponding to the first text on an editing timeline (S105).
Need to check novelty before this filing date? Find Prior Art

Description

Method and device for text-to-speech conversion

[0001] Cross-reference to Related Applications

[0002] This application claims priority to Chinese Patent Application No. 202411376201.1, filed September 29, 2024, the disclosure of which is incorporated herein in its entirety as part of the present application. TECHNICAL FIELD

[0003] The present disclosure relates to a method and device for text-to-speech conversion. BACKGROUND

[0004] Text-to-speech (TTS) technology, also known as speech synthesis technology, is a technology that uses algorithms or models to analyze and process input text and then generates speech corresponding to the text. Speech synthesis technology has a wide range of applications, such as in audiobook production, where it can convert book content into speech to provide an audiobook, and in navigation services, where it can convert text navigation information into speech to provide voice navigation prompts.

[0005] Currently, the commonly used speech synthesis process is as follows: first, the text to be converted into speech is sent to a speech conversion server, then the speech conversion server processes the text using algorithms or models to obtain the speech corresponding to the text, and finally receives the speech corresponding to the text sent by the speech conversion server. If speech synthesis is performed using the current speech synthesis process, interaction with the speech conversion server is required every time speech conversion is performed, which consumes a large amount of resources and takes a long time. Therefore, the efficiency of speech synthesis needs to be improved. SUMMARY

[0006] In view of the above, the embodiments of the present disclosure provide a method and device for text-to-speech conversion.

[0007] To achieve the above-mentioned purpose, the technical solutions of the embodiments of the present disclosure are provided as follows:

[0008] In a first aspect, the embodiments of the present disclosure provide a method for text-to-speech conversion, comprising:

[0009] receiving a speech conversion operation of a user on a first text input in a video editing interface, the speech conversion operation being used to perform speech conversion on the first text based on preconfigured speech synthesis parameters;

[0010] determining whether a target voice file is saved in a first storage space according to the preconfigured voice synthesis parameter and the first text, the target voice file being obtained by voice conversion on the first text based on the preconfigured voice synthesis parameter in advance, and the first storage space being a storage space of a terminal device;

[0011] if yes, obtaining the target voice file from the first storage space;

[0012] if no, generating the target voice file according to the preconfigured voice synthesis parameter and the first text, and saving the target voice file into the first storage space;

[0013] adding a first audio clip in a time interval corresponding to the first text on an editing timeline according to the target voice file.

[0014] As an optional implementation of the embodiment of the present disclosure, the generating the target voice file according to the preconfigured voice synthesis parameter and the first text comprises:

[0015] sending a voice conversion request to a service server, the voice conversion request carrying the preconfigured voice synthesis parameter and the first text, and being used for requesting voice conversion on the first text based on the preconfigured voice synthesis parameter;

[0016] receiving an access address of the target voice file sent by the service server;

[0017] obtaining the target voice file according to the access address.

[0018] As an optional implementation of the embodiment of the present disclosure, the determining whether a target voice file is saved in a first storage space according to the preconfigured voice synthesis parameter and the first text comprises:

[0019] generating a target file identifier according to the preconfigured voice synthesis parameter and the first text;

[0020] determining whether the target file identifier is included in a first file identifier list;

[0021] if the target file identifier is included in the first file identifier list, determining that the target voice file is saved in the first storage space;

[0022] if the target file identifier is not included in the first file identifier list, determining that the target voice file is not saved in the first storage space;

[0023] After saving the target voice file into the first storage space, the method further comprises: adding the target file identifier into the first file identifier list.

[0024] As an optional implementation of the embodiment of the present disclosure, the preconfigured voice synthesis parameter comprises: a timbre parameter and a language parameter; and the generating the target file identifier according to the preconfigured voice synthesis parameter and the first text comprises:

[0025] concatenating the timbre parameter, the language parameter and the identifier information of the first text to obtain a concatenated parameter;

[0026] processing the concatenated parameter based on a message digest algorithm to obtain the target file identifier.

[0027] As an optional implementation of the embodiment of the present disclosure, before saving the target voice file into the first storage space, the method further comprises:

[0028] judging whether the data amount of the voice files saved in the first storage space is greater than a first threshold value;

[0029] in response to the data amount of the voice files saved in the first storage space being greater than the first threshold value, obtaining the idle time length of each voice file in the first storage space; the idle time length of any voice file is the time length from the time point of accessing the voice file last time to the current time point;

[0030] deleting the voice file with the longest idle time length from the first storage space, and re-judging whether the data amount of the voice files saved in the first storage space is greater than the first threshold value, until the data amount of the voice files saved in the first storage space is less than or equal to the first threshold value.

[0031] In a second aspect, the present disclosure provides a text-to-speech method, comprising:

[0032] receiving a voice conversion request sent by a terminal device; the voice conversion request carries a preconfigured voice synthesis parameter and a first text, and is used to request voice conversion of the first text based on the preconfigured voice synthesis parameter;

[0033] determining whether a target voice file is saved in a second storage space according to the preconfigured voice synthesis parameter and the first text, the target voice file being obtained by previously performing voice conversion of the first text based on the preconfigured voice synthesis parameter; the second storage space is a storage space of a business server;

[0034] If the target voice file is stored in the second storage space, an access address of the target voice file is generated according to a storage location of the target voice file;

[0035] If the target voice file is not stored in the second storage space, the target voice file is generated according to the preconfigured voice synthesis parameter and the first text, the target voice file is stored in the second storage space, and an access address of the target voice file is generated according to a storage location of the target voice file;

[0036] The access address is sent to the terminal device, so that the terminal device acquires the target voice file according to the access address.

[0037] As an optional implementation of the embodiment of the present disclosure, the target voice file is generated according to the preconfigured voice synthesis parameter and the first text, including:

[0038] The voice conversion request is sent to a voice conversion server;

[0039] The target voice file sent by the voice conversion server is received.

[0040] As an optional implementation of the embodiment of the present disclosure, whether the target voice file is stored in the second storage space is determined according to the preconfigured voice synthesis parameter and the first text, including:

[0041] A target file identifier is generated according to the preconfigured voice synthesis parameter and the first text;

[0042] It is determined whether the target file identifier is included in a second file identifier list, and if the target file identifier is included in the second file identifier list, it is determined that the target voice file is stored in the second storage space, and if the target file identifier is not included in the second file identifier list, it is determined that the target voice file is not stored in the second storage space;

[0043] After the target voice file is stored in the second storage space, the method further includes: adding the target file identifier to the second file identifier list.

[0044] As an optional implementation of the embodiment of the present disclosure, before the target voice file is stored in the second storage space, the method further includes:

[0045] It is determined whether a data amount of a voice file stored in the second storage space is greater than a second threshold value;

[0046] In response to the data amount of the voice files saved in the second storage space being greater than the second threshold value, the uncontacted time length of each voice saved in the second storage space is acquired; the uncontacted time length of any voice file is the time length from the time of last accessing the voice file to the current time;

[0047] The voice file with the longest uncontacted time length is deleted from the second storage space, and it is re-judged whether the data amount of the voice files saved in the second storage space is greater than the second threshold value until the data amount of the voice files saved in the second storage space is less than or equal to the second threshold value.

[0048] In a third aspect, the embodiments of the present disclosure provide a terminal device, comprising:

[0049] A user input unit is configured to receive a voice conversion operation of a user on a first text in a video editing interface, the voice conversion operation being configured to convert the first text into voice based on preconfigured voice synthesis parameters;

[0050] A processing unit is configured to determine whether a target voice file is saved in a first storage space according to the preconfigured voice synthesis parameters and the first text, the target voice file being obtained by converting the first text into voice based on the preconfigured voice synthesis parameters in advance; and the first storage space being a storage space of the terminal device.

[0051] An acquiring unit is configured to acquire the target voice file from the first storage space in a case where the target voice file is saved in the first storage space, and generate the target voice file according to the preconfigured voice synthesis parameters and the first text and save the target voice file into the first storage space in a case where the target voice file is not saved in the first storage space.

[0052] An editing unit is configured to add a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

[0053] As an optional implementation of the embodiments of the present disclosure, the acquiring unit is specifically configured to send a voice conversion request to a service server, the voice conversion request carrying the preconfigured voice synthesis parameters and the first text, and being configured to request converting the first text into voice based on the preconfigured voice synthesis parameters; receive an access address of the target voice file sent by the service server; and acquire the target voice file according to the access address.

[0054] As an optional implementation of the embodiment of the present disclosure, the processing unit is specifically configured to determine whether the target file identifier is included in the first file identifier list; and determine that the target speech file is saved in the first storage space if the target file identifier is included in the first file identifier list; and determine that the target speech file is not saved in the first storage space if the target file identifier is not included in the first file identifier list.

[0055] The obtaining unit is further configured to add the target file identifier into the first file identifier list after saving the target speech file into the first storage space.

[0056] As an optional implementation of the embodiment of the present disclosure, the preconfigured speech synthesis parameter includes a timbre parameter and a language parameter; and the processing unit is specifically configured to splice the timbre parameter, the language parameter and identification information of the first text to obtain spliced parameters; and process the spliced parameters based on a message digest algorithm to obtain the target file identifier.

[0057] As an optional implementation of the embodiment of the present disclosure, the obtaining unit is further configured to, before saving the target speech file into the first storage space, determine whether a data amount of speech files saved in the first storage space is greater than a first threshold value; in response to the data amount of speech files saved in the first storage space being greater than the first threshold value, obtain an idle duration of each speech file in the first storage space; the idle duration of any speech file is a duration from a time point of last accessing the speech file to a current time point; delete a speech file with the longest idle duration from the first storage space, and re-determine whether the data amount of speech files saved in the first storage space is greater than the first threshold value until the data amount of speech files saved in the first storage space is less than or equal to the first threshold value.

[0058] In a fourth aspect, the embodiments of the present disclosure provide a service server, comprising:

[0059] The receiving unit is configured to receive a speech conversion request sent by a terminal device; the speech conversion request carries preconfigured speech synthesis parameters and a first text, and is used to request speech conversion of the first text based on the preconfigured speech synthesis parameters;

[0060] The processing unit is configured to determine whether a target speech file is saved in a second storage space according to the preconfigured speech synthesis parameters and the first text, the target speech file being obtained by previously performing speech conversion on the first text based on the preconfigured speech synthesis parameters; and the second storage space being a storage space of the service server.

[0061] The generating unit is configured to generate an access address of the target voice file according to a storage location of the target voice file in a case where the target voice file is stored in the second storage space; and generate the target voice file according to the preconfigured voice synthesis parameter and the first text, store the target voice file into the second storage space, and generate the access address of the target voice file according to a storage location of the target voice file in a case where the target voice file is not stored in the second storage space.

[0062] The sending unit is configured to send the access address to the terminal device, so that the terminal device acquires the target voice file according to the access address.

[0063] As an optional implementation of the embodiment of the present disclosure, the generating unit is specifically configured to send the voice conversion request to a voice conversion server; and receive the target voice file sent by the voice conversion server.

[0064] As an optional implementation of the embodiment of the present disclosure, the processing unit is specifically configured to generate a target file identifier according to the preconfigured voice synthesis parameter and the first text; determine whether the target file identifier is included in a second file identifier list; determine that the target voice file is stored in the second storage space in a case where the target file identifier is included in the second file identifier list; and determine that the target voice file is not stored in the second storage space in a case where the target file identifier is not included in the second file identifier list.

[0065] The generating unit is further configured to add the target file identifier to the second file identifier list after storing the target voice file into the second storage space.

[0066] As an optional implementation of the embodiment of the present disclosure, the generating unit is further configured to determine whether a data amount of voice files stored in the second storage space is greater than a second threshold value before storing the target voice file into the second storage space; in response to the data amount of the voice files stored in the second storage space being greater than the second threshold value, acquire an untouched time length of each voice stored in the second storage space; the untouched time length of any voice file is a time length from a time point of last accessing the voice file to a current time point; delete the voice file with the longest untouched time length from the second storage space, and re-determine whether the data amount of the voice files stored in the second storage space is greater than the second threshold value until the data amount of the voice files stored in the second storage space is less than or equal to the second threshold value.

[0067] In a fifth aspect, an electronic device is provided, comprising a memory and a processor, the memory is configured to store a computer program, and the processor is configured to execute the computer program, so that the electronic device implements the text-to-speech method according to any one of the embodiments.

[0068] In a sixth aspect, a computer readable storage medium is provided, when the computer program is executed by a computing device, the computing device implements the text-to-speech method according to any one of the embodiments.

[0069] In a seventh aspect, a computer program product is provided, when the computer program product is executed on a computer, the computer implements the text-to-speech method according to any one of the embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0070] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0071] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required to be invoked in the embodiment description will be briefly introduced as follows. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.

[0072] FIG. 1 is a step flowchart of a text-to-speech method according to an embodiment of the present disclosure;

[0073] FIG. 2 is a step flowchart of a text-to-speech method according to an embodiment of the present disclosure;

[0074] FIG. 3 is a step flowchart of a text-to-speech method according to an embodiment of the present disclosure;

[0075] FIG. 4 is a structural schematic diagram of a terminal device according to an embodiment of the present disclosure;

[0076] FIG. 5 is a structural schematic diagram of a service server according to an embodiment of the present disclosure; and

[0077] FIG. 6 is a hardware structural schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0078] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required to be invoked in the embodiment description will be briefly introduced as follows. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.

[0079] In the following description, numerous specific details are set forth to provide a thorough understanding of the present disclosure. However, it will be apparent to those skilled in the art that the present disclosure can be practiced without the specific details. In other instances, well-known methods have not been described in detail in order not to obscure the present disclosure. The examples in the specification illustrate possible implementations of the present disclosure and do not exhaustively list all possible implementations.

[0080] In the present disclosure, the word "exemplary" or "for example" is used to mean "an example of" or "an example, only. Any implementation described as "exemplary" or "for example" in the present disclosure is not necessarily to be construed as preferred or advantageous over other implementations. The illustrative examples given are intended only to

[0081] The present disclosure provides a text-to-speech method. The text-to-speech method can be executed by a terminal device such as a mobile phone, a personal computer, a palm computer, or a vehicle-mounted device. The text-to-speech method includes the following steps, as shown in FIG. 1.

[0082] In S101, a voice conversion operation of a first text input in a video editing interface is received.

[0083] The voice conversion operation is configured to convert the first text into speech based on preconfigured voice synthesis parameters.

[0084] In some embodiments, the preconfigured voice synthesis parameters can include a timbre parameter and a language parameter. For example, the timbre parameter is male voice, the language parameter is Chinese, and the text content of the first text is "today's weather is really good". The voice conversion operation is configured to convert the text "today's weather is really good" into a Chinese male voice file.

[0085] In some embodiments, the terminal device can display selectable timbres and languages, and determine the preconfigured voice synthesis parameters according to a user's selection operation or default timbres and languages.

[0086] In some embodiments, a business service interface calling the text-to-speech method provided by the present disclosure can be added in the terminal device, and the business service interface and different manufacturers' text-to-speech engines can be encapsulated based on a Base Text To Audio Speech Protocol. When performing voice conversion, the business service interface is called first. If the target voice file cannot be obtained through the business service interface, the corresponding text-to-speech engine is called to obtain the target voice file.

[0087] In some embodiments, receiving a voice conversion operation can be a click operation on the voice conversion control corresponding to the first text, a voice command input to the first text, or one or more specific gestures. The specific gesture can be any one of a single-click gesture, a swipe gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture.

[0088] S102. Determine whether the target speech file is stored in the first storage space based on the pre-configured speech synthesis parameters and the first text.

[0089] The target speech file is obtained by pre-converting the first text into speech based on the pre-configured speech synthesis parameters; the first storage space is the storage space of the terminal device.

[0090] That is, the terminal device first checks whether the local storage space contains a previously cached target speech file obtained by converting the first text into speech based on the pre-configured speech synthesis parameters and the first text.

[0091] In step S102 above, if the target audio file is stored in the first storage space, then step S103 is executed as follows:

[0092] S103. Obtain the target audio file from the first storage space.

[0093] That is, if the terminal device's first storage space contains a target speech file that has been pre-converted from the first text based on the pre-configured speech synthesis parameters, then the target speech file is directly obtained from the first storage space, without going through the speech conversion server to obtain the target speech file obtained from the first text based on the pre-configured speech synthesis parameters.

[0094] In some embodiments, the target audio file includes: audio data corresponding to the first text and metadata of the audio data corresponding to the first text.

[0095] For example, the metadata of the audio data corresponding to the first text may include the time period corresponding to each character in the first text. For instance, if the text content of the first text is "The weather is really nice today," then the metadata of the audio data corresponding to the first text may be as follows:

[0096] (00ms, 02ms]->"Today";

[0097] (03ms, 04ms) -> "day";

[0098] (06ms, 08ms) -> "day";

[0099] (08ms, 09ms) -> "air";

[0100] (10ms, 12ms) -> "true";

[0101] (13ms, 13ms) -> "good".

[0102] In step S102, if the target voice file is not saved in the first storage space, the following step S104 is performed:

[0103] S104, generating the target voice file according to the pre-configured voice synthesis parameters and the first text, and saving the target voice file into the first storage space.

[0104] After the target voice file obtained by performing step S103 or S104, the following step S105 is further performed:

[0105] S105, adding a first audio segment in the time interval corresponding to the first text on the editing timeline according to the target voice file.

[0106] In some embodiments, the first audio segment is all audio in the target voice file.

[0107] In other embodiments, the first audio segment is part of the audio in the target voice file.

[0108] For example, if the time interval corresponding to the first text on the editing timeline is [t1, t2], the first audio segment is added to the time interval [t1, t2] according to the target voice file.

[0109] The method for converting text into speech provided in the embodiments of the present disclosure first determines whether a target speech file, which is obtained by converting the first text into speech based on preconfigured speech synthesis parameters, is saved in a first storage space when receiving a speech conversion operation for converting the first text into speech based on the preconfigured speech synthesis parameters, and directly acquires the target speech file from the first storage space in a case where the target speech file is saved in the first storage space, generates the target speech file according to the preconfigured speech synthesis parameters and the first text in a case where the target speech file is not saved in the first storage space, and saves the target speech file into the first storage space, and finally adds a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target speech file. Since the method for converting text into speech provided in the embodiments of the present disclosure determines whether a target speech file, which is obtained by converting the first text into speech based on preconfigured speech synthesis parameters, is saved in a first storage space of a terminal device according to the preconfigured speech synthesis parameters and the first text, the terminal device can acquire the target speech file without interacting with a server in a case where the target speech file is saved in the first storage space of the terminal device, and therefore the embodiments of the present disclosure can improve the efficiency of speech synthesis.

[0110] The embodiments of the present disclosure provide another method for converting text into speech. Referring to FIG. 2, the method for converting text into speech includes the following steps:

[0111] S201, a terminal device receives a speech conversion operation of a user on a first text in a video editing interface.

[0112] The speech conversion operation is used to convert the first text into speech based on preconfigured speech synthesis parameters.

[0113] S202, the terminal device generates a target file identifier according to the preconfigured speech synthesis parameters and the first text.

[0114] In the embodiments, the implementation manner of generating the target file identifier according to the preconfigured speech synthesis parameters and the first text is not limited. The implementation manner of generating the file identifier according to the speech synthesis parameters and the text can make the file identifiers generated according to different speech synthesis parameters and / or different texts different, and the file identifier generated according to the same speech synthesis parameters and text unique.

[0115] In some embodiments, the preconfigured voice synthesis parameters include tone parameters and language parameters; and the generating the target file identifier according to the preconfigured voice synthesis parameters and the first text includes splicing the tone parameters, the language parameters and identification information of the first text to obtain spliced parameters, and processing the spliced parameters based on a message digest algorithm to obtain the target file identifier.

[0116] For example, the tone parameters are aaaaa, the language parameters are bbbbb, and the identification information of the first text is ccccc, and the spliced parameters obtained by splicing the tone parameters, the language parameters and the identification information of the first text are aaaaa bbbbb cccc.

[0117] In some embodiments, the target file identifier can be obtained by processing the spliced parameters based on a fifth version message digest (MD5) algorithm.

[0118] S203, the terminal device determines whether the target file identifier is included in the first file identifier list.

[0119] In some embodiments, the first file identifier list includes file identifiers of each voice file saved in the first storage space.

[0120] In the above step S203, if the terminal device determines that the target file identifier is included in the first file identifier list, the following steps S204-S206 are performed.

[0121] S204, the terminal device determines that the target voice file is saved in the first storage space.

[0122] The first storage space is a storage space of the terminal device.

[0123] S205, the terminal device obtains the target voice file from the first storage space.

[0124] In some embodiments, the first file identifier list further includes storage locations corresponding to each voice file saved in the first storage space, and the obtaining the target voice file from the first storage space includes obtaining the target voice file from the first storage space according to the storage address of the voice file.

[0125] For example, the first file identifier list is shown in Table 1 as follows:

[0126] Table 1: First file identifier list

[0127] When the target file identifier is identified as the file identifier 2, it is determined that the target voice file is stored in the first storage space, and the target voice file is acquired from the first storage space according to the storage address 2.

[0128] In the step S203, if the terminal device determines that the target file identifier is not included in the first file identifier list, the following steps are performed:

[0129] S206, the terminal device determines that the target voice file is not stored in the first storage space.

[0130] That is, it is determined that the target voice file is not stored in the local storage space of the terminal device, and the target voice file cannot be directly acquired from the local storage space, and the target semantic file needs to be acquired through other manners.

[0131] S207, the terminal device sends a voice conversion request to the service server.

[0132] Correspondingly, the service server receives the voice conversion request sent by the terminal device.

[0133] The voice conversion request carries the pre-configured voice synthesis parameter and the first text, and the voice conversion request is used to request voice conversion of the first text based on the pre-configured voice synthesis parameter.

[0134] In some embodiments, the terminal device can send the voice conversion request to the service server through a communication link established with the service server.

[0135] S208, the service server acquires a target file identifier.

[0136] The target file identifier is generated according to the pre-configured voice synthesis parameter and the first text.

[0137] In some embodiments, the voice conversion request also carries the target file identifier, and the service server acquires the target file identifier, including: acquiring the target file identifier from the voice conversion request.

[0138] In some embodiments, the service server acquires the target file identifier, including: generating the target file identifier according to the pre-configured voice synthesis parameter and the first text.

[0139] The implementation manner of generating the target file identifier according to the pre-configured voice synthesis parameter and the first text can include: splicing the timbre parameter, the language parameter and the identification information of the first text to obtain spliced parameters; and processing the spliced parameters based on a message digest algorithm to obtain the target file identifier.

[0140] It should be noted that the implementation manner of the terminal device for generating the target file identifier according to the preconfigured voice synthesis parameter and the first text can be the same as or different from the implementation manner of the service server for generating the target file identifier according to the preconfigured voice synthesis parameter and the first text.

[0141] In S209, the service server determines whether the target voice file is saved in the second storage space according to the target file identifier.

[0142] The target voice file is obtained by performing voice conversion on the first text based on the preconfigured voice synthesis parameter in advance; and the second storage space is a storage space of the service server.

[0143] In S209, if the target voice file is saved in the second storage space, the following step S210 is performed.

[0144] In S210, the service server generates an access address of the target voice file according to a storage location of the target voice file.

[0145] In some embodiments, the access address of the target voice file is a uniform resource locator (URL) of the target voice file.

[0146] In S209, if the target voice file is not saved in the second storage space, the following step S211 is performed.

[0147] In S211, the service server generates the target voice file according to the preconfigured voice synthesis parameter and the first text, saves the target voice file into the second storage space, and generates an access address of the target voice file according to a storage location of the target voice file.

[0148] After the service server generates the access address of the target voice file in the above-mentioned any manner, the following step is further performed.

[0149] In S212, the service server sends the access address to the terminal device.

[0150] Correspondingly, the terminal device receives the access address of the target voice file sent by the service server.

[0151] In S213, the terminal device acquires the target voice file according to the access address.

[0152] After the terminal device acquires the target voice file based on any of the above manners, the terminal device further performs the following steps.

[0153] S214, the terminal device adds a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

[0154] Another text-to-speech method is provided in the embodiments of the present disclosure, and the text-to-speech method includes the following steps with reference to FIG. 3.

[0155] S301, the terminal device receives a voice conversion operation of a user on a first text in a video editing interface.

[0156] The voice conversion operation is configured to perform voice conversion on the first text based on preconfigured voice synthesis parameters.

[0157] S302, the terminal device concatenates the timbre parameters, the language parameters, and identification information of the first text to obtain concatenated parameters.

[0158] S303, the terminal device processes the concatenated parameters based on a message digest algorithm to obtain the target file identification.

[0159] S304, the terminal device determines whether the target file identification is included in a first file identification list.

[0160] In the above step S304, if the terminal device determines that the target file identification is included in the first file identification list, the terminal device performs the following steps S305-S306.

[0161] S305, the terminal device determines that the target voice file is saved in the first storage space.

[0162] The first storage space is a storage space of the terminal device.

[0163] S306, the terminal device acquires the target voice file from the first storage space.

[0164] In the above step S304, if the terminal device determines that the target file identification is not included in the first file identification list, the terminal device performs the following steps.

[0165] S307, the terminal device determines that the target voice file is not saved in the first storage space.

[0166] S308, the terminal device sends a voice conversion request to a service server.

[0167] Correspondingly, the service server receives the voice conversion request sent by the terminal device.

[0168] The voice conversion request carries the preconfigured voice synthesis parameter and the first text, and is used to request voice conversion of the first text based on the preconfigured voice synthesis parameter.

[0169] S309, the service server acquires a target file identifier.

[0170] The target file identifier is generated according to the preconfigured voice synthesis parameter and the first text.

[0171] S310, the service server determines whether the target file identifier is included in a second file identifier list.

[0172] In some embodiments, the second file identifier list can include file identifiers of respective voice files saved in a second storage space.

[0173] In the above step S310, if the service server determines that the target file identifier is included in the second file identifier list, the following steps are performed:

[0174] S311, the service server determines that the target voice file is saved in the second storage space.

[0175] S312, the service server generates an access address of the target voice file according to a storage location of the target voice file.

[0176] In the above step S310, if the service server determines that the target file identifier is included in the second file identifier list, the following steps are performed:

[0177] S313, the service server determines that the target voice file is not saved in the second storage space.

[0178] S314, the service server sends the voice conversion request to a voice conversion server.

[0179] In response, the voice conversion server receives the voice conversion request sent by the service server.

[0180] S315, the voice conversion server performs voice conversion on the first text based on the preconfigured voice synthesis parameter to acquire a target voice file.

[0181] S316, the voice conversion server sends the target voice file to the service server.

[0182] Correspondingly, the service server receives the target voice file sent by the voice conversion server.

[0183] S317, the service server judges whether the data amount of the voice file saved in the second storage space is greater than a second threshold value.

[0184] In the step S317, if the data amount of the voice file saved in the second storage space is less than or equal to the second threshold value, the following step S318 is performed:

[0185] S318, the service server saves the target voice file into the second storage space, adds the target file identifier into the second file identifier list, and generates the access address of the target voice file according to the storage position of the target voice file.

[0186] In the step S317, if the data amount of the voice file saved in the second storage space is greater than the second threshold value, the following step is performed:

[0187] S319, the service server acquires the untouched time length of each voice saved in the second storage space.

[0188] The untouched time length of any voice file is the time length from the time of the last access to the voice file to the current time.

[0189] S320, the service server deletes the voice file with the longest untouched time length from the second storage space, deletes the file identifier corresponding to the voice file with the longest untouched time length from the second file identifier list, and returns to the step S317.

[0190] That is, the service server deletes the voice file with the longest untouched time length from the second storage space, deletes the file identifier corresponding to the voice file with the longest untouched time length from the second file identifier list, and re-judges whether the data amount of the voice file saved in the second storage space is greater than the second threshold value, until the data amount of the voice file saved in the second storage space is less than or equal to the second threshold value, the step S318 is performed to save the target voice file into the second storage space, add the target file identifier into the second file identifier list, and generate the access address of the target voice file according to the storage position of the target voice file.

[0191] After the service server generates the access address of the target voice file based on any of the above implementation manners, the service server further performs the following step S321.

[0192] S321, the service server sends the access address to the terminal device.

[0193] In response, the terminal device accepts the access address sent by the service server.

[0194] S323, the terminal device acquires the target voice file according to the access address.

[0195] After the terminal device acquires the target voice file according to any of the above implementation manners, the following steps are performed:

[0196] S324, the terminal device adds a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

[0197] When the target voice file is not saved in the first storage space, the terminal device further performs the following steps after acquiring the target voice file:

[0198] S325, the terminal device determines whether the data amount of the voice file saved in the first storage space is greater than a first threshold.

[0199] For example, when the first threshold is 50MB, the terminal device determines whether the data amount of the voice file saved in the first storage space is greater than 50MB.

[0200] In step S325, if the terminal device determines that the data amount of the voice file saved in the first storage space is less than or equal to the first threshold, the following step S326 is performed:

[0201] S326, the terminal device adds the target file identifier to the first file identifier list and saves the target voice file in the first storage space.

[0202] In step S325, if the terminal device determines that the data amount of the voice file saved in the first storage space is less than or equal to the first threshold, the following step is performed:

[0203] S327, the terminal device acquires the idle duration of each voice file in the first storage space.

[0204] The idle duration of any voice file is the duration from the time of the last access to the voice file to the current time.

[0205] S328, the terminal device deletes the voice file with the longest idle duration from the first storage space, deletes the file identifier corresponding to the voice file with the longest idle duration from the first file identifier list, and returns to step S325.

[0206] That is, the voice file with the longest idle duration is deleted from the first storage space, and the file identifier corresponding to the voice file with the longest idle duration is deleted from the first file identifier list, and it is re-determined whether the data amount of the voice files saved in the first storage space is greater than the first threshold value, until the data amount of the voice files saved in the first storage space is less than or equal to the first threshold value, the step S326 of adding the target file identifier to the first file identifier list and saving the target voice file to the first storage space is executed.

[0207] Based on the same inventive concept, as an implementation of the above method, the embodiments of the disclosure also provide a terminal device and a service server. The embodiments correspond to the foregoing method embodiments, and for the sake of readability, the details in the foregoing method embodiments will not be described one by one, but it should be clear that the terminal device and the service server in the embodiments can correspondingly implement all the contents in the foregoing method embodiments.

[0208] The embodiments of the disclosure provide a terminal device, and FIG. 4 is a structural schematic diagram of the terminal device. As shown in FIG. 4, the terminal device 400 includes:

[0209] The user input unit 41 is configured to receive a voice conversion operation of a user on the first text input in the video editing interface, and the voice conversion operation is configured to perform voice conversion on the first text based on preconfigured voice synthesis parameters.

[0210] The processing unit 42 is configured to determine whether a target voice file is saved in a first storage space according to the preconfigured voice synthesis parameters and the first text, and the target voice file is obtained by performing voice conversion on the first text based on the preconfigured voice synthesis parameters in advance; and the first storage space is a storage space of the terminal device.

[0211] The obtaining unit 43 is configured to, in a case where the target voice file is saved in the first storage space, obtain the target voice file from the first storage space, and in a case where the target voice file is not saved in the first storage space, generate the target voice file according to the preconfigured voice synthesis parameters and the first text, and save the target voice file into the first storage space.

[0212] The editing unit 44 is configured to add a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

[0213] As an optional implementation of the embodiment of the present disclosure, the obtaining unit 43 is specifically configured to send a voice conversion request to a service server; the voice conversion request carries the preconfigured voice synthesis parameter and the first text, and is used to request voice conversion of the first text based on the preconfigured voice synthesis parameter; receive an access address of the target voice file sent by the service server; and obtain the target voice file according to the access address.

[0214] As an optional implementation of the embodiment of the present disclosure, the processing unit 42 is specifically configured to generate a target file identifier according to the preconfigured voice synthesis parameter and the first text; determine whether the target file identifier is included in a first file identifier list; if the target file identifier is included in the first file identifier list, it is determined that the target voice file is saved in the first storage space; and if the target file identifier is not included in the first file identifier list, it is determined that the target voice file is not saved in the first storage space.

[0215] The obtaining unit 43 is further configured to add the target file identifier to the first file identifier list after saving the target voice file into the first storage space.

[0216] As an optional implementation of the embodiment of the present disclosure, the preconfigured voice synthesis parameter includes a timbre parameter and a language parameter; and the processing unit 42 is specifically configured to splice the timbre parameter, the language parameter and identification information of the first text to obtain spliced parameters; and process the spliced parameters based on a message digest algorithm to obtain the target file identifier.

[0217] As an optional implementation of the embodiment of the present disclosure, the obtaining unit 43 is further configured to, before saving the target voice file into the first storage space, determine whether a data amount of voice files saved in the first storage space is greater than a first threshold value; in response to the data amount of the voice files saved in the first storage space being greater than the first threshold value, obtain an idle duration of each voice file in the first storage space; the idle duration of any voice file is a duration from a time point of last accessing the voice file to a current time point; delete the voice file with the longest idle duration from the first storage space, and re-determine whether the data amount of the voice files saved in the first storage space is greater than the first threshold value until the data amount of the voice files saved in the first storage space is less than or equal to the first threshold value.

[0218] The embodiment of the present disclosure provides a service server, and FIG. 5 is a structural schematic diagram of the service server, as shown in FIG. 5, the service server 500 includes:

[0219] The receiving unit 51 is configured to receive a voice conversion request sent by the terminal device, wherein the voice conversion request carries preconfigured voice synthesis parameters and a first text, and is used to request voice conversion of the first text based on the preconfigured voice synthesis parameters.

[0220] The processing unit 52 is configured to determine whether a target voice file is saved in a second storage space according to the preconfigured voice synthesis parameters and the first text, wherein the target voice file is obtained by performing voice conversion on the first text based on the preconfigured voice synthesis parameters in advance, and the second storage space is a storage space of a service server.

[0221] The generating unit 53 is configured to generate an access address of the target voice file according to a storage location of the target voice file in a case where the second storage space saves the target voice file, and generate the target voice file according to the preconfigured voice synthesis parameters and the first text in a case where the second storage space does not save the target voice file, save the target voice file into the second storage space, and generate the access address of the target voice file according to a storage location of the target voice file.

[0222] The sending unit 54 is configured to send the access address to the terminal device, so that the terminal device acquires the target voice file according to the access address.

[0223] As an optional implementation of the embodiment of the present disclosure, the generating unit 53 is specifically configured to send the voice conversion request to a voice conversion server, and receive the target voice file sent by the voice conversion server.

[0224] As an optional implementation of the embodiment of the present disclosure, the processing unit 52 is specifically configured to generate a target file identifier according to the preconfigured voice synthesis parameters and the first text, determine whether the target file identifier is included in a second file identifier list, determine that the second storage space saves the target voice file in a case where the second file identifier list includes the target file identifier, and determine that the second storage space does not save the target voice file in a case where the second file identifier list does not include the target file identifier.

[0225] The generating unit 53 is further configured to add the target file identifier into the second file identifier list after saving the target voice file into the second storage space.

[0226] As an optional implementation of the embodiment of the present disclosure, the generation unit 53 is further configured to: before saving the target voice file into the second storage space, determine whether the data amount of the voice files saved in the second storage space is greater than a second threshold; in response to the data amount of the voice files saved in the second storage space being greater than the second threshold, acquire the untouched time length of each voice saved in the second storage space; the untouched time length of any voice file is the time length from the time point of last accessing the voice file to the current time point; delete the voice file with the longest untouched time length from the second storage space, and re-determine whether the data amount of the voice files saved in the second storage space is greater than the second threshold, until the data amount of the voice files saved in the second storage space is less than or equal to the second threshold.

[0227] The terminal device and the service server provided by the embodiments of the present disclosure can execute the text-to-speech method provided by any of the above embodiments, and the implementation principle and technical effects are similar, which will not be described here.

[0228] Based on the same inventive concept, the embodiments of the present disclosure also provide an electronic device. FIG. 6 is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. As shown in FIG. 6, the electronic device provided by the embodiment includes a memory 601 and a processor 602. The memory 601 is configured to store a computer program. The processor 602 is configured to execute the text-to-speech method provided by the above embodiments when executing the computer program.

[0229] Based on the same inventive concept, the embodiments of the present disclosure also provide a computer readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computing device implements the text-to-speech method provided by the above embodiments.

[0230] Based on the same inventive concept, the embodiments of the present disclosure also provide a computer program product. When the computer program product runs on a computer, the computing device implements the text-to-speech method provided by the above embodiments.

[0231] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer usable storage media having computer usable program code contained therein.

[0232] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can be any conventional processor.

[0233] The memory can include non-persistent memory in computer readable media, random access memory (RAM), and / or non-volatile memory, etc., such as read only memory (ROM) or flash RAM. The memory is an example of computer readable media.

[0234] The computer readable media includes non-transitory and transitory, removable and non-removable media. The storage media can be implemented using any methods or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile discs (DVDs) or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices or any other non-transmission media which can be used to store information accessible to a computing device. According to the definition herein, the computer readable media does not include transitory computer readable media, such as modulated data signals and carrier waves.

[0235] Finally, it should be noted that the above-described embodiments are merely intended for describing the technical solutions of the present disclosure, but not to limit them. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still make modifications to the technical solutions described in the foregoing embodiments, or equivalently replace part or all of the technical features thereof, and these modifications or replacements do not cause the essence of the technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. A method for converting text to speech, comprising: receiving a voice conversion operation of a user on a first text input in a video editing interface, the voice conversion operation being used to convert the first text to speech based on preconfigured voice synthesis parameters; determining whether a target voice file is saved in a first storage space according to the preconfigured voice synthesis parameters and the first text, the target voice file being obtained by previously converting the first text to speech based on the preconfigured voice synthesis parameters, and the first storage space being a storage space of a terminal device; if yes, obtaining the target voice file from the first storage space; if no, generating the target voice file according to the preconfigured voice synthesis parameters and the first text, and saving the target voice file into the first storage space; adding a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

2. The method of claim 1, wherein, The generating of the target voice file according to the preconfigured voice synthesis parameters and the first text comprises: sending a voice conversion request to a service server, the voice conversion request carrying the preconfigured voice synthesis parameters and the first text, and being used to request converting the first text to speech based on the preconfigured voice synthesis parameters; receiving an access address of the target voice file sent by the service server; obtaining the target voice file according to the access address.

3. The method of claim 1 or 2, wherein, The determining of whether the target voice file is saved in the first storage space according to the preconfigured voice synthesis parameters and the first text comprises: generating a target file identifier according to the preconfigured voice synthesis parameters and the first text; determining whether the target file identifier is included in a first file identifier list; if the target file identifier is included in the first file identifier list, determining that the target voice file is saved in the first storage space; if the target file identifier is not included in the first file identifier list, determining that the target voice file is not saved in the first storage space; After saving the target voice file into the first storage space, the method further comprises adding the target file identifier into the first file identifier list.

4. The method of claim 3, wherein, The preconfigured voice synthesis parameters comprise tone parameters and language parameters, and the generating of the target file identifier according to the preconfigured voice synthesis parameters and the first text comprises: splicing the tone parameters, the language parameters and identifier information of the first text to obtain spliced parameters; processing the spliced parameters based on a message digest algorithm to obtain the target file identifier.

5. The method according to any one of claims 1 to 4, wherein, Before saving the target voice file into the first storage space, the method further comprises: determining whether a data amount of voice files saved in the first storage space is greater than a first threshold value; in response to the data amount of the voice files saved in the first storage space being greater than the first threshold value, obtaining an idle duration of each voice file in the first storage space, the idle duration of any voice file being a duration from a time of last accessing the voice file to a current time. delete the voice file with the longest idle time from the first storage space, and repeatedly determine whether the data amount of the voice files stored in the first storage space is greater than the first threshold value until the data amount of the voice files stored in the first storage space is less than or equal to the first threshold value.

6. A method for text-to-speech conversion, comprising: receiving a voice conversion request sent by a terminal device; the voice conversion request carrying preconfigured voice synthesis parameters and a first text, and being used to request voice conversion of the first text based on the preconfigured voice synthesis parameters; determining whether a target voice file is stored in a second storage space according to the preconfigured voice synthesis parameters and the first text, the target voice file being obtained by previously performing voice conversion on the first text based on the preconfigured voice synthesis parameters, and the second storage space being a storage space of a service server; if the target voice file is stored in the second storage space, generating an access address of the target voice file according to a storage location of the target voice file; if the target voice file is not stored in the second storage space, generating the target voice file according to the preconfigured voice synthesis parameters and the first text, storing the target voice file in the second storage space, and generating an access address of the target voice file according to a storage location of the target voice file; sending the access address to the terminal device, so that the terminal device acquires the target voice file according to the access address.

7. The method of claim 6, wherein, the generating of the target voice file according to the preconfigured voice synthesis parameters and the first text comprises: sending the voice conversion request to a voice conversion server; receiving the target voice file sent by the voice conversion server.

8. The method of claim 6 or 7, wherein, the determining of whether the target voice file is stored in the second storage space according to the preconfigured voice synthesis parameters and the first text comprises: generating a target file identifier according to the preconfigured voice synthesis parameters and the first text; determining whether the target file identifier is included in a second file identifier list, and if the target file identifier is included in the second file identifier list, determining that the target voice file is stored in the second storage space, and if the target file identifier is not included in the second file identifier list, determining that the target voice file is not stored in the second storage space; after storing the target voice file in the second storage space, the method further comprises: adding the target file identifier to the second file identifier list.

9. The method according to any one of claims 6-8, wherein, before storing the target voice file in the second storage space, the method further comprises: determining whether a data amount of voice files stored in the second storage space is greater than a second threshold value; in response to the data amount of the voice files stored in the second storage space being greater than the second threshold value, acquiring an untouched time length of each voice stored in the second storage space, the untouched time length of any voice file being a time length from a time point of last access of the voice file to a current time point. delete the voice file with the longest time length from the second storage space, and repeatedly determine whether the data amount of the voice files stored in the second storage space is greater than the second threshold value until the data amount of the voice files stored in the second storage space is less than or equal to the second threshold value.

10. A terminal device, comprising: a user input unit configured to receive a voice conversion operation of a user on a first text input in a video editing interface, the voice conversion operation being used to perform voice conversion on the first text based on preconfigured voice synthesis parameters; a processing unit configured to determine whether a target voice file is stored in a first storage space according to the preconfigured voice synthesis parameters and the first text, the target voice file being obtained by performing voice conversion on the first text based on the preconfigured voice synthesis parameters in advance, the first storage space being a storage space of the terminal device; an obtaining unit configured to, in a case where the target voice file is stored in the first storage space, obtain the target voice file from the first storage space, and in a case where the target voice file is not stored in the first storage space, generate the target voice file according to the preconfigured voice synthesis parameters and the first text, and store the target voice file into the first storage space; an editing unit configured to add a first audio segment in a time interval corresponding to the first text on an editing timeline according to the target voice file.

11. A service server, comprising: a receiving unit configured to receive a voice conversion request sent by a terminal device; the voice conversion request carrying preconfigured voice synthesis parameters and a first text, and being used to request to perform voice conversion on the first text based on the preconfigured voice synthesis parameters; a processing unit configured to determine whether a target voice file is stored in a second storage space according to the preconfigured voice synthesis parameters and the first text, the target voice file being obtained by performing voice conversion on the first text based on the preconfigured voice synthesis parameters in advance, the second storage space being a storage space of the service server; a generating unit configured to, in a case where the target voice file is stored in the second storage space, generate an access address of the target voice file according to a storage location of the target voice file; in a case where the target voice file is not stored in the second storage space, generate the target voice file according to the preconfigured voice synthesis parameters and the first text, store the target voice file into the second storage space, and generate an access address of the target voice file according to a storage location of the target voice file; a sending unit configured to send the access address to the terminal device, so that the terminal device obtains the target voice file according to the access address.

12. An electronic device comprising: a memory and a processor, wherein the memory is configured to store a computer program, and the processor is used to execute the computer program, so that the electronic device implements the method for text-to-speech in any one of claims 1-9.

13. A computer readable storage medium storing a computer program, wherein, When the computer program is executed by a computing device, the computing device is caused to implement the text-to-speech method of any one of claims 1-9.

14. A computer program product, wherein, When the computer program product is run on a computer, the computer is caused to implement the text-to-speech method of any one of claims 1-9.

Citation Information

Patent Citations

  • Speech output method and device of robot, robot and storage medium

    CN110600003A

  • Video dubbing method based on text-to-speech technology

    CN110769167A

  • Voice broadcast method and device based on voice synthesis and voice conversion, and medium

    CN115985288A

  • Video generation method and device, electronic equipment and storage medium

    CN116156248A

  • Voice conversion method and device, computer equipment and storage medium

    CN117238295A