A voice broadcast method, device, equipment and readable storage medium
By prioritizing online voice audio broadcasting and converting to offline voice audio broadcasting based on disconnection points when the network state is poor, the problems of high memory usage and discontinuous broadcasting during voice broadcasting are solved, and efficient broadcasting is achieved under different network states.
Patent Information
- Application Number
- CN202412000142.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
AI Technical Summary
In the voice broadcasting process, the prior art needs to rely on memory to store audio, resulting in an increase in memory usage and unable to achieve smooth voice broadcasting when the network environment is poor.
By priority broadcasting online voice audio, when the network status is poor and the online voice audio has not been synthesized, it is converted to offline voice audio broadcast based on the disconnection point, reducing memory usage and ensuring broadcast continuity.
Reduce memory usage when the network is in good condition, and achieve continuity of voice broadcasting through disconnection point conversion when the network is in bad condition.
Smart Images

Figure CN119788552A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of audio processing technology, and in particular to a voice broadcasting method, apparatus, device and readable storage medium. Background Art
[0002] When performing voice broadcast, it is usually necessary to do so in a good network environment. When the network environment is poor, there may be lag or the broadcast may fail. In order to solve the above problems, the existing technology usually stores the audio to be broadcast in a local cache when the network environment is good. When voice broadcast is required, if the audio corresponding to the voice broadcast has been stored in the local cache, the audio stored in the local cache can be directly used for broadcast. If it is not stored in the local cache, online audio synthesis and broadcast are performed.
[0003] However, as more and more audio is broadcast, this solution will undoubtedly increase memory usage. When the corresponding audio does not exist in the local cache and the network environment is poor, smooth voice broadcasting is still impossible. Therefore, there is an urgent need for a method that does not rely on memory usage and can achieve smooth voice broadcasting both offline and online. Summary of the Invention
[0004] The object of the present invention is to provide a voice broadcast method, device, equipment and readable storage medium, which achieves the effect of reducing memory usage and ensuring the continuity of voice broadcast when the network environment is poor by giving priority to broadcasting online voice audio and, based on the disconnection point, switching from broadcasting online voice audio to broadcasting offline voice audio when the network status at the second moment is in a poor state and the online voice audio has not been synthesized.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] In a first aspect, the present invention provides a voice broadcast method, the method comprising:
[0007] When receiving a voice broadcast command, the network status is monitored in real time; the voice broadcast command includes a voice broadcast text;
[0008] If the network status at the first moment is good, the offline voice audio and the online voice audio are synthesized according to the voice broadcast text, and the online voice audio is broadcast;
[0009] If the network status at the second moment is in a bad state and the online voice audio has not been synthesized, the disconnection point in the voice broadcast text is determined based on the online voice audio; the second moment is later than the first moment;
[0010] Based on the disconnection point, the offline voice audio is played.
[0011] In some embodiments, determining a break point in the voice broadcast text based on the online voice audio includes:
[0012] According to the mapping relationship between the online voice audio and the voice broadcast text, the disconnection point in the voice broadcast text corresponding to the end point of the online voice audio is determined.
[0013] In some embodiments, the offline voice audio is reported based on the disconnection point, including:
[0014] Determine the starting point in the offline voice audio corresponding to the disconnection point based on the mapping relationship between the offline voice audio and the voice broadcast text;
[0015] When it is detected that the online voice audio has reached its end point, the offline voice audio will be played from the starting point.
[0016] In some embodiments, the method further comprises:
[0017] If the network status at the first moment is in a bad state, the offline voice audio is synthesized according to the voice broadcast text;
[0018] Play offline voice audio.
[0019] In some embodiments, the method further comprises:
[0020] If the network status at the second moment is in a good state and / or the online voice audio is synthesized, the online voice audio continues to be broadcasted.
[0021] In some embodiments, the method further comprises:
[0022] If it is detected that the online voice audio or offline voice audio has been played, the offline voice audio is deleted from the local storage system.
[0023] In a second aspect, the present invention further provides a voice broadcasting device, comprising:
[0024] The network monitoring module is used to monitor the network status in real time when receiving a voice broadcast instruction; the voice broadcast instruction includes a voice broadcast text;
[0025] An audio synthesis module is used to synthesize offline voice audio and online voice audio according to the voice broadcast text if the network status at the first moment is in a good state, and broadcast the online voice audio;
[0026] a breakpoint determination module, configured to determine a breakpoint in the voice broadcast text based on the online voice audio if the network status at the second moment is in a poor state and the online voice audio has not been synthesized; the second moment is later than the first moment;
[0027] The audio broadcast module is used to broadcast offline voice audio based on the disconnection point.
[0028] In a third aspect, the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the voice broadcast method provided in the first aspect when executing the computer program.
[0029] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the voice broadcast method provided in the first aspect when the computer program is executed by a processor.
[0030] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the voice broadcast method provided in the first aspect.
[0031] The beneficial effects of the present invention are:
[0032] When a voice broadcast instruction is received, the network status is first monitored in real time; the voice broadcast instruction contains a voice broadcast text; if the network status at the first moment is in a good state, the offline voice audio and the online voice audio are synthesized according to the voice broadcast text, and the online voice audio is broadcast; if the network status at the second moment is in a bad state, and the online voice audio has not been synthesized, the disconnection point in the voice broadcast text is determined according to the online voice audio; the second moment is later than the first moment; finally, based on the disconnection point, the offline voice audio is broadcast. The above scheme gives priority to broadcasting online voice audio when the network status is good, which greatly reduces the memory usage. Secondly, when the network status is not good, the voice broadcast can be converted from online voice broadcast to offline voice broadcast based on the disconnection point, ensuring the continuity of the voice broadcast when the network status is poor.
[0033] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A flow chart of a voice broadcasting method according to an embodiment of the present invention;
[0035] Figure 2 This is a schematic diagram of a process for broadcasting offline voice audio according to an embodiment of the present invention;
[0036] Figure 3 Another voice broadcast method shown in an embodiment of the present invention;
[0037] Figure 4 This is a structural diagram of a voice broadcasting device according to an embodiment of the present invention;
[0038] Figure 5 This is a structural diagram of another voice broadcasting device according to an embodiment of the present invention;
[0039] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0041] It should be noted that references to "one embodiment," "an embodiment," "an example embodiment," etc., in this specification indicate that the described embodiment may include specific features, structures, or characteristics. However, not every embodiment must include these specific features, structures, or characteristics. In addition, such references do not necessarily refer to the same embodiment. Furthermore, when specific features, structures, or characteristics are described in conjunction with an embodiment, whether or not explicitly described, it is indicated that it is within the knowledge of those skilled in the art to incorporate such features, structures, or characteristics into other embodiments.
[0042] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0043] In some embodiments, as Figure 1 As shown, a voice broadcast method is provided, and the specific method includes:
[0044] S101, when a voice broadcast instruction is received, the network status is monitored in real time.
[0045] The voice broadcast instruction includes a voice broadcast text.
[0046] For example, when voice broadcast is required, the operation and maintenance personnel will send a voice broadcast command carrying the voice broadcast text. After receiving the voice broadcast command, the network monitoring tool can be called to monitor the network status, such as Nagios Core, Zabbix, Icinga2, OpenNMS, Prometheus, Graphite, Checkmk, etc. These tools provide rich functions, including network performance monitoring, fault detection, traffic analysis, etc.
[0047] S102: If the network status at the first moment is in a good state, synthesize the offline voice audio and the online voice audio according to the voice broadcast text, and broadcast the online voice audio.
[0048] In fact, the first moment is the moment when the voice audio is about to be performed.
[0049] Specifically, if the network status at the first moment is in good condition, the online and offline TTS (Text to Speech) services are directly called, the offline voice audio and the online voice audio are synthesized simultaneously based on the voice broadcast text, and the online voice audio is broadcast.
[0050] Optionally, if the network status at the first moment is in a bad state, offline voice audio is synthesized according to the voice broadcast text; and the offline voice audio is broadcast.
[0051] Specifically, if the network status at the first moment is in a bad state, the online voice audio cannot be synthesized. At this time, it is only necessary to call the offline TTS service, synthesize the offline voice audio according to the voice broadcast text, and broadcast the offline voice audio.
[0052] S103: If the network status at the second moment is in a bad state and the online voice audio has not been synthesized, a disconnection point in the voice broadcast text is determined based on the online voice audio.
[0053] The second moment is later than the first moment, and the second moment is any moment during the process of broadcasting the online voice audio.
[0054] Specifically, if the network status at the second moment is in a bad state and the online voice audio has not been synthesized, the complete voice broadcast text cannot be broadcast directly based on the online voice audio. At this time, it is necessary to determine the disconnection point in the voice broadcast text based on the last synthesis point of the online voice audio.
[0055] Optionally, if the network status at the second moment is in a good state and / or the online voice audio is synthesized, the online voice audio continues to be broadcast.
[0056] Specifically, if the network status at the second moment is in a good state, the online voice audio can continue to be synthesized and the online voice audio can be played directly. If the online voice audio has been synthesized, the online voice audio can still be played even if the network status is in a bad state.
[0057] Optionally, the method for determining the disconnection point in the voice broadcast text based on the online voice audio may be: determining the disconnection point in the voice broadcast text corresponding to the end point of the online voice audio based on the mapping relationship between the online voice audio and the voice broadcast text.
[0058] Specifically, the online voice audio and the voice broadcast text have a certain mapping relationship, and the disconnection point corresponding to the online voice audio termination point in the voice broadcast text can be found according to the mapping relationship between the online voice audio and the voice broadcast text.
[0059] For example, when the network is detected to be unavailable, the length of the synthesized online voice audio and the timestamp file of the relationship between the voice broadcast text can be used to know the synthesized length of the current voice broadcast text, and the position of the currently disconnected text can be found through the mapping relationship, which is the disconnection point.
[0060] S104: Play the offline voice audio based on the disconnection point.
[0061] Specifically, according to the mapping relationship between the offline voice audio and the voice broadcast text, the starting point corresponding to the disconnection point in the offline voice audio can be found, and then the offline voice audio can be played from the starting point until the voice audio is played to completion.
[0062] In the above embodiment, when a voice broadcast instruction is received, the network status is first monitored in real time; the voice broadcast instruction includes a voice broadcast text; if the network status at the first moment is in a good state, the offline voice audio and the online voice audio are synthesized according to the voice broadcast text, and the online voice audio is broadcast; if the network status at the second moment is in a bad state, and the online voice audio has not been synthesized, the disconnection point in the voice broadcast text is determined according to the online voice audio; the second moment is later than the first moment; finally, based on the disconnection point, the offline voice audio is broadcast. The above scheme gives priority to broadcasting online voice audio when the network status is good, which greatly reduces the memory usage. Secondly, when the network status is not good, the voice broadcast can be converted from online voice broadcast to offline voice broadcast based on the disconnection point, ensuring the continuity of the voice broadcast when the network status is poor.
[0063] On the basis of the above embodiment, in order to further reduce memory usage, the voice broadcast method may further include: if it is detected that the online voice audio or offline voice audio has been broadcasted, deleting the offline voice audio from the local storage system.
[0064] Specifically, the broadcast status of online voice audio and offline voice audio can be monitored in real time. When the online voice audio or offline voice audio is finished broadcasting, the cache file of the offline voice audio is deleted from the local storage system. That is, each time the voice is broadcast, only one cache file of the offline voice audio needs to be stored, which greatly reduces memory usage.
[0065] In another embodiment, Figure 2 As shown in the figure, the specific process of broadcasting offline voice audio based on the disconnection point is described, including:
[0066] S201: Determine a starting point in the offline voice audio corresponding to a disconnection point according to a mapping relationship between the offline voice audio and the voice broadcast text.
[0067] Specifically, the offline voice audio has a duration, and each word in the voice broadcast text corresponds to the timestamp of the offline voice audio, that is, the mapping relationship between the offline voice audio and the voice broadcast text. The starting point in the offline voice audio corresponding to the disconnection point can be determined based on the mapping relationship.
[0068] S202, when it is detected that the broadcast reaches the end point of the online voice audio, the offline voice audio is broadcast from the starting point.
[0069] Specifically, when the online voice audio is broadcast to the end point, the synthesized online voice audio has been broadcasted, but the broadcast of the entire voice broadcast text has not been completed. At this time, the offline voice audio is broadcasted from the starting point.
[0070] In the solution of the above embodiment, when the network status at the second moment is in a poor state and the online voice audio has not been synthesized, the online voice broadcast can be seamlessly connected to the offline voice broadcast according to the disconnection point, which greatly improves the broadcast continuity when the network status is poor.
[0071] In order to more comprehensively demonstrate this solution, this embodiment provides an optional method of voice broadcasting, such as Figure 3 As shown:
[0072] S301, when a voice broadcast instruction is received, the network status is monitored in real time.
[0073] The voice broadcast instruction includes a voice broadcast text.
[0074] S302: If the network status at the first moment is in a good state, synthesize the offline voice audio and the online voice audio according to the voice broadcast text, and broadcast the online voice audio.
[0075] S303: If the network status at the first moment is in a bad state, synthesize offline voice audio according to the voice broadcast text.
[0076] S304: Play the offline voice audio.
[0077] S305: If the network status at the second moment is in a bad state and the online voice audio has not been synthesized, a disconnection point in the voice broadcast text corresponding to the online voice audio termination point is determined according to a mapping relationship between the online voice audio and the voice broadcast text.
[0078] Among them, the second moment is later than the first moment.
[0079] S306: Determine a starting point in the offline voice audio corresponding to the disconnection point according to a mapping relationship between the offline voice audio and the voice broadcast text.
[0080] S307: When it is detected that the online voice audio ends at the broadcasting point, the offline voice audio is broadcasted from the starting point.
[0081] S308: If the network status at the second moment is in a good state and / or the online voice audio is synthesized, the online voice audio continues to be broadcasted.
[0082] S309: If it is detected that the online voice audio or offline voice audio has been played, the offline voice audio is deleted from the local storage system.
[0083] The specific process of the above S301-S309 can be found in the description of the above method embodiment. The implementation principle and technical effects are similar and will not be repeated here.
[0084] Based on the same inventive concept, the present application also provides a voice broadcast device for implementing the aforementioned voice broadcast method. The implementation solution provided by the device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more voice broadcast device embodiments provided below can be found in the above-mentioned limitations of the voice broadcast method and will not be repeated here.
[0085] In one embodiment, Figure 4 As shown, a voice broadcasting device is provided, which includes:
[0086] The network monitoring module 40 is used to monitor the network status in real time when receiving a voice broadcast instruction; the voice broadcast instruction includes a voice broadcast text;
[0087] The audio synthesis module 41 is used to synthesize the offline voice audio and the online voice audio according to the voice broadcast text if the network status at the first moment is in a good state, and broadcast the online voice audio;
[0088] a breakpoint determination module 42 for determining a breakpoint in the voice broadcast text based on the online voice audio if the network status at the second moment is in a poor state and the online voice audio has not been synthesized; the second moment is later than the first moment;
[0089] The audio broadcast module 43 is used to broadcast the offline voice audio based on the disconnection point.
[0090] In the above-mentioned voice broadcast device, when the network monitoring module 40 receives the voice broadcast instruction, it first monitors the network status in real time; the voice broadcast instruction contains a voice broadcast text; if the network status at the first moment is in a good state, the audio synthesis module 41 synthesizes the offline voice audio and the online voice audio according to the voice broadcast text, and broadcasts the online voice audio; if the network status at the second moment is in a bad state, and the online voice audio has not been synthesized, the breakpoint determination module 42 determines the disconnection point in the voice broadcast text according to the online voice audio; the second moment is later than the first moment; finally, the audio broadcast module 43 broadcasts the offline voice audio based on the disconnection point. The above-mentioned scheme gives priority to broadcasting online voice audio when the network status is good, which greatly reduces the memory usage. Secondly, when the network status is not good, the voice broadcast can be converted from online voice broadcast to offline voice broadcast based on the disconnection point, ensuring the continuity of the voice broadcast when the network status is poor.
[0091] In another embodiment, the above Figure 4 The breakpoint determination module 42 is specifically configured to:
[0092] According to the mapping relationship between the online voice audio and the voice broadcast text, the disconnection point in the voice broadcast text corresponding to the end point of the online voice audio is determined.
[0093] In another embodiment, Figure 5 As shown above Figure 4 The audio broadcast module 43 includes:
[0094] The point determination unit 430 is used to determine the starting point in the offline voice audio corresponding to the disconnection point according to the mapping relationship between the offline voice audio and the voice broadcast text;
[0095] The audio broadcast unit 431 is used to broadcast the offline voice audio from the starting point when it is detected that the broadcast reaches the ending point of the online voice audio.
[0096] In another embodiment, the voice broadcasting device further includes:
[0097] The offline broadcast module is used to synthesize offline voice audio according to the voice broadcast text if the network status at the first moment is in a bad state; and broadcast the offline voice audio.
[0098] In another embodiment, the voice broadcasting device further includes:
[0099] The continuing broadcasting module is used to continue broadcasting the online voice audio if the network status at the second moment is in a good state and / or the online voice audio synthesis is completed.
[0100] In another embodiment, the voice broadcasting device further includes:
[0101] The cache deletion module is used to delete the offline voice audio from the local storage system if it is detected that the online voice audio or offline voice audio has been played.
[0102] The present application also provides an electronic device, in some embodiments, referring to Figure 6 As shown, the electronic device 700 includes an input unit 710, a memory 720, a processor 730, and an output unit 740. The memory 720 stores program instructions that can be executed by the processor 730. The processor 730 calls the program instructions to execute the voice broadcast method and / or technical solution based on the above-mentioned embodiment. The electronic device 700 can be a mobile terminal device such as a mobile phone or a computer.
[0103] In addition, an embodiment of the present application further provides a computer-readable storage medium for storing a computer program for executing the voice broadcast method. For example, computer program instructions, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. The program instructions for calling the method of the present application may be stored in a fixed or removable storage medium, and / or transmitted via a data stream in a broadcast or other signal-bearing medium and / or stored in a storage medium that operates according to the program instructions.
[0104] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device. They can be concentrated on a single computing device or distributed across a network consisting of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0105] The various technical features of the above embodiments can be arbitrarily integrated. To make the description concise, not all possible integrations of the various technical features in the above embodiments are described. However, as long as there is no contradiction in the integration of these technical features, they should be considered to be within the scope of this specification.
[0106] The above embodiments merely illustrate several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.
Claims
1. A voice broadcast method, characterized in that: The method comprises: When receiving a voice broadcast instruction, the network status is monitored in real time; the voice broadcast instruction includes a voice broadcast text; If the network status at the first moment is in a good state, synthesizing the offline voice audio and the online voice audio according to the voice broadcast text, and broadcasting the online voice audio; If the network status at the second moment is in a bad state and the online voice audio has not been synthesized, determining the disconnection point in the voice broadcast text according to the online voice audio; the second moment is later than the first moment; Based on the disconnection point, the offline voice audio is broadcasted.
2. The voice broadcast method according to claim 1, characterized in that: Determining the disconnection point in the voice broadcast text according to the online voice audio includes: According to the mapping relationship between the online voice audio and the voice broadcast text, a disconnection point in the voice broadcast text corresponding to the termination point of the online voice audio is determined.
3. The voice broadcast method according to claim 2, characterized in that: Based on the disconnection point, the offline voice audio is broadcasted, including: Determine the starting point in the offline voice audio corresponding to the disconnection point according to the mapping relationship between the offline voice audio and the voice broadcast text; When it is detected that the broadcast reaches the end point of the online voice audio, the offline voice audio is broadcast from the starting point.
4. The voice broadcasting method according to claim 1, characterized in that: The method further comprises: If the network status at the first moment is in a bad state, synthesizing offline voice audio according to the voice broadcast text; The offline voice audio is broadcasted.
5. The voice broadcast method according to claim 1, characterized in that: The method further comprises: If the network status at the second moment is in a good state and / or the online voice audio is synthesized, the online voice audio continues to be broadcasted.
6. The voice broadcast method according to any one of claims 1 to 5, characterized in that: The method further comprises: If it is detected that the online voice audio or offline voice audio has been broadcasted, the offline voice audio is deleted from the local storage system.
7. A voice broadcasting device, characterized in that: The device comprises: A network monitoring module, used to monitor the network status in real time when receiving a voice broadcast instruction; the voice broadcast instruction includes a voice broadcast text; An audio synthesis module, for synthesizing offline voice audio and online voice audio according to the voice broadcast text if the network status at the first moment is in a good state, and broadcasting the online voice audio; A breakpoint determination module, configured to determine a breakpoint in the voice broadcast text according to the online voice audio if the network status at the second moment is in a bad state and the online voice audio has not been synthesized; the second moment is later than the first moment; The audio broadcast module is used to broadcast the offline voice audio based on the disconnection point.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the voice broadcast method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the voice broadcast method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the voice broadcast method according to any one of claims 1 to 6 is implemented.