An audio synthesis method and apparatus
By validating instance data and pending callback events during the audio synthesis process on the server side, the audio sending error caused by asynchronous callbacks in existing technologies is resolved, ensuring the accuracy and reliability of audio synthesis.
Patent Information
- Application Number
- CN202611522110.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-29
- Publication Date
- 2026-11-20
AI Technical Summary
In existing technologies, audio synthesis methods do not validate asynchronous callbacks, which may cause asynchronous callbacks generated by old instances to be applied to new instances, resulting in incorrect audio being sent to the client.
During the asynchronous callback process between the server and the TTS engine, the accuracy of audio synthesis is ensured by validating the instance data. This includes atomically comparing and updating the target instance data with the engine instance data of the TTS engine, and verifying whether the callback event is delayed in order to identify and reject delayed old instance callbacks.
It enables accurate audio transmission during asynchronous callbacks, avoiding erroneous and duplicate transmissions caused by delayed callbacks, and improving the reliability and accuracy of audio synthesis.
Smart Images

Figure CN123142584A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of audio synthesis technology, and in particular to an audio synthesis method and apparatus. Background Technology
[0002] Currently, Android systems and other server-side applications provide the TextToSpeech audio synthesis interface, which is commonly used in scenarios such as queuing and calling, cashier announcements, device alarms, order notifications, accessibility announcements, and industrial terminal notifications. In existing technologies, the business application typically generates the audio file directly, and then reads the audio file during the callback and returns it to the client through channels such as HTTP, HTTPS, WebSocket, MQTT, RPC, or message queues.
[0003] However, existing audio synthesis technologies do not validate asynchronous callbacks, which means that asynchronous callbacks generated by old instances may still act on tasks recreated in new instances, leading to incorrect audio transmission.
[0004] Therefore, existing audio synthesis methods cannot accurately identify delayed asynchronous callbacks, resulting in the inability to send the correct audio to the client. Summary of the Invention
[0005] In order to overcome the shortcomings of the prior art, the present invention aims to provide an audio synthesis method and device that can verify the instance data of the server and the TTS engine in the asynchronous callback process so as to correctly send the audio to the client.
[0006] This invention is implemented according to the following scheme: An audio synthesis method is provided, applied on the server side, through which the client connects to the TTS engine. The method includes: Receive a text audio synthesis request sent by the client, query whether there is reusable audio based on the text audio synthesis request, if there is, send the reusable audio to the client, if there is not, create a task context based on the text audio synthesis request; Based on the task context, target instance data and data to be synthesized are extracted. When the TTS engine is called, the engine instance data of the current engine instance of the TTS engine is obtained. The target instance data and the engine instance data are atomically compared and updated to obtain a first result. The first result is used to indicate whether to send the data to be synthesized to the TTS engine. In response to the callback event sent by the TTS engine based on the data to be synthesized, the system checks whether the callback event is delayed and obtains a second result. Based on the second result, the callback file of the event to be called back is read, and the callback audio to be sent to the client is obtained based on the callback file.
[0007] Optionally, querying whether reusable audio exists based on the text-to-audio synthesis request includes: Based on the text-audio synthesis request, obtain the target idempotent key used to identify the text-audio synthesis request; The database on the server is queried based on the target idempotent key, and the database includes multiple historical synthesized audio records with idempotent keys; If the database contains historical synthesized audio with the same idempotent key as the target idempotent key, then reusable audio exists. If no historical synthesized audio with the same idempotent key as the target idempotent key exists in the database, then no reusable audio is available.
[0008] Optionally, based on the text-audio synthesis request, obtaining a target idempotent key for identifying the text-audio synthesis request includes: If the text audio synthesis request carries an idempotent key, then the idempotent key carried in the text audio synthesis request is determined as the target idempotent key; If the text audio synthesis request does not carry an idempotent key, the text audio synthesis request is parsed to obtain the data to be synthesized, and the target idempotent key is determined based on the data to be synthesized.
[0009] Optionally, creating a task context based on the text-to-audio synthesis request includes: A task identifier is generated for the text audio synthesis request, and the text audio synthesis request is parsed to obtain the data to be synthesized; Obtain the response connection identifier of the text audio synthesis request, the service generation number of the current service instance, and the engine generation number of the current engine instance of the TTS engine. The response connection identifier is used to identify the communication channel between the server and the client. An initial context is created using the task identifier as the primary key. The target idempotent key, the data to be synthesized, the response connection identifier, the service generation number, and the engine generation number are associated with the initial context to obtain the task context.
[0010] Optionally, the target instance data includes a target engine generation number, which is used to identify the engine instance used by the TTS engine when creating the task context; the engine instance data includes a current engine generation number, which is used to identify the engine instance used by the TTS engine when the first result is obtained through atomic update. The first result is obtained by atomically comparing and updating the target instance data and the engine instance data, including: If the target engine era number is the same as the current engine era number, then the first result is to send the data to be synthesized to the TTS engine; If the target engine era number is different from the current engine era number, the first result is not to send the data to be synthesized to the TTS engine.
[0011] Optionally, the TTS engine obtains the callback event based on the data to be synthesized, including: The TTS engine synthesizes the target audio based on the data to be synthesized. The target audio is written to a temporary audio file, and the callback event is generated when the writing is complete.
[0012] Optionally, after receiving the callback event, the audio synthesis method further includes: The temporary audio file is then encapsulated.
[0013] Optionally, a second result is obtained by verifying whether the event to be called back is delayed, including: Obtain the current service generation number of the current service instance and the current engine generation number of the current engine instance of the TTS engine; Obtain the target task context based on the event to be called back; Based on the target task context, extract the service generation number to be called back and the engine generation number to be called back. The service generation number to be called back is used to identify the service instance used by the server when the task context is created, and the engine generation number to be called back is used to identify the engine instance used by the TTS engine when the task context is created. When the generation number of the service to be called back is the same as the current service generation number, and the generation number of the engine to be called back is the same as the current engine generation number, then the second result is that the event to be called back is not delayed. When the generation number of the service to be called back is different from the current service generation number, and / or the generation number of the engine to be called back is different from the current engine generation number, the second result is the delay of the event to be called back.
[0014] Optionally, based on the second result, the callback file of the event to be called back is read, and the callback audio to be sent to the client is obtained based on the callback file, including: If the second result indicates that the event to be called back is delayed, then reading the callback file of the event to be called back will be refused. When the second result is that the event to be called back is not delayed, the callback file of the event to be called back is read, and the callback file is divided into blocks to obtain multiple callback file blocks with block order. Determine the target task context based on the pending callback event; The callback file blocks are sent to the client sequentially according to the block order, and the target task context is updated after each successful sending of the callback file block to the client.
[0015] A computer device is also provided, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the audio synthesis method described above.
[0016] Compared with the prior art, the beneficial effects of the audio synthesis method of the present invention are as follows: In the asynchronous callback process between the server and the TTS engine, the target instance data is extracted from the task context of the audio to be synthesized by the client, and the target instance data is atomically compared and updated with the engine instance data of the TTS engine to ensure that the TTS engine will not synthesize audio based on an incorrect engine instance; in addition, by verifying whether the callback event is delayed, the delayed old instance callback event is identified to ensure that the file is not misread due to delayed callback, so as to correctly send the audio to the client. Attached Figure Description
[0017] Figure 1 This is a flowchart of the audio synthesis method of the present invention. Detailed Implementation
[0018] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0019] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0020] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0021] See Figure 1 As shown, an audio synthesis method of the present invention is applied to a server, and the client connects to a TTS engine through the server. The method includes: S1: Receive the text audio synthesis request sent by the client, query whether there is reusable audio based on the text audio synthesis request, if there is, send the reusable audio to the client, if there is not, create a task context based on the text audio synthesis request; the present invention queries the active task storage and valid result cache of the server to reuse the original task or the original audio result when the network times out or is submitted repeatedly, thereby avoiding repeated synthesis and repeated broadcasting.
[0022] In one embodiment of the present invention, querying whether reusable audio exists based on a text audio synthesis request includes: obtaining a target idempotent key for identifying the text audio synthesis request based on the text audio synthesis request; querying a server database based on the target idempotent key, the database including multiple historical synthesized audios with idempotent keys; if a historical synthesized audio with the same idempotent key as the target idempotent key exists in the database, then reusable audio exists; if no historical synthesized audio with the same idempotent key as the target idempotent key exists in the database, then no reusable audio exists.
[0023] In one embodiment of the present invention, obtaining a target idempotent key for identifying a text audio synthesis request based on a text audio synthesis request includes: if the text audio synthesis request carries an idempotent key, then the idempotent key carried in the text audio synthesis request is determined as the target idempotent key; if the text audio synthesis request does not carry an idempotent key, then the text audio synthesis request is parsed to obtain data to be synthesized, and the target idempotent key is determined based on the data to be synthesized.
[0024] In one embodiment of the present invention, the data to be synthesized includes at least one of the following: text to be synthesized, business order number, language, speaker, speech rate, pitch, output format, business priority, and timeout period; any unprovided optional parameters are supplemented by a preset configuration table on the server side; determining the target idempotency key based on the data to be synthesized includes: normalizing key parameters such as business order number, content summary of the text to be synthesized, language, speaker, speech rate, pitch, and output format, and performing hash calculation on the normalized result to obtain the target idempotency key; wherein, the idempotency key is used to identify the same business request and avoid repeated execution.
[0025] In one embodiment of the present invention, querying the database of the server based on the target idempotent key includes: first querying the active task storage of the database using the target idempotent key as an index, and then querying the effective result cache of the database; the active task storage includes at least one of a memory-mapped table, an SQLite database, a key-value database, or a persistent recovery snapshot; the query result includes at least the task identifier, task status, file status, task version, deadline time, and return status of the historical synthesized audio. After retrieving a historical synthesized audio with the same idempotent key as the target, if the historical synthesized audio is in the same semantic activity task (RECEIVED, VALIDATED, ENGINE_PREPARING, SYNTHESIZING, FILE_READY, or STREAMING), the task identifier and current status of the historical synthesized audio are returned. If the cached file of the query result exists within its validity period, has a length greater than zero, has the correct format header, and the checksum is consistent, the audio result is reused. If the historical synthesized audio has exceeded its cache period, the temporary file has been deleted, the file length is zero, the format or checksum fails, the task is in the FAILED, CANCELLED, or RECYCLED state, or the text and key parameter summary of this request are different, the historical synthesized audio cannot be reused.
[0026] In one embodiment of the present invention, creating a task context based on a text-to-audio synthesis request includes: generating a task identifier for the text-to-audio synthesis request and parsing the text-to-audio synthesis request to obtain data to be synthesized; obtaining the response connection identifier of the text-to-audio synthesis request, the service generation number of the current service instance, and the engine generation number of the current engine instance of the TTS engine, wherein the response connection identifier is used to identify the communication channel between the server and the client; creating an initial context with the task identifier as the primary key, and associating the target idempotent key, the data to be synthesized, the response connection identifier, the service generation number, and the engine generation number with the initial context to obtain the task context.
[0027] In one embodiment of the present invention, generating a task identifier for a text-to-audio synthesis request includes: generating a task identifier (task_id) using a UUID, a timestamp plus a random number, a snowflake algorithm, or a server sequence number; obtaining a response connection identifier (connection_id) for the text-to-audio synthesis request includes: obtaining or generating a response connection identifier from the underlying session carrying the text-to-audio synthesis request, wherein the underlying session is a session between the server and the client; the service generation number (service_generation) is a service instance version identifier generated by the server each time the network voice service is started, the process is rebuilt, or the listening service is rebuilt; the engine generation number (engine_generation) is an engine version identifier generated each time the TTS engine is initialized, rebuilt, switched, or the language pack is reloaded.
[0028] In one embodiment of the present invention, after receiving a text-to-audio synthesis request, the audio synthesis method further includes: the server calculating the task deadline based on the reception time of the received text-to-audio synthesis request and the timeout time (timeout_ms); the server obtaining source permissions from the access token, client certificate, signature, IP address, device number, or registered terminal information; if the text to be synthesized is empty, the text length exceeds the limit, the language or speaker is not supported, the parameters are out of bounds, the permission verification fails, or the timeout time is lower than the minimum threshold, then a parameter error is directly returned, and no task context is created.
[0029] In one embodiment of the present invention, the audio synthesis callback identifier utteranceId, the temporary audio file identifier temp_file_id, the audio stream sent offset stream_offset, the response status response_status, the task deadline deadline, the retry count retry, the cleanup status cleanup_status, and the error code are also associated with the initial context. Specifically, the audio synthesis callback identifier utteranceId is used to associate the asynchronous callback of the TTS engine with the task identifier task_id; the temporary audio file identifier temp_file_id is used to identify the temporary audio file generated by the TTS engine; the audio stream sent offset stream_offset is used to record the audio transmission progress; the response status response_status is used to record the audio transmission status; the task deadline deadline is used to limit the validity period of the task; the retry count retry is used to limit the retry limit; and the cleanup status cleanup_status is used to indicate whether the resources have been reclaimed. After association, the task state in the task context is initialized to RECEIVED, the version number is initialized to the initial version number, the audio stream offset is initialized to zero, the response status is initialized to not sent, and the cleanup status is initialized to not recycled.
[0030] S2: Extract target instance data and data to be synthesized based on the task context. When calling the TTS engine, obtain the engine instance data of the current engine instance of the TTS engine. Perform an atomic comparison and update between the target instance data and the engine instance data to obtain a first result. The first result is used to indicate whether to send the data to be synthesized to the TTS engine. The target instance data includes the target engine generation number, which is used to identify the engine instance used by the TTS engine when creating the task context. The engine instance data includes the current engine generation number, which is used to identify the engine instance used by the TTS engine when performing an atomic update to obtain the first result.
[0031] In one embodiment of the present invention, the TTS engine selects a healthy engine instance that supports the language and speaker in the task context, and records the service generation number and engine generation number; when the engine is not ready, the task state enters the engine preparation state ENGINE_PREPARING; after the engine state is READY, an atomic comparison update is performed to change the task state from the engine preparation state to the SYNTHESIZING state and update the task context, specifically, the state version number is incremented.
[0032] In one embodiment of the present invention, the atomic comparison and update of the target instance data and the engine instance data to obtain a first result includes: if the target engine era number is the same as the current engine era number, the first result is to send the data to be synthesized to the TTS engine; if the target engine era number is not the same as the current engine era number, the first result is not to send the data to be synthesized to the TTS engine.
[0033] In one embodiment of the present invention, when the first result is that the data to be synthesized is not sent to the TTS engine, it is determined that the old engine instance is not operating or the engine instance is inconsistent. The submission is rejected, and the engine instance of the TTS engine is rebuilt or switched to generate a new engine generation number. After creating a new engine instance, the data to be synthesized is sent to the TTS engine.
[0034] In one embodiment of the present invention, the atomic comparison update is performed before the formal invocation of the TTS engine for audio synthesis to confirm that the engine is ready and to ensure that only one execution path can be submitted for synthesis for the same task. The present invention determines whether the engine instance when the task context is created is the same as the current engine instance to reject the submission of the old engine instance, ensuring that there is only one valid synthesis path for the same task, avoiding duplicate synthesis, state rollback and the old engine continuing to submit synthesis, thereby improving the reliability and automatic recovery capability of speech synthesis service under multi-client concurrency conditions.
[0035] S3: In response to the callback event obtained from the data to be synthesized sent by the TTS engine, the system checks whether the callback event is delayed and obtains a second result. This invention identifies delayed old instance callback events by checking whether the callback event is delayed, ensuring that the file is not misread due to delayed callbacks, so as to correctly send audio to the client.
[0036] In one embodiment of the present invention, the TTS engine obtains the callback event based on the data to be synthesized, including: the TTS engine synthesizes the target audio based on the data to be synthesized; writes the target audio to a temporary audio file; and generates the callback event when the writing is completed.
[0037] In one embodiment of the present invention, after the server receives the callback event, the audio synthesis method further includes: encapsulating the temporary audio file, wherein the encapsulation process includes at least one of stopping further writing, closing or synchronizing the file handle, so as to change the temporary audio file from a write state to a readable stable state, so as to avoid reading the temporary audio file that has not been written, truncated or damaged.
[0038] In one embodiment of the present invention, verifying whether the callback event is delayed to obtain a second result includes: obtaining the current service generation number of the current service instance and the current engine generation number of the current engine instance of the TTS engine; obtaining the target task context based on the callback event; extracting the callback service generation number and the callback engine generation number based on the target task context, wherein the callback service generation number is used to identify the service instance used by the server when creating the task context, and the callback engine generation number is used to identify the engine instance used by the TTS engine when creating the task context; when the callback service generation number is the same as the current service generation number, and the callback engine generation number is the same as the current engine generation number, the second result is that the callback event is not delayed; when the callback service generation number is different from the current service generation number, and / or the callback engine generation number is different from the current engine generation number, the second result is that the callback event is delayed.
[0039] This invention identifies delayed callbacks of the old engine instance by checking whether the engine instance when creating the task context is the same as the current engine instance at the time of xxx. At the same time, it identifies delayed callbacks of the old service instance by checking whether the service instance when creating the task context is the same as the current service instance. Thus, delayed callbacks are rejected to avoid misreading files or sending audio.
[0040] S4: Based on the second result, read the callback file of the event to be called back, and obtain the callback audio to be sent to the client based on the callback file, including: if the second result is that the event to be called back is delayed, then refuse to read the callback file of the event to be called back; if the second result is that the event to be called back is not delayed, then read the callback file of the event to be called back, divide the callback file into blocks, and obtain multiple callback file blocks with block order; determine the target task context according to the event to be called back; send the callback file blocks to the client in the block order, and update the target task context after each successful sending of a callback file block to the client.
[0041] In one embodiment of the present invention, before reading the callback file of the event to be called back, the audio synthesis method further includes: the server performing file verification on the sealed temporary audio file, including at least one of file existence, file length, file format header and verification value; if the verification passes, the temporary audio file is atomically renamed to obtain the callback file; if the verification fails, the temporary audio file is rejected as the callback file, the temporary audio file is cleaned up, and error information is recorded.
[0042] In one embodiment of the present invention, for a temporary audio file in WAV format, file verification further includes verifying at least one of RIFF, WAVE, fmt and data blocks, sampling rate, number of channels, bit depth and data block length; the verification value includes at least one of SHA-256 or CRC32, used to identify file truncation, disk abnormality or unexpected overwriting.
[0043] In one embodiment of the present invention, the temporary audio file is generated by the TTS engine and written to the application's private or controlled cache directory pre-configured on the server; the server allocates a unique file path in the subdirectory named after the task identifier based on the temporary audio file identifier, a random number, a UUID, or an incrementing sequence; the path only uses the controlled identifier generated by the server and does not accept absolute paths, text, or filenames from the client.
[0044] In one embodiment of the present invention, after each successful transmission of a callback file block to the client, the target task context is updated, including: updating the audio stream transmission offset and response status in the target task context, wherein the audio stream transmission offset is used to record the byte position that has been successfully transmitted to the client, and the response status is used to record the progress of audio return transmission.
[0045] This invention determines the second result, reads the callback file and sends it to the client in chunks when the callback event is not delayed, and refuses to read the callback file when the callback event is delayed, thereby achieving accurate and secure audio transmission and avoiding audio mis-sending, duplicate sending or sending audio to the wrong client due to delayed callbacks in old instances.
[0046] The computer device of the present invention includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the above-described audio synthesis method.
[0047] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0048] Memory can be used to store computer programs or modules. The processor implements various functions of the audio synthesis method by running or executing the computer programs or modules stored in the memory and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a given function, etc.; the data storage area can store data created based on the use of the terminal, etc. Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, SmartMediaCards (SMC), Secure Digital (SD) cards, FlashCards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0049] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An audio synthesis method, characterized in that, Applied to the server side, the client connects to the TTS engine through the server, and the method includes: Receive a text audio synthesis request sent by the client, query whether there is reusable audio based on the text audio synthesis request, if there is, send the reusable audio to the client, if there is not, create a task context based on the text audio synthesis request; Based on the task context, target instance data and data to be synthesized are extracted. When the TTS engine is called, the engine instance data of the current engine instance of the TTS engine is obtained. The target instance data and the engine instance data are atomically compared and updated to obtain a first result. The first result is used to indicate whether to send the data to be synthesized to the TTS engine. In response to the callback event sent by the TTS engine based on the data to be synthesized, the system checks whether the callback event is delayed and obtains a second result. Based on the second result, the callback file of the event to be called back is read, and the callback audio to be sent to the client is obtained based on the callback file.
2. The audio synthesis method according to claim 1, characterized in that, Based on the text-to-audio synthesis request, querying whether reusable audio exists includes: Based on the text-audio synthesis request, obtain the target idempotent key used to identify the text-audio synthesis request; The database on the server is queried based on the target idempotent key, and the database includes multiple historical synthesized audio records with idempotent keys; If the database contains historical synthesized audio with the same idempotent key as the target idempotent key, then reusable audio exists. If no historical synthesized audio with the same idempotent key as the target idempotent key exists in the database, then no reusable audio is available.
3. The audio synthesis method according to claim 2, characterized in that, Based on the text-audio synthesis request, obtain the target idempotent key used to identify the text-audio synthesis request, including: If the text audio synthesis request carries an idempotent key, then the idempotent key carried in the text audio synthesis request is determined as the target idempotent key; If the text audio synthesis request does not carry an idempotent key, the text audio synthesis request is parsed to obtain the data to be synthesized, and the target idempotent key is determined based on the data to be synthesized.
4. The audio synthesis method according to claim 2, characterized in that, Creating a task context based on the text-to-audio synthesis request includes: A task identifier is generated for the text audio synthesis request, and the text audio synthesis request is parsed to obtain the data to be synthesized; Obtain the response connection identifier of the text audio synthesis request, the service generation number of the current service instance, and the engine generation number of the current engine instance of the TTS engine. The response connection identifier is used to identify the communication channel between the server and the client. An initial context is created using the task identifier as the primary key. The target idempotent key, the data to be synthesized, the response connection identifier, the service generation number, and the engine generation number are associated with the initial context to obtain the task context.
5. The audio synthesis method according to claim 1, characterized in that, The target instance data includes a target engine generation number, which is used to identify the engine instance used by the TTS engine when the task context is created. The engine instance data includes the current engine generation number, which is used to identify the engine instance used by the TTS engine when the first result is obtained by performing an atomic update. The first result is obtained by atomically comparing and updating the target instance data and the engine instance data, including: If the target engine era number is the same as the current engine era number, then the first result is to send the data to be synthesized to the TTS engine; If the target engine era number is different from the current engine era number, the first result is not to send the data to be synthesized to the TTS engine.
6. The audio synthesis method according to claim 1, characterized in that, The TTS engine obtains the callback events based on the data to be synthesized, including: The TTS engine synthesizes the target audio based on the data to be synthesized. The target audio is written to a temporary audio file, and the callback event is generated when the writing is complete.
7. The audio synthesis method according to claim 6, characterized in that, After receiving the callback event, the audio synthesis method further includes: The temporary audio file is then encapsulated.
8. The audio synthesis method according to claim 1, characterized in that, The second result is obtained by verifying whether the event to be called back is delayed, including: Obtain the current service generation number of the current service instance and the current engine generation number of the current engine instance of the TTS engine; Obtain the target task context based on the event to be called back; Based on the target task context, extract the service generation number to be called back and the engine generation number to be called back. The service generation number to be called back is used to identify the service instance used by the server when the task context is created, and the engine generation number to be called back is used to identify the engine instance used by the TTS engine when the task context is created. When the generation number of the service to be called back is the same as the current service generation number, and the generation number of the engine to be called back is the same as the current engine generation number, then the second result is that the event to be called back is not delayed. When the generation number of the service to be called back is different from the current service generation number, and / or the generation number of the engine to be called back is different from the current engine generation number, the second result is the delay of the event to be called back.
9. The audio synthesis method according to claim 1, characterized in that, Based on the second result, the callback file of the event to be called back is read, and the callback audio to be sent to the client is obtained based on the callback file, including: If the second result indicates that the event to be called back is delayed, then reading the callback file of the event to be called back will be refused. When the second result is that the event to be called back is not delayed, the callback file of the event to be called back is read, and the callback file is divided into blocks to obtain multiple callback file blocks with block order. Determine the target task context based on the pending callback event; The callback file blocks are sent to the client sequentially according to the block order, and the target task context is updated after each successful sending of the callback file block to the client.
10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement an audio synthesis method as described in any one of claims 1 to 9.
