Audio transmission method and system and storage medium
By detecting the amount of audio data and remaining space in the on-board KTV entertainment system, predicting the remaining time of the target data and remaining space, and adopting scheduling operations to retrieve and write audio data, the problem of insufficient or overflow of the cache area is solved, real-time and stability of audio data transmission is achieved, and the sound quality is improved.
Patent Information
- Application Number
- CN202411855524.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-05-30
AI Technical Summary
In the on-board KTV entertainment system, the cache area of the audio data is set too small, resulting in insufficient data or overflow, causing problems of noise and sound quality to decline.
By detecting the amount of audio data and remaining space in the cache area, predicting the remaining time of the target data and the remaining space of the target, and taking scheduling operations to retrieve and write audio data, ensuring the real-time and consistency of data transmission.
Real-time and stability of audio data transmission is achieved, noise problems caused by insufficient data or overflow are avoided, sound quality is improved, and audio data transmission is more reliable and stable.
Smart Images

Figure CN120066399A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of audio signal processing, and particularly relates to an audio transmission method, system and storage medium. Background Art
[0002] In an in-vehicle KTV entertainment system, the delay problem of sound has always been an important consideration factor. To ensure that users can feel the synchronization of their own singing and accompaniment in real time, the KTV system usually controls the delay of sound processing at an extremely low level. To achieve this goal, the system often reduces the kernel cache to reduce the audio data cache. However, this also brings a series of problems. When the buffer is set too small, the non-real-time scheduling and the inconsistency between the generation and consumption rates between the microphone (MIC) and the digital signal processing (DSP) will cause the data in the buffer to be insufficient or overflow.
[0003] Non-real-time scheduling will cause the processing of human voice data to be untimely. In some cases, due to factors such as contention for system resources and adjustment of the priority of processing tasks, the human voice data may be insufficient or overflow. This situation is particularly obvious when the kernel cache buffer is small. When the data in the read buffer is not read out in time, it will cause the human voice data to overflow. When the write buffer is not written in time, it will cause the human voice data to be insufficient. Whether the human voice data overflows or is insufficient, it will cause obvious noise.
[0004] As an input device for sound signals, the sampling rate of the microphone is limited by the hardware performance. And as a sound signal processing device, the processing speed of the DSP is affected by various factors such as algorithm complexity, hardware performance, and system load. Therefore, in practical applications, it is often difficult for the audio data generation and consumption rates between the MIC and the DSP to achieve a perfect match. When the sampling rate of the MIC is higher than the processing speed of the DSP, the data in the buffer will accumulate rapidly and cause overflow. The overflow data may be discarded or overwritten, resulting in the loss or distortion of the sound signal. When the processing speed of the DSP is higher than the sampling rate of the MIC, the data in the buffer will decrease rapidly and cause insufficiency. At this time, the system may adopt strategies such as muting or repeating the previously played data to fill in the blanks, and these strategies will also cause the decline of sound quality and the generation of noise. Summary of the Invention
[0005] To solve the above technical problems, this application proposes an audio transmission method, system and storage medium, aiming to avoid the phenomenon of insufficient or overflow data in the buffer during the audio data transmission process, so that the rate of audio data generated by the microphone is consistent with the rate of audio data consumed by the digital signal processor, and avoid the decline of sound quality and the generation of noise.
[0006] Specifically, the present application proposes an audio transmission method, including: Detect the amount of audio data collected in the first buffer.
[0007] Based on the amount of audio data, predict the first remaining time to obtain the target data amount, and based on the first remaining time, take a first scheduling operation to transfer the audio data of the target data amount to the second buffer based on the first scheduling operation.
[0008] Detect the remaining space in the third buffer.
[0009] Based on the remaining space, predict the second remaining time to obtain the target remaining space, and based on the second remaining time, take a second scheduling operation to write the audio data in the second buffer into the target remaining space in the third buffer based on the second scheduling operation.
[0010] In the above technical solution, by performing the transfer and writing of the audio data in the buffer through the first scheduling operation and the second scheduling operation, the audio data in the buffer is adjusted in real time, reducing the audio output delay caused by excessive caching of audio data, ensuring the real-time nature of audio data transmission and the consistency of the audio generation and consumption rates, avoiding noise problems caused by insufficient or overflow of audio data, improving the sound quality, enabling the audio data to better handle emergencies during the transmission process, and enhancing the reliability and stability of audio data transmission.
[0011] As an implementation manner, the first scheduling operation may at least include a reading operation and a first sleep operation.
[0012] When the first remaining time is less than or equal to the first preset time threshold, perform the reading operation.
[0013] When the first remaining time is greater than the first preset time threshold, perform the first sleep operation.
[0014] By predicting the first remaining time for the amount of audio data collected in the first buffer to reach the target data amount, the real-time nature of audio data transmission is ensured. Through the first scheduling operation, the overflow of audio data in the buffer is avoided. When the first remaining time is greater than the first preset time threshold, the first sleep operation is performed, enabling the audio data reading process to enter the sleep state, thereby reducing resource consumption.
[0015] Further, the reading operation specifically includes: determining whether the amount of audio data in the first buffer reaches the target data amount. If so, control the reading process to read the audio data of the target data amount into the second buffer; otherwise, continue to detect the amount of audio data in the first buffer until it reaches the target data amount.
[0016] By judging in real time whether the amount of audio data in the first buffer reaches the target data volume, and only controlling the reading process to read the audio data when the audio data reaches the target data volume, the accuracy of audio data reading is ensured, and the problems of data overflow and data loss in the second buffer caused by unnecessary repeated reading operations are avoided. The efficiency, stability and fluency of audio data transmission are ensured. Further, the first sleep operation specifically includes: Controlling the reading process to enter the sleep state until the amount of audio data in the first buffer reaches the target data volume, activating the reading process, and controlling the reading process to read the audio data of the target data volume into the second buffer.
[0017] By controlling the reading process to enter the sleep state, the consumption of resources in the audio data transmission process is reduced, thereby improving the data transmission efficiency. By controlling the reading process to enter the sleep state or the working state, the flexibility of the audio data transmission process is improved.
[0018] Further, the second scheduling operation at least includes a writing operation and a second sleep operation.
[0019] When the second remaining time is less than or equal to the second preset time threshold, the writing operation is taken.
[0020] When the second remaining time is greater than the second preset time threshold, the second sleep operation is taken.
[0021] By judging the second remaining time and taking different scheduling operations according to different remaining times, unnecessary writing operations are avoided. When the second remaining time is greater than the second preset time threshold, by taking the second sleep operation, the energy consumption of audio data transmission is reduced. Through the writing operation, the real-time performance of audio data transmission is ensured.
[0022] Further, the writing operation specifically includes: judging whether the remaining space reaches the target remaining space. If so, controlling the writing process to write the audio data in the second buffer into the third buffer; otherwise, continuing to detect the remaining space in the third buffer until it reaches the target remaining space.
[0023] The second sleep operation specifically includes: Controlling the writing process to enter the sleep state until the remaining space in the third buffer reaches the target remaining space, activating the writing process, and controlling the writing process to write the audio data in the second buffer into the third buffer.
[0024] By judging the remaining space in the third buffer, it avoids the problems of data overflow and data loss caused by premature or overly frequent audio data writing operations, avoids data backlog and writing conflicts, ensures the real-time nature of audio data transmission, and by controlling the writing process to enter the sleep state, it reduces the resource consumption during the audio data transmission process and improves the efficiency and stability of audio data transmission.
[0025] Further, the retrieving the audio data of the target data volume to the second buffer further includes: Real-time monitoring of the audio data volume in the second buffer; wherein, when the audio data volume in the second buffer is less than the minimum preset value, the audio data of the target data volume is increased to the second buffer through a preset management algorithm.
[0026] When the audio data volume in the second buffer is greater than the maximum preset value, the audio data corresponding to the target remaining space in the second buffer is reduced through the preset management algorithm.
[0027] By comparing the audio data volume in the second buffer with the maximum preset value and the minimum preset value, the audio data in the second buffer is adjusted in real time, avoiding the situation of idle space and insufficient data in the second buffer, ensuring the continuity and real-time nature of audio data transmission. It prevents problems such as overflow of cached audio data, excessive memory occupation or system overload, and ensures the stability of audio data transmission.
[0028] Further, the second buffer is at least further provided with a starting address and an ending address.
[0029] Based on the starting address, the audio data is written or retrieved in the second buffer.
[0030] After the audio data is written or retrieved in the second buffer, the positions of the starting address and the ending address are adjusted according to the data volume of the audio data.
[0031] By adjusting the positions of the starting address and the ending address, the cache space of the buffer can be fully utilized without resource waste, avoiding the situation of too much idle space or overly compact data in the buffer. It reduces the time for searching the cache space during audio data reading and writing, improves the efficiency of data reading and writing. It enhances the continuity of audio data, avoiding problems such as stuttering, data loss or misalignment caused by discontinuous buffer or incorrect data positions. The adjustment of the starting address and the ending address enables the cache space in the buffer to be recycled, without the need for re-memory allocation or release, improving the utilization efficiency of the cache space.
[0032] Based on the same inventive concept, the present application also proposes a system for an audio transmission method, the system comprising: A first detection module, configured to detect the amount of audio data collected in a first buffer.
[0033] A reading module, configured to predict a first remaining time for obtaining a target data amount based on the amount of audio data, and perform a first scheduling operation based on the first remaining time, so as to retrieve audio data of the target data amount to a second buffer based on the first scheduling operation.
[0034] A second detection module, configured to detect the remaining space in a third buffer.
[0035] And a writing module, configured to predict a second remaining time for obtaining a target remaining space based on the remaining space, and perform a second scheduling operation based on the second remaining time, so as to write the audio data in the second buffer into the third buffer based on the second scheduling operation.
[0036] Based on the same inventive concept, the present application also proposes a computer-readable storage medium storing computer-executable instructions that can be read and executed by a domain controller to perform the audio transmission method.
[0037] Compared with the prior art, the present application has at least the following beneficial effects: The audio transmission method, system and storage medium proposed by the present application solve the problem that in the process of audio data transmission, due to the phenomenon of insufficient or overflowing data in the buffer, the rate of audio data generated by the microphone is consistent with the rate of audio data consumed by the digital signal processor, avoiding the problems of sound quality degradation and noise. By performing the first scheduling operation and the second scheduling operation to retrieve and write the audio data in the buffer, real-time adjustment of the audio data in the buffer is achieved, reducing the audio output delay caused by excessive caching of audio data, ensuring the real-time nature of audio data transmission and the consistency of the audio generation and consumption rates, avoiding noise problems caused by insufficient or overflowing audio data, improving the sound quality, enabling the audio data to better cope with emergencies during transmission, and enhancing the reliability and stability of audio data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flowchart of the audio transmission method shown in an embodiment of the present application.
[0039] Figure 2 is a schematic diagram of the audio transmission system shown in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server including a series of steps or units does not necessarily limit to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0042] Embodiment 1: Please refer to Figure 1 , and this audio transmission method mainly includes steps S1 to S4: Among them, step S1 mainly includes: detecting the amount of audio data collected in the first buffer. The first buffer can mainly be a buffer for audio data collection, such as a microphone buffer. The audio transmission method described in the present application is mainly applied to an in-vehicle KTV entertainment system, and audio data can be collected through a microphone or other sound collection devices and cached in the first buffer.
[0043] Step S2 includes: predicting and obtaining the first remaining time for the target data volume based on the amount of audio data, and taking a first scheduling operation based on the first remaining time to retrieve the audio data of the target data volume to the second buffer based on the first scheduling operation. For example, if it is necessary to obtain a target data volume of 240 frames, and the microphone in the first buffer can collect 48 frames of audio data per 1 ms, the first remaining time can be 4 ms, 3 ms, 2 ms, etc. Based on the first remaining time, 240 frames of the target data volume of audio data can be retrieved to the second buffer through the first scheduling operation. The second buffer can mainly be a buffer for dynamically managing audio data, and the amount of audio data is adjusted in the second buffer to ensure the stability and reliability of audio data transmission.
[0044] Step S3 includes: detecting the remaining space in the third buffer. The third buffer can mainly be a buffer for digital signal processing or a buffer for data playback. By detecting the size of the remaining space in the third buffer in real time, data overflow or data shortage caused by frequent writing of audio data can be avoided.
[0045] Step S4 includes: predicting a second remaining time of the target remaining space based on the remaining space, and taking a second scheduling operation based on the second remaining time to write the audio data in the second buffer into the target remaining space in the third buffer based on the second scheduling operation. For example, the target remaining space can be the buffer space for 240 frames of audio data, and the consumption rate of audio data in the third buffer can be 48 frames of audio data per 1 ms, that is, the second remaining time can be 1 ms, 2 ms, 4 ms, etc. When the remaining space is greater than or equal to the target remaining space, directly take the second scheduling operation to write the audio data in the second buffer into the target remaining space in the third buffer.
[0046] For example, in an in-vehicle KTV entertainment system, audio data of a user is collected by a microphone and buffered in the first buffer. The amount of audio data in the first buffer is detected in real time. Among them, the microphone can collect 48 frames of audio data per 1 ms, and the target data volume is 240 frames of audio data. If the current amount of audio data in the first buffer is 144 frames, that is, the first remaining time is predicted to be 2 ms, and the first scheduling operation is used based on the first remaining time to transfer the target data volume of audio data to the second buffer. By detecting the remaining space in the third buffer, that is, the remaining space in the audio playback buffer, if 48 frames of audio data can be consumed per 1 ms in the audio playback buffer, and the target remaining space is the buffer space for 240 frames of audio data volume, and the currently detected remaining space in the audio playback buffer is the buffer space for 192 frames of audio data volume, that is, the second remaining time is 1 ms, and the second scheduling operation is used based on the remaining time to transfer the audio data in the second buffer to the target remaining space in the audio playback buffer.
[0047] In some embodiments, the first scheduling operation at least includes a read operation and a first sleep operation.
[0048] When the first remaining time is less than or equal to a first preset time threshold, take the read operation.
[0049] When the first remaining time is greater than the first preset time threshold, take the first sleep operation.
[0050] Among them, the first preset time threshold may be 1 ms. When the remaining time is less than or equal to 1 ms, a reading operation is performed. When the remaining time is greater than 1 ms, a first sleep operation is performed. For example, if the current remaining time is 0.5 ms, the reading operation is adopted. If the current remaining time is 3 ms, the first sleep operation is performed. Those skilled in the art can adjust the preset time threshold according to the actual situation, and it is not limited thereto.
[0051] Optionally, the reading operation specifically includes: Determine whether the amount of audio data in the first buffer reaches the target data amount. If so, control the reading process to read the target data amount of audio data into the second buffer; otherwise, continue to detect the amount of audio data in the first buffer until it reaches the target data amount.
[0052] For example, if the target data amount is 240 frames and the current amount of audio data in the first buffer is 250 frames, that is, the amount of audio data in the first buffer reaches the target data amount, then control the reading process to read 240 frames of audio data from the first buffer into the second buffer; if the current amount of audio data in the first buffer is 200 frames, then by circularly detecting the amount of audio data in the first buffer until the amount of audio data reaches 240 frames, control the reading process to read the audio data.
[0053] Optionally, the first sleep operation specifically includes: Control the reading process to enter the sleep state until the amount of audio data in the first buffer reaches the target data amount, activate the reading process, and control the reading process to read the target data amount of audio data into the second buffer.
[0054] For example, if the current first remaining time is 5 ms and the first preset time threshold is 1 ms, then control the reading process to enter the sleep state. After waiting for 5 ms, the amount of audio data in the first buffer reaches the target data amount, activate the reading process, and control the reading process to read the target data amount of audio data into the second buffer.
[0055] Optionally, the second scheduling operation includes at least a writing operation and a second sleep operation.
[0056] When the second remaining time is less than or equal to the second preset time threshold, the writing operation is performed.
[0057] When the second remaining time is greater than the second preset time threshold, the second sleep operation is performed.
[0058] For example, in an in-vehicle KTV entertainment system, the audio playback buffer can consume 48 frames of audio data per 1 ms. The time required for the target remaining space can be 5 ms, and the second preset time threshold can be 1 ms. If it is currently detected that the remaining time for the remaining space in the audio playback buffer to reach the target remaining space is 1 ms, then the write operation is performed to write the audio data of the target data volume in the second buffer into the target remaining space. If it is currently detected that the remaining time for the remaining space in the audio playback buffer to reach the target remaining space is 2 ms, then the second sleep operation is performed. Those skilled in the art can adjust the second preset time threshold and the target remaining space according to the actual situation, and are not limited thereto.
[0059] Optionally, the write operation specifically includes: determining whether the remaining space reaches the target remaining space. If so, controlling the write process to write the audio data in the second buffer into the third buffer; otherwise, continuously detecting the remaining space in the third buffer until it reaches the target remaining space.
[0060] The second sleep operation specifically includes: Controlling the write process to enter the sleep state until the remaining space in the third buffer reaches the target remaining space, activating the write process, and controlling the write process to write the audio data in the second buffer into the third buffer.
[0061] For example, if there is still a remaining space of 96 frames of audio data in the third buffer, the target remaining space is 240 frames of audio data. The second preset time threshold is 1 ms, and the third buffer consumes 48 frames of audio data per 1 ms. Then the second remaining time is 3 ms, that is, the second remaining time is greater than the second preset time threshold. Control the write process to enter the sleep state. After sleeping for 3 ms, when the remaining time in the third buffer reaches the target remaining space, activate the write process and write the audio data in the second buffer into the target remaining space in the third buffer.
[0062] Optionally, retrieving the audio data of the target data volume to the second buffer further includes: Real-time monitoring of the amount of audio data in the second buffer.
[0063] Among them, when the amount of audio data in the second buffer is less than the minimum preset value, the audio data of the target data volume is increased to the second buffer through a preset management algorithm.
[0064] When the amount of audio data in the second buffer is greater than the maximum preset value, the audio data corresponding to the target remaining space in the second buffer is reduced through the preset management algorithm.
[0065] Among them, the preset management algorithm can be the WSOLA algorithm (Waveform Similarity Overlap-Add). The WSOLA algorithm maintains the periodic structure and fundamental frequency of the signal unchanged by finding the frame most similar to the previous frame within a range for superposition and stretching. Specifically, WSOLA intercepts a frame of signal from the original signal, and then finds another frame of signal most similar to this frame within an interval for superposition or stretching. Those skilled in the art can select other preset management algorithms according to the actual situation, not limited to this. For example, the OLA (Overlap-Add) can be directly adopted to implement. OLA is an audio signal processing technology that processes audio data through steps such as framing, windowing, overlapping, and superposition. The minimum preset value can mainly be 10 frames of audio data, and the maximum preset value can be 300 frames of audio data. When the amount of audio data in the second buffer is less than 10 frames of audio data, the audio data of the target data volume is increased to the second buffer through the preset management algorithm. When the amount of audio data in the second buffer is greater than 300 frames, the audio data corresponding to the target remaining space in the second buffer is reduced through the preset management algorithm. Those skilled in the art can adjust the maximum preset value and the minimum preset value according to the actual situation, not limited to this. For example, the minimum preset value can be set to 5 frames or even smaller, and the maximum preset value can be set to 301 or even larger.
[0066] Optionally, the second buffer is at least further provided with a start address and an end address.
[0067] Based on the start address, the audio data is written into or retrieved from the second buffer.
[0068] After the audio data is written into or retrieved from the second buffer, the positions of the start address and the end address are adjusted according to the amount of the audio data.
[0069] For example, when retrieving audio data of length len from the first buffer to the second buffer through the first scheduling operation, the start address in the second buffer will correspondingly increase by an address position of length len.
[0070] Embodiment 2: Please refer to Figure 2 , this application also proposes a system adopting the audio transmission method described in Embodiment 1, mainly including: a first detection module, a reading module, a second detection module, and a writing module.
[0071] Among them, the first detection module is used to detect the amount of audio data collected in the first buffer. The first buffer can mainly be a buffer for caching data after the audio acquisition device collects audio data. By detecting the amount of audio data in real time, it provides effective audio data for subsequent retrieval of audio data.
[0072] The reading module is used to predict and obtain the first remaining time for the target data volume based on the amount of audio data, and take a first scheduling operation based on the first remaining time, so as to retrieve the audio data of the target data volume to the second buffer based on the first scheduling operation. Among them, the second buffer is a buffer for temporarily storing audio data, and the size of the target data volume can be adjusted according to the actual situation. For example, the target data volume can be set to 240 frames of audio data.
[0073] The second detection module is used to detect the remaining space in the third buffer. The third buffer can mainly be a buffer for audio consumption or audio playback. For example, in a vehicle-mounted KTV entertainment system, the third buffer can be a buffer for a speaker or a signal processor.
[0074] And, the writing module is used to predict and obtain the second remaining time for the target remaining space based on the remaining space, and take a second scheduling operation based on the second remaining time, so as to write the audio data in the second buffer into the target remaining space in the third buffer based on the second scheduling operation. The target remaining space can be a buffer space for 240 frames of audio data. Those skilled in the art can select other target remaining spaces according to the actual situation, and are not limited thereto.
[0075] Embodiment 3: The present application also proposes a domain controller, including a computer-readable storage medium, and the computer-readable storage medium includes: The computer-readable storage medium stores computer-executable instructions.
[0076] When the computer-executable instructions are executed by a control processor, the audio transmission method described in Embodiment 1 is implemented.
[0077] In the computer-readable storage medium, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state disk (SSD)).
[0078] In summary, the audio transmission method, system, and storage medium proposed in the present application solve the problem that in the process of audio data transmission, due to the phenomenon of insufficient or overflowing data in the buffer, the rate of audio data generated by the microphone is consistent with the rate of audio data consumed by the digital signal processor, avoiding the problems of decreased sound quality and noise. By performing the first scheduling operation and the second scheduling operation to retrieve and write the audio data in the buffer, real-time adjustment of the audio data in the buffer is achieved, reducing the audio output delay caused by excessive buffering of audio data, ensuring the real-time nature of audio data transmission and the consistency of the audio generation and consumption rates, avoiding noise problems caused by insufficient or overflowing audio data, improving the sound quality, enabling the audio data to better handle emergencies during transmission, and enhancing the reliability and stability of audio data transmission.
[0079] In several embodiments provided in the present application, it can be understood that each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code includes one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved.
[0080] If the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing an electronic device to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.
[0081] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of this application. It should be understood that the above description is only the specific embodiments of this application and is not used to limit the protection scope of this application. It is particularly pointed out that for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included in the protection scope of this application.
Claims
1. An audio transmission method, characterized in that: A first buffer area for audio acquisition, a second buffer area for temporary audio storage, and a third buffer area for audio processing are preset, and the audio transmission method includes: Detecting the amount of audio data collected in the first buffer; Predicting a first remaining time of a target data volume based on the audio data volume, and taking a first scheduling operation based on the first remaining time to retrieve the audio data of the target data volume to a second buffer area based on the first scheduling operation; Detecting remaining space in the third buffer area; A second remaining time of the target remaining space is obtained based on the remaining space prediction, and a second scheduling operation is taken based on the second remaining time to write the audio data in the second buffer area into the target remaining space in the third buffer area based on the second scheduling operation.
2. The audio transmission method according to claim 1, characterized in that: The first scheduling operation at least includes a read operation and a first sleep operation; When the first remaining time is less than or equal to a first preset time threshold, taking the reading operation; When the first remaining time is greater than a first preset time threshold, the first sleep operation is performed.
3. The audio transmission method according to claim 2, characterized in that: The reading operation specifically includes: Determine whether the amount of audio data in the first buffer area has reached the target data amount. If so, control the reading process to read the audio data of the target data amount to the second buffer area; otherwise, continue to detect the amount of audio data in the first buffer area until it reaches the target data amount.
4. The audio transmission method according to claim 2, characterized in that: The first sleep operation specifically includes: The reading process is controlled to enter a dormant state until the amount of audio data in the first buffer area reaches the target data amount, the reading process is activated, and the reading process is controlled to read the audio data of the target data amount into the second buffer area.
5. The audio transmission method according to claim 1, characterized in that: The second scheduling operation at least includes a write operation and a second sleep operation; When the second remaining time is less than or equal to a second preset time threshold, taking the write operation; When the second remaining time is greater than a second preset time threshold, the second sleep operation is performed.
6. The audio transmission method according to claim 4, characterized in that: The write operation specifically includes: determining whether the remaining space reaches the target remaining space, and if so, controlling the write process to write the audio data in the second buffer area into the third buffer area; otherwise, continuing to detect the remaining space in the third buffer area until the target remaining space is reached; The second sleep operation specifically includes: The writing process is controlled to enter a dormant state until the remaining space of the third buffer area reaches the target remaining space, the writing process is activated, and the writing process is controlled to write the audio data in the second buffer area into the third buffer area.
7. The audio transmission method according to claim 6, characterized in that: The step of retrieving the target amount of audio data to the second buffer area further includes: monitoring the amount of audio data in the second buffer in real time; Wherein, when the amount of audio data in the second buffer area is less than a minimum preset value, adding a target amount of audio data to the second buffer area through a preset management algorithm; When the amount of audio data in the second buffer area is greater than a maximum preset value, the audio data corresponding to the target remaining space in the second buffer area is reduced by the preset management algorithm.
8. The audio transmission method according to claim 7, characterized in that: The second buffer area is also provided with at least a start address and an end address; Writing or retrieving the audio data in the second buffer area based on the starting address; After the audio data is written into or retrieved from the second buffer area, the positions of the start address and the end address are adjusted according to the data volume of the audio data.
9. A system based on the audio transmission method according to any one of claims 1 to 8, characterized in that: The system comprises: A first detection module, used to detect the amount of audio data collected in the first buffer area; a reading module, configured to predict and obtain a first remaining time of a target data volume based on the audio data volume, and to perform a first scheduling operation based on the first remaining time, so as to retrieve the audio data of the target data volume to a second buffer area based on the first scheduling operation; A second detection module, used to detect the remaining space in the third buffer area; And, a writing module is used to obtain a second remaining time of the target remaining space based on the remaining space prediction, and to take a second scheduling operation based on the second remaining time to write the audio data in the second buffer area into the target remaining space in the third buffer area based on the second scheduling operation.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by the control processor, the audio transmission method as described in any one of claims 1-8 is implemented.