Disclosure of Invention
The application provides an audio transmission method and electronic equipment, which can solve the problems of high computational complexity and high power consumption of the existing audio transmission method.
In a first aspect, the application provides an audio transmission method, which comprises the steps that first equipment receives noise energy data and transmission efficiency data from second equipment, wherein the noise energy data are used for indicating noise energy or noise loudness, the transmission efficiency data are used for indicating the quality of a wireless channel between the first equipment and the second equipment, the first equipment determines a first code rate according to the noise energy data and determines a second code rate according to the transmission efficiency data, the first equipment encodes an audio stream according to a code rate with a smaller value in the first code rate and the second code rate to obtain audio data, and the first equipment sends the audio data to the second equipment.
In the application, the first equipment and the second equipment have wireless connection relation. The first device may be an electronic device including audio coding functions, such as a mobile phone, a tablet computer, a smart television, a vehicle-mounted device, a wearable electronic device (such as a smart bracelet) having audio coding functions and wireless communication functions, and the like. The second device may be an electronic device comprising audio playback functionality, such as a wireless headset, a wireless sound box, a smart television, a tablet computer, a music playback device, etc.
After the first device establishes a wireless connection with the second device, the first device may encode according to a random encoding rate to obtain first audio data, and then send the first audio data to the second device. Then, the first device receives noise energy data of the second device side and transmission efficiency data of the received audio data. And the first equipment determines a first code rate according to the noise energy data, determines a second code rate according to the transmission efficiency data, and encodes the audio stream according to the code rate with smaller numerical value in the first code rate and the second code rate to obtain audio data. The noise energy data is used for indicating noise energy or noise loudness, and the transmission efficiency data is used for indicating the quality of a wireless channel between the first device and the second device.
It can be seen that, by adopting the implementation manner, when the first device determines the coding rate, the noise and the wireless signal quality of the second device end are used as reference factors. Therefore, the method can determine a relatively small coding rate, reduce the calculation complexity and power consumption of coding and decoding, and well balance the power consumption and the hearing of a user.
In one possible design, the first code rate includes a first value if the noise energy data is determined to be less than a first threshold, or a second value if the noise energy data is determined to be greater than the first threshold and less than a second threshold, or a third value if the noise energy data is determined to be greater than the second threshold, wherein the first threshold is less than the second threshold, the first value is greater than the second value, and the second value is greater than the third value. Wherein when the noise energy data is less than the first threshold, indicating that the loudness of the noise heard by the user is relatively small, the first device may encode the audio with a relatively large encoding rate. When the noise energy data is greater than the first threshold and less than the second threshold, indicating that the loudness of the noise heard by the user is relatively medium, the first device may encode the audio with a relatively medium encoding rate. When the noise energy data is greater than the second threshold, indicating that the loudness of the noise heard by the user is relatively large, the first device may encode the audio with a relatively small encoding rate. By adopting the implementation mode, the complexity of coding can be reduced, and the power consumption and the hearing between users can be balanced better.
In one possible design, the first value, the second value, and the third value are all preset fixed values. In some embodiments, the user has no requirement on the quality of the audio. Accordingly, the first device may adaptively adjust the coding rate of the output audio. Based on this, in the present embodiment, the first value, the second value, and the third value may be preset fixed values. By adopting the implementation mode, the computational complexity and the power consumption of encoding and decoding can be reduced, and the hearing experience of a user can be maintained unchanged.
In one possible design, the first value, the second value, and the third value are all preset percentages of an initial code rate to which the audio data corresponds. In some embodiments, the user may have certain requirements on the quality of the audio, e.g., the user may select high quality music, etc., while the initial code rate for different quality audio is different. Accordingly, the first device may determine an encoding rate of the audio based on the initial rate of the audio. Based on this, in this embodiment, the first value, the second value, and the third value may be preset percentages of the audio initial code rate. By adopting the implementation mode, the first equipment can determine the coding rate according to the initial rate of the audio, so that the power consumption and the hearing between users can be balanced better.
In a second aspect, the application provides an audio transmission method, which comprises the steps that a second device determines noise energy data and transmission efficiency data, wherein the noise energy data is used for indicating noise energy or noise loudness, the transmission efficiency data is used for indicating the quality of a wireless channel between the second device and a first device, the second device sends the noise energy data and the transmission efficiency data to the first device, the second device receives audio data from the first device, and the second device decodes the audio data and plays audio obtained by decoding.
In the application, the second equipment and the first equipment have wireless connection relation. After the second device establishes a wireless connection with the first device, the second device may receive audio data from the first device. Further, the second device may determine noise energy data of the second device and transmission efficiency data of the second device to receive the audio data. Then, the second device transmits both the noise energy data and the transmission efficiency data to the first device, so that the first device determines one code rate according to the noise and the quality of the wireless channel, and then selects the smaller code rate as the coding code rate. This can not only reduce power consumption for audio encoding and decoding and transmitting audio, but also balance power consumption and auditory sensation between users.
In one possible design, the second device determines noise energy data, wherein the second device collects noise sound waves, the second device samples the noise sound waves to obtain noise digital signals, the second device selects k continuous sampling points in the digital signals, k is an integer greater than or equal to 1, the second device calculates energy data corresponding to each sampling point in the k sampling points to obtain k energy data, and the second device takes the energy data with the smallest value in the k energy data as the noise energy data. By adopting the implementation mode, the second equipment can determine the energy or loudness of noise perceived by a user, and further, provide a data reference for determining the coding rate of the audio.
In one possible design, the second device samples the noise sound wave to obtain a noise digital signal x (n), wherein x (n) is greater than-1 and less than 1, n is an integer greater than or equal to 1, and the second device determines the noise energy data l (n) according to l (n) =min (x 2(n),x2(n-1),...x2 (n-k)). The second device may collect noise sound waves through a microphone of the second device. In some embodiments, the loudness of the noise received by the microphone of the second device is the same as the loudness of the noise actually perceived by the user. Based on this, in this embodiment, the second device may accurately determine the noise energy or the noise loudness actually perceived by the user according to the above algorithm, and further may provide a data reference for determining the coding rate of the audio.
In one possible design, the second device samples the noise sound wave to obtain a noise digital signal x ' (n), wherein x ' (n) is larger than x (n), x ' (n) is larger than-1 and smaller than 1, converts x ' (n) into x (n) according to x (n) =α1×x ' (n), α1 is larger than 0 and smaller than 1, and determines the noise energy data l (n) according to l (n) =min (x 2(n),x2(n-1),...x2 (n-k)). In some embodiments, the loudness of the noise received by the microphone of the second device is greater than the loudness of the noise actually perceived by the user. Based on this, in this embodiment, the second device may accurately determine the noise energy or the noise loudness actually perceived by the user according to the above algorithm, and further may provide a data reference for determining the coding rate of the audio.
In one possible design, the second device samples the noise sound wave to obtain a noise digital signal x ' (n), wherein x ' (n) is larger than x (n), x ' (n) is larger than-1 and smaller than 1, the second device determines initial energy data l ' (n) according to l ' (n) =min (x ′2(n),x′2(n-1),...x′2 (n-k)), and the second device converts the initial energy data l ' (n) into the noise energy data l (n) according to l (n) =α2×l ' (n), and α2 is larger than 0 and smaller than 1. In some embodiments, the loudness of the noise received by the microphone of the second device is greater than the loudness of the noise actually perceived by the user. Based on this, in this embodiment, the second device may accurately determine the noise energy or the noise loudness actually perceived by the user according to the above algorithm, and further may provide a data reference for determining the coding rate of the audio.
In a third aspect, the present application provides an electronic device having functionality to implement the method of the first aspect described above. The functions may be implemented by hardware, or may be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions described above. In one possible design, the electronic device includes a processor and a transceiver in a structure thereof, where the processor is configured to process the electronic device to perform the corresponding functions in the method. The transceiver is used for realizing data transceiving. The electronic device may also include a memory for coupling with the processor that holds the program instructions and data necessary for the electronic device.
In a fourth aspect, the present application provides an electronic device having a function to implement the method of the second aspect. The functions may be implemented by hardware, or may be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions described above. In one possible design, the electronic device includes a processor and a transceiver in a structure thereof, where the processor is configured to process the electronic device to perform the corresponding functions in the method. The transceiver is used for realizing data transceiving. The electronic device may also include a memory for coupling with the processor that holds the program instructions and data necessary for the electronic device.
In a fifth aspect, the present application also provides a chip system, which is provided in the electronic device in the third aspect, and includes at least one processor and an interface. The interface is coupled to the processor for receiving code instructions and transmitting the code instructions to the at least one processor. The at least one processor executes the code instructions and implements some or all of the steps of the audio transmission method of the first aspect and various possible implementations of the first aspect.
In a sixth aspect, the present application also provides a chip system, which is provided in the electronic device in the fourth aspect, and includes at least one processor and an interface. The interface is coupled to the processor for receiving code instructions and transmitting the code instructions to the at least one processor. The at least one processor executes the code instructions and implements some or all of the steps of the audio transmission method of the second aspect and the various possible implementations of the second aspect.
In a seventh aspect, the present application provides a computer storage medium having instructions stored therein which, when executed on a computer, cause the computer to perform part or all of the steps of the first aspect, the second aspect, the various possible implementations of the first aspect, and the audio transmission method in the various possible implementations of the second aspect.
In an eighth aspect, the present application provides a computer program product which, when run on a computer, causes the computer to perform part or all of the steps of the audio transmission method of the first aspect, of the second aspect, of the various possible implementations of the first aspect and of the various possible implementations of the second aspect.
Detailed Description
The technical scheme of the present application will be clearly described below with reference to the accompanying drawings.
The terminology used in the following embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates to the contrary. It should also be understood that, although the terms first, second, etc. may be used in the following embodiments to describe certain types of objects, the objects should not be limited to these terms. These terms are only used to distinguish between specific objects of that class of objects. For example, the terms first, second, etc. may be used in the following embodiments to describe the code rate, but the code rate should not be limited to these terms. These terms are only used to distinguish between different code rates. Other classes of objects that may be described in the following embodiments using the terms first, second, etc. are not described here again.
The following describes an implementation scenario of the present application.
As shown in fig. 2, the present application relates to a first device and a second device, which are connected to each other through a wireless channel. The first device may be configured to encode the audio data before transmitting the audio data over the wireless channel to the second device. The second device may be used to decode the audio data and then play the decoded audio.
The first device related to the present application may be an electronic device including an audio encoding function, such as a mobile phone, a tablet computer, a smart television, a vehicle-mounted device, a wearable electronic device (such as a smart bracelet) having an audio encoding function and a wireless communication function, and the like. The first device may be, for example, a device including but not limited to, a deviceOr electronic devices such as electronic device vehicle-mounted devices of other operating systems.
The second device related to the present application may be an electronic device including an audio playing function, such as a wireless earphone, a wireless speaker, a smart tv, a tablet computer, a music playing device (e.g., an MP3 player, an MP4 player, etc.), a vehicle-mounted device, and the like.
The connection mode of the first device and the second device in the application can comprise wireless fidelity (WIRELESS FIDELITY, wiFi) connection, bluetooth connection and the like.
The audio coding according to the present application refers to a process of sampling, quantizing, and coding a waveform signal of audio (i.e., an analog audio signal) into a digital audio signal. Accordingly, the present application relates to audio decoding, which refers to a process of restoring a digital audio signal to an analog audio signal. The "sound source", "audio stream" or "input audio" in the embodiment of the present application is an analog audio signal, and the "audio data" in the embodiment of the present application is a digital audio signal obtained after encoding. Among other things, embodiments of the present application may support a variety of audio codec formats, such as pulse code modulation (pulse code modulation, PCM), waveform sound files (WAV), MP3, WMA (windows media audio), advanced audio coding (advanced audio coding, AAC), MPEG4, and so on. The format supported by the first device encoding is the same as the format supported by the second device decoding.
The noise referred to in the present application may also be referred to as ambient noise, and refers to sounds other than audio corresponding to audio data received by the second device from the first device. The noise may include, for example, sounds generated when the vehicle is running, sounds generated in public places, entertainment places, etc., sounds generated from home appliances such as televisions and washing machines, etc. The embodiment of the application can represent the energy of noise or the loudness of noise by the noise energy data.
In connection with fig. 2, in one prior implementation, the first device, when determining the coding rate of the audio, typically references the quality of the wireless communication, irrespective of the effects of noise, such that the determined rate is relatively large. But the actual use environment of the user is often noisy. Based on the above, even if the audio data is obtained by adopting a larger code rate coding, the hearing experience of the user cannot be improved, but the calculation complexity of the audio coding and decoding is higher, and the power consumption in the equipment coding and decoding process is higher.
The application provides an audio transmission method and electronic equipment, wherein a second equipment can send noise of a second equipment end to first equipment, so that the first equipment takes the noise as one of reference factors when determining a coding rate. Therefore, the method can determine a relatively small coding rate, reduce the computational complexity and power consumption of coding and decoding, and maintain the hearing experience of a user unchanged.
An embodiment of the present application, such as fig. 3A, shows a schematic structural diagram of the first device 100.
The first device 100 may include a processor 110, a memory 120, an antenna 130, a wireless communication module 140, an audio module 150, a power management module 160A, a battery 160B, a speaker 170A, a microphone 170B, and a headset interface 170C, among others. Among other things, the wireless communication module 140 may include a Bluetooth (BT) module, a wireless fidelity (WIRELESS FIDELITY, wiFi) module, a Near Field Communication (NFC) module, and the like.
It is to be understood that the illustrated structure of the present application does not constitute a specific limitation on the first apparatus 100. In other embodiments of the application, the first device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a controller, an audio codec, a baseband processor, and the like. Wherein the different processing units may be separate devices or may be integrated in one or more processors. In some embodiments, the first device 100 may also include one or more processors 110.
Wherein the controller may be a neural hub and a command center of the first device 100. The controller can generate an operation control signal according to the instruction operation code and the time sequence signal to finish the control of determining the target code rate and the like.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A). In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be separate from the processor 110 and located in the same device as the other functional modules.
Audio codecs are used to compress (i.e., encode) or decompress (i.e., decode) digital audio. For example, audio to be transmitted is encoded according to a target code rate. The first device 100 may support one or more audio codecs. Thus, the first device 100 may play or record audio in a variety of encoding formats, such as PCM, WAV, MP, WMA, AAC, MPEG, etc.
In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit built-in audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, or the like.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 150 via an I2S bus to enable communication between the processor 110 and the audio module 150. In some embodiments, the audio module 150 may transmit an audio signal to the wireless communication module 140 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 150 and the wireless communication module 140 may be coupled by a PCM bus interface. In some embodiments, the audio module 150 may also transmit audio signals to the wireless communication module 140 through the PCM interface, so as to implement a function of answering a call through the bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 140. For example, the processor 110 communicates with a bluetooth module in the wireless communication module 140 through a UART interface to implement bluetooth functions. In some embodiments, the audio module 150 may communicate audio signals to the wireless communication module 140 through a UART interface to implement a function of playing music through a bluetooth playback device (e.g., a bluetooth headset).
It should be understood that the interfacing relationship between the modules illustrated in the present application is only illustrative and not limiting on the structure of the first device 100. In other embodiments, the first device 100 may also use different interfaces in the above embodiments, or a combination of interfaces.
Memory 120 may be used to store one or more computer programs, including instructions. The processor 110 may cause the first device 100 to perform the audio transmission method, the data processing, and the like provided in some embodiments of the present application by executing the above-described instructions stored in the memory 120. The memory 120 may include a stored program area and a stored data area. The storage program area may store an operating system, one or more application programs (such as a music player, etc.), and the like. The storage data area may store data (e.g., target code rate, audio data, etc.) involved in the execution of the embodiment of the present application by the first device 100. The memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash memory (universal flash storage, UFS), and the like.
The wireless communication module 140 may provide solutions for communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (WIRELESS FIDELITY, wi-Fi) network), bluetooth, global navigation satellite system (global navigation SATELLITE SYSTEM, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (NEAR FIELD communication, NFC), infrared technology (IR), fiber optics, etc., applied on the first device 100. The wireless communication module 140 may be one or more devices integrating at least one communication processing module. The wireless communication module 140 receives electromagnetic waves via the antenna 130, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 140 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 130.
In some embodiments, the solution to the communication provided by the wireless communication module 140 may enable the first device 100 to communicate with the second device 200 such that the first device 100 may communicate with the second device 200 for audio transmission.
The first device 100 may implement audio functions through the audio module 150, the speaker 170A, the microphone 170B, the earphone interface 170C, and the application processor, etc. Such as music playing, recording, etc.
The audio module 150 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 150 may also be used to encode and decode audio signals. In some embodiments, the audio module 150 may be disposed in the processor 110, or some functional modules of the audio module 150 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The first device 100 may listen to music through the speaker 170A.
Microphone 170B, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When recording, making a call, or sending voice information, the user may place a sound source near microphone 170B and input a sound signal to microphone 170B. The first device 100 may be provided with at least one microphone 170B. In other embodiments, the first device 100 may be provided with two microphones 170B, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the first device 100 may also be provided with three, four or more microphones 170B to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170C is used to connect a wired earphone. The headset interface 170C may be a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The power management module 160A is configured to connect to the battery 160B. The power management module 160A receives input from the battery 160B and provides power to the processor 110, memory 120, and wireless communication module 140, among other things. The power management module 160A may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance), etc. In other embodiments, the power management module 160A may also be disposed in the processor 110. In other embodiments, the power management module 160A may be disposed in the same device.
The first device 100, which is exemplarily shown in fig. 3A, may determine the target code rate through the processor 110. The first device 100 may encode audio to be transmitted through an audio codec. The first device 100 may transmit audio data to the second device 200 through the wireless communication module 140, and so on.
Fig. 3B shows an exemplary architectural schematic of the second device 200.
The second device 200 may include a processor 210, a memory 220, a wireless communication module 230, an audio module 240, a speaker 240A, an earphone interface 240B, a microphone 240C, and a power supply 250, among others.
It is to be understood that the illustrated construction of the present application does not constitute a specific limitation on the second device 200. In other embodiments of the application, the second device 200 may include more or less components than illustrated, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
In this embodiment, the processor 210 includes hardware and software and functions of the hardware and software, similar to the processor 110, for example, the processor 210 includes an audio codec. The present application is not described in detail herein. The processor 210 may be configured to invoke the microphone 240 to acquire the noise signal and then calculate the noise energy data. The processor 210 may also be configured to count transmission efficiency data of the received audio data such that the first device 100 determines a quality of the wireless communication based on the transmission efficiency data. The transmission efficiency data may include at least one of packet loss rate, transmission delay, retransmission rate, and the like. The processor 210 may also be used to invoke the speaker 240A or the headphone interface 240B to play audio.
Memory 220 may be used to store one or more computer programs, including instructions. The processor 210 may cause the second device 200 to perform the audio transmission method or the like provided in some embodiments of the present application by executing the above-described instructions stored in the memory 220. For example, the memory 220 may be used to buffer audio data received by the second device 200 from the first device 100, as well as collected noise signals, and the like.
The solution for communication provided by the wireless communication module 230 is similar to the wireless communication module 140 and will not be described in detail herein. The solution for communication provided by the wireless communication module 230 may enable the second device 200 to communicate with the first device 100 such that the second device 200 may communicate data with the first device 100.
The function of the audio module 240 is similar to that of the audio module 150 and will not be described in detail herein.
Speaker 240A functions similarly to speaker 170A and will not be described in detail herein. In this embodiment, the speaker 240A may be used to convert an audio electrical signal decoded by an audio codec into a sound signal. The function of the headphone interface 240B is similar to that of the headphone interface 170C, and will not be described in detail here.
Microphone 240C functions similarly to microphone 170B and will not be described in detail herein. In this embodiment, the microphone 240C may be used to collect sound waves of noise and then transmit the collected sound waves of noise to the processor 210. In some embodiments, the microphone 240C may be a device belonging to the second apparatus 200. In other embodiments, the microphone 240C may be an external device independent of other components of the second device 200.
The power supply 250 may be used to power the processor 210, the memory 220, the microphone 240C, etc.
The second device 200 exemplarily shown in fig. 3B may acquire the noise signal through the microphone 240C. The second device 200 may transmit noise energy data to the first device 100 through the wireless communication module 230. The second device 200 may play audio through the speaker 240A or the headphone interface 240B, and so on.
The audio transmission method of the present application is exemplarily described below in connection with the first device 100 and the second device 200.
Fig. 4 illustrates a signaling interaction diagram of an audio transmission method 10. The audio transmission method 10 (hereinafter referred to as method 10) involves a first device and a second device, wherein the first device and the second device have a wireless connection relationship, such as a bluetooth connection relationship. The first device may be implemented as the first device 100, for example. The second device may be implemented as the second device 200, for example. The method 10 includes the steps of:
In step S11, the first device transmits the first audio data to the second device.
After the first device and the second device establish wireless connection, the first device may encode the audio stream with a random encoding rate to obtain first audio data. The first device then transmits the first audio data to the second device over a wireless connection with the second device.
In step S12, the second device determines noise energy data and transmission efficiency data.
The noise energy data is used to indicate the noise energy or the loudness actually perceived by the user, and the unit of measure of the noise energy data may be decibel (dB), for example. The larger the noise energy data, the more energy that represents the noise or the more loudness the noise is. The smaller the noise energy data, the less energy representing the noise or the less loudness of the noise. The transmission efficiency data is used to indicate the quality of the wireless channel between the second device and the first device. The transmission efficiency data may include at least one of packet loss rate, transmission delay, retransmission rate, and the like. For example, the second device may determine transmission efficiency data of the first audio data after receiving the first audio data. In some embodiments, the second device may employ two threads to determine noise energy data and to determine transmission efficiency data, respectively.
Illustratively, the second device may collect noise sound waves through a microphone of the second device, and then sample and quantize the collected noise sound waves to obtain a digital signal of noise. Then, the second device selects k consecutive samples in the digital signal, calculates energy data corresponding to each of the k samples, and then, the second device may use the minimum energy data as the noise energy data. k is an integer greater than or equal to 1.
It will be appreciated that in actual operation, noise occurs more randomly. In some scenarios, the second device may collect sporadically short-term and loud noise. Based on this, if the largest energy data among the energy data of the k samples is taken as the noise energy data, or an average value of the energy data of the k samples is taken as the noise energy data, the obtained noise energy data may be inaccurate. Based on this, in one possible implementation of the present application, the second device takes the smallest energy data as the noise energy data.
It is noted that when the implementation of the second device is different, the implementation of the microphone on the second device is also different. Accordingly, in some scenarios, the loudness of the noise received by the microphone is the same as the loudness of the noise actually perceived by the user. For example, the loudness of the noise received by the in-ear microphone of the wireless headset is the same as the loudness of the noise actually perceived by the user. For another example, the loudness of the noise received by the peripheral microphone of the wireless loudspeaker box is the same as the loudness of the noise actually perceived by the user. In other embodiments, the loudness of the noise received by the microphone is different from the loudness of the noise actually perceived by the user. For example, the loudness of the noise received by the out-of-ear microphone of the wireless headset is greater than the loudness of the noise actually perceived by the user. Based on this, the manner in which the second device determines the noise energy data is different in different scenarios.
In scene one, the loudness of the noise received by the microphone is the same as the loudness of the noise actually perceived by the user:
And after the second device collects noise sound waves through the microphone, sampling and quantizing the noise sound waves to obtain a noise data signal x (n), wherein 1>x (n) > -1, and n is an integer greater than or equal to 1. Further, the second device determines noise energy data l (n), l (n) =min (x 2(n),x2(n-1),...x2 (n-k)). Where k is the window length used to select the sample point, and the value of k is as described above and will not be described here again.
In scene two, the loudness of the noise received by the microphone is greater than the loudness of the noise actually perceived by the user:
The first mode is that after noise sound waves are collected through a microphone, the noise sound waves are sampled and quantized to obtain noise data signals x '(n), wherein 1>x' (n) > -1, and n is an integer greater than or equal to 1. The second device then converts x '(n) to x (n), where x (n) =α1×x' (n), α1 being greater than 0 and less than 1.
And secondly, after the second device collects noise sound waves through the microphone, sampling and quantizing the noise sound waves to obtain noise data signals x '(n), wherein 1>x' (n) > -1, and n is an integer greater than or equal to 1. The second device then determines initial energy data l ' (n), l ' (n) =min (x ′2(n),x′2(n-1),...x′2 (n-k)) from x ' (n). The second device then converts l '(n) to l (n), where l (n) =α2×l' (n), where α2 is greater than 0 and less than 1.
It will be appreciated that the above process of determining noise energy data is merely illustrative and that embodiments of the present application are not limited in scope. In other embodiments of the application, the second device may determine the noise energy data in other ways, depending on the microphone settings, and the usage scenario. And will not be described in detail herein.
In step S13, the second device transmits noise energy data and transmission efficiency data to the first device.
Wherein the second device may transmit noise energy data and transmission efficiency data to the first device over a wireless channel with the first device.
The operation of the second device transmitting the noise energy data and the operation of transmitting the transmission efficiency data to the first device may or may not be performed simultaneously, as examples. There is no limitation here.
Step S14, the first device determines a first code rate according to the noise energy data and determines a second code rate according to the transmission efficiency data.
Wherein the first code rate and the second code rate are both coding code rates of audio, and the measurement unit may be kilobits per second (kbps), for example. The coding rate indicates the bytes in each audio data packet.
In combination with the description of the noise energy data in step S12, further, after receiving the noise energy data, if it is determined that the noise energy data is smaller than the first threshold, the first device determines that the first code rate is a first value. If the noise energy data is determined to be greater than the first threshold and less than the second threshold, the first device determines the first code rate to be a second value. If the noise energy data is determined to be greater than the second threshold, the first device determines that the first code rate is a third value. Wherein the first threshold is less than the second threshold. The first threshold is, for example, -80dB and the second threshold is, for example, -20dB. The first value is greater than the second value, and the second value is greater than the third value.
In some embodiments, the user has no requirement on the quality of the audio. Accordingly, the first device may adaptively adjust the coding rate of the output audio. Based on this, in the present embodiment, the first value, the second value, and the third value may be preset fixed values. For example, the first value is 960kbps, the second value is 256kbps, and the third value is 96kbps. By adopting the implementation mode, the computational complexity and the power consumption of encoding and decoding can be reduced, and the hearing experience of a user can be maintained unchanged.
In other embodiments, the user may have certain requirements on the quality of the audio, for example, the user may select high quality music, etc., while the initial code rate for different quality audio is different. Accordingly, the first device may determine an encoding rate of the audio based on the initial rate of the audio. Based on this, in this embodiment, the first value, the second value, and the third value may be preset percentages of the audio initial code rate. For example, the first value is 95% of the initial code rate, the second value is 40% of the initial code rate, and the third value is 10% of the initial code rate. By adopting the implementation mode, the first equipment can determine the coding rate according to the initial rate of the audio, so that the power consumption and the hearing between users can be balanced better.
It will be appreciated that the above process of determining the first code rate from the noise energy data is merely illustrative, and is not a limitation of the embodiments of the present application. In other embodiments of the present application, the first device may determine the first code rate according to other conditions. The specific values of the first threshold value, the second threshold value, the first value, the second value, and the third value, and the determination method may be other. There is no limitation here.
On the other hand, after receiving the transmission efficiency data of the audio data, the first device may determine the wireless communication quality according to the transmission efficiency data, and then determine the second code rate according to the wireless communication quality. Taking the transmission delay of the first audio data as an example, if the transmission delay is smaller than the third threshold, it indicates that the wireless communication quality is good, and the first device may determine the second code rate as a larger value. If the transmission delay is greater than the third threshold, which indicates that the wireless communication quality is poor, the first device may determine the second code rate as a smaller value. Wherein the third threshold is for example 2 milliseconds (ms). And will not be described in detail herein.
And S15, the first device encodes the audio stream according to the code rate with smaller value in the first code rate and the second code rate to obtain second audio data.
Wherein the first device may support a plurality of encoding formats, such as PCM, WAV, MP, WMA, AAC, MPEG, etc. The first device may encode in any encoding format supported by the first device. And will not be described in detail herein.
In step S16, the first device transmits the second audio data to the second device.
Wherein the first device may send the second audio data to the second device over a wireless channel with the second device.
In step S17, the second device decodes the second audio data and plays the audio corresponding to the second audio data.
Wherein the decoding format of the second audio data by the second device may be the same as the encoding format of the first device. For example, the first device encodes using AAC, and in this step, the second device may also decode using AAC.
In summary, according to the audio transmission method disclosed by the embodiment of the application, the second device sends the noise acquired by the second device end and the transmission efficiency information reflecting the wireless channel quality to the first device. Further, the first device determines one code rate based on the noise and the quality of the wireless channel, respectively, and then selects a smaller code rate among them as the encoding code rate. This can not only reduce power consumption for audio encoding and decoding and transmitting audio, but also balance power consumption and auditory sensation between users.
The audio transmission method of the embodiment of the present application is described below with reference to examples.
The first device 100 is, for example, a mobile phone. The second device 200 is for example a wireless headset. The handset establishes a bluetooth connection with the wireless headset. The wireless headset includes an in-ear microphone and an out-of-ear microphone.
Fig. 5 shows a signaling interaction diagram of the audio transmission method 20, and the audio transmission method 20 (hereinafter referred to as 20) includes the following steps:
in step S21, the mobile phone sends the first audio data to the wireless headset.
The first audio data is the first audio data sent to the wireless earphone by the mobile phone after the Bluetooth connection is established between the mobile phone and the wireless earphone.
In practical implementation, after the mobile phone and the wireless earphone establish bluetooth connection, the mobile phone may encode the audio stream with a random encoding rate to obtain the first audio data. And then, the mobile phone sends the first audio data to the wireless earphone through the Bluetooth connection.
In step S22, the wireless earphone determines noise energy data according to the noise collected by the in-ear microphone.
Illustratively, after the wireless headset receives the noise sound waves collected by the in-ear microphone, the noise sound waves are converted into data signals x (n), and then the noise energy data l (n) is determined as l (n) =min (x 2(n),x2(n-1),...x2 (n-k)). The noise energy data l (n) is, for example, -50dB.
It should be noted that in other embodiments, the wireless headset may also determine the noise energy data l (n) from the noise collected by the extra-aural microphone. Since the loudness of the noise collected by the extra-aural microphone is greater than the loudness of the noise heard by the user, in one possible implementation, after the wireless headset converts the noise sound wave collected by the extra-aural microphone into a data signal x ' (n), x ' (n) may be converted into x (n), e.g., according to the algorithm x (n) =α1×x ' (n), and the noise energy data l (n) may be determined according to l (n) =min (x 2(n),x2(n-1),...x2 (n-k)).
In step S23, the wireless earphone determines a transmission delay of the first audio data.
Wherein the transmission delay is for example 1.5ms.
After step S21, the wireless headset may further decode the first audio data, and then play audio corresponding to the first audio data.
It should be noted that the execution of step S22 and step S23 is not limited by the description of the present embodiment. In other embodiments, the wireless headset may perform step S22 and step S23 simultaneously. In other embodiments, the wireless headset may perform step S23 simultaneously, and then perform step S22.
Step S24, the wireless earphone sends transmission delay and noise energy data to the mobile phone.
The wireless headset may or may not transmit both transmission delay and noise energy data simultaneously, as described in connection with step S22 and step S23. The application is not limited in this regard.
Step S25, the mobile phone determines a first code rate according to the noise energy data and determines a second code rate according to the transmission delay.
Wherein, when the noise energy data is-50 dB, the noise energy data is more than-80 dB and less than-20 dB. Based on this, the handset may determine that the first code rate is 256kbps.
In addition, the transmission delay is less than 2ms, which indicates that the Bluetooth signal quality is better. The handset may determine, for example, that the second code rate is 480kbps.
And S26, the mobile phone encodes the audio stream according to the first code rate to obtain second audio data.
Wherein the first code rate 256kbps is less than the second code rate 480kbps, and the mobile phone encodes the audio stream according to the first code rate.
In step S27, the mobile phone sends the second audio data to the wireless headset.
In step S28, the wireless headset decodes the second audio data and plays the decoded audio.
The mobile phone and the wireless earphone circularly execute the corresponding steps from the step S22 to the step S28 until the mobile phone end stops audio transmission or the mobile phone and the wireless earphone are disconnected with Bluetooth.
It will be appreciated that fig. 5 is only a schematic depiction and is not to be construed as limiting on embodiments of the present application. In other embodiments, the noise energy data, the first code rate, the second code rate, etc. involved in the present application may be other values. In addition, the embodiment of the present application may be applicable to other similar implementation scenarios, for example, in other embodiments, the first device 100 may be a smart television, and the second device 200 may be a smart speaker. And will not be described in detail herein.
In summary, according to the audio transmission method illustrated in the embodiment of the present application, the second device determines noise energy data at the second device end, determines transmission efficiency data of the audio data, and further sends both the noise energy data and the transmission efficiency data to the first device. Further, the first device determines one code rate based on the noise energy data and the transmission efficiency data, respectively, and then selects a smaller code rate as the encoding code rate. This can not only reduce power consumption for audio encoding and decoding and transmitting audio, but also balance power consumption and auditory sensation between users.
The embodiments described above introduce various schemes of the audio transmission method provided by the present application from the perspective of the hardware structure, the software architecture, and the actions performed by the software and hardware of the electronic device. Those skilled in the art will readily appreciate that the present application may be implemented not only in hardware or a combination of hardware and computer software, in connection with the processing steps of determining noise energy data, determining transmission efficiency data, etc., as described in connection with the embodiments disclosed herein. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
For example, the first device 100 may implement the corresponding functions described above in the form of functional modules. In some embodiments, the first device 100 may include a processing module and a transceiver module. The transceiver module may be used to perform the transceiving of data in any of the embodiments illustrated in fig. 4 and 5 described above. The processing module may be used to perform operations other than data transceiving in any of the embodiments illustrated in fig. 4 and 5 described above. For details, reference may be made to descriptions related to the corresponding embodiments of fig. 4 and fig. 5, which are not repeated here.
It will be appreciated that the above division of the modules is merely a division of logic functions, and that in actual implementation, the functions of the transceiver module may be integrated into a transceiver implementation, and the functions of the processing module may be integrated into a processor implementation. As shown in fig. 6A, the electronic device 60 includes a transceiver 601 and a processor 602. The transceiver 601 may perform the transceiving of data in any of the embodiments illustrated in fig. 4 and 5 described above. The processor 602 may be configured to perform operations other than data transceiving in any of the embodiments illustrated in fig. 4 and 5 described above.
For example, the transceiver 601 may be configured to receive noise energy data from a second device and transmission efficiency data, wherein the noise energy data is used to indicate noise energy or noise loudness and the transmission efficiency data is used to indicate the quality of a wireless channel between the first device and the second device. The processor 602 may be configured to determine a first code rate according to the noise energy data, determine a second code rate according to the transmission efficiency data, and encode an audio stream according to a code rate with a smaller value of the first code rate and the second code rate to obtain audio data. In this embodiment, the transceiver 601 may also be configured to transmit the audio data to the second device.
For details, reference may be made to descriptions related to the first device 100 in the corresponding embodiment of fig. 4 and fig. 5, which are not repeated herein.
Fig. 6A depicts the first device 100 of the present application from the perspective of an independent functional entity. In another implementation scenario, each independently operating functional entity may be integrated into one hardware entity, e.g., a chip, and accordingly, as shown in fig. 6B, in this implementation scenario, the electronic device 61 may include a processor 611, a transceiver 612, and a memory 613. The memory 613 may be used to store programs/codes preloaded on the electronic device 61, or may be used to store codes executed by the processor 611, or the like.
It should be appreciated that the electronic device 61 of the present application may correspond to the first device in the embodiments of the present application illustrated in fig. 4 and 5, wherein the transceiver 612 is configured to perform the data transceiving of the data in any of the embodiments illustrated in fig. 4 and 5, and the processor 611 is configured to perform the processing of the first device other than the data transceiving in any of the embodiments illustrated in fig. 4 and 5. And will not be described in detail herein.
For details, reference may be made to descriptions related to the first device in the embodiments corresponding to fig. 4 and fig. 5, which are not repeated herein.
The second device 200 may implement the corresponding functions described above in the form of functional modules. In some embodiments, the second device 200 may include a processing module and a transceiver module. The transceiver module may be used to perform the transceiving of data in any of the embodiments illustrated in fig. 4 and 5 described above. The processing module may be used to perform operations other than data transceiving in any of the embodiments illustrated in fig. 4 and 5 described above. For details, reference may be made to descriptions related to the corresponding embodiments of fig. 4 and fig. 5, which are not repeated here.
It will be appreciated that the above division of the modules is merely a division of logic functions, and that in actual implementation, the functions of the transceiver module may be integrated into a transceiver implementation, and the functions of the processing module may be integrated into a processor implementation. As shown in fig. 7A, the electronic device 70 includes a transceiver 701 and a processor 702. The transceiver 701 may perform the transceiving of data in any of the embodiments illustrated in fig. 4 and 5 described above. The processor 702 may be configured to perform operations other than data transceiving in any of the embodiments illustrated in fig. 4 and 5 described above.
For example, the processor 702 may be configured to determine noise energy data indicative of noise energy or noise loudness and transmission efficiency data indicative of quality of a wireless channel between the second device and the first device. The transceiver 701 may be configured to transmit the noise energy data and the transmission efficiency data to the first device, and to receive audio data from the first device. In this embodiment, the processor 702 may be further configured to decode the audio data and play the decoded audio.
For details, reference may be made to descriptions related to the second device 100 in the embodiments corresponding to fig. 4 and fig. 5, which are not repeated herein.
Fig. 7A depicts the second device 100 of the present application from the perspective of an independent functional entity. In another implementation scenario, each independently operating functional entity may be integrated into one hardware entity, e.g., a chip, and accordingly, as shown in fig. 7B, in this implementation scenario, the electronic device 71 may include a processor 711, a transceiver 712, and a memory 713. The memory 713 may be used to store programs/codes preloaded by the electronic device 71, or may be used to store codes for execution by the processor 711, or the like.
It should be appreciated that the electronic device 71 of the present application may correspond to the second device in the embodiment of the present application illustrated in fig. 4 and 5, wherein the transceiver 712 is configured to perform the data transceiving of the data in any of the embodiments illustrated in fig. 4 and 5, and the processor 711 is configured to perform the processing of the second device in addition to the data transceiving of the data in any of the embodiments illustrated in fig. 4 and 5. And will not be described in detail herein.
For details, reference may be made to descriptions related to the second device in the embodiments corresponding to fig. 4 and fig. 5, which are not repeated here.
In a specific implementation, the present application further provides a computer storage medium corresponding to the electronic device, where the computer storage medium provided in any device may store a program, and when the program is executed, part or all of the steps in each embodiment of the audio transmission method provided in fig. 4 and 5 may be implemented. The storage medium in any device may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
In the present application, the transceiver may be a wireless transceiver, for example, a wireless local area network transceiver, a cellular network transceiver, or a combination thereof. The processor may be a central processor (central processing unit, CPU), a network processor (network processor, NP) or a combination of CPU and NP. The processor may further comprise a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (programmable logic device, PLD), or a combination thereof. The PLD may be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (FPGA) GATE ARRAY, generic array logic (GENERIC ARRAY logic, GAL), or any combination thereof. The memory may include volatile memory (RAM), such as random-access memory (RAM), non-volatile memory (ROM), such as read-only memory (ROM), flash memory (flash memory), hard disk (HARD DISK DRIVE, HDD) or solid state disk (solid-state disk) (STATE DRIVE, SSD), and combinations of the above.
A bus interface may also be included in fig. 6B and 7B, which may include any number of interconnected buses and bridges, with various circuits of the memory, in particular, represented by one or more of the processors and the memory, being linked together. The bus interface may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. The bus interface provides an interface. The transceiver provides a means for communicating with various other apparatus over a transmission medium. The processor is responsible for managing the bus architecture and general processing, and the memory may store messages used by the processor in performing operations.
It will also be appreciated by those of skill in the art that the various illustrative logical blocks (illustrative logical block) and steps (steps) described in connection with embodiments of the present application may be implemented in electronic hardware, computer software, or combinations of both. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Those skilled in the art may implement the described functionality in varying ways for each particular application, but such implementation is not to be understood as beyond the scope of the embodiments of the present application.
The various illustrative logical blocks and circuits described in connection with the embodiments of the present application may be implemented or performed with a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the general purpose processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software unit executed by a processor, or in a combination of the two. The software elements may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. In an example, a storage medium may be coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may reside in an electronic device. In the alternative, the processor and the storage medium may reside in different components in an electronic device.
It should be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may 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 in accordance with the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or message center to another website, computer, server, or message center by a wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a message storage device including one or more servers, message centers, etc. that can be integrated with the available medium. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Drive (SSD)), etc.
All parts of the specification are described in a progressive manner, and all parts of the embodiments which are the same and similar to each other are referred to each other, and each embodiment is mainly described as being different from other embodiments. In particular, for apparatus and system embodiments, the description is relatively simple, as it is substantially similar to method embodiments, with reference to the description of the method embodiments section.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.