Audio transmission method and audio system
By dividing the wireless audio transmission process into four time periods of a fixed time period and maintaining the consistent duration of the time during each audio transmission cycle, the delay and lag caused by fluctuations in audio encoding and wireless transmission time is solved, and the time stability and user experience of audio data transmission are improved.
Patent Information
- Application Number
- CN202311096200.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
During wireless audio transmission, fluctuations in audio encoding and wireless transmission time cause audio delays or lags, affecting the user experience.
By dividing the audio transmission process into four periods of fixed time: acquisition, encoding, transmission and decoding, and maintaining the same duration throughout each audio transmission cycle, ensuring that each stage is completed within a fixed time.
It realizes the time stability of audio data transmission, avoids delays and lags, and improves the user experience.
Smart Images

Figure CN119545504A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of audio transmission, and in particular to an audio transmission method and an audio system. Background Art
[0002] Wireless transmission technology plays a very important role in the transmission of audio, video, etc. For example, the application of various wireless transmission technologies such as Wifi (Wireless Fidelity), Bluetooth and Zigbee is becoming more and more extensive. Nowadays, more attention is paid to the transmission quality of wirelessly transmitted audio or video.
[0003] The study found that in the wireless transmission process, including audio sampling, audio encoding, audio wireless transmission, audio decoding and other transmission stages, usually, the audio sampling and audio decoding transmission stages are completed within a fixed time, but due to the different high-frequency and low-frequency data included in the audio data, the time of the audio encoding stage is not fixed. For example, for 2.5 milliseconds of audio data, the audio encoding time is 1.7 milliseconds-2.3 milliseconds, and due to the different amounts of data included in the audio data, there are time fluctuations in the audio wireless transmission. Since the encoding time and the wireless transmission time fluctuate greatly, when the audio encoding time and the audio wireless transmission time of the current and subsequent audio data are longer, it is easy to cause delays in the continuous external audio output. However, when the audio encoding time and the audio wireless transmission time of the current and subsequent audio data are shorter, the external audio output will be stuck, which seriously affects the user experience. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides an audio transmission method and an audio system, in which each stage of audio data transmission is completed within a fixed time period, ensuring the time stability of audio data transmission, effectively alleviating the problem of audio delay or freeze, and greatly improving the user experience.
[0005] In a first aspect, an embodiment of the present invention provides a method for audio transmission, wherein the method is applied to an audio sending end, and the method includes:
[0006] For each audio transmission cycle, audio data is collected in the first time period of the audio transmission cycle; wherein the duration of each audio transmission cycle is the same;
[0007] In the second period of the audio transmission cycle, the audio data is encoded to obtain encoded audio data;
[0008] In the third time period of the audio transmission cycle, when a data acquisition request is received from the audio receiving end, the encoded audio data is packaged and sent to the audio receiving end, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain audio data.
[0009] In a possible implementation, the method further includes:
[0010] In the second time period, the encoded audio data is stored in a first cache unit; wherein the first storage unit is deployed at the audio sending end.
[0011] In a second aspect, an embodiment of the present invention provides a method for audio transmission, wherein the method is applied to an audio receiving end, and the method includes:
[0012] For each audio transmission cycle, in the third period of the audio transmission cycle, sending a data acquisition request to the audio sending end;
[0013] Receiving the encoded audio data sent by the audio transmitting end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0014] In the fourth time period of the audio transmission cycle, the encoded audio data is decoded to obtain audio data.
[0015] In a possible implementation, the method further includes:
[0016] In a third time period, the received encoded audio data is stored in a second cache unit; wherein the second cache unit is deployed at the audio receiving end, and the second cache unit is a cache for storing the encoded audio data.
[0017] In a possible implementation, before decoding the encoded audio data, the method further includes:
[0018] monitoring whether the encoded audio data is read from the second cache unit;
[0019] When it is detected that no encoded audio data is read from the second cache unit, acquiring the previous frame of audio data;
[0020] New audio data is obtained based on the previous frame of audio data using a pitch synchronization algorithm.
[0021] In a possible implementation, the method further includes:
[0022] When it is detected that the packaged encoded audio data sent by the audio sending end in response to the data acquisition request is not received, the data acquisition request is resent to the audio sending end until the encoded audio data is received within the third time period.
[0023] In a possible implementation, the method further includes:
[0024] In a third period, sending a control request to the audio sending end;
[0025] Count the total duration of receiving encoded audio data;
[0026] Determine whether the total duration is greater than a preset duration threshold;
[0027] When it is determined that the total duration is less than or equal to the preset duration threshold, receiving a control data packet sent by the audio transmitting end in response to the control request in a third time period;
[0028] In a possible implementation, the method further includes:
[0029] When it is determined that the total duration is greater than the preset duration threshold, a control data packet sent by the audio sending end in response to the control request is received in the fourth time period, or a control data packet sent by the audio sending end in response to the control request is received in the third time period of the next audio transmission cycle of the audio transmission cycle.
[0030] In a possible implementation, the method further includes:
[0031] When it is detected that the control data packet sent by the audio sending end in response to the control request is not received, the control request is resent to the audio sending end until the control data packet is received in the third time period, the fourth time period or the third time period of the next audio transmission cycle.
[0032] In a possible implementation, the method further includes:
[0033] In the fourth time period of the audio transmission cycle or the fourth time period of the next audio transmission cycle, decoding the control data packet to obtain control data;
[0034] The control data and the audio data are sent to the audio player, so that the audio player performs audio control and playback on the audio data based on the control data.
[0035] In a third aspect, an embodiment of the present invention provides an audio transmission device, wherein the device is applied to an audio sending end, and the device includes:
[0036] A collection module, used for collecting audio data in a first period of each audio transmission cycle; wherein the duration of each audio transmission cycle is the same;
[0037] The encoding processing module is used to encode the audio data in the second period of the audio transmission cycle to obtain encoded audio data;
[0038] The receiving and sending module is used to package the encoded audio data and send it to the audio receiving end when a data acquisition request is received from the audio receiving end in the third time period of the audio transmission cycle, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain audio data.
[0039] In a fourth aspect, an embodiment of the present invention provides an audio transmission device, wherein the device is applied to an audio receiving end, and the device includes:
[0040] A sending module, used for sending a data acquisition request to the audio sending end in a third time period of each audio transmission cycle;
[0041] A receiving module, used to receive the encoded audio data sent by the audio sending end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0042] The decoding processing module is used to decode the encoded audio data in the fourth time period of the audio transmission cycle to obtain audio data.
[0043] In a fifth aspect, an embodiment of the present invention provides an audio system, wherein the audio system includes a clock-synchronized audio transmitter and an audio receiver, wherein the audio transmitter is used to execute the above-mentioned audio transmission method, and the audio receiver is used to execute the above-mentioned audio transmission method.
[0044] The audio transmission method and audio system provided by the embodiment of the present invention include, for each audio transmission cycle, in the first time period of the audio transmission cycle, collecting audio data; in the second time period of the audio transmission cycle, encoding the audio data to obtain the encoded audio data; in the third time period of the audio transmission cycle, when receiving the data acquisition request sent by the audio receiving end, the encoded audio data is packaged and sent to the audio receiving end, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain the audio data. Compared with the problem of audio delay or jamming caused by the non-fixed audio encoding time and transmission time due to the different audio data amounts in the existing audio transmission process, the present invention can make the four transmission stages of audio data transmission completed within the fixed time period of the audio transmission cycle in each audio transmission cycle with the same duration, which can be understood as that the audio encoding time and audio wireless transmission time of the two audio data before and after the audio transmission process are the same, and stable audio can be continuously output to the outside. Therefore, the audio transmission method provided by the present invention ensures the time stability of the transmission of the two audio data before and after, thereby effectively alleviating the problem of audio delay or jamming caused by the large fluctuation of audio encoding and audio wireless transmission time during the audio data transmission process, and greatly improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of the structure of an audio system provided by an embodiment of the present invention;
[0046] Figure 2 A flowchart of an embodiment of a method for audio transmission provided by an embodiment of the present invention;
[0047] Figure 3 A timing diagram of audio transmission provided by an embodiment of the present invention;
[0048] Figure 4 A flowchart of another audio transmission method provided by an embodiment of the present invention;
[0049] Figure 5 A flowchart of another audio transmission method provided by an embodiment of the present invention;
[0050] Figure 6 A flowchart of another audio transmission method provided by an embodiment of the present invention;
[0051] Figure 7 A schematic diagram of the structure of another audio system provided by an embodiment of the present invention;
[0052] Figure 8 A block diagram of an embodiment of an audio transmission device provided by an embodiment of the present invention;
[0053] Fig. 9 A block diagram of another embodiment of an audio transmission device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] To facilitate understanding of the embodiments of the present invention, specific embodiments will be further explained below in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present invention.
[0056] To facilitate understanding of this embodiment, the following first describes in detail the audio transmission method provided by the embodiment of the present invention. The execution subject is the audio sending end in the audio system, such as Figure 1 The following is a schematic diagram of the structure of the audio system. Figure 1 As shown, the audio system includes a clock-synchronized audio transmitter 100 and an audio receiver 101. In one embodiment, the audio receiver 101 can be connected to multiple audio transmitters 100. Figure 1 The example of connecting two audio transmitting terminals 100 and one audio receiving terminal 101 is used for illustration. In this embodiment, the audio transmitting terminal and the audio receiving terminal need to be in clock synchronization in order to execute the audio transmission method provided in this embodiment to achieve the time stability of audio data transmission.
[0057] In one implementation, clock synchronization can be achieved by a synchronization clock deployed on the audio transmitter and a synchronization clock deployed on the audio receiver, wherein the clock synchronization process can be described as follows: the synchronization clock on the audio receiver records the local clock of the local terminal, and sends the local clock of the audio receiver to the synchronization clock of each audio transmitter, and the synchronization clock of the audio transmitter increases the data transmission time on the basis of the local clock and then synchronizes to the synchronization clock of the audio receiver, at which point the audio receiver completes synchronization with the clock of each audio transmitter. In order to avoid clock deviation, the audio transmitter and the audio receiver need to perform clock synchronization regularly.
[0058] The following describes a method for audio transmission in detail, taking the execution subject as an audio transmitter in an audio system as an example. Figure 2 , is a flow chart of an embodiment of an audio transmission method provided by an embodiment of the present invention. Figure 2 As shown, the process may include the following steps:
[0059] Step 201, for each audio transmission cycle, in the first time period of the audio transmission cycle, collect audio data;
[0060] Among them, the duration of each audio transmission cycle is the same, and each audio transmission cycle includes four time periods, namely the first time period, the second time period, the third time period and the fourth time period, so as to complete the corresponding audio transmission stage in each time period, wherein the duration of the first time period, the second time period, the third time period and the fourth time period can be the same or different. For example, the duration of the audio transmission cycle is 20ms in total, and the duration of the first time period, the second time period, the third time period and the fourth time period are 5ms respectively; or, the first time period is 6ms, the second time period is 4ms, the third time period is 5ms, and the fourth time period is 5ms. The specific duration of each time period is determined according to the processing performance of the audio data by the audio sending end and the audio receiving end, and is not limited here.
[0061] In this embodiment, the first period of the audio transmission cycle is used to complete the audio data collection, which can be understood as the first period of each audio transmission cycle is used to collect audio data. Figure 3 A timing diagram of audio transmission is shown, taking the same duration of each period of the audio transmission cycle as an example for illustration, wherein T1 to T4 are the current audio transmission cycle (the first audio transmission cycle), T2 to T5 are the next audio transmission cycle (the second audio transmission cycle), and T3 to T6 ( Figure 3 (not shown) is the next audio transmission cycle (the third audio transmission cycle), and so on and so forth and will not be described in detail here.
[0062] Among them, the audio transmitter samples audio data 1 in the T1 period of the first audio transmission cycle (T1 is the first period of the first audio transmission cycle), and completes the collection of audio data 1 within the T1 period; the audio transmitter samples audio data 2 in the T2 period of the second audio transmission cycle (T2 is the first period of the second audio transmission cycle), and completes the collection of audio data 2 within the T2 period; the audio transmitter samples audio data 3 in the T3 period of the third audio transmission cycle (T3 is the first period of the third audio transmission cycle), and completes the collection of audio data 3 within the T3 period; the audio transmitter samples audio data 4 in the T4 period of the fourth audio transmission cycle (T4 is the first period of the fourth audio transmission cycle), and completes the collection of audio data 4 within the T4 period; the audio transmitter samples audio data 5 in the T5 period of the fifth audio transmission cycle (T5 is the first period of the fifth audio transmission cycle), and completes the collection of audio data 5 within the T5 period, and so on, which will not be repeated here.
[0063] In actual application, if the duration of each time period in the audio transmission cycle is different, each audio transmission cycle needs to be reset according to the preset duration of each time period. For example, the duration of the first time period T1 of the first audio transmission cycle is 6ms, the duration of the second time period T2 is 4ms, the duration of the third time period T3 is 3ms, and the duration of the fourth time period T4 is 7ms. Then in the second audio transmission cycle, since T2 is the first time period of the second audio transmission cycle, the duration of T2 is set to 6ms, T3 is the second time period of the second audio transmission cycle, so the duration of T3 is set to 4ms, T4 is the third time period of the second audio transmission cycle, so the duration of T4 is set to 3ms, T5 is the fourth time period of the second audio transmission cycle, so the duration of T5 is set to 7ms, and the duration settings of each time period of subsequent audio transmission cycles are the same as above, which will not be repeated here.
[0064] Step 202, in the second period of the audio transmission cycle, encoding the audio data to obtain encoded audio data;
[0065] In specific implementation, the second time period of the audio transmission cycle is used to complete the audio data encoding process, which can be understood as the second time period of each audio transmission cycle is used to perform audio data encoding process.
[0066] For ease of understanding, Figure 3 As shown, the audio transmitter encodes the audio data 1 in the T2 period of the first audio output cycle (T2 is the second period of the first audio transmission cycle), and completes the encoding of the audio data 1 within the T2 period; the audio transmitter encodes the audio data 2 in the T3 period of the second audio transmission cycle (T3 is the second period of the second audio transmission cycle), and completes the encoding of the audio data 2 within the T3 period; the audio transmitter encodes the audio data 3 in the T4 period of the third audio transmission cycle (T4 is the second period of the third audio transmission cycle), and completes the encoding of the audio data 3 within the T4 period; the audio transmitter encodes the audio data 4 in the T5 period of the fourth audio transmission cycle (T5 is the second period of the fourth audio transmission cycle), and completes the encoding of the audio data 4 within the T5 period; the audio transmitter encodes the audio data 5 in the T6 period of the fifth audio transmission cycle (T6 is the second period of the fifth audio transmission cycle), and completes the encoding of the audio data 5 within the T6 period, and so on, which will not be repeated here.
[0067] Among them, the method of encoding audio data in this embodiment can be implemented using existing encoding technology, which will not be described in detail here; in the specific implementation, in order to avoid the loss of encoded audio data, the encoded audio data can be stored in the first cache unit in the second time period; the above-mentioned first cache unit is a cache deployed on the audio sending end.
[0068] Step 203, in the third time period of the audio transmission cycle, when a data acquisition request sent by the audio receiving end is received, the encoded audio data is packaged and sent to the audio receiving end, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain audio data.
[0069] When the audio receiving end needs to start this round of communication in the third time period, it sends a data acquisition request to the audio sending end to establish data communication to realize audio wireless transmission of audio data. Specifically, when the audio receiving end sends the data acquisition request to the audio sending end, the audio sending end extracts the identification information about the audio receiving end in the data acquisition request, and then the audio sending end takes out the encoded audio data stored in the first cache unit, packages it with the identification information, and then sends it to the audio receiver corresponding to the identification information.
[0070] The existing audio wireless transmission of different audio data has a problem of large time fluctuations. To solve this problem, in this embodiment, the audio transmitter is required to complete the audio wireless transmission of all encoded audio data within the third time period to ensure that the audio receiver completes audio decoding within the fourth period of the audio transmission cycle.
[0071] For ease of understanding, Figure 3 As shown, the audio transmitter will package and send the encoded audio data 1 to the audio receiving end in the T3 period of the first audio output cycle (T3 is the third period of the first audio transmission cycle), and complete the transmission of the encoded audio data 1 within the T3 period; the audio transmitter will package and send the encoded audio data 2 to the audio receiving end in the T4 period of the second audio transmission cycle (T4 is the third period of the second audio transmission cycle), and complete the transmission of the encoded audio data 2 within the T4 period; the audio transmitter will package and send the encoded audio data 3 to the audio receiving end in the T5 period of the third audio transmission cycle (T5 is the third period of the third audio transmission cycle), and complete the transmission of the encoded audio data 3 within the T5 period; the transmission process of the encoded audio data 4 and the encoded audio data 5 is the same, and will not be repeated here.
[0072] Since the audio receiver needs to continuously play audio data to the outside, decoding processing is required after receiving the encoded audio data. In this embodiment, audio decoding can be completed within the fourth time period of the audio transmission cycle; wherein, the encoded audio data can be decoded using a decoding method corresponding to the encoding method, which is not described in detail here.
[0073] like Figure 3 As shown, the audio receiver decodes the encoded audio data 1 in the T4 period of the first audio output cycle (T4 is the fourth period of the first audio transmission cycle), and completes the decoding of the encoded audio data 1 within the T4 period; the audio receiver decodes the encoded audio data 2 in the T5 period of the second audio transmission cycle (T5 is the fourth period of the second audio transmission cycle), and completes the decoding of the encoded audio data 2 within the T5 period; the decoding process of the encoded audio data 3, the encoded audio data 4 and the encoded audio data 5 is the same as above and will not be repeated here.
[0074] Through the description of the entire audio transmission process, it can be seen that there is time overlap between different audio transmission cycles. For example, time period T2 is both the second time period of the first audio transmission cycle and the first time period of the second audio transmission cycle; time period T3 is both the third time period of the first audio transmission cycle and the second time period of the second audio transmission cycle, and the first time period of the third audio transmission cycle; time period T4 is both the fourth time period of the first audio transmission cycle and the third time period of the second audio transmission cycle, and the second time period of the third audio transmission cycle and the first time period of the fourth audio transmission cycle; and so on, which will not be repeated here.
[0075] The audio transmission method provided by the embodiment of the present invention includes, for each audio transmission cycle, collecting audio data in the first time period of the audio transmission cycle; in the second time period of the audio transmission cycle, encoding the audio data to obtain the encoded audio data; in the third time period of the audio transmission cycle, when receiving the data acquisition request sent by the audio receiving end, packaging the encoded audio data and sending it to the audio receiving end, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain the audio data. Compared with the problem of audio delay or jamming caused by the non-fixed audio encoding time and transmission time due to the different audio data amounts in the existing audio transmission process, the present invention can make the four transmission stages of audio data transmission completed within the fixed time period of the audio transmission cycle in each audio transmission cycle with the same duration, which can be understood as that the audio encoding time and audio wireless transmission time of the two audio data before and after the audio transmission process are the same, and stable audio can be continuously output to the outside. Therefore, the audio transmission method provided by the present invention ensures the time stability of the transmission of the two audio data before and after, effectively alleviates the problem of audio delay or jamming caused by the large fluctuation of audio encoding and audio wireless transmission time in the audio data transmission process, and greatly improves the user experience.
[0076] The following describes a method for audio transmission in detail, taking the execution subject as an audio receiving end in an audio system as an example. Figure 4 , is a flow chart of another embodiment of an audio transmission method provided by an embodiment of the present invention. Figure 4 As shown, the process may include the following steps:
[0077] Step 401, for each audio transmission cycle, in the third time period of the audio transmission cycle, sending a data acquisition request to the audio sending end;
[0078] Step 402, receiving the encoded audio data sent by the audio transmitting end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0079] Step 403: In the fourth time period of the audio transmission cycle, the encoded audio data is decoded to obtain audio data.
[0080] The implementation process of the above steps 401 to 403 can be found in Figure 2The corresponding audio transmission implementation process is not described in detail here. Similarly, another audio transmission method provided by this embodiment can be implemented in each audio transmission cycle of the same duration, so that the four transmission stages of audio data transmission are completed within a fixed time period of the audio transmission cycle, that is, the audio encoding time and audio wireless transmission time of the two audio data before and after the audio transmission process are the same, and stable audio can be continuously output to the outside, ensuring the time stability of audio data transmission, effectively alleviating the audio delay or freeze caused by large time fluctuations during audio data transmission, and greatly improving the user experience.
[0081] exist Figure 4 Based on Figure 5 , is a flow chart of another embodiment of an audio transmission method provided by an embodiment of the present invention. Figure 5 As shown, the process may include the following steps:
[0082] Step 501, for each audio transmission cycle, in the third time period of the audio transmission cycle, sending a data acquisition request to the audio sending end;
[0083] Step 502, receiving the encoded audio data sent by the audio transmitting end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0084] Step 503, storing the received encoded audio data in a second cache unit;
[0085] In actual use, in order to prevent the received coded audio data from being lost, the audio receiving end may store the received coded audio data in the second cache unit during the third period, so as to ensure that the coded audio data can be normally obtained for decoding processing during the fourth period. The second cache unit is deployed at the audio receiving end, and the second cache unit is a cache for storing coded audio data.
[0086] Due to the large fluctuations in the audio encoding time and the audio wireless transmission time, the time interval for the audio receiving end to receive each frame of encoded audio data from the audio transmitting end fluctuates greatly. For the audio system, the audio receiving end needs to open a multi-frame cache unit to store the encoded audio data to alleviate the audio delay and jamming problems caused by the time fluctuations in the audio encoding time and the audio wireless transmission time. However, opening up multiple frame storage units will cause the problem of increased delay. In this embodiment, since the time when the audio receiving end receives the encoded audio data is stable, it is only necessary to open up a second cache unit for storing one frame of encoded audio data, which effectively alleviates the problem of increased delay caused by opening multiple frame cache units, thereby realizing the low latency function of the audio system.
[0087] Step 504, in the fourth period of the audio transmission cycle, monitoring whether the encoded audio data is read from the second cache unit;
[0088] In the fourth time period, the audio receiving end reads the encoded audio data sent by each audio sending end from the second cache unit. If the audio data packet is read, the audio decoding is started, that is, step 507 is executed; if the audio data packet is not read, it is considered that the audio data is lost, and the PLC (Programmable Logic Controller) is started to recover the lost audio data, and steps 505 to 506 need to be executed.
[0089] Step 505, obtaining the previous frame of audio data;
[0090] The previous frame of audio data is audio data obtained by decoding in the fourth time period of the previous audio transmission cycle.
[0091] Step 506, obtaining new audio data using a pitch synchronization algorithm based on the previous frame of audio data;
[0092] According to the previous frame of audio data, the pitch synchronization algorithm is used to predict new audio data related to the previous frame of audio data, thereby ensuring that no sound loss occurs. Among them, the process of predicting audio data using the pitch synchronization algorithm is a prior art content and will not be described in detail here.
[0093] Step 507: Decode the encoded audio data to obtain audio data.
[0094] exist Figure 4 Based on Figure 6 , is a flow chart of another embodiment of an audio transmission method provided by an embodiment of the present invention. Figure 6 As shown, the process may include the following steps:
[0095] Step 601, for each audio transmission cycle, in the third time period of the audio transmission cycle, sending a data acquisition request and a control request to the audio transmitting end;
[0096] Among them, the control request is used to request control data. The above control data can control the playback of audio data, such as the volume of the audio, the playback speed, etc. In specific implementation, the control data can also control the interaction between the audio transmitter and the audio receiver, such as gain, opening / closing recording, etc. The specific control data can be set according to actual needs and is not limited here. In specific implementation, for each audio data transmission process, the control request can be sent or not, and is set according to actual needs and is not limited here.
[0097] In addition to clock synchronization and request interaction with the audio transmitter, the audio receiver does not need to interact with other information, which simplifies the audio system, reduces interaction, is not easily interfered with during wireless transmission, and makes wireless transmission more stable.
[0098] Step 602, receiving the encoded audio data sent by the audio transmitting end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0099] When the transmission of encoded audio data fails, the number of retransmissions of the encoded audio data can be increased to improve anti-interference performance. Specifically, when it is monitored that the packaged encoded audio data sent by the audio sending end in response to the data acquisition request is not received, the data acquisition request is resent to the audio sending end until the encoded audio data is received within the third time period, so as to ensure that the audio receiving end can decode the received encoded audio data in the fourth time period without sound loss.
[0100] Step 603, counting the total duration of receiving the encoded audio data;
[0101] In this embodiment, when the audio sending end needs to send the encoded audio data and the control data packet corresponding to the control request to the audio receiving end, the audio sending end gives priority to sending the encoded audio data, and sends the control data packet only after sending the encoded audio data. The audio receiving end must complete the transmission (including retransmission) of all the encoded audio data within the third time period. Due to the time limit of the third time period, the encoded audio data may be retransmitted multiple times. At this time, there may not be enough time to send the control data packet after the encoded audio data is sent in the third time period. Then, the control data packet is postponed to the subsequent time period (the fourth time period or the third time period of the next audio transmission cycle) for transmission until it is sent successfully.
[0102] In order to determine whether the control data packet is transmitted in the third time period or in the subsequent time period, it is necessary to first count the total duration of receiving the encoded audio data (including the retransmission duration) to determine whether the control data packet sent by the audio transmitter is received in the third time period through the total duration.
[0103] Step 604, determining whether the total duration is greater than a preset duration threshold;
[0104] Among them, the preset time threshold is the duration of the third time period minus the duration of the control data packet transmission. For example, the third time period is 2.5 milliseconds, and the control data packet transmission duration is 0.5 milliseconds, then the preset time threshold is 2 milliseconds. Specifically, when the total duration is less than or equal to 2 milliseconds, there is still time to transmit the control data packet in the third time period. When the total duration is greater than 2 milliseconds, it means that there is no time to transmit the control data packet in the third time period. Therefore, the control data packet needs to be delayed to the subsequent time period for transmission.
[0105] Specifically, when it is determined that the total duration is less than or equal to the preset duration threshold, step 605 is executed; when it is determined that the total duration is greater than the preset duration threshold, step 606 is executed.
[0106] Step 605, receiving a control data packet sent by the audio transmitting end in response to the control request in a third time period;
[0107] Step 606, receiving a control data packet sent by the audio transmitting end in response to the control request in a fourth time period, or receiving a control data packet sent by the audio transmitting end in response to the control request in a third time period of the next audio transmission cycle of the audio transmission cycle;
[0108] Step 607, in the fourth time period of the audio transmission cycle, decoding the encoded audio data to obtain audio data;
[0109] Step 608, in the fourth time period of the audio transmission cycle or the fourth time period of the next audio transmission cycle, decoding the control data packet to obtain control data;
[0110] In one embodiment, the lost control data can also be re-requested. Specifically, when it is monitored that the control data packet sent by the audio sending end in response to the control request is not received, the control request is re-sent to the audio sending end until the control data packet is received in the third time period, the fourth time period or the third time period of the next audio transmission cycle.
[0111] In actual use, in order to ensure the reliability of control data, the terminal connected to the audio system needs to have a retransmission mechanism for the control data, that is, the terminal sends a control request to the audio receiving end, and the audio receiving end sends the control request to the audio sending end again to receive the control data packet again. When the control data packet received again is different from the control data packet received last time, the control data packet received again can replace the control data packet received last time.
[0112] Step 609: Send the control data and the audio data to the audio player, so that the audio player performs audio control and playback on the audio data based on the control data.
[0113] exist Figure 1 Based on Figure 7 The audio system further includes an audio player 700, which is connected to the audio receiving terminal 101 so that the audio receiving terminal sends audio data and control data to the audio player to control the audio playback.
[0114] Corresponds to Figure 2 The audio transmission method provided by the present invention provides an audio transmission device, see Figure 8 , is a block diagram of an embodiment of an audio transmission device provided by an embodiment of the present invention, and the device is applied to an audio transmitting end, such as Figure 8 As shown, the device comprises:
[0115] The acquisition module 801 is used to acquire audio data in the first time period of each audio transmission cycle; wherein the duration of each audio transmission cycle is the same;
[0116] The encoding processing module 802 is used to encode the audio data in the second period of the audio transmission cycle to obtain encoded audio data;
[0117] The receiving and sending module 803 is used to package the encoded audio data and send it to the audio receiving end when a data acquisition request is received from the audio receiving end in the third time period of the audio transmission cycle, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain the audio data.
[0118] Corresponds to Figure 4 The audio transmission method provided by the present invention provides another audio transmission device, see Fig. 9 , is a block diagram of another embodiment of an audio transmission device provided by an embodiment of the present invention, the device is applied to an audio receiving end, such as Fig. 9 As shown, the device comprises:
[0119] The sending module 901 is used to send a data acquisition request to the audio sending end in the third time period of each audio transmission cycle;
[0120] The receiving module 902 is used to receive the encoded audio data sent by the audio transmitting end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle;
[0121] The decoding processing module 903 is used to decode the encoded audio data in the fourth time period of the audio transmission cycle to obtain audio data.
[0122] An embodiment of the present invention further provides an electronic device, wherein the electronic device includes the above-mentioned audio system.
[0123] The electronic devices are devices that can support audio playback, such as mobile phones, computers, tablets, televisions and other electronic devices. Since the audio system is installed on the electronic device, it is effectively guaranteed that there will be no audio delay or freeze when the electronic device is playing audio, which brings a good user experience to the user, greatly improves the user's preference for the electronic device, and can increase the sales of the electronic device.
[0124] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0125] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0126] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for audio transmission, characterized in that: The method is applied to an audio transmitting end, and the method comprises: For each audio transmission cycle, audio data is collected in the first time period of the audio transmission cycle; wherein the duration of each audio transmission cycle is the same; In a second time period of the audio transmission cycle, encoding the audio data to obtain encoded audio data; In the third time period of the audio transmission cycle, when a data acquisition request is received from the audio receiving end, the encoded audio data is packaged and sent to the audio receiving end, so that the audio receiving end decodes the encoded audio data in the fourth time period of the audio transmission cycle to obtain the audio data.
2. The method according to claim 1, characterized in that The method further comprises: During the second time period, the encoded audio data is stored in a first cache unit; wherein the first storage unit is deployed at the audio sending end.
3. A method for audio transmission, characterized in that: The method is applied to an audio receiving end, and the method comprises: For each audio transmission cycle, during a third period of the audio transmission cycle, sending a data acquisition request to the audio sending end; Receiving the encoded audio data sent by the audio sending end in response to the data acquisition request; wherein the encoded audio data is obtained by encoding the audio data in the second time period of the audio transmission cycle, and the audio data is collected in the first time period of the audio transmission cycle; In a fourth time period of the audio transmission cycle, the encoded audio data is decoded to obtain the audio data.
4. The method according to claim 3, characterized in that The method further comprises: In the third time period, the received encoded audio data is stored in a second cache unit; wherein the second cache unit is deployed at the audio receiving end, and the second cache unit is a cache for storing the encoded audio data.
5. The method according to claim 4, characterized in that Before decoding the encoded audio data, the method further includes: monitoring whether the encoded audio data is read from the second cache unit; When it is detected that the encoded audio data is not read from the second cache unit, acquiring a previous frame of audio data; New audio data is obtained based on the previous frame of audio data using a pitch synchronization algorithm.
6. The method according to claim 3, characterized in that The method further comprises: When it is detected that the packaged encoded audio data sent by the audio sending end in response to the data acquisition request is not received, the data acquisition request is resent to the audio sending end until the encoded audio data is received within the third time period.
7. The method according to claim 3, characterized in that The method further comprises: In the third time period, sending a control request to the audio sending end; Counting the total duration of receiving the encoded audio data; Determine whether the total duration is greater than a preset duration threshold; When it is determined that the total duration is less than or equal to the preset duration threshold, a control data packet sent by the audio sending end in response to the control request is received in the third time period.
8. The method according to claim 7, characterized in that The method further comprises: When it is determined that the total duration is greater than the preset duration threshold, a control data packet sent by the audio transmitter in response to the control request is received in the fourth time period, or a control data packet sent by the audio transmitter in response to the control request is received in the third time period of the next audio transmission cycle of the audio transmission cycle.
9. The method according to claim 7, characterized in that: The method further comprises: When it is detected that the control data packet sent by the audio sending end in response to the control request is not received, the control request is resent to the audio sending end until the control data packet is received in the third time period, the fourth time period or the third time period of the next audio transmission cycle.
10. The method according to claim 7, characterized in that The method further comprises: In the fourth time period of the audio transmission cycle or the fourth time period of the next audio transmission cycle, decoding the control data packet to obtain control data; The control data and the audio data are sent to an audio player, so that the audio player performs audio control and playback on the audio data based on the control data.
11. An audio system, characterized in that: The audio system includes a clock-synchronized audio transmitter and an audio receiver, wherein the audio transmitter is used to execute the audio transmission method described in any one of claims 1 to 2, and the audio receiver is used to execute the audio transmission method described in any one of claims 3 to 10.