WO2020132907A1 - 一种音频数据的通信方法及电子设备 - Google Patents

一种音频数据的通信方法及电子设备 Download PDF

Info

Publication number
WO2020132907A1
WO2020132907A1 PCT/CN2018/123656 CN2018123656W WO2020132907A1 WO 2020132907 A1 WO2020132907 A1 WO 2020132907A1 CN 2018123656 W CN2018123656 W CN 2018123656W WO 2020132907 A1 WO2020132907 A1 WO 2020132907A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio data
electronic device
earplug
transmission parameter
audio
Prior art date
Application number
PCT/CN2018/123656
Other languages
English (en)
French (fr)
Inventor
朱宇洪
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201880098111.7A priority Critical patent/CN112771828B/zh
Priority to PCT/CN2018/123656 priority patent/WO2020132907A1/zh
Publication of WO2020132907A1 publication Critical patent/WO2020132907A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Definitions

  • the embodiments of the present application relate to the field of communication technologies, and in particular, to a communication method of audio data and an electronic device.
  • TWS headphones have gradually entered people's field of vision.
  • the TWS earphone includes two earphone bodies, such as left earplug and right earplug, respectively, and no wire connection is needed between the left and right earplugs.
  • the left and right earplugs of the TWS earphone can establish a Bluetooth connection with an electronic device (such as a mobile phone) and be used as an audio input/output device of the mobile phone.
  • an electronic device such as a mobile phone
  • the synchronization of the left and right earplugs and the audio clock of the electronic device is particularly important. Among them, if the left and right earplugs are not synchronized with the audio clock of the electronic device, it may cause the earphones to overflow or underflow the data to be played.
  • Embodiments of the present application provide an audio data communication method and an electronic device, which can suppress or alleviate the overflow or underflow of data to be played by electronic devices (such as earplugs of TWS headphones).
  • inventions of the present application provide a method for communicating audio data.
  • the first electronic device may send audio data to the second electronic device according to the first transmission parameter.
  • the audio data sent in unit time according to the first transmission parameter has a first playing duration.
  • the first electronic device sends audio data to the second electronic device according to the second transmission parameter.
  • the audio data sent in unit time according to the second transmission parameter has a second playing duration.
  • the first electronic device sends audio data to the second electronic device according to the third transmission parameter.
  • the audio data sent in unit time according to the third transmission parameter has a third playing duration. It should be noted that the second playing duration is shorter than the first playing duration, and the third playing duration is longer than the first playing duration.
  • the above-mentioned first signal may be sent when the data to be played of the second electronic device overflows.
  • the first electronic device may send audio data according to the second transmission parameter in response to the first signal.
  • the audio data sent in the unit time according to the second transmission parameter has a smaller playing duration (second playing duration). That is, the second playing duration is shorter than the first playing duration.
  • the playing time of the audio data sent from the first electronic device to the second electronic device per unit time becomes smaller, which means that the progress of the audio data transmission from the first electronic device to the second electronic device is slowed down. In other words, the progress of sending audio data according to the second transmission parameter is slower than the progress of sending audio data according to the first transmission parameter.
  • the first electronic device may adjust the transmission parameters for transmitting audio data to the second electronic device.
  • the progress of transmitting audio data from the first electronic device to the second electronic device may be slowed.
  • the progress of storing the audio data in the buffer of the second electronic device will also be slowed down, and the speed of buffering the data in the buffer of the second electronic device will be reduced.
  • the second electronic device processes the audio data buffered in the buffer, the data buffered in the buffer can be reduced. In this way, the continuation or exacerbation of the overflow phenomenon can be suppressed.
  • the above second signal is sent when the data to be played by the second electronic device underflows.
  • the first electronic device may send audio data according to the third transmission parameter in response to the second signal.
  • the audio data sent in unit time according to the third transmission parameter has a larger playing duration (second playing duration). That is, the third playing duration is greater than the first playing duration.
  • the playing time of the audio data sent from the first electronic device to the second electronic device per unit time becomes larger, which means that the progress of transmitting audio data from the first electronic device to the second electronic device is accelerated. In other words, the progress of sending audio data according to the third transmission parameter is faster than the progress of sending audio data according to the first transmission parameter.
  • the first electronic device may adjust the transmission parameters for transmitting audio data to the second electronic device. In this way, the progress of transmitting audio data from the first electronic device to the second electronic device can be accelerated. In this way, the progress of storing the audio data in the buffer of the second electronic device will be accelerated, and the speed of buffering the data in the buffer of the second electronic device will increase.
  • the second electronic device processes the audio data buffered in the buffer at a constant speed, the data buffered in the buffer can be increased. In this way, the continuation or exacerbation of the underflow phenomenon can be suppressed.
  • the first signal is sent when the data to be played of the second electronic device overflows.
  • the second signal is sent when the data to be played by the second electronic device underflows.
  • the overflow of the data to be played by the second electronic device may specifically be that: the data in the buffer of the second electronic device exceeds the first preset value (which may also be called a waterline).
  • the underflow of the data to be played by the second electronic device is specifically as follows: the data in the buffer of the second electronic device is lower than the second preset value (which may also be called a waterline).
  • the data in the cache of the second electronic device exceeds the first preset value, which may specifically be: the size of the data in the cache of the second electronic device exceeds the first default value.
  • the data in the cache of the second electronic device is lower than the second preset value, which may specifically be: the size of the data in the cache of the second electronic device is lower than the second preset value.
  • the unit of the size of the above data is megabyte (Mbyte, MB) or kilobyte (Kilobyte, KB).
  • the data in the cache of the second electronic device exceeds the first preset value, which may specifically be: the duration of the data in the cache of the second electronic device to be played exceeds The first preset value.
  • the data in the cache of the second electronic device is lower than the second preset value, which may specifically be: the duration of the data in the cache of the second electronic device to be played is lower than the second preset value.
  • the data in the cache of the second electronic device exceeds the first preset value, which may specifically be: the number of audio data packets in the cache of the second electronic device Greater than the first preset value.
  • the data in the cache of the second electronic device is lower than the second preset value, which may specifically be: the number of audio data packets in the cache of the second electronic device is less than the second preset value.
  • the first transmission parameter, the second transmission parameter, and the third transmission parameter all include playing time, time interval, data amount, and pulse code modulation (pulse code modulation (PCM) ) At least one of the sampling rates.
  • the first electronic device sends an audio data packet to the second electronic device every time interval, the data volume is the size of the audio data included in each audio data packet, and the playing time is the audio included in each audio data packet The duration of the data.
  • the second electronic device may send the first electronic device to indicate that the data to be played have overflowed or underflowed To indicate the overflow or underflow phenomenon.
  • the second electronic device may send a first indication message to the first electronic device when the data to be played overflows.
  • the first electronic device may receive the first indication message sent by the second electronic device.
  • the first indication message is used to indicate that the data to be played of the second electronic device has overflowed.
  • the second electronic device may send a second indication message to the first electronic device when the data to be played underflows.
  • the first electronic device may receive the second indication message sent by the second electronic device.
  • the second indication message is used to indicate that the data to be played of the second electronic device underflows. That is, the first signal is a first indication message, and the second signal is a second indication message.
  • the second electronic device when the data to be played overflows or underflows, sends a request to the first electronic device to adjust the progress of the audio data.
  • the second electronic device may send a first adjustment request to the first electronic device.
  • the first adjustment request is used to request the first electronic device to slow down the progress of transmitting audio data to the second electronic device.
  • the second electronic device may send a second adjustment request to the first electronic device.
  • the second adjustment request is used to request the first electronic device to speed up the progress of transmitting audio data to the second electronic device. That is, the above-mentioned first signal is the first adjustment request.
  • the first adjustment request is used to request the first electronic device to decrease the playing time of the audio data sent to the second electronic device per unit time.
  • the above-mentioned second signal is a second adjustment request.
  • the second adjustment request is used to request the first electronic device to increase the playing time of the audio data sent to the second electronic device per unit time.
  • the first signal includes a second transmission parameter.
  • the second signal includes the third transmission parameter.
  • the second electronic device sends a transmission parameter of the audio data to the first electronic device to request the first electronic device to transmit the audio data to the first electronic device according to the transmission parameter.
  • the audio data transmission progress corresponding to the transmission parameter sent by the second electronic device to the first electronic device is slower than the current transmission progress.
  • the audio data transmission progress corresponding to the transmission parameter sent by the second electronic device to the first electronic device is faster.
  • the above transmission parameter may be at least one parameter such as the PCM sampling rate, the transmission time interval of the audio data packet, and the size of the audio data packet.
  • the first electronic device may transmit audio data to the second electronic device according to the transmission parameter indicated by the second electronic device.
  • the playing duration of the audio data in the audio data packet sent according to the second transmission parameter is equal to the playing duration of the audio data in the audio data packet sent according to the first transmission parameter.
  • the pulse code modulation PCM sampling rate of the audio data in the audio data packet sent according to the second transmission parameter is less than the PCM sampling rate of the audio data in the audio data packet sent according to the first transmission parameter.
  • the amount of audio data in the audio data packet sent according to the second transmission parameter is less than the amount of audio data in the audio data packet sent according to the first transmission parameter; the amount of data is the size of the audio data included in each audio data packet .
  • the first electronic device may adjust the PCM sampling rate in the first transmission parameter according to the first preset step to obtain the second transmission parameter.
  • the PCM sampling rate of the second transmission parameter is smaller than the PCM sampling rate of the first transmission parameter. It can be understood that, after adjusting the PCM sampling rate, the amount of data in the second transmission parameter is smaller than the amount of data in the first transmission parameter. In the case where the above time interval is fixed and the duration of the data to be played is fixed, the larger the PCM sampling rate, the more PCM samples obtained per unit time sampling, and the more audio data in the audio data packet.
  • the first electronic device may lower the PCM sampling rate to reduce the data in the audio data packet. In this way, the continuation or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the playing duration of the audio data in the audio data packet sent according to the third transmission parameter is equal to the playing duration of the audio data in the audio data packet sent according to the first transmission parameter.
  • the PCM sampling rate of the audio data in the audio data packet sent according to the third transmission parameter is greater than the PCM sampling rate of the audio data in the audio data packet sent according to the first transmission parameter.
  • the amount of audio data in the audio data packet sent according to the third transmission parameter is greater than the amount of audio data in the audio data packet sent according to the first transmission parameter; the amount of data is the size of the audio data included in each audio data packet .
  • the first electronic device adjusts the PCM sampling rate in the first transmission parameter according to the second preset step to obtain the third transmission parameter.
  • the PCM sampling rate of the third transmission parameter is greater than the PCM sampling rate of the first transmission parameter. It can be understood that after adjusting the PCM sampling rate, the amount of data in the third transmission parameter is greater than the amount of data in the first transmission parameter. In the case where the above time interval is fixed and the duration of the data to be played is fixed, the smaller the PCM sampling rate, the fewer the number of PCM samples obtained per unit time sampling, and the less the audio data in the audio data packet.
  • the first electronic device may increase the PCM sampling rate to increase the data in the audio data packet. In this way, the persistence or exacerbation of the underflow phenomenon can be suppressed or avoided.
  • the amount of audio data in the audio data packet sent according to the second transmission parameter is equal to the amount of audio data in the audio data packet sent according to the first transmission parameter;
  • the amount of data is the size of the audio data included in each audio data packet.
  • the PCM sampling rate of the audio data in the audio data packet sent according to the second transmission parameter is greater than the PCM sampling rate of the audio data in the audio data packet sent according to the first transmission parameter.
  • the playing duration of the audio data in the audio data packet sent according to the second transmission parameter is less than the playing duration of the audio data in the audio data packet sent according to the first transmission parameter.
  • the first electronic device adjusts the PCM sampling rate in the first transmission parameter according to the third preset step to obtain the second transmission parameter.
  • the PCM sampling rate of the second transmission parameter is greater than the PCM sampling rate of the first transmission parameter. It can be understood that, after adjusting the PCM sampling rate, the playing duration in the second transmission parameter is smaller than the playing duration in the first transmission parameter.
  • the duration of the data to be played in each audio data packet depends on the conversion of the analog signal into a digital signal by the first electronic device The size of the PCM sampling rate used.
  • the first preset value ie, overflow
  • the amount of audio data in the audio data packet sent according to the third transmission parameter is equal to the amount of audio data in the audio data packet sent according to the first transmission parameter;
  • the amount of data is the size of the audio data included in each audio data packet.
  • the PCM sampling rate of the audio data in the audio data packet sent according to the third transmission parameter is less than the PCM sampling rate of the audio data in the audio data packet sent according to the first transmission parameter.
  • the playing duration of the audio data in the audio data packet sent according to the third transmission parameter is greater than the playing duration of the audio data in the audio data packet sent according to the first transmission parameter.
  • the first electronic device adjusts the PCM sampling rate in the first transmission parameter according to the fourth preset step to obtain the third transmission parameter.
  • the PCM sampling rate of the third transmission parameter is smaller than the PCM sampling rate of the first transmission parameter. It can be understood that, after adjusting the PCM sampling rate, the playing duration in the third transmission parameter is greater than the playing duration in the first transmission parameter.
  • the duration of the data to be played in each audio data packet depends on the conversion of the analog signal into a digital signal by the first electronic device The size of the PCM sampling rate used.
  • the time interval of the audio data packet sent according to the second transmission parameter is greater than the time interval of the audio data packet sent according to the first transmission parameter.
  • the time interval of the audio data packet sent according to the third transmission parameter is smaller than the time interval of the audio data packet sent according to the first transmission parameter.
  • the frequency with which the first electronic device sends audio data packets to the second electronic device is greater, that is, the smaller the time interval, the more audio data packets buffered in the buffer of the second electronic device, and the more audio data.
  • the first electronic device adjusts the time interval in the first transmission parameter according to the fifth preset step to obtain the second transmission parameter.
  • the time interval of the second transmission parameter is greater than the time interval of the first transmission parameter.
  • the first electronic device adjusts the time interval in the first transmission parameter according to the sixth preset step to obtain the third transmission parameter.
  • the time interval of the third transmission parameter is smaller than the time interval of the first transmission parameter.
  • the method in the embodiment of the present application may further include: the first electronic device sends a synchronization message to the second electronic device.
  • This synchronization message is used for Bluetooth clock synchronization.
  • the synchronization message may include Bluetooth clock information of the first electronic device.
  • the synchronization message may be a pilot signal.
  • embodiments of the present application provide a communication method of audio data.
  • the method may include: the second electronic device feeds back the overflow to the first electronic device when the data to be played overflows; the second electronic device feeds back the underflow to the first electronic device when the data to be played underflow.
  • the method in the embodiment of the present application may further include: the second electronic device receives the synchronization message sent by the first electronic device.
  • This synchronization message is used for Bluetooth clock synchronization.
  • the synchronization message may include Bluetooth clock information of the first electronic device.
  • the synchronization message may be a pilot signal.
  • the second electronic device adjusts the Bluetooth clock of the second electronic device so that the Bluetooth clock of the second electronic device is synchronized with the Bluetooth clock indicated by the synchronization message.
  • the method of the embodiment of the present application may further include: the second electronic device adjusts the audio clock of the second electronic device so that the audio clock of the second electronic device and the second electronic device The device's Bluetooth clock is synchronized.
  • an embodiment of the present application provides an electronic device, the electronic device is a first electronic device, the electronic device includes: a processor, a memory, and a communication interface; the memory and the communication interface are coupled to the processor
  • the memory is used to store computer program code; the computer program code includes computer instructions, when the processor executes the above computer instructions, the electronic device executes audio as described in the first aspect and its possible design Data communication method.
  • an embodiment of the present application provides an electronic device, the electronic device is a second electronic device, the electronic device includes: a processor, a memory, and a communication interface; the memory and the communication interface are coupled to the processor
  • the memory is used to store computer program code; the computer program code includes computer instructions, when the processor executes the above computer instructions, the electronic device executes audio as described in the second aspect and its possible design Data communication method.
  • inventions of the present application provide an audio data communication system.
  • the audio data communication system includes the first electronic device described in the third aspect and the second electronic device described in the fourth aspect.
  • the first electronic device may communicate with one or more second electronic devices for audio data.
  • the plurality of second electronic devices may be two earplugs of a TWS earphone.
  • an embodiment of the present application provides a computer storage medium, which includes computer instructions, and when the computer instructions run on an electronic device, the electronic device is executed as described in the first aspect, the second aspect, and Any possible design method of the audio data communication method.
  • an embodiment of the present application provides a computer program product, which, when the computer program product runs on a computer, causes the computer to execute as described in the first aspect, the second aspect, and any possible design method thereof The mentioned audio data communication method.
  • the computer storage medium and the computer program product described in the seventh aspect are used to perform the corresponding methods provided above. Therefore, for the beneficial effects that can be achieved, refer to the corresponding methods provided above The beneficial effects will not be repeated here.
  • FIG. 1A is a schematic structural diagram of a communication network system of an audio data communication method according to an embodiment of the present application
  • 1B is a schematic diagram of a clock synchronization principle provided by an embodiment of this application.
  • FIG. 2 is a schematic structural diagram of a communication network system of another audio data communication method according to an embodiment of the present application
  • 3A is a schematic structural diagram of a communication network system of another audio data communication method according to an embodiment of the present application.
  • 3B is another schematic diagram of another clock synchronization principle provided by an embodiment of the present application.
  • 4A is a schematic diagram of a communication network system structure of another audio data communication method according to an embodiment of the present application.
  • 4B is a schematic diagram of another clock synchronization principle provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an example of a product form of a TWS earphone provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a hardware structure of an earplug of a TWS earphone provided by an embodiment of the present application;
  • FIG. 7 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a TWS audio system framework provided by an embodiment of the present application.
  • FIG. 9 is a flowchart of an audio data communication method based on a dual-sending method provided by an embodiment of the present application.
  • 10A is a schematic diagram illustrating the principle of synchronizing an audio clock and a Bluetooth clock of an earplug of a TWS earphone provided by an embodiment of the present application;
  • 10B-10E are schematic diagrams of an example of Bluetooth counting and audio counting of a Bluetooth clock provided by an embodiment of the present application.
  • 11 is an audio protocol framework based on bluetooth (BLE) energy provided by an embodiment of the present application.
  • BLE bluetooth
  • FIG. 12 is a flowchart of another audio data communication method based on a dual-sending method provided by an embodiment of the present application.
  • FIG. 13 is a flowchart of an audio data communication method based on a listening mode or a forwarding mode provided by an embodiment of the present application;
  • FIG. 14 is a flowchart of a single-shot audio data communication method according to an embodiment of the present application.
  • An embodiment of the present application provides an audio data communication method, which can be applied to a process in which audio data is transmitted between a first electronic device and a second electronic device.
  • the first electronic device is simply referred to as an electronic device
  • the second electronic device is an earplug of a TWS earphone as an example.
  • the electronic device can perform audio data transmission with one or two earplugs of the TWS earphone.
  • the clock synchronization in the embodiment of the present application may include: synchronization of the earphone of the TWS earphone and the Bluetooth clock of the electronic device (referred to as clock synchronization-1); synchronization of the audio clock of the earphone of the TWS earphone and the Bluetooth clock (referred to as clock synchronization-2) ;
  • the audio clock of the electronic device is synchronized with the audio clock of the earplug of the TWS earphone (referred to as clock synchronization-3).
  • the above-mentioned clock synchronization-3 specifically refers to: the electronic device can improve or mitigate the overflow or underflow of audio data in the earplug by adjusting the progress of transmitting audio data to the earplug. After the overflow or underflow phenomenon is improved or alleviated, it can be considered that the audio clock of the electronic device and the audio clock of the earplug tend to be synchronized.
  • adjusting the progress of the electronic device to transmit the audio data to the earplug to suppress or avoid the overflow or underflow phenomenon is referred to as synchronizing the audio clock of the electronic device and the earplug.
  • the TWS earphone may include a left earplug and a right earplug.
  • the TWS earphone 101 may include an earplug 101-1 and an earplug 101-2.
  • the earplug 101-1 is the left earplug of the TWS earphone 101
  • the earplug 101-2 is the right earplug.
  • the earplug 101-1 is the right earplug of the TWS earphone 101
  • the earplug 101-2 is the left earplug.
  • the method of the embodiment of the present application may be applied to the following scenario (1)-scene (4).
  • Scenario (1) The electronic device 100 and the TWS headset 101 can transmit audio data through the first transmission method.
  • the first transmission method may also be referred to as a dual transmission method.
  • the earplugs 101-1 and 101-2 of the TWS earphone 101 serve as audio input/output devices of an electronic device 100 (such as a mobile phone) and can be used together to achieve music playback or voice communication, etc.
  • the electronic device 100 is paired and connected with the earplug 101-1 and the earplug 101-2, respectively, and the electronic device 100 transmits audio data with the earplug 101-1 and the earplug 101-2, respectively.
  • the audio data transmitted from the electronic device 100 to the earplug 101-1 may be the same as or different from the audio data transmitted from the electronic device 100 to the earplug 101-2.
  • the audio data transmitted by the electronic device 100 to the earplug 101-1 and the earplug 101-2 are different.
  • the electronic device 100 transmits the left channel encoded audio data to the earplug 101-1 and the right channel encoded audio data to the earplug 101-2.
  • the audio data transmitted by the electronic device 100 to the earplug 101-1 and the earplug 101-2 are the same.
  • the synchronization of the earbuds of the TWS earphone and the Bluetooth clock of the electronic device may specifically include: the synchronization of the earbud 101-1 and the Bluetooth clock of the electronic device 100;
  • the earbud 101-2 is synchronized with the Bluetooth clock of the electronic device 100.
  • the Bluetooth clock of the earbud 101-1 and the Bluetooth clock of the earbud 101-2 are synchronized with the Bluetooth clock of the electronic device 100 respectively, the Bluetooth clock of the earbud 101-1 and the Bluetooth clock of the earbud 101-2 are synchronized accordingly.
  • the audio clock of the earplug of the TWS earphone is synchronized with the Bluetooth clock (that is, clock synchronization-2), which may specifically include: the Bluetooth clock of the earplug 101-1 and the audio of the earplug 101-1 Clock synchronization; the Bluetooth clock of the earbud 101-2 is synchronized with the audio clock of the earbud 101-2.
  • clock synchronization-2 which may specifically include: the Bluetooth clock of the earplug 101-1 and the audio of the earplug 101-1 Clock synchronization; the Bluetooth clock of the earbud 101-2 is synchronized with the audio clock of the earbud 101-2.
  • the synchronization of the audio clock of the electronic device and the audio clock of the earplug of the TWS earphone may specifically include: the audio clock of the electronic device 100 and the earplug 101-1 Synchronization of the audio clock of the electronic device; the audio clock of the electronic device 100 is synchronized with the audio clock of the earplug 101-2.
  • the synchronization of the audio clock of the electronic device 100 and the audio clock of the earplug 101-1 specifically means that the electronic device 100 can improve or mitigate the audio data in the earplug 101-1 by adjusting the progress of transmitting audio data to the earplug 101-1 Overflow or underflow phenomenon, so that the audio clock of the electronic device 100 and the audio clock of the earplug 101-1 tend to be synchronized.
  • the synchronization of the audio clock of the electronic device 100 and the audio clock of the earplug 101-2 specifically means that the electronic device 100 can improve or alleviate the increase in the audio data in the earplug 101-2 by adjusting the progress of transmitting audio data to the earplug 101-2 An overflow or underflow phenomenon, so that the audio clock of the electronic device 100 and the audio clock of the earplug 101-2 tend to be synchronized.
  • Scenario (2) The electronic device 100 and the TWS headset 101 can transmit audio data through the second transmission method.
  • the second transmission mode may also be called a monitoring mode.
  • the earplugs 101-1 and 101-2 of the TWS earphone 101 serve as audio input/output devices of an electronic device 100 (such as a mobile phone), and can be used together to realize functions such as music playback or voice communication .
  • the electronic device 100 is paired and connected with only one earplug (such as the earplug 101-1), and the earplug 101-1 and the earplug 101-2 are paired and connected.
  • the electronic device 100 transmits audio data to the earplug 101-1, and the earplug 101-2 can monitor the audio data transmitted from the electronic device 100 to the earplug 101-1 according to the connection parameters of the electronic device 100 and the earplug 101-1.
  • the earplug 101-1 can transmit the connection parameters of the electronic device 100 and the earplug 101-1 to the earplug 101-2 through the connection with the earplug 101-2.
  • Scenario (3) The electronic device 100 and the TWS headset 101 can transmit audio data through a third transmission method.
  • the third transmission method may also be referred to as a forwarding method.
  • the earplugs 101-1 and 101-2 of the TWS earphone 101 serve as audio input/output devices of an electronic device 100 (such as a mobile phone), and can be used together to realize functions such as music playback or voice communication .
  • the electronic device 100 is paired and connected with only one earplug (such as the earplug 101-1), and the earplug 101-1 and the earplug 101-2 are paired and connected.
  • the forwarding method is different from the monitoring method in that the earplug 101-2 does not need to monitor the audio data transmitted from the electronic device 100 to the earplug 101-1.
  • the earplug 101-1 may forward the audio data received from the electronic device 100 to the earplug 101-2.
  • clock synchronization-1 may specifically include: synchronization of the Bluetooth clock of the earplug 101-1 and the electronic device 100; synchronization of the Bluetooth clock of the earplug 101-2 and the earplug 101-1 . Since the earplug 101-1 is synchronized with the Bluetooth clock of the electronic device 100, after the earplug 101-2 is synchronized with the Bluetooth clock of the earplug 101-1, the Bluetooth clock of the earplug 101-2 is synchronized with the Bluetooth clock of the electronic device 100.
  • clock synchronization-2 may specifically include: synchronization of the Bluetooth clock of the earbud 101-1 and the audio clock of the earbud 101-1; the Bluetooth clock of the earbud 101-2 and the earbud 101 -2 synchronization of audio clock.
  • clock synchronization-2 since the Bluetooth clock of the earbud 101-1 and the earbud 101-2 has been synchronized in the above clock synchronization-1; therefore, after the clock synchronization-2, the audio clock of the earbud 101-1 and the earbud 101-2 The audio clock is synchronized with it.
  • clock synchronization-3 may specifically include: synchronization of the audio clock of the electronic device 100 and the audio clock of the earbud 101-1.
  • Scenario (4) The electronic device 100 and the TWS headset 101 can transmit audio data through the fourth transmission method.
  • the fourth transmission mode may also be referred to as a single transmission mode.
  • an earplug such as earplug 101-1 of the TWS earphone 101 serves as an audio input/output device of the electronic device 100 (such as a mobile phone), and is used alone to realize functions such as music playback or voice communication. .
  • clock synchronization-1 may specifically include: synchronization of the earbud 101-1 and the Bluetooth clock of the electronic device 100.
  • the clock synchronization-2 may specifically include: synchronization of the Bluetooth clock of the earbud 101-1 and the audio clock of the earbud 101-1.
  • the clock synchronization-3 may specifically include: synchronization of the audio clock of the electronic device 100 and the audio clock of the earbud 101-1.
  • the synchronization of the audio clock of the electronic device 100 and the audio clock of the earplug 101-1 specifically means that the electronic device 100 can adjust the transmission of audio data to the earplug 101-1 Progress, improve or alleviate the overflow or underflow of audio data in the earplug 101-1, so that the audio clock of the electronic device 100 and the audio clock of the earplug 101-1 tend to be synchronized.
  • the above clock synchronization-3 does not directly adjust the audio clock of the electronic device 100 or the earplug (such as the earplug 101-1), so that the audio clock of the electronic device 100 and the earplug are synchronized. Instead, by adjusting other parameters (such as the progress of the electronic device 100 transmitting audio data to the earplug), the audio clock of the electronic device 100 is synchronized with the audio clock of the earplug.
  • the above clock synchronization-1 and clock synchronization-2 both achieve clock synchronization by directly adjusting the clock (Bluetooth clock or audio clock).
  • the electronic device 100 may be a mobile phone, tablet, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital Assistants (personal digital assistant, PDA), augmented reality (augmented reality, AR) ⁇ virtual reality (virtual reality, VR) devices, media players, televisions and other devices.
  • PDA personal digital assistant
  • augmented reality augmented reality, AR
  • virtual reality virtual reality
  • VR virtual reality
  • FIG. 5 is a schematic diagram of a product form of a TWS earphone provided by an embodiment of the present application.
  • the TWS earphone 101 may include: an earplug 101-1, an earplug 101-2, and an earplug box 101-3.
  • the earplug box can be used to store the left and right earplugs of TWS earphones.
  • FIG. 5 only provides a schematic diagram of an example of a product form of a TWS earphone by way of example.
  • the product forms of peripheral devices provided by the embodiments of the present application include but are not limited to the TWS earphone 101 shown in FIG. 5.
  • FIG. 6 is a schematic structural diagram of an earplug (left earplug or right earplug) of a TWS earphone provided by an embodiment of the present application.
  • the earplugs (such as earplugs 101-2) of the TWS headset 101 may include: a processor 610, a memory 620, a sensor 630, a wireless communication module 640, a receiver 650, a microphone 660, and a power supply 670.
  • the memory 620 may be used to store application code, such as for establishing a wireless connection with another earplug of the TWS headset 101 (such as earplug 101-2), and pairing the earplug with the electronic device 100 (such as mobile phone 100) Application code.
  • the processor 610 may control to execute the above application program code to implement the function of the earplug of the TWS earphone in the embodiment of the present application.
  • the memory 620 may also store a Bluetooth address for uniquely identifying the earbud, and a Bluetooth address of another earbud where the TWS earphone is stored.
  • the memory 620 may also store connection data of the electronic device that has been successfully paired with the earplug before.
  • the connection data may be the Bluetooth address of the electronic device that has successfully paired with the earbud. Based on the connection data, the earplug can be automatically paired with the electronic device without having to configure a connection with it, such as performing legality verification.
  • the aforementioned Bluetooth address may be a media access control (media access control, MAC) address.
  • the sensor 630 may be a distance sensor or a proximity light sensor.
  • the earplug can determine whether the earphone is worn by the user through the sensor 630.
  • the earplug may use a proximity light sensor to detect whether there is an object near the earplug, thereby determining whether the earplug is worn by the user.
  • the earplug may open the receiver 650.
  • the earplug may also include a bone conduction sensor, combined with a bone conduction earphone. Using the bone conduction sensor, the earplug can obtain the vibration signal of the vibrating bone mass of the voice part, analyze the voice signal, and realize the voice function.
  • the earplug may further include a touch sensor for detecting the user's touch operation.
  • the earplug may further include a fingerprint sensor, which is used to detect a user's fingerprint and identify the user's identity.
  • the earplug may further include an ambient light sensor, which may adaptively adjust some parameters, such as volume, according to the perceived brightness of the ambient light.
  • the wireless communication module 640 is used to support short-distance data exchange between the earplug of the TWS earphone and various electronic devices, such as the electronic device 100 described above.
  • the wireless communication module 640 may be a Bluetooth transceiver.
  • the earplugs of the TWS headset can establish a wireless connection with the electronic device 100 through the Bluetooth transceiver to achieve short-range data exchange between the two.
  • At least one receiver 650 which may also be referred to as an "earpiece,” may be used to convert audio electrical signals into sound signals and play them.
  • the receiver 650 may convert the received audio electrical signal into a sound signal and play it.
  • At least one microphone 660 which may also be referred to as a "microphone” or a “microphone,” is used to convert sound signals into audio electrical signals.
  • the microphone 660 can collect the user's voice signal during the user's speech (such as talking or sending a voice message) and convert it into audio signal.
  • the above audio electrical signal is the audio data in the embodiment of the present application.
  • the power supply 670 can be used to supply power to various components included in the earplugs of the TWS earphone 101.
  • the power source 670 may be a battery, such as a rechargeable battery.
  • the TWS earphone 101 will be equipped with an earplug box (eg, 101-3 shown in FIG. 5).
  • the earplug box can be used to store the left and right earplugs of TWS earphones.
  • the earplug box 101-3 can be used to store earplugs 101-1 and 101-2 of TWS earphones.
  • the earplug box can also charge the left and right earplugs of the TWS earphone 101.
  • the above-mentioned earplug may further include: an input/output interface 680.
  • the input/output interface 680 may be used to provide any wired connection between the earplug of the TWS earphone and the earplug box (such as the earplug box 101-3 described above).
  • the input/output interface 680 may be an electrical connector.
  • the earplugs of the TWS earphone 101 When the earplugs of the TWS earphone 101 are placed in the earplug box, the earplugs of the TWS earphone 101 can be electrically connected to the earplug box (such as the input/output interface with the earplug box) through the electrical connector. After the electrical connection is established, the earplug box can charge the power supply 670 of the earplug of the TWS earphone. After the electrical connection is established, the earplugs of the TWS earphone 101 can also perform data communication with the earplug box.
  • the earplugs of the TWS earphone 101 can receive pairing instructions from the earplug box through this electrical connection.
  • the pairing command is used to instruct the earbuds of the TWS earphone 101 to turn on the wireless communication module 640, so that the earbuds of the TWS earphone 101 can use the corresponding wireless communication protocol (such as Bluetooth) to pair with the electronic device 100.
  • the wireless communication protocol such as Bluetooth
  • the earplugs of the TWS earphone 101 may not include the input/output interface 680.
  • the earplug may implement a charging or data communication function based on the wireless connection established with the earplug box 101-3 through the wireless communication module 640 described above.
  • the earplug box (such as the aforementioned earplug box 101-3) may further include a processor, a memory, and other components.
  • the memory can be used to store application program code, and is controlled and executed by the processor of the earplug box to realize the function of the earplug box.
  • the processor of the earbud box can send a pairing command to the earbud of the TWS headset in response to the user's operation of opening the lid by executing the application code stored in the memory.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the earplugs of the TWS earphone 101. It may have more or fewer components than shown in FIG. 6, two or more components may be combined, or may have different component configurations.
  • the earplug may also include an indicator light (which can indicate the status of the earplug's power level, etc.), a dust filter (which can be used with the earpiece), and other components.
  • the various components shown in FIG. 6 may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing or application specific integrated circuits.
  • the structure of the left and right earplugs of the TWS earphone 101 may be the same.
  • the left and right earplugs of the TWS earphone 101 may include the components shown in FIG. 6.
  • the structure of the left and right earplugs of the TWS earphone 101 may also be different.
  • one earplug (such as the right earplug) of the TWS earphone 101 may include the components shown in FIG. 6, and the other earplug (such as the left earplug) may include other components in FIG. 6 other than the microphone 660.
  • FIG. 7 shows a schematic structural diagram of the electronic device 100.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , A display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an environment Light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), and an image signal processor. (image)signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • the different processing units may be independent devices or may be integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller can generate the operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetch and execution.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or recycled.
  • the processor 110 may include one or more interfaces.
  • Interfaces can include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit, sound, I2S) interface, PCM interface, universal asynchronous transceiver (universal asynchronous receiver/transmitter, UART) interface, mobile Industrial processor interface (mobile industry interface, MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (universal serial) bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM interface universal asynchronous transceiver (universal asynchronous receiver/transmitter, UART) interface
  • mobile Industrial processor interface mobile industry interface, MIPI
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the interface connection relationship between the modules illustrated in the embodiments of the present invention is only a schematic description, and does not constitute a limitation on the structure of the electronic device 100.
  • the electronic device 100 may also use different interface connection methods in the foregoing embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be disposed in the processor 110.
  • the power management module 141 and the charging management module 140 may also be set in the same device.
  • the wireless communication function of the electronic device 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), and the like.
  • the mobile communication module 150 can receive the electromagnetic wave from the antenna 1 and filter, amplify, etc. the received electromagnetic wave, and transmit it to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor and convert it to electromagnetic wave radiation through the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be transmitted into a high-frequency signal.
  • the demodulator is used to demodulate 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 passed to the application processor.
  • the application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110, and may be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (bluetooth, BT), and global navigation satellites that are applied to the electronic device 100 Wireless communication solutions such as global navigation (satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR), etc.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives the electromagnetic wave via the antenna 2, frequency-modulates and filters the electromagnetic wave signal, and sends the processed signal to the processor 110.
  • the wireless communication module 160 can also receive the signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and convert it to electromagnetic waves through the antenna 2 to radiate it out.
  • the antenna 1 of the electronic device 100 and the mobile communication module 150 are coupled, and the antenna 2 and the wireless communication module 160 are coupled so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include a global mobile communication system (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long-term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation system (BDS), and a quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite-based augmentation system (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS beidou navigation system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation system
  • the electronic device 100 may utilize the wireless communication module 160 to establish a wireless connection with a peripheral device through a wireless communication technology, such as Bluetooth (BT). Based on the established wireless connection, the electronic device 100 can send voice data to the peripheral device and can also receive voice data from the peripheral device.
  • BT Bluetooth
  • the electronic device 100 realizes a display function through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations, and is used for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active matrix organic light-emitting diode (active-matrix organic light-emitting diode) emitting diode, AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can realize a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP processes the data fed back by the camera 193.
  • the ISP may be set in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • the video codec is used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100.
  • the processor 110 may execute instructions stored in the internal memory 121, establish a wireless connection with the peripheral device through the wireless communication module 160, and perform short-range data exchange with the peripheral device to pass the peripheral device Realize functions such as calling and playing music.
  • the internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area may store an operating system, at least one function required application programs (such as sound playback function, image playback function, etc.).
  • the storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100 and the like.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and so on.
  • a wireless connection is established by Bluetooth
  • the electronic device 100 can store the Bluetooth address of the peripheral device in the internal memory 121.
  • the peripheral device is a device including two main bodies, such as a TWS headset
  • the left and right earbuds of the TWS headset have respective Bluetooth addresses
  • the electronic device 100 may associate the Bluetooth addresses of the left and right earbuds of the TWS headset in the In the internal memory 121.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, and an application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
  • the speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also known as "handset" is used to convert audio electrical signals into sound signals.
  • the voice can be received by bringing the receiver 170B close to the ear.
  • the microphone 170C also known as “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through the human mouth, and input the sound signal to the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C. In addition to collecting sound signals, it may also implement a noise reduction function. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the TWS headset when the electronic device 100 establishes a wireless connection with a peripheral device 101 such as a TWS headset, the TWS headset can be used as an audio input/output device of the electronic device 100.
  • the audio module 170 may receive the audio electrical signal transmitted by the wireless communication module 160 to realize functions such as answering a phone call and playing music through a TWS headset.
  • the TWS headset can collect the user's voice signal, convert it into an audio electrical signal, and send it to the wireless communication module 160 of the electronic device 100.
  • the wireless communication module 160 transmits the audio electrical signal to the audio module 170.
  • the audio module 170 can convert the received audio electrical signal into a digital audio signal, encode it, and pass it to the mobile communication module 150. It is transmitted by the mobile communication module 150 to the call peer device to realize the call.
  • the application processor may transmit the audio electrical signal corresponding to the music played by the media player to the audio module 170.
  • the audio electrical signal is transmitted to the wireless communication module 160 by the audio module 170.
  • the wireless communication module 160 may send the audio electrical signal to the TWS headset, so that the TWS headset converts the audio electrical signal into a sound signal and plays it.
  • the headset interface 170D is used to connect wired headsets.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile electronic device (open mobile terminal) platform (OMTP) standard interface, and the American Telecommunications Industry Association (cellular telecommunications industry association of the United States, CTIA) standard interface.
  • OMTP open mobile electronic device
  • CTIA American Telecommunications Industry Association
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the electronic device 100 determines the strength of the pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation intensities may correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the movement posture of the electronic device 100.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the magnetic sensor 180D includes a Hall sensor.
  • the acceleration sensor 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (generally three axes).
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense the brightness of ambient light.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access to application lock, fingerprint photo taking, fingerprint answering call, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • Touch sensor 180K also known as "touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 constitute a touch screen, also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the location where the display screen 194 is located.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can also contact the pulse of the human body and receive a blood pressure beating signal.
  • the application processor may analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
  • the key 190 includes a power-on key, a volume key, and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.
  • the motor 191 may generate a vibration prompt.
  • the motor 191 can be used for vibration notification of incoming calls and can also be used for touch vibration feedback.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the amount of power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation with the electronic device 100.
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the electronic device 100 interacts with the network through a SIM card to realize functions such as call and data communication
  • FIG. 8 shows a schematic structural diagram of a TWS audio system provided by an embodiment of the present application.
  • the TWS audio system shown in FIG. 8 can be applied to the above scene (1)-scene (4).
  • the electronic device 100, the earplug 101-1, and the earplug 101-2 may all include a Bluetooth module, an audio module, and a codec (Codec) module.
  • Codec codec
  • the Bluetooth module is responsible for Bluetooth protocol processing and the reception and transmission of Bluetooth data (such as audio data).
  • the Bluetooth module may include at least one receiver and transmitter, and a radio frequency antenna. And, the Bluetooth module can maintain a Bluetooth clock (BT clock).
  • BT clock Bluetooth clock
  • the audio module is responsible for audio coding and audio decoding.
  • the audio module includes at least one audio encoder or audio decoder.
  • the Codec module is responsible for sampling and playback of audio signals.
  • the Codec module includes at least a digital-to-analog converter (DAC) or a digital-to-analog converter (analog to digital converter, ADC).
  • DAC digital-to-analog converter
  • ADC analog to digital converter
  • the Codec module maintains an audio clock (Audio clock).
  • the Bluetooth module of the mobile phone 100 shown in FIG. 8 may be implemented in the wireless communication module 160 shown in FIG. 7.
  • the audio module and Codec module of the mobile phone 100 shown in FIG. 8 may be implemented in the audio module 170 shown in FIG. 7.
  • the audio module 170 shown in FIG. 7 may be disposed in the processor 110, or a part of the functional modules of the audio module 170 may be disposed in the processor 110.
  • the Bluetooth module of the earplug 101-1 or the earplug 101-2 shown in FIG. 8 may be implemented in the wireless communication module 640 shown in FIG.
  • the audio module and Codec module of the earplug 101-1 or the earplug 101-2 shown in FIG. 8 may be implemented in the processor 610 shown in FIG.
  • the electronic device is the mobile phone 100
  • the first earplug of the TWS earphone is the earplug 101-1 of the TWS earphone 101
  • the second earplug is the earplug 101-2 of the TWS earphone 101 as an example for description.
  • the earplug 101-1 and earplug 101-2 of the TWS earphone 101 are used together to realize functions such as music playback or voice communication.
  • the audio data communication method provided in the embodiments of the present application will be described.
  • the lid of the earplug box 101-3 of the TWS earphone 101 can be opened.
  • the earplug 101-1 and the earplug 101-2 can be automatically paired and connected.
  • the earplug box 101-3 may include a sensor (such as an ambient light sensor or a magnetic sensor, etc.).
  • the sensor can detect that the earplug box 101-3 is opened.
  • the earplug box 101-3 includes an ambient light sensor. After the earplug box 101-3 is opened, the ambient light brightness detected by the ambient light sensor in the earplug box 101-3 is relatively large. After the earplug box 101-3 is closed, the ambient light brightness detected by the ambient light sensor in the earplug box 101-3 is small. Assuming that the earplug box 101-3 is closed, after the earplug box 101-3 is opened, the ambient light brightness detected by the ambient light sensor will change from small to large.
  • the earplug box 101-3 can generate a pairing instruction to any earplug (such as earplug 101-1) when the ambient light brightness detected by the ambient light sensor changes from small to large, and the ambient light brightness is higher than the preset brightness threshold , Indicating that the earbud is paired with another earbud.
  • a pairing instruction to any earplug (such as earplug 101-1) when the ambient light brightness detected by the ambient light sensor changes from small to large, and the ambient light brightness is higher than the preset brightness threshold , Indicating that the earbud is paired with another earbud.
  • the earplug box 101-3 can use a magnetic sensor to detect the opening and closing of the box cover.
  • the earplug box 101-3 can detect the opening and closing of the box cover according to the magnetic sensor.
  • a pairing instruction can be issued to any earplug (such as the earplug 101-1), indicating that the earplug is paired with another earplug.
  • the earplug 101-1 may generate a pairing request to the earplug 101-2, requesting pairing connection with the earplug 101-2.
  • the earplugs (such as earplugs 101-1) of the TWS earphone 101 may include the aforementioned ambient light sensor.
  • the earplug 101-1 can change the ambient light brightness detected by the ambient light sensor from small to large, and when the ambient light brightness is higher than the preset brightness threshold, a pairing request is sent to the earbud 101-2, requesting the earbud 101-2 Pair connection.
  • any earplug of the earplug 101-1 and the earplug 101-2 can send a paired broadcast to the outside.
  • the mobile phone 100 has turned on the Bluetooth function, the mobile phone 100 can receive the pairing broadcast and prompt the user that the relevant Bluetooth device (such as the earbud 101-1) has been scanned.
  • the mobile phone 100 can be paired with the earplug 101-1.
  • the earbud 101-1 After the earbud 101-1 is paired with the mobile phone 100, the earbud 101-1 can send the Bluetooth address of the mobile phone 100 to the earbud 101-2 through the Bluetooth connection with the earbud 101-2, and notify the earbud 101-2 to send a pairing broadcast to the outside . In this way, the mobile phone 100 can receive the pairing broadcast sent by the earplug 101-2 and pair with the earplug 101-2 and connect.
  • the audio data communication method provided in the embodiment of the present application may be implemented to synchronize the Bluetooth clock and the audio clock of the mobile phone 100 and the TWS headset 101.
  • the left and right earplugs of the TWS earphone 101 and the Bluetooth clock of the mobile phone 100 can be synchronized first.
  • the above clock synchronization-1 may specifically include: synchronization of the earphone 101-1 and the Bluetooth clock of the mobile phone 100 (ie, S901); and, synchronization of the earbud 101-2 and the Bluetooth clock of the mobile phone 100 (Ie S902).
  • the mobile phone 100 can send a synchronization message to the earplug 101-1.
  • This synchronization message is used for Bluetooth clock synchronization.
  • the synchronization message may include Bluetooth clock information of the mobile phone 100.
  • the synchronization message may be a pilot signal.
  • the earplug 101-1 (for example, the Bluetooth module of the earplug 101-1 shown in FIG. 8) can estimate the difference between the Bluetooth clock indicated by the pilot signal and the Bluetooth clock maintained by the earplug 101-1.
  • the earbud 101-1 may adjust the Bluetooth clock of the earbud 101-1 according to the estimated difference, so that the Bluetooth clock of the earbud 101-1 and the pilot signal indicate Bluetooth clock synchronization. That is, the mobile phone 100 and the earplug 101-1 can perform S901 to synchronize the Bluetooth clock of the earplug 101-1 and the electronic device 100. Wherein, the mobile phone 100 and the earplug 101-2 can perform S902, and the method for synchronizing the Bluetooth clock of the earplug 101-2 and the electronic device 100 is similar to S901, and details are not described herein in the embodiments of the present application.
  • the Bluetooth clock of the earbud 101-1 is synchronized with the Bluetooth clock of the mobile phone 100
  • the Bluetooth clock of the earbud 101-2 is synchronized with the Bluetooth clock of the mobile phone 100. Since the Bluetooth clock of the earbud 101-1 and the Bluetooth clock of the earbud 101-2 are synchronized with the Bluetooth clock of the mobile phone 100; therefore, the Bluetooth clock of the earbud 101-1 and the Bluetooth clock of the earbud 101-2 will also be synchronized.
  • the audio clock of the earplug of the TWS earphone 101 can be synchronized with the Bluetooth clock (that is, clock synchronization-2).
  • the earplug 101-1 may adjust the audio clock of the earplug 101-1 so that the audio clock is synchronized with the Bluetooth clock. Specifically, the earplug 101-1 (for example, the Bluetooth module of the earplug 101-1 shown in FIG. 8) may generate a synchronization signal based on the Bluetooth clock of the earplug 101-1. Then, the earplug 101-1 (for example, the audio module of the earplug 101-1 shown in FIG. 8) may calculate the difference between the synchronization signal and the audio clock of the earplug 101-1. Wherein, the audio module of the earplug 101-1 shown in FIG.
  • the earplug 101-1 (for example, the audio module of the earplug 101-1 shown in FIG. 8) can adjust the audio clock of the earplug 101-1 according to the difference, so that the audio clock of the earplug 101-1 is synchronized with the Bluetooth clock. That is, the earbud 101-1 can execute S903 to synchronize the audio clock of the earbud 101-1 with the Bluetooth clock.
  • the earplug 101-2 (for example, the audio module of the earplug 101-2 shown in FIG. 8) can adjust the audio clock of the earplug 101-2 so that the audio clock is synchronized with the Bluetooth clock.
  • the earplug 101-2 (for example, the Bluetooth module of the earplug 101-2 shown in FIG. 8) may generate a synchronization signal based on the Bluetooth clock of the earplug 101-2.
  • the earplug 101-2 (for example, the audio module of the earplug 101-2 shown in FIG. 8) may calculate the difference between the synchronization signal and the audio clock of the earplug 101-2.
  • the earplug 101-2 (for example, the audio module of the earplug 101-2 shown in FIG. 8) can adjust the audio clock of the earplug 101-2 according to the difference, so that the audio clock of the earplug 101-2 is synchronized with the Bluetooth clock. That is, the earbud 101-2 can execute S904 to synchronize the audio clock of the earbud 101-2 with the Bluetooth clock.
  • the Bluetooth clocks of the earbuds 101-1 and 101-2 are synchronized with the Bluetooth clock of the mobile phone 100, the earbuds 101-1 and the earbuds 101-2 each adjust the audio clock to synchronize with the Bluetooth clock; The audio clock and the audio clock of the earbud 101-2 will also be synchronized.
  • the above clock synchronization-2 may specifically include: synchronization of the audio clock of the earbud 101-1 and the Bluetooth clock (that is, S903); and, audio of the earbud 101-2 Synchronization of clock and Bluetooth clock (ie S904).
  • the audio clock of the earbud 101-1 is synchronized with the Bluetooth clock as an example to describe the specific method of the above clock synchronization-2.
  • the earplug 101-1 (for example, the Bluetooth module of the earplug 101-1 shown in FIG. 8) may generate a synchronization signal based on the Bluetooth clock of the earplug 101-1, and the synchronization signal may represent the value of the Bluetooth clock of the earplug 101-1. among them.
  • the Bluetooth count shown in FIG. 10A is the value of the Bluetooth clock of the earbud 101-1.
  • the earplug 101-1 (for example, the audio module of the earplug 101-1 shown in FIG.
  • the audio count shown in FIG. 10A is the value of the audio clock of the earplug 101-1.
  • the earplug 101-1 (for example, the audio module of the earplug 101-1 shown in FIG. 8) can compare the Bluetooth count and the audio count to obtain the difference between the Bluetooth count and the audio count.
  • the earplug 101-1 (for example, the audio module of the earplug 101-1 shown in FIG.
  • the frequency is such that the audio count of the earbud 101-1 is the same as the Bluetooth count, and the audio clock of the earbud 101-1 is synchronized with the Bluetooth clock.
  • the Bluetooth module of the earplug 101-1 can perform m Bluetooth counts every a ms.
  • the audio module of the earplug 101-1 can perform m audio counts every a ms.
  • the Bluetooth module of the earbud 101-1 performs 10000 Bluetooth counts every 10 ms. Among them, the Bluetooth module can clear the Bluetooth count every 10ms.
  • the audio module of the earplug 101-1 performs 10,000 audio counts every 10 ms. Among them, the Bluetooth module can clear the Bluetooth count every 10ms.
  • the Bluetooth module of the earplug 101-1 may send a synchronization signal to the audio module every a ms (for example, 10 ms).
  • This synchronization signal may characterize the value of the Bluetooth clock of the earbud 101-1 (ie, Bluetooth count).
  • the Bluetooth module of the earbud 101-1 sends a synchronization signal to the audio module every 10 ms.
  • the Bluetooth count of the Bluetooth module is synchronized with the audio count of the audio module.
  • the audio clock and the Bluetooth clock of the earbud 101-1 may be different.
  • the audio count of the earbud 101-1 may be less than the Bluetooth count. As shown in FIG. 10D, if the Bluetooth count indicated by the synchronization signal is 10000 and the audio count is 9990, it means that the audio count is 10 counts smaller than the Bluetooth count.
  • the audio module can adjust the input and output frequency of the audio PLL of the earplug 101-1, so that the audio count of the earplug 101-1 is synchronized with the Bluetooth count, so that the audio clock of the earplug 101-1 is synchronized with the Bluetooth clock.
  • the audio count of the earbud 101-1 may be greater than the Bluetooth count.
  • the Bluetooth count indicated by the synchronization signal is 10000 and the audio count is 10, it means that when the Bluetooth count is 10000 in a 10ms period (that is, 0 in the next 10ms period of the 10ms period), the audio The count is already 10 for the next 10ms period. That is, the audio count is 10 counts greater than the Bluetooth count.
  • the audio module can adjust the input and output frequency of the audio PLL of the earplug 101-1, so that the audio count of the earplug 101-1 is synchronized with the Bluetooth count, so that the audio clock of the earplug 101-1 is synchronized with the Bluetooth clock.
  • the method for synchronizing the audio clock with the Bluetooth clock by the earbud 101-2 is the same as the method for synchronizing the audio clock with the Bluetooth clock by the earbud 101-1, which will not be repeated here in the embodiments of the present application.
  • the audio clock and the Bluetooth clock may be synchronized periodically (eg, every 10 ms).
  • the earplug 101-1 is taken out of the earplug box 101-3, it is not necessarily used.
  • the earplug 101-1 is taken out of the earplug box 101-3, it may not necessarily perform audio data communication with an electronic device (such as the mobile phone 100).
  • the earplug 101-1 may perform the synchronization of the audio clock and the Bluetooth clock when the earplug 101-1 establishes a connection with the electronic device, or when the earplug 101-1 and the electronic device communicate audio data.
  • the audio clock of the mobile phone 100 and the audio clock of the earplugs of the TWS earphone 101 can be synchronized (that is, clock synchronization-3).
  • the above clock synchronization-3 may specifically include: synchronization of the audio clock of the mobile phone 100 and the audio clock of the earplug 101-1 (that is, S905); and, the audio clock of the mobile phone 100 and the earplug 101- Synchronization of the audio clock of 2 (ie S906).
  • synchronizing the audio clock of the mobile phone 100 and the audio clock of the earplug 101-1 may specifically include: the earplug 101-1 may request the mobile phone when the data to be played (ie, audio data) overflows or underflows. 100 adjusts the progress of the mobile phone 100 transmitting audio data to the earplug 101-1 to suppress or avoid the continuation or aggravation of the above-mentioned overflow or underflow phenomenon.
  • the earplug 101-1 or the earplug 101-2 After receiving the audio data sent by the mobile phone 100, the earplug 101-1 or the earplug 101-2 stores the received audio data (that is, data to be played) in a buffer.
  • the overflow of the data to be played may include that: the data buffered in the buffer exceeds the first preset value (which may also be referred to as a waterline).
  • the underflow of the data to be played may include that: the data buffered in the buffer is lower than a second preset value (which may also be called a waterline).
  • a specific implementation manner in which the data buffered in the buffer is higher than the first preset value and the data buffered in the buffer is lower than the second preset value may include at least implementation manner (1)-implementation manner (3).
  • the data buffered in the buffer exceeds the first preset value, which may specifically be: the size of the data buffered in the buffer exceeds the first preset value.
  • the data buffered in the buffer is lower than the second preset value, which may specifically be: the size of the data buffered in the buffer is lower than the second preset value.
  • the unit of the size of the above data may be MB or KB.
  • the unit of the first preset value and the second preset value is also MB or KB.
  • the data buffered in the buffer exceeds the first preset value, which may specifically be: the duration of the data buffered in the buffer to be played exceeds the first preset value.
  • the data buffered in the buffer is lower than the second preset value, which may specifically be: the duration of the data buffered in the buffer to be played is lower than the second preset value.
  • the duration of the data to be played refers to the length of time required for the earplug (such as earplug 101-1) to play the data.
  • the unit of the duration of the above data to be played may be milliseconds (ms) or seconds (s).
  • the units of the first preset value and the second preset value are also milliseconds or seconds.
  • the data buffered in the buffer exceeds the first preset value, which may specifically be: the number of data packets buffered in the buffer is greater than the first preset value.
  • the data buffered in the buffer is lower than the second preset value, which may specifically be: the number of data packets buffered in the buffer is less than the second preset value.
  • the overflow of the data to be played may include that the data buffered in the buffer is about to exceed the first preset value (which may also be called a watermark).
  • the underflow of the data to be played may include that the data buffered in the buffer is about to fall below the second preset value (which may also be called a waterline).
  • the mobile phone 100 may send audio data to the earplug 101-1 according to the first transmission parameter.
  • the audio data sent in unit time according to the first transmission parameter has a first playing duration.
  • the data to be played of the earplug 101-1 overflows, it sends a first signal to the mobile phone 100.
  • the mobile phone 100 may send audio data to the earplug 101-1 according to the second transmission parameter.
  • the audio data sent in unit time according to the second transmission parameter has a second playing duration. The second playing duration is shorter than the first playing duration.
  • a second signal is sent to the mobile phone 100.
  • the mobile phone 100 sends audio data to the earplug 101-1 according to the third transmission parameter.
  • the audio data sent in unit time according to the third transmission parameter has a third playing duration.
  • the third playing duration is greater than the first playing duration.
  • the above-mentioned first signal may be sent by the earplug 101-1.
  • the mobile phone 100 may send audio data according to the second transmission parameter in response to the first signal.
  • the audio data sent in the unit time according to the second transmission parameter has a smaller playing duration (second playing duration). That is, the second playing duration is shorter than the first playing duration.
  • the playing time of the audio data sent from the mobile phone 100 to the earplug 101-1 per unit time becomes smaller, which means that the progress of the audio data transmission from the mobile phone 100 to the earplug 101-1 is slowed. In other words, the progress of sending audio data according to the second transmission parameter is slower than the progress of sending audio data according to the first transmission parameter.
  • the mobile phone 100 may adjust the transmission parameters for transmitting audio data to the earplug 101-1. In this way, the progress of the mobile phone 100 transmitting audio data to the earbud 101-1 can be slowed. In this way, the progress of the earplug 101-1 storing audio data in its buffer will also be slowed down, and the speed of buffering data in the buffer of the earplug 101-1 will be reduced. As the earphone 101-1 processes the audio data buffered in the buffer, the data buffered in the buffer can be reduced. In this way, the continuation or exacerbation of the overflow phenomenon can be suppressed.
  • the above second signal is sent when the data to be played of the earplug 101-1 underflows.
  • the mobile phone 100 may send audio data according to the third transmission parameter in response to the second signal.
  • the audio data sent in unit time according to the third transmission parameter has a larger playing duration (second playing duration). That is, the third playing duration is greater than the first playing duration.
  • the playing time of the audio data sent from the mobile phone 100 to the earplug 101-1 per unit time becomes larger, which means that the progress of the audio data transmission from the mobile phone 100 to the earplug 101-1 is accelerated. In other words, the progress of sending audio data according to the third transmission parameter is faster than the progress of sending audio data according to the first transmission parameter.
  • the mobile phone 100 may adjust the transmission parameters for transmitting audio data to the earplug 101-1. In this way, the progress of the mobile phone 100 transmitting audio data to the earbud 101-1 can be accelerated. In this way, the progress of storing the audio data in the buffer of the earplug 101-1 will be accelerated, and the speed of buffering the data in the buffer of the earplug 101-1 will increase. On the premise that the audio data buffered in the buffer by the earbud 101-1 is processed at a constant speed, the data buffered in the buffer can be increased. In this way, the continuation or exacerbation of the underflow phenomenon can be suppressed.
  • the earplug 101-1 may request the mobile phone 100 to adjust the transmission of the mobile phone 100 to the earplug 101-1 through the following three implementations (implementation a-implementation c) when the data to be played overflows or underflows.
  • the above-mentioned first signal is a first indication message.
  • the above-mentioned second signal is a second indication message.
  • Implementation method a When the data to be played overflows or underflows, the earplug 101-1 may send indication information indicating that the data to be played has overflowed or underflowed to the mobile phone 100 to feed back the overflow or underflow phenomenon .
  • the earplug 101-1 may send a first instruction message to the mobile phone 100 when the data to be played overflows.
  • the first indication message is used to indicate that the data to be played of the earplug 101-1 has overflowed.
  • the earplug 101-1 may send a second instruction message to the mobile phone 100 when the data to be played underflows.
  • the second indication message is used to indicate that the data to be played of the earplug 101-1 has underflowed.
  • Implementation method b When the data to be played overflows or underflows, the earplug 101-1 sends a request to the mobile phone 100 to adjust the progress of the audio data.
  • the above-mentioned first signal is a first adjustment request.
  • the above-mentioned second signal is a second adjustment request.
  • the earplug 101-1 may send a first adjustment request to the mobile phone 100 when the data to be played overflows.
  • the first adjustment request is used to request the mobile phone 100 to slow down the progress of transmitting audio data to the earbud 101-1.
  • the earplug 101-1 may send a second adjustment request to the mobile phone 100 when the data to be played underflows.
  • the second adjustment request is used to request the mobile phone 100 to speed up the progress of transmitting audio data to the earbud 101-1.
  • Implementation manner c When the data to be played overflows or underflows, the earplug 101-1 sends the transmission parameter of the audio data to the mobile phone 100 to request the mobile phone 100 to transmit the audio data to the mobile phone 100 according to the transmission parameter.
  • the first signal may include a second transmission parameter.
  • the second transmission signal may include a third transmission parameter.
  • the transmission parameter (that is, the second Transmission parameters) corresponding to the audio data transmission progress is slow.
  • the transmission parameter (that is, the third transmission parameter) sent by the earplug 101-1 to the mobile phone 100 )
  • the corresponding audio data transmission progress is faster.
  • the above transmission parameter may be at least one parameter such as the PCM sampling rate, the transmission time interval of the audio data packet, and the size of the audio data packet.
  • the mobile phone 100 can transmit audio data to the earplug 101-1 according to the transmission parameters indicated by the earplug 101-1.
  • the mobile phone 100 transmits audio data to the earplug 101-1 according to the transmission parameters corresponding to method 1 in Table 1.
  • the earplug 101-1 may send the transmission parameter corresponding to the method 2 in Table 1 to the mobile phone 100 when the data to be played overflows.
  • the mobile phone 100 can transmit audio data to the earplug 101-1 according to the transmission parameters corresponding to the mode 2 in Table 1.
  • the earplug 101-1 can transmit the first indication message, the second indication message, the first adjustment request, the second adjustment request, and the transmission parameter through the control link between the earplug 101-1 and the mobile phone 100 Wait.
  • the control link may be an asynchronous connection-oriented (ACL) link.
  • the earplug 101-1 when the data to be played overflows, it means that there is more data buffered in the buffer of the earplug (such as the earplug 101-1), and the earplug 101-1 is too late to play more audio data.
  • the reason for the large amount of data buffered in the buffer may be that the mobile phone 100 has a faster progress in transmitting audio data to the earbud 101-1. In this case, if the mobile phone 100 still transmits audio data to the earbud 101-1 according to the original transmission progress, the audio data may be lost because the buffer cannot cache the audio data from the mobile phone 100. In this way, the audio data played by the earbud 101-1 may be discontinuous.
  • the mobile phone 100 may slow down the progress of transmitting audio data to the earbud 101-1. In this way, the buffer pressure of the earplug 101-1 can be relieved, and the persistence or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the earplug 101-1 When the data to be played underflows, it means that there is less audio data buffered in the buffer of the earplug (such as the earplug 101-1), and the earplug 101-1 does not buffer enough data to be played.
  • the reason why less data is buffered in the buffer may be that the mobile phone 100 has a slower progress in transmitting audio data to the earbud 101-1. In this case, if the mobile phone 100 still transmits audio data to the earbud 101-1 according to the original transmission progress, then the earbud 101-1 may play no data after playing the data buffered in the buffer. In this way, the earplug 101-1 will have a playback interruption. At this time, the mobile phone 100 can speed up the progress of transmitting audio data to the earbud 101-1. In this way, the buffer of the earplug 101-1 can be increased, and the persistence or exacerbation of the underflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 may adjust the progress of transmitting audio data to the earplug 101-1 through the following implementation manner (i)-implementation manner (ii).
  • the mobile phone 100 (for example, the codec module of the mobile phone 100 shown in FIG. 8) can adjust the PCM sampling rate of the audio data transmitted from the mobile phone 100 to the earplug 101-1 to adjust the mobile phone 100 to the earplug 101 -1
  • the progress of transmitting audio data to suppress or avoid the persistence or aggravation of underflow.
  • the higher the PCM sampling rate the more the number of PCM samples obtained per unit time sampling. The greater the number of PCM samples, the more data will be sampled.
  • the audio data sent by the mobile phone 100 to the earplug 101-1 is a digital signal.
  • the data signal is converted from an analog signal.
  • the mobile phone 100 (for example, the codec module of the mobile phone 100 shown in FIG. 8) can convert an analog signal into a digital signal.
  • the mobile phone 100 can adjust the progress of the audio data transmission from the mobile phone 100 to the earbud 101-1 by adjusting the PCM sampling rate used in the process of converting the analog signal to the digital signal.
  • the time interval at which the mobile phone 100 sends audio data packets to the earbud 101-1 is fixed.
  • the mobile phone 100 sends an audio data packet to the earplug 101-1 every 20 milliseconds (ms).
  • the duration of the data to be played in each audio data packet is fixed.
  • the duration of the data to be played in each audio data packet is 20 ms.
  • the mobile phone 100 can suppress or avoid the continuation or exacerbation of the overflow or underflow phenomenon by adjusting the size of the audio data included in each audio data packet.
  • the size of the audio data included in each audio data packet depends on the size of the PCM sampling rate used when the mobile phone 100 converts the analog signal into a digital signal .
  • the mobile phone 100 can increase the PCM sampling rate to increase the data in the audio data packet. In this way, the persistence or exacerbation of the underflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 can lower the PCM sampling rate to reduce the data in the audio data packet. In this way, the continuation or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • each audio data packet includes 20 ms of audio data.
  • the PCM sampling rate used by the mobile phone 100 to transmit audio data packets to the earbud 101-1 is 24 kilohertz (kHz).
  • the size of the audio data included in each audio data packet is 100KB.
  • the mobile phone 100 may lower the PCM sampling rate used by the mobile phone 100 to transmit the audio data packet to the earplug 101-1. For example, the mobile phone 100 may adjust the PCM sampling rate to 16 kHz as shown in the method 2 in Table 1. After lowering the PCM sampling rate, the mobile phone 100 still transmits an audio data packet to the earbud 101-1 every 20 ms. Each audio data packet includes 20 ms of audio data. However, the size of the audio data included in each audio data packet has changed. Specifically, the audio data included in each audio data packet becomes less. As shown in Table 1, the audio data included in each audio data packet is changed from 100 KB shown in Mode 1 to 80 KB shown in Mode 2. In this way, the buffer pressure of the earplug 101-1 can be relieved, and the persistence or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 may increase the PCM sampling rate used by the mobile phone 100 to transmit the audio data packet to the earplug 101-1.
  • the mobile phone 100 can adjust the PCM sampling rate to 32 kHz as shown in method 3 in Table 1.
  • the mobile phone 100 still transmits an audio data packet to the earbud 101-1 every 20 ms.
  • Each audio data packet includes 20 ms of audio data.
  • the size of the audio data included in each audio data packet has changed. Specifically, more audio data is included in each audio data packet. As shown in Table 1, the audio data included in each audio data packet is changed from 100KB shown in mode 1 to 160KB shown in mode 3. In this way, the buffer of the earplug 101-1 can be increased to suppress or avoid the persistence or aggravation of the underflow phenomenon.
  • the time interval at which the mobile phone 100 sends audio data packets to the earbud 101-1 is fixed.
  • the mobile phone 100 sends an audio data packet to the earplug 101-1 every 20 ms.
  • the size of the audio data included in each audio data packet is fixed.
  • each audio data packet includes 100 KB of audio data. Then, the mobile phone 100 can suppress or avoid the continuation or exacerbation of overflow or underflow by adjusting the duration of the data to be played in each audio data packet.
  • the duration of the data to be played in each audio data packet depends on the use of the mobile phone 100 when converting the analog signal into a digital signal The size of the PCM sampling rate.
  • the mobile phone 100 can increase the PCM sampling rate to shorten the duration of the data to be played in the audio data packet. In this way, the continuation or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 can lower the PCM sampling rate to increase the duration of the data to be played in the audio data packet. In this way, the persistence or exacerbation of the underflow phenomenon can be suppressed or avoided.
  • each audio data packet includes 20 ms of audio data.
  • the PCM sampling rate used by the mobile phone 100 to transmit audio data packets to the earbud 101-1 is 24 kHz.
  • the mobile phone 100 may increase the PCM sampling rate used by the mobile phone 100 to transmit the audio data packet to the earplug 101-1. For example, the mobile phone 100 may adjust the PCM sampling rate to 32 kHz as shown in method 2 in Table 2. After increasing the PCM sampling rate, the mobile phone 100 still transmits an audio data packet to the earbud 101-1 every 20 ms. Each audio data packet includes 100KB of audio data. However, the playing time of the audio data in each audio data packet has changed. Specifically, the playing time of the audio data in the audio data packet becomes shorter. As shown in Table 2, the playing time of the audio data in each audio data packet has changed from 20 ms shown in mode 1 to 10 ms shown in mode 2. In this way, the buffer pressure of the earplug 101-1 can be relieved, and the persistence or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 can lower the PCM sampling rate used by the mobile phone 100 to transmit the audio data packet to the earplug 101-1.
  • the mobile phone 100 may adjust the PCM sampling rate to 16 kHz as shown in method 3 in Table 2.
  • the mobile phone 100 still transmits an audio data packet to the earbud 101-1 every 20 ms.
  • Each audio data packet includes 100KB of audio data.
  • the playing time of the audio data in each audio data packet has changed. Specifically, the playing time of the audio data in the audio data packet becomes longer.
  • the playing time of the audio data in each audio data packet has changed from 20 ms shown in mode 1 to 30 ms shown in mode 3.
  • the buffer of the earplug 101-1 can be increased to suppress or avoid the persistence or aggravation of the underflow phenomenon.
  • the mobile phone 100 can adjust the progress of transmitting audio data from the mobile phone 100 to the earplug 101-1 by adjusting the interval time for transmitting audio data packets to the earplug (such as the earplug 101-1), so as to suppress or avoid underflow Continued or intensified.
  • each audio data packet includes 100 KB of audio data.
  • the duration of the data to be played in each audio data packet is fixed.
  • the duration of the data to be played in each audio data packet is 20 ms.
  • the mobile phone 100 may increase the time interval for transmitting audio data to the earbud 101-1. For example, the mobile phone 100 may transmit an audio data packet to the earbud 101-1 every 30 ms. After increasing the time interval for transmitting audio data to the earplug 101-1, although the size of the audio data in each audio data packet does not change, the playing duration of the audio data in each audio data packet does not change. However, the number of audio data packets sent by the mobile phone 100 to the earplug 101-1 is reduced, so that the audio data to be buffered by the buffer of the earplug 101-1 becomes less, and the playing time of the audio data to be buffered by the buffer is also shorter. In this way, the buffer pressure of the earplug 101-1 can be relieved, and the persistence or exacerbation of the overflow phenomenon can be suppressed or avoided.
  • the mobile phone 100 may adjust the time interval for transmitting audio data to the earbud 101-1. For example, the mobile phone 100 may transmit an audio data packet to the earbud 101-1 every 10 ms. After adjusting the time interval for transmitting audio data to the earplug 101-1, although the size of the audio data in each audio data packet does not change, the playing duration of the audio data in each audio data packet does not change. However, the number of audio data packets sent from the mobile phone 100 to the earplug 101-1 increases, so that the audio data to be buffered by the buffer of the earplug 101-1 increases, and the playing duration of the audio data to be buffered by the buffer also becomes longer. In this way, the buffer of the earplug 101-1 can be increased to suppress or avoid the persistence or aggravation of the underflow phenomenon.
  • the Bluetooth clock of the mobile phone 100 has not been adjusted while the mobile phone 100 adjusts the progress of transmitting audio data to the earbuds. That is, the time for the mobile phone 100 to transmit audio data to the earbuds has not changed.
  • the mobile phone 100 just adjusts the interval of transmitting audio data packets to the earplugs. For example, the mobile phone 100 may not send the audio data packet at some time when the audio data packet is originally to be sent.
  • the mobile phone 100 can not only adjust the progress of transmitting audio data to the earplug 101-1 through the following implementation manner (i)-implementation manner (ii).
  • the mobile phone 100 may also adjust the size of the audio data included in the audio data packet, the duration of the data to be played in each audio data packet, and the at least two parameters among the three parameters of the time interval for sending the audio data packet, Adjust the progress of transferring audio data to the earbud 101-1.
  • the mobile phone 100 receives the first indication message sent by the earplug 101-1, it indicates that the data to be played of the earplug 101-1 has overflowed. At this time, the mobile phone 100 may lower the PCM sampling rate to slow down the progress of the mobile phone 100 transmitting audio data to the earbud 101-1. If the mobile phone 100 receives the second instruction message sent by the earplug 101-1, it indicates that the data to be played of the earplug 101-1 has underflowed. At this time, the mobile phone 100 can increase the PCM sampling rate to speed up the progress of the mobile phone 100 transmitting audio data to the earbud 101-1.
  • the mobile phone 100 may respond to the first adjustment request and lower the PCM sampling rate to slow down the transmission of audio from the mobile phone 100 to the earplug 101-1 The progress of the data. If the mobile phone 100 receives the second adjustment request sent by the earplug 101-1, it may increase the PCM sampling rate in response to the second adjustment request to speed up the progress of the mobile phone 100 transmitting audio data to the earplug 101-1.
  • the mobile phone 100 may adjust the progress of the audio data transmission from the mobile phone 100 to the earplug 101-1 according to a preset step.
  • the mobile phone 100 may decrease the PCM sampling rate in the first transmission parameter according to the first preset step to slow down the transmission of audio from the mobile phone 100 to the earbud 101-1 Data progress; the mobile phone 100 can increase the PCM sampling rate in the first transmission parameter according to the second preset step to speed up the progress of the mobile phone 100 transmitting audio data to the earbud 101-1.
  • the mobile phone 100 can increase the PCM sampling rate in the first transmission parameter according to the third preset step, which can reduce the playing time of the audio data in the audio data packet .
  • the progress of the mobile phone 100 transmitting audio data to the earbud 101-1 can be slowed.
  • the mobile phone 100 may decrease the PCM sampling rate in the first transmission parameter according to the fourth preset step. This can increase the playing time of the audio data in the audio data packet. Therefore, the progress of the audio data transmission from the mobile phone 100 to the earbud 101-1 can be speeded up.
  • the mobile phone 100 may increase the time interval in the first transmission parameter according to the fifth preset step to slow down the progress of the audio data transmission from the mobile phone 100 to the earbud 101-1; 100 may decrease the time interval in the first transmission parameter according to the sixth preset step to speed up the progress of the mobile phone 100 transmitting audio data to the earbud 101-1.
  • Both the fifth preset step and the sixth preset step may be 5 ms. Assume that the size of the audio data included in the audio data packet sent by the mobile phone 100 to the earplug 101-1 is fixed, and the duration of the data to be played in each audio data packet is fixed. When the data to be played overflows, the mobile phone 100 may extend the time interval for transmitting the audio data packet to the earplug 101-1 by 5 ms.
  • the mobile phone 100 may adjust the time interval for transmitting audio data packets to the earplug 101-1 from 10 ms to 15 ms.
  • the mobile phone 100 can shorten the time interval for transmitting the audio data packet to the earbud 101-1 by 5 ms.
  • the mobile phone 100 may adjust the time interval for transmitting audio data packets to the earplug 101-1 from 10 ms to 5 ms.
  • the protocol framework may include an application layer, a host, a host controller interface (HCI), and a controller.
  • HCI host controller interface
  • the controller includes the link layer and the physical layer.
  • the physical layer is responsible for providing physical channels for data transmission.
  • the link layer includes ACL links and ISO channels.
  • the ACL link is used to transmit control messages between devices, such as content control messages (such as previous song, next song, etc.).
  • the ISO channel can be used to transmit isochronous data (such as audio data) between devices.
  • Host and Controller communicate via HCI.
  • the communication medium between Host and Controller is HCI instruction.
  • Host can be implemented in the application processor (AP) of the device, and Controller can be implemented in the Bluetooth chip of the device.
  • AP application processor
  • Host and Controller can be implemented in the same processor or controller, in which case HCI is optional.
  • the time interval at which the mobile phone 100 sends audio data packets to the earbuds is fixed, and the duration of the data to be played in each audio data packet is fixed.
  • adjust the PCM sampling rate to suppress overflow or underflow as an example to explain the specific process of the above clock synchronization-3.
  • S905 For the specific process of synchronizing the audio clock of the mobile phone 100 with the earplug 101-1 (that is, S905), refer to S1201.
  • S905 For the specific process of synchronizing the audio clock of the earphone 101-2 with the earphone 101-2 (ie, S905), refer to S1202.
  • the mobile phone 100 and the earplug both have a Host and a link layer LL (included in the controller), and the Host and LL communicate through HCI.
  • the audio module of the earplug 101-1 can send an audio clock setting request to the Host of the earplug 101-1 when the data to be played overflows or underflows.
  • the set audio clock request may be Set Audio Clock Request.
  • the Host of the earplug 101-1 may send the audio clock setting confirmation message to the LL of the earplug 101-1.
  • the setting audio clock confirmation information is used to instruct the LL of the earplug 101-1 to request the mobile phone 100 to adjust the audio clock of the mobile phone 100 (that is, to adjust the transmission progress of transmitting audio data to the earplug 101-1).
  • the set audio clock confirmation information may be the HCI command "HCI Set Audio Clock Command”.
  • the LL of the earplug 101-1 can send an audio clock control command to the LL of the mobile phone 100.
  • the audio clock control command is used to request the mobile phone 100 to adjust the audio clock of the mobile phone 100 (that is, adjust the transmission progress of the audio data sent to the earbud 101-1).
  • the audio clock control command may be an LL_Control_PDU message.
  • the LL of the earplug 101-1 can send the LL_Control_PDU message to the LL of the mobile phone 100 through the ACL link (the ACL link of the link layer shown in FIG. 11).
  • the LL of the mobile phone 100 may trigger an event of setting an audio clock to the Host of the mobile phone 100 (for example, “HCI Set Audio Clock event”).
  • the LL of the mobile phone 100 can trigger an event of setting an audio clock to the Host of the mobile phone 100 through an HCI instruction.
  • the Host of the mobile phone 100 may adjust the PCM sampling rate of the audio data transmitted to the earplug 101-1 to encode.
  • the mobile phone 100 After the earplug 101-1 reports an overflow or underflow, the mobile phone 100 adjusts the PCM sampling rate of the audio data transmitted to the earplug 101-1, which can suppress or avoid the continuation or exacerbation of the above overflow or underflow phenomenon.
  • the mobile phone 100 is paired and connected with the earplug 101-1.
  • the earplug 101-1 and the earplug 101-2 are paired and connected.
  • clock synchronization-1 may specifically include: synchronization of the earphone 101-1 with the Bluetooth clock of the mobile phone 100 (ie, S901); and, earplug 101-2 is synchronized with the Bluetooth clock of the earbud 101-1 (ie S1301).
  • the clock synchronization-2 may specifically include: synchronization of the audio clock of the earbud 101-1 and the Bluetooth clock (ie, S903); and synchronization of the audio clock of the earbud 101-2 and the Bluetooth clock (ie, S904).
  • the clock synchronization-3 may specifically include: synchronization of the audio clock of the mobile phone 100 and the audio clock of the earbud 101-1 (ie, S905).
  • the earphone 101-1 can be synchronized with the Bluetooth clock of the mobile phone 100, and the earbud 101-2 can be synchronized with the Bluetooth clock of the mobile phone 100, thereby implementing the TWS headset 101
  • the Bluetooth clocks of the two earbuds are synchronized.
  • the audio clock of the earbud 101-1 can be synchronized with the Bluetooth clock
  • the audio clock of the earbud 101-2 can be synchronized with the Bluetooth clock, thereby achieving synchronization of the audio clock of the two earbuds of the TWS earphone 101.
  • the mobile phone 100 can also separately adjust the progress of the audio data transmission to the two earplugs of the TWS earphone 101, thereby suppressing or avoiding the continuation or exacerbation of overflow or underflow phenomena, and improving the transmission efficiency and playback quality of audio data.
  • the mobile phone 100 is paired and connected with the earplug 101-1.
  • clock synchronization-1 may specifically include: synchronization of the earbud 101-1 with the Bluetooth clock of the mobile phone 100 (ie, S901).
  • the clock synchronization-2 may specifically include: synchronization of the audio clock of the earbud 101-1 and the Bluetooth clock (ie, S903).
  • the clock synchronization-3 may specifically include: synchronization of the audio clock of the mobile phone 100 and the audio clock of the earbud 101-1 (ie, S905).
  • the earphone 101-1 and the Bluetooth clock of the mobile phone 100 can be synchronized. Furthermore, the audio clock of the earbud 101-1 can be synchronized with the Bluetooth clock. Further, the mobile phone 100 can also separately adjust the progress of the audio data transmitted to the earplug 101-1, so as to suppress or avoid the continuation or exacerbation of the overflow or underflow phenomenon, and improve the transmission efficiency and playback quality of the audio data.
  • the earplug 101-1 can shorten the data buffered in the buffer and play it. For example, the earplug 101-1 may shorten audio data with a playback time of 30 ms, and shorten the playback time of the processed audio data to 20 ms. In this way, the earplug 101-1 can play the shortened audio data in 20 ms.
  • the earplug 101-1 can perform stretching processing on the data buffered in the buffer and play it.
  • the earplug 101-1 may perform stretching processing on audio data with a playback duration of 20 ms, and the playback duration of the audio data after the stretching processing is 30 ms. In this way, the earplug 101-1 can play the shortened audio data in 30 ms.
  • the single shot mode described in the above scene (4) may be converted into the double shot mode described in the above scene (1), the monitoring mode described in the scene (2) due to the addition of new earplugs, or The forwarding method described in scenario (3).
  • the mobile phone 100 has just started to transmit audio data to the newly added earplug (eg, earplug 101-2)
  • the buffer of the earplug such as the earplug 101-1) that is playing audio data may have buffered more data.
  • the phenomenon that the data to be played of the earplug 101-2 underflows and the data to be played of the earplug 101-1 may overflow may occur.
  • the mobile phone 100 may slow down the progress of transmitting audio data to the earplug 101-1 when it detects the newly added earplug 101-2.
  • the mobile phone 100 may transmit audio data to the earplug 101-2 when the data buffered in the buffer of the earplug 101-1 is lower than the third preset value (which may also be referred to as a waterline).
  • the mobile phone 100 may slow down the progress of transmitting audio data to the earplug 101-1 when it detects the newly added earplug 101-2. At the same time, the mobile phone 100 can speed up the progress of transmitting audio data to the earbud 101-2 until the difference between the data buffered in the buffer of the earbud 101-1 and the earbud 101-2 is less than the preset value.
  • an electronic device is also provided, and the electronic device is a second electronic device.
  • the second electronic device may be an earplug of a TWS earphone.
  • the structure of the earplug of the TWS earphone refer to the structure of the earplug shown in FIG. 6.
  • One or more computer programs can be stored in the memory of the earplug.
  • the one or more computer programs include instructions.
  • the instruction can be used to perform various functions or steps performed by the earplugs (such as earplugs 101-1 and 101-2) of the TWS earphone in the description corresponding to any one of FIG. 9, FIG. 12, FIG. 13, or FIG. 14.
  • the earplugs of the TWS earphone shown in FIG. 6 may also include other devices such as sensors, which is not limited in this embodiment of the present application.
  • an electronic device is also provided, and the electronic device is a first electronic device.
  • the structure of the electronic device refer to the structure of the electronic device shown in FIG. 7.
  • One or more computer programs can be stored in the memory of the electronic device.
  • the one or more computer programs include instructions.
  • the instruction may be used to execute various functions or steps performed by the mobile phone 100 in the description corresponding to any one of FIG. 9, FIG. 12, FIG. 13 or FIG. 14.
  • An embodiment of the present application further provides a computer storage medium, the computer storage medium including computer instructions, when the computer instructions run on the above electronic device (first electronic device or second electronic device), the electronic device is executed as shown in FIG. 9.
  • the computer instructions run on the above electronic device (first electronic device or second electronic device)
  • the electronic device is executed as shown in FIG. 9.
  • An embodiment of the present application also provides a computer program product that, when the computer program product runs on a computer, causes the computer to perform audio data communication as shown in any one of FIG. 9, FIG. 12, FIG. 13, or FIG. 14. method.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the modules or units is only a division of logical functions.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical, or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each of the embodiments of this embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or software function unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of this embodiment essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium
  • several instructions are included to enable a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the methods described in the various embodiments.
  • the foregoing storage media include: flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本申请实施例提供一种音频数据的通信方法及电子设备,涉及通信技术领域,可以抑制或者缓解电子设备的待播放数据的上溢或者下溢。具体方案包括:第一电子设备根据第一传输参数向第二电子设备发送音频数据;根据第一传输参数在单位时间发送的音频数据具有第一播放时长;响应于第二电子设备发送的第一信号,根据第二传输参数向第二电子设备发送音频数据;根据第二传输参数在单位时间发送的音频数据具有第二播放时长;响应于第二电子设备发送的第二信号,根据第三传输参数向第二电子设备发送音频数据;根据第三传输参数在单位时间发送的音频数据具有第三播放时长。第二播放时长小于第一播放时长,第三播放时长大于第一播放时长。

Description

一种音频数据的通信方法及电子设备 技术领域
本申请实施例涉及通信技术领域,尤其涉及一种音频数据的通信方法及电子设备。
背景技术
随着科技的进步,真无线立体声(true wireless stereo,TWS)耳机逐渐进入人们的视野。TWS耳机包含两个耳机主体,如,分别称为左耳塞和右耳塞,且左右耳塞之间不需要线材的连接。
其中,TWS耳机的左右耳塞可以与电子设备(如手机)建立蓝牙连接,作为手机的音频输入/输出设备使用。在TWS耳机的左右耳塞作为手机的音频输入/输出设备使用的过程中,左右耳塞与电子设备的音频时钟的同步尤为重要。其中,如果左右耳塞与电子设备的音频时钟不同步,则可能会导致耳塞的待播放数据的上溢或者下溢。
发明内容
本申请实施例提供一种音频数据的通信方法及电子设备,可以抑制或者缓解电子设备(如TWS耳机的耳塞)的待播放数据的上溢或者下溢。
本申请采用如下技术方案:
第一方面,本申请实施例提供一种音频数据的通信方法。第一电子设备可以根据第一传输参数向第二电子设备发送音频数据。其中,根据第一传输参数在单位时间发送的音频数据具有第一播放时长。响应于第二电子设备发送的第一信号,第一电子设备根据第二传输参数向第二电子设备发送音频数据。其中,根据第二传输参数在单位时间发送的音频数据具有第二播放时长。响应于第二电子设备发送的第二信号,第一电子设备根据第三传输参数向所述第二电子设备发送音频数据。其中,根据第三传输参数在单位时间发送的音频数据具有第三播放时长。需要注意的是,第二播放时长小于第一播放时长,第三播放时长大于第一播放时长。
其中,上述第一信号可以是第二电子设备的待播放数据上溢时发送的。第一电子设备响应于该第一信号可以根据第二传输参数发送音频数据。相比于根据第一传输参数在单位时间发送的音频数据,根据第二传输参数在单位时间发送的音频数据具有的播放时长(第二播放时长)较小。即第二播放时长小于第一播放时长。第一电子设备单位时间向第二电子设备发送的音频数据的播放时长变小,则表示第一电子设备向第二电子设备传输音频数据的进度放慢了。换言之,根据上述第二传输参数发送音频数据的进度,慢于根据第一传输参数发送音频数据的进度。可以理解,如果第二电子设备的待播放数据上溢,第一电子设备可以调整向第二电子设备传输音频数据的传输参数。如此,可以放慢第一电子设备向第二电子设备传输音频数据的进度。这样,第二电子设备向其缓存(buffer)中保存音频数据的进度也会放慢,第二电子设备的buffer中缓存数据的速度会降低。随着第二电子设备对缓存(buffer)中缓存的音频数据的处理,buffer中缓存的数据则可以减少。这样,便可以抑制上溢现象的持续或者加剧。
上述第二信号是第二电子设备的待播放数据下溢时发送的。第一电子设备响应于 该第二信号可以根据第三传输参数发送音频数据。相比于根据第一传输参数在单位时间发送的音频数据,根据第三传输参数在单位时间发送的音频数据具有的播放时长(第二播放时长)较大。即第三播放时长大于第一播放时长。第一电子设备单位时间向第二电子设备发送的音频数据的播放时长变大,则表示第一电子设备向第二电子设备传输音频数据的进度加快了。换言之,根据上述第三传输参数发送音频数据的进度,快于根据第一传输参数发送音频数据的进度。可以理解,如果第二电子设备的待播放数据下溢,第一电子设备可以调整向第二电子设备传输音频数据的传输参数。如此,可以加快第一电子设备向第二电子设备传输音频数据的进度。这样,第二电子设备向其缓存(buffer)中保存音频数据的进度也会加快,第二电子设备的buffer中缓存数据的速度会增大。在第二电子设备处理buffer中缓存的音频数据是速度不变的前提下,buffer中缓存的数据则可以增多。这样,便可以抑制下溢现象的持续或者加剧。
结合第一方面,在一种可能的设计方式中,第一信号是第二电子设备的待播放数据上溢时发送的。第二信号是第二电子设备的待播放数据下溢时发送的。上述第二电子设备的待播放数据上溢,具体可以为:第二电子设备的缓存(buffer)中的数据超过第一预设值(也可以称为上水线)。上述第二电子设备的待播放数据下溢,具体为:第二电子设备的缓存(buffer)中的数据低于第二预设值(也可以称为下水线)。
结合第一方面,在另一种可能的设计方式中,上述第二电子设备的缓存中的数据超过第一预设值,具体可以为:第二电子设备的缓存中的数据的大小超过第一预设值。上述第二电子设备的缓存中的数据低于第二预设值,具体可以为:第二电子设备的缓存中的数据的大小低于第二预设值。其中,上述数据的大小的单位为兆字节(Mbyte,MB)或者千字节(Kilobyte,KB)。
结合第一方面,在另一种可能的设计方式中,上述第二电子设备的缓存中的数据超过第一预设值,具体可以为:第二电子设备的缓存中的数据的待播放时长超过第一预设值。上述第二电子设备的缓存中的数据低于第二预设值,具体可以为:第二电子设备的缓存中的数据的待播放时长低于第二预设值。
结合第一方面,在另一种可能的设计方式中,上述第二电子设备的缓存中的数据超过第一预设值,具体可以为:第二电子设备的缓存中的音频数据包的个数大于第一预设值。上述第二电子设备的缓存中的数据低于第二预设值,具体可以为:第二电子设备的缓存中的音频数据包的个数小于第二预设值。
结合第一方面,在另一种可能的设计方式中,上述第一传输参数、第二传输参数和第三传输参数均包括播放时长、时间间隔、数据量和脉冲编码调制(pulse code modulation,PCM)采样率中的至少一项。其中,上述第一电子设备每间隔时间间隔向第二电子设备发送一个音频数据包,数据量为每个音频数据包中包括的音频数据的大小,播放时长是每个音频数据包中包括的音频数据的播放时长。
结合第一方面,在另一种可能的设计方式中,第二电子设备在待播放数据发生上溢或者下溢时,可以向第一电子设备发送用于指示待播放数据发生上溢或者下溢的指示信息,以反馈该上溢或者下溢现象。例如,第二电子设备可以在待播放数据发生上溢时,向第一电子设备发送第一指示消息。第一电子设备可以接收第二电子设备发送的第一指示消息。该第一指示消息用于指示第二电子设备的待播放数据发生上溢。第二电子设备可以在待播 放数据发生下溢时,向第一电子设备发送第二指示消息。第一电子设备可以接收第二电子设备发送的第二指示消息。该第二指示消息用于指示第二电子设备的待播放数据发生下溢。即上述第一信号是第一指示消息,上述第二信号是第二指示消息。
结合第一方面,在另一种可能的设计方式中,第二电子设备在待播放数据发生上溢或者下溢时,向第一电子设备发送调整音频数据进度的请求。例如,第二电子设备在待播放数据发生上溢时,可以向第一电子设备发送第一调整请求。该第一调整请求用于请求第一电子设备调慢向第二电子设备传输音频数据的进度。第二电子设备在待播放数据发生下溢时,可以向第一电子设备发送第二调整请求。该第二调整请求用于请求第一电子设备调快向第二电子设备传输音频数据的进度。即上述第一信号是第一调整请求。第一调整请求用于请求第一电子设备调小单位时间向第二电子设备发送的音频数据的播放时长。上述第二信号是第二调整请求。第二调整请求用于请求第一电子设备调大单位时间向第二电子设备发送的音频数据的播放时长。
结合第一方面,在另一种可能的设计方式中,上述第一信号中包括第二传输参数。上述第二信号中包括第三传输参数。其中,第二电子设备在待播放数据发生上溢或者下溢时,向第一电子设备发送音频数据的传输参数,以请求第一电子设备按照该传输参数向第一电子设备传输音频数据。其中,当第二电子设备的待播放数据发生上溢时,相比于当前的传输进度,第二电子设备向第一电子设备发送的传输参数所对应的音频数据传输进度较慢。当第二电子设备的待播放数据发生下溢时,相比于当前的传输进度,第二电子设备向第一电子设备发送的传输参数所对应的音频数据传输进度较快。例如,上述传输参数可以为PCM采样率和音频数据包的传输时间间隔,以及音频数据包的大小等至少一个参数。其中,第一电子设备可以按照第二电子设备所指示的传输参数,向第二电子设备传输音频数据。
结合第一方面,在另一种可能的设计方式中,根据第二传输参数发送的音频数据包中音频数据的播放时长,等于根据第一传输参数发送的音频数据包中音频数据的播放时长。根据第二传输参数发送的音频数据包中音频数据的脉冲编码调制PCM采样率,小于根据第一传输参数发送的音频数据包中音频数据的PCM采样率。根据第二传输参数发送的音频数据包中音频数据的数据量,小于根据第一传输参数发送的音频数据包中音频数据的数据量;数据量为每个音频数据包中包括的音频数据的大小。
示例性的,如果第二电子设备的待播放数据上溢,第一电子设备可以按照第一预设步进调整第一传输参数中的PCM采样率,得到第二传输参数。其中,第二传输参数的PCM采样率小于第一传输参数中的PCM采样率。可以理解,调整PCM采样率后,第二传输参数中的数据量小于第一传输参数中的数据量。在上述时间间隔固定,待播放数据的时长固定的情况下,PCM采样率越大,单位时间采样得到的PCM样本数则越多,音频数据包中的音频数据则越多。这样,如果第二电子设备的缓存中的数据的大小超过第一预设值(即上溢),第一电子设备可以调低PCM采样率,以减小音频数据包中的数据。如此,便可以抑制或避免上溢现象的持续或者加剧。
结合第一方面,在另一种可能的设计方式中,根据第三传输参数发送的音频数据包中音频数据的播放时长,等于根据第一传输参数发送的音频数据包中音频数据的播放时长。根据第三传输参数发送的音频数据包中音频数据的PCM采样率,大于根据第一传输参数 发送的音频数据包中音频数据的PCM采样率。根据第三传输参数发送的音频数据包中音频数据的数据量,大于根据第一传输参数发送的音频数据包中音频数据的数据量;数据量为每个音频数据包中包括的音频数据的大小。
示例性的,如果第二电子设备的待播放数据下溢,第一电子设备按照第二预设步进调整第一传输参数中的PCM采样率,得到第三传输参数。其中,第三传输参数的PCM采样率大于第一传输参数中的PCM采样率。可以理解,调整PCM采样率后,第三传输参数中的数据量大于第一传输参数中的数据量。在上述时间间隔固定,待播放数据的时长固定的情况下,PCM采样率越小,单位时间采样得到的PCM样本数则越少,音频数据包中的音频数据则越少。这样,如果第二电子设备的缓存中的数据的大小低于第二预设值(即下溢),第一电子设备可以调高PCM采样率,以增大音频数据包中的数据。如此,便可以抑制或避免下溢现象的持续或者加剧。
结合第一方面,在另一种可能的设计方式中,根据第二传输参数发送的音频数据包中音频数据的数据量,等于根据第一传输参数发送的音频数据包中音频数据的数据量;数据量为每个音频数据包中包括的音频数据的大小。根据第二传输参数发送的音频数据包中音频数据的PCM采样率,大于根据第一传输参数发送的音频数据包中音频数据的PCM采样率。根据第二传输参数发送的音频数据包中音频数据的播放时长,小于根据第一传输参数发送的音频数据包中音频数据的播放时长。
示例性的,如果第二电子设备的待播放数据上溢,第一电子设备按照第三预设步进调整第一传输参数中的PCM采样率,得到第二传输参数。其中,第二传输参数的PCM采样率大于第一传输参数中的PCM采样率。可以理解,调整PCM采样率后,第二传输参数中的播放时长小于第一传输参数中的播放时长。其中,在上述时间间隔固定,每个音频数据包中包括的音频数据的大小固定的情况下,每个音频数据包中待播放数据的时长,取决于第一电子设备将模拟信号转换为数字信号时所使用的PCM采样率的大小。PCM采样率越大,每个音频数据包中待播放数据的时长越短。这样,如果第二电子设备的缓存中的数据的待播放时长超过第一预设值(即上溢),第一电子设备可以调高PCM采样率,以缩短音频数据包中的待播放数据的时长。如此,便可以抑制或避免上溢现象的持续或者加剧。
结合第一方面,在另一种可能的设计方式中,根据第三传输参数发送的音频数据包中音频数据的数据量,等于根据第一传输参数发送的音频数据包中音频数据的数据量;数据量为每个音频数据包中包括的音频数据的大小。根据第三传输参数发送的音频数据包中音频数据的PCM采样率,小于根据第一传输参数发送的音频数据包中音频数据的PCM采样率。根据第三传输参数发送的音频数据包中音频数据的播放时长,大于根据第一传输参数发送的音频数据包中音频数据的播放时长。
示例性的,如果第二电子设备的待播放数据下溢,第一电子设备按照第四预设步进调整第一传输参数中的PCM采样率,得到第三传输参数。其中,第三传输参数的PCM采样率小于第一传输参数中的PCM采样率。可以理解,调整PCM采样率后,第三传输参数中的播放时长大于第一传输参数中的播放时长。其中,在上述时间间隔固定,每个音频数据包中包括的音频数据的大小固定的情况下,每个音频数据包中待播放数据的时长,取决于第一电子设备将模拟信号转换为数字信号时所使用的PCM采样率的大小。PCM采样率 越小,每个音频数据包中待播放数据的时长越长。这样,如果第二电子设备的缓存中的数据的待播放时长低于第二预设值(即下溢),第一电子设备可以调低PCM采样率,以增大音频数据包中的待播放数据的时长。如此,便可以抑制或避免下溢现象的持续或者加剧。
结合第一方面,在另一种可能的设计方式中,根据第二传输参数发送的音频数据包的时间间隔,大于根据第一传输参数发送的音频数据包的时间间隔。
结合第一方面,在另一种可能的设计方式中,根据第三传输参数发送的音频数据包的时间间隔,小于根据第一传输参数发送的音频数据包的时间间隔。
其中,第一电子设备向第二电子设备发送音频数据包的频率越大,即时间间隔越小,第二电子设备的buffer中缓存的音频数据包则越多,音频数据则越多。第一电子设备向第二电子设备发送音频数据包的频率越小,即时间间隔越大,耳塞101-1的buffer中缓存的音频数据包则越少,音频数据则越少。
示例性的,如果第二电子设备的待播放数据上溢,第一电子设备按照第五预设步进调整第一传输参数中的时间间隔,得到第二传输参数。其中,第二传输参数的时间间隔大于第一传输参数的时间间隔。可以理解,虽然每个音频数据包中的音频数据的大小不变,每个音频数据包中音频数据的播放时长不变。但是,第一电子设备向第二电子设备发送的音频数据包的个数减少了,从而第二电子设备的buffer要缓存的音频数据变少了,buffer要缓存的音频数据的播放时长也会变短。如此,可以缓解第二电子设备的缓存压力,抑制或避免上溢现象的持续或者加剧。
示例性的:如果第二电子设备的待播放数据下溢,第一电子设备按照第六预设步进调整第一传输参数中的时间间隔,得到第三传输参数。其中,第三传输参数的时间间隔小于第一传输参数的时间间隔。可以理解,虽然每个音频数据包中的音频数据的大小不变,每个音频数据包中音频数据的播放时长不变。但是,第一电子设备向第二电子设备发送的音频数据包的个数增多了,从而第二电子设备的buffer要缓存的音频数据增多了,buffer要缓存的音频数据的播放时长也会变长。如此,可以增加第二电子设备的缓存,抑制或避免下溢现象的持续或者加剧。
结合第一方面,在另一种可能的设计方式中,本申请实施例的方法还可以包括:第一电子设备向第二电子设备发送同步消息。该同步消息用于进行蓝牙时钟同步。该同步消息中可以包括第一电子设备的蓝牙时钟信息。例如,该同步消息可以为导频信号。
第二方面,本申请实施例提供一种音频数据的通信方法。该方法可以包括:第二电子设备在待播放数据上溢时,向第一电子设备反馈上溢;第二电子设备在待播放数据下溢时,向第一电子设备反馈下溢。其中,第二电子设备向第一电子设备反馈上溢或者下溢的具体方法,可以参考第一方面及其可能的设计方式中的描述。本申请实施例这里不予赘述。
结合第二方面,在另一种可能的设计方式中,本申请实施例的方法还可以包括:第二电子设备接收第一电子设备发送的同步消息。该同步消息用于进行蓝牙时钟同步。该同步消息中可以包括第一电子设备的蓝牙时钟信息。例如,该同步消息可以为导频信号。响应于该同步消息,第二电子设备调整第二电子设备的蓝牙时钟,使得第二电子设备的蓝牙时钟与同步消息所指示的蓝牙时钟同步。
结合第二方面,在另一种可能的设计方式中,本申请实施例的方法还可以包括:第二电子设备调整第二电子设备的音频时钟,使得第二电子设备的音频时钟与第二电子设备的蓝牙时钟同步。
第三方面,本申请实施例提供一种电子设备,该电子设备是第一电子设备,该电子设备包括:处理器、存储器和通信接口;所述存储器和所述通信接口与所述处理器耦合;所述存储器用于存储计算机程序代码;所述计算机程序代码包括计算机指令,当所述处理器执行上述计算机指令时,所述电子设备执行如第一方面及其可能的设计方式所述的音频数据的通信方法。
第四方面,本申请实施例提供一种电子设备,该电子设备是第二电子设备,该电子设备包括:处理器、存储器和通信接口;所述存储器和所述通信接口与所述处理器耦合;所述存储器用于存储计算机程序代码;所述计算机程序代码包括计算机指令,当所述处理器执行上述计算机指令时,所述电子设备执行如第二方面及其可能的设计方式所述的音频数据的通信方法。
第五方面,本申请实施例提供一种音频数据的通信系统。该音频数据的通信系统包括第三方面所述的第一电子设备和第四方面所述的第二电子设备。
结合第五方面,在一种可能的设计方式中,上述第一电子设备可以与一个或者多个第二电子设备进行音频数据的通信。例如,上述多个第二电子设备可以为TWS耳机的两个耳塞。
第六方面,本申请实施例提供一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如第一方面、第二方面及其任一种可能的设计方式所述的音频数据的通信方法。
第七方面,本申请实施例提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如第一方面、第二方面及其任一种可能的设计方式所述的音频数据的通信方法。
可以理解地,上述提供的第三方面、第四方面及其任一种可能的设计方式所述的电子设备,第五方面及其任一种可能的设计方式所述的通信系统,第六方面所述的计算机存储介质,以及第七方面所述的计算机程序产品均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
附图说明
图1A为本申请实施例提供的一种音频数据的通信方法的通信网络系统结构示意图;
图1B为本申请实施例提供的一种时钟同步原理示意图;
图2为本申请实施例提供的另一种音频数据的通信方法的通信网络系统结构示意图;
图3A为本申请实施例提供的另一种音频数据的通信方法的通信网络系统结构示意图;
图3B为本申请实施例提供的另一种时钟同步原理示意图;
图4A为本申请实施例提供的另一种音频数据的通信方法的通信网络系统结构示 意图;
图4B为本申请实施例提供的另一种时钟同步原理示意图;
图5为本申请实施例提供的一种TWS耳机的产品形态实例示意图;
图6为本申请实施例提供的一种TWS耳机的耳塞的硬件结构示意图;
图7为本申请实施例提供的一种电子设备的硬件结构示意图;
图8为本申请实施例提供的一种TWS音频系统框架示意图;
图9为本申请实施例提供的一种基于双发方式的音频数据的通信方法流程图;
图10A为本申请实施例提供的一种TWS耳机的耳塞实现音频时钟与蓝牙时钟同步的原理示意图;
图10B-图10E为本申请实施例提供的一种蓝牙时钟的蓝牙计数和音频时钟的音频计数实例示意图;
图11为本申请实施例提供的一种基于低功耗蓝牙(blue tooth low energy,BLE)的音频协议框架;
图12为本申请实施例提供的另一种基于双发方式的音频数据的通信方法流程图;
图13为本申请实施例提供的一种基于监听方式或者转发方式的音频数据的通信方法流程图;
图14为本申请实施例提供的一种基于单发方式的音频数据的通信方法流程图。
具体实施方式
本申请实施例提供一种音频数据的通信方法,可以应用于第一电子设备与第二电子设备进行音频数据传输的过程中。本申请实施例中,将第一电子设备简称为电子设备,以第二电子设备为TWS耳机的耳塞为例。电子设备可以与TWS耳机的一个或者两个耳塞进行音频数据传输。
本申请实施例中的时钟同步可以包括:TWS耳机的耳塞与电子设备的蓝牙时钟的同步(简称时钟同步-1);TWS耳机的耳塞的音频时钟与蓝牙时钟的同步(简称时钟同步-2);电子设备的音频时钟与TWS耳机的耳塞的音频时钟的同步(简称时钟同步-3)。
需要注意的是,在本申请实施例中,上述时钟同步-3具体是指:电子设备可以通过调整向耳塞传输音频数据的进度,改善或者缓解耳塞中音频数据的上溢或下溢现象。上溢或者下溢现象得到改善或者缓解后,则可以认为电子设备的音频时钟与耳塞的音频时钟趋于同步。本申请实施例中,将电子设备调整向耳塞传输音频数据的进度,以抑制或避免上溢或者下溢现象,称为电子设备与耳塞的音频时钟同步。
其中,TWS耳机可以包括左耳塞和右耳塞。例如,如图1A所示,TWS耳机101可以包括耳塞101-1和耳塞101-2。耳塞101-1为TWS耳机101的左耳塞,耳塞101-2为右耳塞。或者,耳塞101-1为TWS耳机101的右耳塞,耳塞101-2为左耳塞。
示例性的,本申请实施例的方法可以应用于以下场景(1)-场景(4)中。
场景(1):电子设备100与TWS耳机101可以通过第一传输方式传输音频数据。
其中,第一传输方式也可以称为双发方式。在双发方式中,如图1A所示,TWS耳机101的耳塞101-1和耳塞101-2作为电子设备100(如手机)的音频输入/输出设备,可以一起使用实现音乐播放或者语音通信等功能。并且,如图1A所示,电子设备100分别与耳塞101-1和耳塞101-2配对连接,并且电子设备100分别与耳塞101-1 和耳塞101-2传输音频数据。
其中,电子设备100向耳塞101-1传输的音频数据,与电子设备100向耳塞101-2传输的音频数据可以相同,也可以不同。例如,TWS耳机101播放立体声时,电子设备100向耳塞101-1和耳塞101-2传输的音频数据不同。如电子设备100向耳塞101-1传输左声道编码的音频数据,向耳塞101-2传输右声道编码的音频数据。又例如,TWS耳机101播放单声道音频数据时,电子设备100向耳塞101-1和耳塞101-2传输的音频数据相同。
上述双发方式中,如图1B所示,TWS耳机的耳塞与电子设备的蓝牙时钟的同步(即时钟同步-1),具体可以包括:耳塞101-1与电子设备100的蓝牙时钟的同步;耳塞101-2与电子设备100的蓝牙时钟的同步。其中,耳塞101-1的蓝牙时钟和耳塞101-2的蓝牙时钟分别与电子设备100的蓝牙时钟同步后,耳塞101-1的蓝牙时钟与耳塞101-2的蓝牙时钟随之同步。
上述双发方式中,如图1B所示,TWS耳机的耳塞的音频时钟与蓝牙时钟的同步(即时钟同步-2),具体可以包括:耳塞101-1的蓝牙时钟与耳塞101-1的音频时钟的同步;耳塞101-2的蓝牙时钟与耳塞101-2的音频时钟的同步。其中,由于在上述时钟同步-1中已经实现了耳塞101-1与耳塞101-2的蓝牙时钟的同步;因此,在时钟同步-2之后,耳塞101-1的音频时钟与耳塞101-2的音频时钟随之同步。
上述双发方式中,如图1B所示,电子设备的音频时钟与TWS耳机的耳塞的音频时钟的同步(即时钟同步-3),具体可以包括:电子设备100的音频时钟与耳塞101-1的音频时钟的同步;电子设备100的音频时钟与耳塞101-2的音频时钟的同步。
其中,电子设备100的音频时钟与耳塞101-1的音频时钟的同步,具体是指:电子设备100可以通过调整向耳塞101-1传输音频数据的进度,改善或者缓解耳塞101-1中音频数据的上溢或下溢现象,以使得电子设备100的音频时钟与耳塞101-1的音频时钟趋于同步。电子设备100的音频时钟与耳塞101-2的音频时钟的同步,具体是指:电子设备100可以通过调整向耳塞101-2传输音频数据的进度,改善或者缓解耳塞101-2中音频数据的上溢或下溢现象,以使得电子设备100的音频时钟与耳塞101-2的音频时钟趋于同步。
场景(2):电子设备100与TWS耳机101可以通过第二传输方式传输音频数据。
其中,第二传输方式也可以称为监听方式。在监听方式中,如图2所示,TWS耳机101的耳塞101-1和耳塞101-2作为电子设备100(如手机)的音频输入/输出设备,可以一起使用实现音乐播放或者语音通信等功能。但是,与双发方式不同的是,如图2所示,电子设备100仅与一个耳塞(如耳塞101-1)配对连接,耳塞101-1与耳塞101-2配对连接。电子设备100向耳塞101-1传输音频数据,耳塞101-2可以根据电子设备100与耳塞101-1的连接参数,监听电子设备100向耳塞101-1传输的音频数据。其中,耳塞101-1可以通过与耳塞101-2之间的连接,向耳塞101-2传输电子设备100与耳塞101-1的连接参数。
场景(3):电子设备100与TWS耳机101可以通过第三传输方式传输音频数据。
其中,第三传输方式也可以称为转发方式。在转发方式中,如图3A所示,TWS耳机101的耳塞101-1和耳塞101-2作为电子设备100(如手机)的音频输入/输出设备,可以一起使用实现音乐播放或者语音通信等功能。但是,与双发方式不同的是, 如图3A所示,电子设备100仅与一个耳塞(如耳塞101-1)配对连接,耳塞101-1与耳塞101-2配对连接。转发方式与监听方式不同的是,耳塞101-2不需要监听电子设备100向耳塞101-1传输的音频数据。耳塞101-1可以向耳塞101-2转发接收自电子设备100的音频数据。
上述监听方式和转发方式中,如图3B所示,时钟同步-1具体可以包括:耳塞101-1与电子设备100的蓝牙时钟的同步;耳塞101-2与耳塞101-1的蓝牙时钟的同步。由于耳塞101-1与电子设备100的蓝牙时钟同步,那么耳塞101-2与耳塞101-1的蓝牙时钟同步后,耳塞101-2的蓝牙时钟与电子设备100的蓝牙时钟随之同步。
上述监听方式和转发方式中,如图3B所示,时钟同步-2具体可以包括:耳塞101-1的蓝牙时钟与耳塞101-1的音频时钟的同步;耳塞101-2的蓝牙时钟与耳塞101-2的音频时钟的同步。其中,由于在上述时钟同步-1中已经实现了耳塞101-1与耳塞101-2的蓝牙时钟的同步;因此,在时钟同步-2之后,耳塞101-1的音频时钟与耳塞101-2的音频时钟随之同步。
上述监听方式和转发方式中,如图3B所示,时钟同步-3具体可以包括:电子设备100的音频时钟与耳塞101-1的音频时钟的同步。
场景(4):电子设备100与TWS耳机101可以通过第四传输方式传输音频数据。
其中,第四传输方式也可以称为单发方式。在单发方式中,如图4A所示,TWS耳机101的一个耳塞(如耳塞101-1)作为电子设备100(如手机)的音频输入/输出设备,单独使用实现音乐播放或者语音通信等功能。
在上述单发方式中,如图4B所示,时钟同步-1具体可以包括:耳塞101-1与电子设备100的蓝牙时钟的同步。时钟同步-2具体可以包括:耳塞101-1的蓝牙时钟与耳塞101-1的音频时钟的同步。时钟同步-3具体可以包括:电子设备100的音频时钟与耳塞101-1的音频时钟的同步。
其中,上述监听方式、转发方式和单发方式中,电子设备100的音频时钟与耳塞101-1的音频时钟的同步,具体是指:电子设备100可以通过调整向耳塞101-1传输音频数据的进度,改善或者缓解耳塞101-1中音频数据的上溢或下溢现象,以使得电子设备100的音频时钟与耳塞101-1的音频时钟趋于同步。
需要注意的是,上述时钟同步-3并不是直接调整电子设备100或者耳塞(如耳塞101-1)的音频时钟,实现电子设备100与耳塞的音频时钟同步。而是通过调整其他参数(如电子设备100向耳塞传输音频数据的进度),使得电子设备100的音频时钟与耳塞的音频时钟同步。与上述时钟同步-3不同的是,上述时钟同步-1和时钟同步-2都是通过直接调整时钟(蓝牙时钟或者音频时钟)实现时钟同步。
示例性的,上述电子设备100可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、媒体播放器、电视机等设备,本申请实施例对该设备的具体形态不作特殊限制。在本申请实施例中,电子设备100的结构可以如图7所示,在以下实施例中将详细介绍。
请参考图5,为本申请实施例提供的一种TWS耳机的产品形态示意图。如图5所 示,TWS耳机101可以包括:耳塞101-1、耳塞101-2和耳塞盒101-3。该耳塞盒可以用于收纳TWS耳机的左右耳塞。图5仅以举例方式给出TWS耳机的一种产品形态实例示意图,本申请实施例提供的外围设备的产品形态包括但不限于图5所示的TWS耳机101。
请参考图6,为本申请实施例提供的一种TWS耳机的耳塞(左耳塞或右耳塞)的结构示意图。如图6所示,TWS耳机101的耳塞(如耳塞101-2)可以包括:处理器610、存储器620、传感器630、无线通信模块640、受话器650、麦克风660以及电源670。
其中,存储器620可以用于存储应用程序代码,如用于与TWS耳机101的另一个耳塞(如耳塞101-2)建立无线连接,以及使得耳塞与上述电子设备100(如手机100)进行配对连接的应用程序代码。处理器610可以控制执行上述应用程序代码,以实现本申请实施例中TWS耳机的耳塞的功能。
存储器620中还可以存储有用于唯一标识该耳塞的蓝牙地址,以及存储有TWS耳机的另一个耳塞的蓝牙地址。另外,该存储器620中还可以存储有与该耳塞之前成功配对过的电子设备的连接数据。例如,该连接数据可以为与该耳塞成功配对过的电子设备的蓝牙地址。基于该连接数据,该耳塞能够与该电子设备自动配对,而不必配置与其之间的连接,如进行合法性验证等。上述蓝牙地址可以为媒体访问控制(media access control,MAC)地址。
传感器630可以为距离传感器或接近光传感器。耳塞可以通过该传感器630确定是否被用户佩戴。例如,耳塞可以利用接近光传感器来检测耳塞附近是否有物体,从而确定耳塞是否被用户佩戴。在确定耳塞被佩戴时,耳塞可以打开受话器650。在一些实施例中,该耳塞还可以包括骨传导传感器,结合成骨传导耳机。利用该骨传导传感器,耳塞可以获取声部振动骨块的振动信号,解析出语音信号,实现语音功能。在另一些实施例中,该耳塞还可以包括触摸传感器,用于检测用户的触摸操作。在另一些实施例中,该耳塞还可以包括指纹传感器,用于检测用户指纹,识别用户身份等。在另一些实施例中,该耳塞还可以包括环境光传感器,可以根据感知的环境光的亮度,自适应调节一些参数,如音量大小。
无线通信模块640,用于支持TWS耳机的耳塞与各种电子设备,如上述电子设备100之间的短距离数据交换。在一些实施例中,该无线通信模块640可以为蓝牙收发器。TWS耳机的耳塞可以通过该蓝牙收发器与上述电子设备100之间建立无线连接,以实现两者之间的短距离数据交换。
至少一个受话器650,也可以称为“听筒”,可以用于将音频电信号转换成声音信号并播放。例如,当TWS耳机的耳塞作为上述电子设备100的音频输出设备时,受话器650可以将接收到的音频电信号转换为声音信号并播放。
至少一个麦克风660,也可以称为“话筒”,“传声器”,用于将声音信号转换为音频电信号。例如,当TWS耳机101的耳塞作为上述电子设备100的音频输入设备时,在用户说话(如通话或发语音消息)的过程中,麦克风660可以采集用户的声音信号,并将其转换为音频电信号。上述音频电信号即为本申请实施例中的音频数据。
电源670,可以用于向TWS耳机101的耳塞包含的各个部件供电。在一些实施例 中,该电源670可以是电池,如可充电电池。
通常,TWS耳机101会配有一耳塞盒(如,图5中所示的101-3)。该耳塞盒可以用于收纳TWS耳机的左右耳塞。如图5所示,该耳塞盒101-3可以用于收纳TWS耳机的耳塞101-1和耳塞101-2。另外,该耳塞盒还可以为TWS耳机101的左右耳塞充电。相应的,在一些实施例中,上述耳塞还可以包括:输入/输出接口680。输入/输出接口680可以用于提供TWS耳机的耳塞与耳塞盒(如上述耳塞盒101-3)之间的任何有线连接。
在一些实施例中,输入/输出接口680可以为电连接器。当TWS耳机101的耳塞置于耳塞盒中时,TWS耳机101的耳塞可以通过该电连接器与耳塞盒(如与耳塞盒的输入/输出接口)电连接。在该电连接建立后,耳塞盒可以为TWS耳机的耳塞的电源670充电。在该电连接建立后,TWS耳机101的耳塞还可以与耳塞盒进行数据通信。例如,TWS耳机101的耳塞可以通过该电连接接收来自耳塞盒的配对指令。该配对命令用于指示TWS耳机101的耳塞打开无线通信模块640,从而使得TWS耳机101的耳塞可以采用对应的无线通信协议(如蓝牙)与电子设备100进行配对连接。
当然,上述TWS耳机101的耳塞还可以不包括输入/输出接口680。在这种情况下,耳塞可以基于通过上述无线通信模块640与耳塞盒101-3建立的无线连接,实现充电或者数据通信功能。
另外,在一些实施例中,耳塞盒(如上述耳塞盒101-3)还可以包括处理器,存储器等部件。该存储器可以用于存储应用程序代码,并由耳塞盒的处理器来控制执行,以实现耳塞盒的功能。例如。当用户打开耳塞盒的盒盖时,耳塞盒的处理器通过执行存储在存储器中的应用程序代码,可以响应于用户打开盒盖的操作向TWS耳机的耳塞发送配对命令等。
可以理解的是,本申请实施例示意的结构并不构成对TWS耳机101的耳塞的具体限定。其可以具有比图6中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。例如,该耳塞还可以包括指示灯(可以指示耳塞的电量等状态)、防尘网(可以配合听筒使用)等部件。图6中所示出的各种部件可以在包括一个或多个信号处理或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
需要说明的是,TWS耳机101的左右耳塞的结构可以相同。例如,TWS耳机101的左右耳塞可以都包括图6中所示的部件。或者,TWS耳机101的左右耳塞的结构也可以不同。例如,TWS耳机101的一个耳塞(如右耳塞)可以包括图6中所示的部件,而另一个耳塞(如左耳塞)可以包括图6中除麦克风660之外的其他的部件。
以上述电子设备是手机100为例,图7示出了电子设备100的结构示意图。如图7所示,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感 器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,PCM接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线 通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。例如,在本申请实施例中,电子设备100可以利用无线通信模块160,通过无线通信技术,如蓝牙(BT)与外围设备建立无线连接。基于建立的无线连接,电子设备100可以向外围设备发送语音数据,还可以接收来自外围设备的语音数据。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。在一些实施例中,ISP可以设置在摄像头193中。摄像头193用于捕获静态图像或视频。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。例如,在本申请实施例中,处理器110可以通过执行存储在内部存储器121中的指令,通过无线通信模块160与外围设备建立无线连接,以及与外围设备进行短距离数据交换,以通过外围设备实现通话、播放音乐等功能。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。在本申请实施例中,在电子设备100与外围设备之间采用无线通信技术,如蓝牙建立了无线连接后,电子设备100可以将外围设备的蓝牙地址存储在内部存储器121中。在一些实施例中,当外围设备为包含两个主体的设备,如TWS耳机时,TWS耳机的左右耳塞分别有各自的蓝牙地址,电子设备100可以将TWS耳机的左右耳塞的蓝牙地址关联存储在内部存储器121中。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些 实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
在本申请实施例中,当电子设备100与外围设备101,如TWS耳机建立了无线连接时,TWS耳机可以作为电子设备100的音频输入/输出设备使用。示例性的,音频模块170可以接收无线通信模块160传递的音频电信号,实现通过TWS耳机接听电话、播放音乐等功能。例如,在用户打电话的过程中,TWS耳机可以采集用户的声音信号,并转换为音频电信号后发送给电子设备100的无线通信模块160。无线通信模块160将该音频电信号传输给音频模块170。音频模块170可以将接收到的音频电信号转换为数字音频信号,并进行编码后传递至移动通信模块150。由移动通信模块150传输至通话对端设备,以实现通话。又例如,用户在使用电子设备100的媒体播放器播放音乐时,应用处理器可以将媒体播放器播放的音乐对应的音频电信号传输至音频模块170。由音频模块170将该音频电信号传输至无线通信模块160。无线通信模块160可以将音频电信号发送给TWS耳机,以便TWS耳机将该音频电信号转换为声音信号后播放。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。陀螺仪传感器180B 还可以用于导航,体感游戏场景。气压传感器180C用于测量气压。磁传感器180D包括霍尔传感器。加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。距离传感器180F,用于测量距离。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。环境光传感器180L用于感知环境光亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。温度传感器180J用于检测温度。触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。骨传导传感器180M可以获取振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。
请参考图8,其示出本申请实施例提供的一种TWS音频系统结构示意图。图8所示的TWS音频系统可以适用于上述场景(1)-场景(4)。如图8所示,电子设备100、耳塞101-1和耳塞101-2均可以包括蓝牙模块、音频模块和编解码(Codec)模块。
其中,蓝牙模块负责蓝牙协议处理以及蓝牙数据(如音频数据)的接收和发送。该蓝牙模块可以包括至少一个接收机和发送机,射频天线。并且,该蓝牙模块可以维护一个蓝牙时钟(BT clock)。
音频模块负责音频编码,音频译码。该音频模块至少包括一个音频编码器或者音频译码器。
Codec模块负责音频信号的采样和播放。该Codec模块至少包括一个数模转换器(digital to analog converter,DAC)或数模转换器(analog to digital converter,ADC)。并且,该Codec模块维护一个音频时钟(Audio clock)。
示例性的,图8所示的手机100的蓝牙模块可以在图7所示的无线通信模块160中实现。图8所示的手机100的音频模块和Codec模块可以在图7所示的音频模块170中实现。其中,图7所示的音频模块170可以设置于处理器110中,或将音频模块170 的部分功能模块设置于处理器110中。
图8所示的耳塞101-1或者耳塞101-2的蓝牙模块可以在图6所示的无线通信模块640中实现。图8所示的耳塞101-1或者耳塞101-2的音频模块和Codec模块可以在图6所示的处理器610中实现。
为了便于理解,以下结合附图对本申请实施例提供的音频数据的通信方法进行详细介绍。以下实施例中均以电子设备为手机100,TWS耳机的第一耳塞是TWS耳机101的耳塞101-1,第二耳塞是TWS耳机101的耳塞101-2为例进行说明。
本申请实施例中,以上述场景(1)中,TWS耳机101的耳塞101-1和耳塞101-2作为手机11的音频输入/输出设备,一起使用实现音乐播放或者语音通信等功能为例,对本申请实施例提供的音频数据的通信方法进行说明。
当用户希望使用TWS耳机101时,可打开TWS耳机101的耳塞盒101-3的盒盖。此时,耳塞101-1和耳塞101-2可以自动配对连接。
在一些实现方式中,耳塞盒101-3中可以包括传感器(如环境光传感器或者磁传感器等)。该传感器可以检测到耳塞盒101-3被打开。例如,以耳塞盒101-3中包括环境光传感器为例。耳塞盒101-3被打开后,耳塞盒101-3中的环境光传感器检测到的环境光亮度较大。耳塞盒101-3闭合后,耳塞盒101-3中的环境光传感器检测到的环境光亮度较小。假设耳塞盒101-3闭合,那么耳塞盒101-3被打开后,环境光传感器检测到的环境光亮度会发生由小到大的变化。耳塞盒101-3可以在环境光传感器检测到的环境光亮度发生由小到大的变化,且环境光亮度高于预设亮度阈值时,向任一耳塞(如耳塞101-1)发生配对指令,指示该耳塞与另一耳塞配对连接。又例如,以耳塞盒101-3中包括磁传感器为例。耳塞盒101-3可以利用磁传感器检测盒盖的开合。其中,耳塞盒101-3可以根据磁传感器检测盒盖的开合。当耳塞盒101-3根据磁传感器检测到盒盖打开后,可以向任一耳塞(如耳塞101-1)发生配对指令,指示该耳塞与另一耳塞配对连接。其中,耳塞101-1响应于该配对指令,可以向耳塞101-2发生配对请求,请求与耳塞101-2配对连接。
在另一些实现方式中,TWS耳机101的耳塞(如耳塞101-1)上可以包括上述环境光传感器。耳塞101-1可以在环境光传感器检测到的环境光亮度发生由小到大的变化,且环境光亮度高于预设亮度阈值时,向耳塞101-2发生配对请求,请求与耳塞101-2配对连接。
并且,耳塞盒101-3的盒盖被打开后,耳塞101-1和耳塞101-2中的任一耳塞(如耳塞101-1)可对外发送配对广播。如果手机100已经打开了蓝牙功能,则手机100可以接收到该配对广播并提示用户已经扫描到相关的蓝牙设备(如耳塞101-1)。当用户在手机100上选中耳塞101-1作为连接设备后,手机100可与耳塞101-1进行配对。
在耳塞101-1与手机100配对后,耳塞101-1可以通过与耳塞101-2之间的蓝牙连接,向耳塞101-2发送手机100的蓝牙地址,并通知耳塞101-2对外发送配对广播。这样,手机100可以接收耳塞101-2发送的配对广播,并与耳塞101-2配对连接。
以上述场景(1)所述的双发方式为例。手机100分别与耳塞101-1和耳塞101-2配对连接后,便可以传输音频数据。手机100与耳塞101-1和耳塞101-2在传输音频数据的过程中,可以执行本申请实施例提供的音频数据的通信方法,实现手机100与 TWS耳机101的蓝牙时钟和音频时钟的同步。
首先,本申请实施例中,可以先实现TWS耳机101的左右耳塞与手机100的蓝牙时钟的同步(即时钟同步-1)。
结合图1B,如图9所示,上述时钟同步-1具体可以包括:耳塞101-1与手机100的蓝牙时钟的同步(即S901);以及,耳塞101-2与手机100的蓝牙时钟的同步(即S902)。
示例性的,以耳塞101-1与电子设备100的蓝牙时钟同步为例。如图9所示,手机100(例如,图8所示的手机100的蓝牙模块)可以向耳塞101-1发送同步消息。该同步消息用于进行蓝牙时钟同步。该同步消息中可以包括手机100的蓝牙时钟信息。例如,该同步消息可以为导频信号。耳塞101-1(例如,图8所示的耳塞101-1的蓝牙模块)接收到该导频信号后,可以估算该导频信号指示的蓝牙时钟与耳塞101-1维护的蓝牙时钟的差异。然后,耳塞101-1(例如,图8所示的耳塞101-1的蓝牙模块)可以根据估算得到的差异调整耳塞101-1的蓝牙时钟,使得耳塞101-1的蓝牙时钟与导频信号指示的蓝牙时钟同步。即手机100与耳塞101-1可以执行S901,实现耳塞101-1与电子设备100的蓝牙时钟同步。其中,手机100与耳塞101-2可以执行S902,实现耳塞101-2与电子设备100的蓝牙时钟同步的方法与S901类似,本申请实施例这里不予赘述。
可以理解,在上述时钟同步-1中,耳塞101-1的蓝牙时钟与手机100的蓝牙时钟同步,并且,耳塞101-2的蓝牙时钟与手机100的蓝牙时钟同步。由于耳塞101-1的蓝牙时钟和耳塞101-2的蓝牙时钟均与手机100的蓝牙时钟同步;因此,耳塞101-1的蓝牙时钟与耳塞101-2的蓝牙时钟也会同步。
其次,本申请实施例中,可以实现TWS耳机101的耳塞的音频时钟与蓝牙时钟的同步(即时钟同步-2)。
耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以调整耳塞101-1的音频时钟,使得音频时钟与蓝牙时钟同步。具体的,耳塞101-1(例如,图8所示的耳塞101-1的蓝牙模块)可以基于耳塞101-1的蓝牙时钟产生同步信号。然后,耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以计算该同步信号与耳塞101-1的音频时钟的差异。其中,图8所示的耳塞101-1的音频模块可以从蓝牙模块得到上述同步信号。最后,耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以根据该差异调整耳塞101-1的音频时钟,使得耳塞101-1的音频时钟与蓝牙时钟同步。即耳塞101-1可以执行S903,实现耳塞101-1的音频时钟与蓝牙时钟同步。
耳塞101-2(例如,图8所示的耳塞101-2的音频模块)可以调整耳塞101-2的音频时钟,使得音频时钟与蓝牙时钟同步。具体的,耳塞101-2(例如,图8所示的耳塞101-2的蓝牙模块)可以基于耳塞101-2的蓝牙时钟产生同步信号。然后,耳塞101-2(例如,图8所示的耳塞101-2的音频模块)可以计算该同步信号与耳塞101-2的音频时钟的差异。其中,图8所示的耳塞101-2的音频模块可以从蓝牙模块得到上述同步信号。最后,耳塞101-2(例如,图8所示的耳塞101-2的音频模块)可以根据该差异调整耳塞101-2的音频时钟,使得耳塞101-2的音频时钟与蓝牙时钟同步。即耳塞101-2可以执行S904,实现耳塞101-2的音频时钟与蓝牙时钟同步。
可以理解,如果耳塞101-1和耳塞101-2的蓝牙时钟与手机100的蓝牙时钟同步后,耳塞101-1和耳塞101-2各自调整音频时钟与蓝牙时钟同步;那么,耳塞101-1的音频时 钟和耳塞101-2的音频时钟也会同步。
结合图1B,在双发方式中,如图9所示,上述时钟同步-2具体可以包括:耳塞101-1的音频时钟与蓝牙时钟的同步(即S903);以及,耳塞101-2的音频时钟与蓝牙时钟的同步(即S904)。
示例性的,本申请实施例这里以耳塞101-1的音频时钟与蓝牙时钟同步为例,对上述时钟同步-2的具体方法进行说明。耳塞101-1(例如,图8所示的耳塞101-1的蓝牙模块)可以基于耳塞101-1的蓝牙时钟产生同步信号,该同步信号可以表征耳塞101-1的蓝牙时钟的值。其中。图10A所示的蓝牙计数是耳塞101-1的蓝牙时钟的值。同时,耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以获取耳塞101-1的音频时钟的值。其中,图10A所示的音频计数是耳塞101-1的音频时钟的值。然后,如图10A所示,耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以对比蓝牙计数和音频计数,得到蓝牙计数和音频计数的差值。最后,耳塞101-1(例如,图8所示的耳塞101-1的音频模块)可以根据该差值调节耳塞101-1的音频(Audio)锁相环(phase locked loop,PLL)的输入输出频率,使得耳塞101-1的音频计数与蓝牙计数相同,耳塞101-1的音频时钟与蓝牙时钟同步。
示例性的,耳塞101-1的蓝牙模块每a ms可以进行m次蓝牙计数。耳塞101-1的音频模块每a ms可以进行m次音频计数。例如,如图10B或者图10C所示,a=10,m=10000。如图10B所示,耳塞101-1的蓝牙模块每10ms进行10000次蓝牙计数。其中,蓝牙模块每10ms可以将蓝牙计数清零。如图10C所示,耳塞101-1的音频模块每10ms进行10000次音频计数。其中,蓝牙模块每10ms可以将蓝牙计数清零。
本申请实施例中,耳塞101-1的蓝牙模块可以每隔a ms(如10ms)向音频模块发送一个同步信号。该同步信号可以表征耳塞101-1的蓝牙时钟的值(即蓝牙计数)。例如,如图10D或者图10E所示,耳塞101-1的蓝牙模块每隔10ms向音频模块发送一个同步信号。
可以理解,耳塞101-1的音频时钟和蓝牙时钟经过同步后,蓝牙模块的蓝牙计数与音频模块的音频计数同步。但是,随着时间的推移,耳塞101-1的蓝牙计数与音频计数可能会存在差异,即耳塞101-1的音频时钟与蓝牙时钟可能会存在差异。
例如,耳塞101-1的音频计数可能会小于蓝牙计数。如图10D所示,如果同步信号所指示的蓝牙计数为10000,而音频计数为9990,则表示音频计数比蓝牙计数小10个计数值。此时,音频模块则可以调整耳塞101-1的音频PLL的输入输出频率,使得耳塞101-1的音频计数与蓝牙计数同步,从而使得耳塞101-1的音频时钟与蓝牙时钟同步。
例如,耳塞101-1的音频计数可能会大于蓝牙计数。如图10E所示,如果同步信号所指示的蓝牙计数为10000,而音频计数为10,则表示当蓝牙计数为一个10ms周期的10000(即该10ms周期的下一个10ms周期的0)时,音频计数已经是该下一个10ms周期的10了。即音频计数比蓝牙计数大10个计数值。此时,音频模块则可以调整耳塞101-1的音频PLL的输入输出频率,使得耳塞101-1的音频计数与蓝牙计数同步,从而使得耳塞101-1的音频时钟与蓝牙时钟同步。
其中,耳塞101-2实现音频时钟与蓝牙时钟同步的方法与耳塞101-1实现音频时钟与蓝牙时钟同步的方法相同,本申请实施例这里不予赘述。
需要注意的是,本申请实施例中,耳塞101-1被拿出耳塞盒101-3后,便可以周期性 (如每隔10ms)执行上述音频时钟与蓝牙时钟的同步。但是,耳塞101-1被拿出耳塞盒101-3后,不一定会被使用。例如,耳塞101-1被拿出耳塞盒101-3后,不一定会与电子设备(如手机100)进行音频数据通信。如果耳塞101-1被拿出耳塞盒101-3后没有被使用,但是却一直在执行上述音频时钟与蓝牙时钟的同步,则会增大耳塞101-1的功耗,影响耳塞101-1的续航时间。为了降低耳塞101-1的功耗,耳塞101-1可以在耳塞101-1与电子设备建立连接,或者耳塞101-1与电子设备进行音频数据通信时,执行上述音频时钟与蓝牙时钟的同步。
最后,本申请实施例中,可以实现手机100的音频时钟与TWS耳机101的耳塞的音频时钟的同步(即时钟同步-3)。
结合图1B,如图9所示,上述时钟同步-3具体可以包括:手机100的音频时钟与耳塞101-1的音频时钟的同步(即S905);以及,手机100的音频时钟与耳塞101-2的音频时钟的同步(即S906)。
示例性的,以手机100的音频时钟与耳塞101-1的音频时钟的同步(即S905)为例。如图9所示,实现手机100的音频时钟与耳塞101-1的音频时钟的同步具体可以包括:耳塞101-1可以在待播放数据(即音频数据)发生上溢或者下溢时,请求手机100调整手机100向耳塞101-1传输音频数据的进度,以抑制或避免上述上溢或者下溢现象的持续或者加剧。
其中,耳塞101-1或者耳塞101-2接收到手机100发送的音频数据后,将接收到的音频数据(即待播放数据)保存在缓存(buffer)。上述待播放数据发生上溢可以包括:buffer中缓存的数据超过第一预设值(也可以称为上水线)。上述待播放数据发生下溢可以包括:buffer中缓存的数据低于第二预设值(也可以称为下水线)。
示例性的,buffer中缓存的数据高于第一预设值,以及buffer中缓存的数据低于第二预设值的具体实现方式至少可以包括实现方式(1)-实现方式(3)。
在实现方式(1)中,buffer中缓存的数据超过第一预设值,具体可以为:buffer中缓存的数据的大小超过第一预设值。buffer中缓存的数据低于第二预设值,具体可以为:buffer中缓存的数据的大小低于第二预设值。其中,上述数据的大小的单位可以为MB或者KB。上述第一预设值和第二预设值的单位也是MB或者KB。
在实现方式(2)中,buffer中缓存的数据超过第一预设值,具体可以为:buffer中缓存的数据的待播放时长超过第一预设值。buffer中缓存的数据低于第二预设值,具体可以为:buffer中缓存的数据的待播放时长低于第二预设值。其中,数据的待播放时长是指耳塞(如耳塞101-1)播放该数据所需要的时间长度。其中,上述数据的待播放时长的单位可以为毫秒(ms)或者秒(s)等。上述第一预设值和第二预设值的单位也是毫秒或者秒等。
在实现方式(3)中,buffer中缓存的数据超过第一预设值,具体可以为:buffer中缓存的数据包的个数大于第一预设值。buffer中缓存的数据低于第二预设值,具体可以为:buffer中缓存的数据包的个数小于第二预设值。
可选的,在一些实施例中,上述待播放数据发生上溢可以包括:buffer中缓存的数据即将超过第一预设值(也可以称为上水线)。上述待播放数据发生下溢可以包括:buffer中缓存的数据即将低于第二预设值(也可以称为下水线)。
需要说明的是,buffer中缓存的数据即将超过第一预设值的具体实现方式,可以参考上述实施例对buffer中缓存的数据超过第一预设值的详细描述。buffer中缓存的数据即将低于第二预设值的具体实现方式,可以参考上述实施例对buffer中缓存的数据低于第二预设值的详细描述。本申请实施例这里不予赘述。
本申请实施例中,手机100可以根据第一传输参数向耳塞101-1发送音频数据。其中,根据第一传输参数在单位时间发送的音频数据具有第一播放时长。耳塞101-1的待播放数据上溢时,向手机100发送第一信号。响应于该第一信号。手机100可以根据第二传输参数向耳塞101-1发送音频数据。根据第二传输参数在单位时间发送的音频数据具有第二播放时长。上述第二播放时长小于第一播放时长。耳塞101-1的待播放数据下溢时,向手机100发送第二信号。响应于耳塞101-1发送的第二信号,手机100根据第三传输参数向所述耳塞101-1发送音频数据。其中,根据第三传输参数在单位时间发送的音频数据具有第三播放时长。该第三播放时长大于第一播放时长。
其中,上述第一信号可以是耳塞101-1发送的。手机100响应于该第一信号可以根据第二传输参数发送音频数据。相比于根据第一传输参数在单位时间发送的音频数据,根据第二传输参数在单位时间发送的音频数据具有的播放时长(第二播放时长)较小。即第二播放时长小于第一播放时长。手机100单位时间向耳塞101-1发送的音频数据的播放时长变小,则表示手机100向耳塞101-1传输音频数据的进度放慢了。换言之,根据上述第二传输参数发送音频数据的进度,慢于根据第一传输参数发送音频数据的进度。可以理解,如果耳塞101-1的待播放数据上溢,手机100可以调整向耳塞101-1传输音频数据的传输参数。如此,可以放慢手机100向耳塞101-1传输音频数据的进度。这样,耳塞101-1向其buffer中保存音频数据的进度也会放慢,耳塞101-1的buffer中缓存数据的速度会降低。随着耳塞101-1对buffer)中缓存的音频数据的处理,buffer中缓存的数据则可以减少。这样,便可以抑制上溢现象的持续或者加剧。
上述第二信号是耳塞101-1的待播放数据下溢时发送的。手机100响应于该第二信号可以根据第三传输参数发送音频数据。相比于根据第一传输参数在单位时间发送的音频数据,根据第三传输参数在单位时间发送的音频数据具有的播放时长(第二播放时长)较大。即第三播放时长大于第一播放时长。手机100单位时间向耳塞101-1发送的音频数据的播放时长变大,则表示手机100向耳塞101-1传输音频数据的进度加快了。换言之,根据上述第三传输参数发送音频数据的进度,快于根据第一传输参数发送音频数据的进度。可以理解,如果耳塞101-1的待播放数据下溢,手机100可以调整向耳塞101-1传输音频数据的传输参数。如此,可以加快手机100向耳塞101-1传输音频数据的进度。这样,耳塞101-1向其buffer中保存音频数据的进度也会加快,耳塞101-1的buffer中缓存数据的速度会增大。在耳塞101-1处理buffer中缓存的音频数据是速度不变的前提下,buffer中缓存的数据则可以增多。这样,便可以抑制下溢现象的持续或者加剧。
示例性的,耳塞101-1可以在待播放数据发生上溢或者下溢时,可以通过以下三种实现方式(实现方式a-实现方式c),请求手机100调整手机100向耳塞101-1传输音频数据的进度,以抑制或避免上述上溢或者下溢现象的持续或者加剧。在实现方式a中,上述第一信号是第一指示消息。上述第二信号是第二指示消息。
实现方式a:耳塞101-1在待播放数据发生上溢或者下溢时,可以向手机100发送用于指示待播放数据发生上溢或者下溢的指示信息,以反馈该上溢或者下溢现象。
例如,耳塞101-1可以在待播放数据发生上溢时,向手机100发送第一指示消息。该第一指示消息用于指示耳塞101-1的待播放数据发生上溢。耳塞101-1可以在待播放数据发生下溢时,向手机100发送第二指示消息。该第二指示消息用于指示耳塞101-1的待播放数据发生下溢。
实现方式b:耳塞101-1在待播放数据发生上溢或者下溢时,向手机100发送调整音频数据进度的请求。在实现方式b中,上述第一信号是第一调整请求。上述第二信号是第二调整请求。
例如,耳塞101-1在待播放数据发生上溢时,可以向手机100发送第一调整请求。该第一调整请求用于请求手机100调慢向耳塞101-1传输音频数据的进度。耳塞101-1在待播放数据发生下溢时,可以向手机100发送第二调整请求。该第二调整请求用于请求手机100调快向耳塞101-1传输音频数据的进度。
需要说明的是,在上述实现方式a和实现方式b中,手机100调整向耳塞101-1传输音频数据的进度的具体方法,可以参考下述实施例中的描述,本申请实施例这里不予赘述。
实现方式c:耳塞101-1在待播放数据发生上溢或者下溢时,向手机100发送音频数据的传输参数,以请求手机100按照该传输参数向手机100传输音频数据。在实现方式c中,上述第一信号中可以包括第二传输参数。上述第二信号中可以包括第三传输参数。
其中,当耳塞101-1的待播放数据发生上溢时,相比于当前的传输进度(即第一传输参数对应的传输进度),耳塞101-1向手机100发送的传输参数(即第二传输参数)所对应的音频数据传输进度较慢。当耳塞101-1的待播放数据发生下溢时,相比于当前的传输进度(即第一传输参数对应的传输进度),耳塞101-1向手机100发送的传输参数(即第三传输参数)所对应的音频数据传输进度较快。例如,上述传输参数可以为PCM采样率和音频数据包的传输时间间隔,以及音频数据包的大小等至少一个参数。其中,手机100可以按照耳塞101-1所指示的传输参数,向耳塞101-1传输音频数据。
示例性的,假设手机100以表1中的方式1对应的传输参数向耳塞101-1传输音频数据。耳塞101-1在待播放数据发生上溢时,可以向手机100发送表1中的方式2对应的传输参数。手机100接收到表1中的方式2对应的传输参数后,可以按照表1中的方式2对应的传输参数向耳塞101-1传输音频数据。
本申请实施例中,耳塞101-1可以通过耳塞101-1与手机100之间的控制链路传输上述第一指示消息、第二指示消息,第一调整请求、第二调整请求和上述传输参数等。例如,该控制链路可以为异步面向连接(asynchronous connection-oriented link,ACL)链路。
可以理解,当待播放数据发生上溢时,表示耳塞(如耳塞101-1)的buffer中缓存的数据较多,耳塞101-1来不及播放较多的音频数据。导致buffer中缓存的数据较多的原因可能是手机100向耳塞101-1传输音频数据的进度较快。这种情况下,如果手机100仍按照原来的传输进度向耳塞101-1传输音频数据,那么则可能会因为buffer不能缓存来自手机100的音频数据,而导致音频数据丢失。这样,耳塞101-1播放的音频数据则可能会不连续。此时,手机100可以调慢向耳塞101-1传输音频数据的进度。这样,可以缓解耳塞101-1的缓存压力,抑制或避免上溢现象的持续或者加剧。
当待播放数据发生下溢时,表示耳塞(如耳塞101-1)的buffer中缓存的音频数据较少,耳塞101-1没有缓存足够的待播放数据。导致buffer中缓存的数据较少的原因可能是手机100向耳塞101-1传输音频数据的进度较慢。这种情况下,如果手机100仍按照原来的传输进度向耳塞101-1传输音频数据,那么则可能会耳塞101-1播放完buffer中缓存的数据后,无音频数据可播放。这样,耳塞101-1则会出现播放中断。此时,手机100可以调快向耳塞101-1传输音频数据的进度。这样,可以增加耳塞101-1的缓存,抑制或避免下溢现象的持续或者加剧。
示例性的,本申请实施例中,手机100可以通过以下实现方式(i)-实现方式(ii)调整向耳塞101-1传输音频数据的进度。
实现方式(i):手机100(例如,图8所示的手机100的编解码(Codec)模块)可以通过调整手机100向耳塞101-1传输音频数据的PCM采样率,调整手机100向耳塞101-1传输音频数据的进度,以抑制或避免下溢现象的持续或者加剧。其中,PCM采样率越高,单位时间采样得到的PCM样本数则越多。PCM样本数越多,采样得到的数据则越多。
其中,手机100向耳塞101-1发送的音频数据是数字信号。该数据信号是由模拟信号转换而来的。手机100(例如,图8所示的手机100的编解码(Codec)模块)可以将模拟信号转换为数字信号。手机100可以通过调整将模拟信号转换为数字信号的过程中,所使用的PCM采样率,来调整手机100向耳塞101-1传输音频数据的进度。
在第一种情况下,假设手机100向耳塞101-1发送音频数据包的时间间隔固定。例如,手机100每间隔20毫秒(ms)向耳塞101-1发送一个音频数据包。并且,每个音频数据包中待播放数据的时长固定。例如,每个音频数据包中待播放数据的时长为20ms。那么,手机100则可以通过调整每个音频数据包中包括的音频数据的大小,来抑制或避免上溢或者下溢现象的持续或者加剧。而在上述时间间隔固定,待播放数据的时长固定的情况下,每个音频数据包中包括的音频数据的大小,取决于手机100将模拟信号转换为数字信号时所使用的PCM采样率的大小。
其中,在上述时间间隔固定,待播放数据的时长固定的情况下,PCM采样率越大,单位时间采样得到的PCM样本数则越多,音频数据包中的音频数据则越多。这样,如果发生上述实现方式(1)中的下溢,手机100可以调高PCM采样率,以增大音频数据包中的数据。如此,便可以抑制或避免下溢现象的持续或者加剧。
在上述时间间隔固定,待播放数据的时长固定的情况下,PCM采样率越小,单位时间采样得到的PCM样本数则越少,音频数据包中的音频数据则越少。这样,如果发生上述实现方式(1)中的上溢,手机100可以调低PCM采样率,以减少音频数据包中的数据。如此,便可以抑制或避免上溢现象的持续或者加剧。
例如,如表1中的方式1所示,假设手机100每隔20ms向耳塞101-1传输一个音频数据包。并且,每个音频数据包中包括20ms的音频数据。手机100向耳塞101-1传输音频数据包所采用的PCM采样率为24千赫兹(kHz)。每个音频数据包中包括的音频数据的大小为100KB。
表1
  时间间隔 播放时长 PCM采样率 数据大小
方式1 20ms 20ms 24kHz 100KB
方式2 20ms 20ms 16kHz 80KB
方式3 20ms 20ms 32kHz 160KB
如果耳塞101-1的待播放数据发生上溢,手机100则可以调低手机100向耳塞101-1传输音频数据包所采用的PCM采样率。例如,手机100可以将PCM采样率调整为表1中的方式2所示的16kHz。调低PCM采样率之后,手机100还是每隔20ms向耳塞101-1传输一个音频数据包。每个音频数据包中包括20ms的音频数据。但是,每个音频数据包中包括的音频数据的大小发生了变化。具体的,每个音频数据包中包括的音频数据变少了。如表1所示,每个音频数据包中包括的音频数据由方式1所示的100KB变成了方式2所示的80KB。如此,则可以缓解耳塞101-1的缓存压力,抑制或避免上溢现象的持续或者加剧。
如果耳塞101-1的待播放数据发生下溢,手机100则可以调高手机100向耳塞101-1传输音频数据包所采用的PCM采样率。例如,手机100可以将PCM采样率调整为表1中的方式3所示的32kHz。调高PCM采样率之后,手机100还是每隔20ms向耳塞101-1传输一个音频数据包。每个音频数据包中包括20ms的音频数据。但是,每个音频数据包中包括的音频数据的大小发生了变化。具体的,每个音频数据包中包括的音频数据变多了。如表1所示,每个音频数据包中包括的音频数据由方式1所示的100KB变成了方式3所示的160KB。如此,则可以增加耳塞101-1的缓存,抑制或避免下溢现象的持续或者加剧。
在第二种情况下,假设手机100向耳塞101-1发送音频数据包的时间间隔固定。例如,手机100每间隔20ms向耳塞101-1发送一个音频数据包。并且,每个音频数据包中包括的音频数据的大小固定。例如,每个音频数据包中包括100KB的音频数据。那么,手机100则可以通过调整每个音频数据包中待播放数据的时长,来抑制或避免上溢或者下溢现象的持续或者加剧。
而在上述时间间隔固定,每个音频数据包中包括的音频数据的大小固定的情况下,每个音频数据包中待播放数据的时长,取决于手机100将模拟信号转换为数字信号时所使用的PCM采样率的大小。
其中,在音频数据包中包括的音频数据的大小固定的情况下,PCM采样率越大,每个音频数据包中待播放数据的时长越短。这样,如果发生上述实现方式(2)中的上溢,手机100可以调高PCM采样率,以缩短音频数据包中的待播放数据的时长。如此,便可以抑制或避免上溢现象的持续或者加剧。
在音频数据包中包括的音频数据的大小固定的情况下,PCM采样率越小,每个音频数据包中待播放数据的时长越长。这样,如果发生上述实现方式(2)中的下溢,手机100可以调低PCM采样率,以加大音频数据包中的待播放数据的时长。如此,便可以抑制或避免下溢现象的持续或者加剧。
例如,如表2中的方式1所示,假设手机100每隔20ms向耳塞101-1传输一个音频数据包。并且,每个音频数据包中包括的音频数据的大小为100KB。每个音频数据包中包括20ms的音频数据。手机100向耳塞101-1传输音频数据包所采用的PCM采样率为24kHz。
表2
  时间间隔 数据大小 PCM采样率 播放时长
方式1 20ms 100KB 24kHz 20ms
方式2 20ms 100KB 32kHz 10ms
方式3 20ms 100KB 16kHz 30ms
如果耳塞101-1的待播放数据发生上溢,手机100则可以调高手机100向耳塞101-1传输音频数据包所采用的PCM采样率。例如,手机100可以将PCM采样率调整为表2中的方式2所示的32kHz。调高PCM采样率之后,手机100还是每隔20ms向耳塞101-1传输一个音频数据包。每个音频数据包中包括100KB的音频数据。但是,每个音频数据包中音频数据的播放时长发生了变化。具体的,音频数据包中音频数据的播放时长变短了。如表2所示,每个音频数据包中音频数据的播放时长由方式1所示的20ms变成了方式2所示的10ms。如此,则可以缓解耳塞101-1的缓存压力,抑制或避免上溢现象的持续或者加剧。
如果耳塞101-1的待播放数据发生下溢,手机100则可以调低手机100向耳塞101-1传输音频数据包所采用的PCM采样率。例如,手机100可以将PCM采样率调整为表2中的方式3所示的16kHz。调低PCM采样率之后,手机100还是每隔20ms向耳塞101-1传输一个音频数据包。每个音频数据包中包括100KB的音频数据。但是,每个音频数据包中音频数据的播放时长发生了变化。具体的,音频数据包中音频数据的播放时长变长了。如表2所示,每个音频数据包中音频数据的播放时长由方式1所示的20ms变成了方式3所示的30ms。如此,则可以增加耳塞101-1的缓存,抑制或避免下溢现象的持续或者加剧。
实现方式(ii):手机100可以通过调整向耳塞(如耳塞101-1)传输音频数据包的间隔时间,来调整手机100向耳塞101-1传输音频数据的进度,以抑制或避免下溢现象的持续或者加剧。
其中,假设手机100向耳塞101-1发送的音频数据包中包括的音频数据的大小固定。例如,每个音频数据包中包括100KB的音频数据。并且,每个音频数据包中待播放数据的时长固定。例如,每个音频数据包中待播放数据的时长为20ms。在这种情况下,手机100向耳塞101-1发送音频数据包的频率越大,即时间间隔越小,耳塞101-1的buffer中缓存的音频数据包则越多,音频数据则越多。手机100向耳塞101-1发送音频数据包的频率越小,即时间间隔越大,耳塞101-1的buffer中缓存的音频数据包则越少,音频数据则越少。
如果发生上述实现方式(1)、实现方式(2)或者实现方式(3)中任一实现方式中的上溢,手机100可以调大向耳塞101-1传输音频数据的时间间隔。例如,手机100可以每隔30ms向耳塞101-1传输一个音频数据包。调大向耳塞101-1传输音频数据的时间间隔之后,虽然每个音频数据包中的音频数据的大小不变,每个音频数据包中音频数据的播放时长不变。但是,手机100向耳塞101-1发送的音频数据包的个数减少了,从而耳塞101-1的buffer要缓存的音频数据变少了,buffer要缓存的音频数据的播放时长也会变短。如此,可以缓解耳塞101-1的缓存压力,抑制或避免上溢现象的持续或者加剧。
如果发生上述实现方式(1)、实现方式(2)或者实现方式(3)中任一实现方式中的下溢,手机100可以调小向耳塞101-1传输音频数据的时间间隔。例如,手机100可以每隔10ms向耳塞101-1传输一个音频数据包。调小向耳塞101-1传输音频数据的时间间隔之后,虽然每个音频数据包中的音频数据的大小不变,每个音频数据包中音频数据的播放时长不变。但是手机100向耳塞101-1发送的音频数据包的个数增多了,从而耳塞101-1的buffer要缓存的音频数据增多了,buffer要缓存的音频数据的播放时长也会变长。如此,可以增加耳塞101-1的缓存,抑制或避免下溢现象的持续或者加剧。
需要注意的是,在手机100调整向耳塞传输音频数据的进度的过程中,手机100的蓝牙时钟并没有被调整。即手机100向耳塞传输音频数据的时间并未发生变化。手机100只是调整了向耳塞传输音频数据包的间隔时间。例如,手机100可以在一些原本要发送音频数据包的时间不发送音频数据包。
需要说明的是,本申请实施例中,手机100不仅可以通过以下实现方式(i)-实现方式(ii)调整向耳塞101-1传输音频数据的进度。手机100还可以通过调整音频数据包中包括的音频数据的大小、每个音频数据包中待播放数据的时长,以及发送音频数据包的时间间隔这三个参数中的至少两个参数的方式,调整向耳塞101-1传输音频数据的进度。
结合上述实现方式a,如果手机100接收到耳塞101-1发送的第一指示消息,则表示耳塞101-1的待播放数据发生上溢。此时,手机100可以调低PCM采样率,以调慢手机100向耳塞101-1传输音频数据的进度。如果手机100接收到耳塞101-1发送的第二指示消息,则表示耳塞101-1的待播放数据发生下溢。此时,手机100可以调高PCM采样率,以调快手机100向耳塞101-1传输音频数据的进度。
结合上述实现方式b,如果手机100接收到耳塞101-1发送的第一调整请求,则可以响应于该第一调整请求,调低PCM采样率,以调慢手机100向耳塞101-1传输音频数据的进度。如果手机100接收到耳塞101-1发送的第二调整请求,则可以响应于该第二调整请求,调高PCM采样率,以调快手机100向耳塞101-1传输音频数据的进度。
示例性的,在上述实现方式a和实现方式b中,手机100可以按照预设步进调整手机100向耳塞101-1传输音频数据的进度。
例如,结合上述实现方式(i)的第一种情况,手机100可以按照第一预设步进,调小第一传输参数中的PCM采样率,以调慢手机100向耳塞101-1传输音频数据的进度;手机100可以按照第二预设步进,调大第一传输参数中的PCM采样率,以调快手机100向耳塞101-1传输音频数据的进度。
例如,结合上述实现方式(i)的第二种情况,手机100可以按照第三预设步进,调大第一传输参数中的PCM采样率,这样可以减少音频数据包中音频数据的播放时长。从而,可以调慢手机100向耳塞101-1传输音频数据的进度。手机100可以按照第四预设步进,调小第一传输参数中的PCM采样率。这样可以增长音频数据包中音频数据的播放时长。从而,可以调快手机100向耳塞101-1传输音频数据的进度。
又例如,结合上述实现方式(ii),手机100可以按照第五预设步进,调大第一传输参数中的时间间隔,以调慢手机100向耳塞101-1传输音频数据的进度;手机100可以按照第六预设步进,调小第一传输参数中的时间间隔,以调快手机100向耳塞101-1传输音频数据的进度。
以手机100通过调整向耳塞101-1传输音频数据包的间隔时间,来调整手机100向耳塞101-1传输音频数据的进度为例。上述第五预设步进和上述第六预设步进均可以为5ms。假设手机100向耳塞101-1发送的音频数据包中包括的音频数据的大小固定,且每个音频数据包中待播放数据的时长固定。待播放数据发生上溢时,手机100可以将向耳塞101-1传输音频数据包的时间间隔延长5ms。例如,手机100可以将向耳塞101-1传输音频数据包的时间间隔由10ms调整为15ms。待播放数据发生下溢时,手机100可以将向耳塞101-1传输音频数据包的时间间隔缩短5ms。例如,手机100可以将向耳塞101-1传输音频数据 包的时间间隔由10ms调整为5ms。
示例性的,本申请实施例这里基于BLE的音频协议框架,对手机100与TWS耳机101的耳塞实现音频时钟同步时的交互过程进行说明。
请参考图11,其示出本申请实施例提供的一种基于BLE的音频协议框架。如图11所示,该协议框架可包括:应用(application)层、主机(Host)、主机控制器接口(Host Controller Interface,HCI)和控制器(controller)。
其中,控制器包括链路层和物理层。物理层负责提供数据传输的物理通道。通常情况下,一个通信系统中存在几种不同类型的信道,如控制信道、数据信道、语音信道等等。链路层包括ACL链路和ISO信道。其中,ACL链路用于传输设备间的控制消息,如内容控制消息(如上一首、下一首等)。ISO信道可用于传输设备间的等时数据(如即音频数据)。
Host和Controller通过HCI进行通讯。Host和Controller通信的介质是HCI指令。Host可以实现于设备的应用处理器中(application processor,AP),Controller可以实现于该设备的蓝牙芯片中。可选的,在小型设备中,Host和Controller可以实现于同一个处理器或控制器中,此时HCI是可选的。
请参考图12,本申请实施例结合图11所示的基于BLE的音频协议框架,以手机100向耳塞发送音频数据包的时间间隔固定,且每个音频数据包中待播放数据的时长固定的前提下,调整PCM采样率抑制上溢或者下溢为例,说明上述时钟同步-3的具体过程。其中,手机100与耳塞101-1的音频时钟同步(即S905)的具体过程可以参考S1201。手机100与耳塞101-2的音频时钟同步(即S905)的具体过程可以参考S1202。其中,手机100和耳塞都具有Host和链路层LL(包括在controller中),Host和LL之间通过HCI通信。
示例性的,以手机100与耳塞101-1的音频时钟同步为例。如图12所示,耳塞101-1的音频模块可以在待播放数据发生上溢或者下溢时,向耳塞101-1的Host发送设置音频时钟请求。例如,该设置音频时钟请求可以为Set Audio Clock Request。耳塞101-1的Host接收到设置音频时钟请求后,可以向耳塞101-1的LL发送设置音频时钟确认信息。该设置音频时钟确认信息用于指示耳塞101-1的LL请求手机100调整手机100的音频时钟(即调整向耳塞101-1发送音频数据的传输进度)。例如,该设置音频时钟确认信息可以为HCI指令“HCI Set Audio Clock Command”。
如图12所示,耳塞101-1的LL接收到设置音频时钟确认信息后,可以向手机100的LL发送音频时钟控制命令。该音频时钟控制命令用于请求手机100调整手机100的音频时钟(即调整向耳塞101-1发送音频数据的传输进度)。例如,该音频时钟控制命令可以为LL_Control_PDU消息。其中,耳塞101-1的LL可以通过ACL链路(如图11所示的链路层的ACL链路)向手机100的LL发送LL_Control_PDU消息。
响应于上述LL_Control_PDU消息,手机100的LL可以向手机100的Host触发设置音频时钟事件(例如,“HCI Set Audio Clock event”)。其中,手机100的LL可以通过HCI指令向手机100的Host触发设置音频时钟事件。响应于手机100的LL触发的设置音频时钟事件,手机100的Host可以调整向耳塞101-1传输的音频数据的PCM采样率以编码。其中,在耳塞101-1反馈上溢或者下溢后,手机100调整向耳塞101-1 传输的音频数据的PCM采样率,可以抑制或避免上述上溢或者下溢现象的持续或者加剧。
在上述场景(2)所述的监听方式和上述场景(3)所述的转发方式中,手机100与耳塞101-1配对连接。耳塞101-1与耳塞101-2配对连接。
结合图3B,如图13所示,在场景(2)和场景(3)中,时钟同步-1具体可以包括:耳塞101-1与手机100的蓝牙时钟的同步(即S901);以及,耳塞101-2与耳塞101-1的蓝牙时钟的同步(即S1301)。时钟同步-2具体可以包括:耳塞101-1的音频时钟与蓝牙时钟的同步(即S903);以及,耳塞101-2的音频时钟与蓝牙时钟的同步(即S904)。时钟同步-3具体可以包括:手机100的音频时钟与耳塞101-1的音频时钟的同步(即S905)。
需要注意的是,场景(2)和场景(3)中S901、S903-S905的详细描述,可以参考上述实施例中对S901、S903-S905的介绍,本申请实施例这里不予赘述。其中,耳塞101-2与耳塞101-1的蓝牙时钟同步(即S1301)的方法与耳塞101-1与手机100的蓝牙时钟同步(即S901)的方法类似,本申请实施例这里不予赘述。
在上述场景(1)-场景(3)中的任一场景中,可以实现耳塞101-1与手机100的蓝牙时钟同步,耳塞101-2与手机100的蓝牙时钟同步,从而实现了TWS耳机101的两个耳塞的蓝牙时钟同步。并且,可以实现耳塞101-1的音频时钟与蓝牙时钟同步,耳塞101-2的音频时钟与蓝牙时钟同步,从而实现了TWS耳机101的两个耳塞的音频时钟同步。进一步的,手机100还可以分别调整向TWS耳机101的两个耳塞传输的音频数据的进度,从而可以抑制或避免上溢或者下溢现象的持续或者加剧,提升音频数据的传输效率和播放质量。
在上述场景(4)所述的单发方式中,手机100与耳塞101-1配对连接。
结合图4B,如图14所示,在场景(4)中,时钟同步-1具体可以包括:耳塞101-1与手机100的蓝牙时钟的同步(即S901)。时钟同步-2具体可以包括:耳塞101-1的音频时钟与蓝牙时钟的同步(即S903)。时钟同步-3具体可以包括:手机100的音频时钟与耳塞101-1的音频时钟的同步(即S905)。其中,场景(4)中S901、S903和S905的详细描述,可以参考上述实施例中对S901、S903和S905的介绍,本申请实施例这里不予赘述。
在上述场景(4),可以实现耳塞101-1与手机100的蓝牙时钟同步。并且,可以实现耳塞101-1的音频时钟与蓝牙时钟同步。进一步的,手机100还可以分别调整向耳塞101-1传输的音频数据的进度,从而可以抑制或避免上溢或者下溢现象的持续或者加剧,提升音频数据的传输效率和播放质量。
在一些实施例中,如果耳塞(如耳塞101-1)的待播放数据发生上溢,表示耳塞101-1的buffer中缓存的数据较多,耳塞101-1来不及播放较多的音频数据。此时,耳塞101-1可以对buffer中缓存的数据进行缩短处理后播放。例如,耳塞101-1可以将播放时长为30ms的音频数据,进行缩短处理,缩短处理后的音频数据的播放时长为20ms。这样,耳塞101-1便可以20ms播放完缩短处理后的音频数据。
如果耳塞(如耳塞101-1)的待播放数据发生下溢,表示耳塞101-1的buffer中缓存的音频数据较少,耳塞101-1没有缓存足够的待播放数据。此时,耳塞101-1可以对buffer中缓存的数据进行拉伸处理后播放。例如,耳塞101-1可以将播放时长为20ms的音频数据,进行拉伸处理,拉伸处理后的音频数据的播放时长为30ms。这样,耳塞101-1便可以 30ms播放完缩短处理后的音频数据。
在一些实施例中,上述场景(4)所述的单发方式可能会因为新耳塞的加入,而转化为上述场景(1)所述的双发方式、场景(2)所述的监听方式或者场景(3)所述的转发方式。其中,在场景(4)所述的单发方式转化为上述场景(1)所述的双发方式的情况下,在手机100刚开始向新加入的耳塞(如耳塞101-2)传输音频数据包时,耳塞101-2的buffer中缓存的数据较少。而正在播放音频数据的耳塞(如耳塞101-1)的buffer中可能已经缓存了较多的数据。此时,可能会发生耳塞101-2的待播放数据下溢,而耳塞101-1的待播放数据上溢的现象。
为了避免这种现象,手机100可以在检测到新加入的耳塞101-2时,调慢向耳塞101-1传输音频数据的进度。手机100可以在耳塞101-1的buffer中缓存的数据低于第三预设值(也可以称为水线)时,再向耳塞101-2传输音频数据。
或者,手机100可以在检测到新加入的耳塞101-2时,调慢向耳塞101-1传输音频数据的进度。同时,手机100可以调快向耳塞101-2传输音频数据的进度,直至耳塞101-1和耳塞101-2的buffer中缓存的数据的差异小于预设值。
在本申请的另一些实施例还提供了一种电子设备,该电子设备是第二电子设备。例如,该第二电子设备可以是TWS耳机的耳塞。该TWS耳机的耳塞的结构可以参考图6所示的耳塞的结构。耳塞的存储器中可以保存一个或多个计算机程序。该一个或多个计算机程序包括指令。该指令可以用于执行如图9、图12、图13或图14中任一附图对应的描述中TWS耳机的耳塞(如耳塞101-1,耳塞101-2)执行的各个功能或者步骤。当然,图6所示的TWS耳机的耳塞还可以包括如传感器等其他器件,本申请实施例对此不做任何限制。
在本申请的另一些实施例还提供了一种电子设备,该电子设备是第一电子设备。该电子设备的结构可以参考图7所示的电子设备的结构。该电子设备的存储器中可以保存一个或多个计算机程序。该一个或多个计算机程序包括指令。该指令可以用于执行如图9、图12、图13或图14中任一附图对应的描述中手机100执行的各个功能或者步骤。
本申请实施例还提供一种计算机存储介质,该计算机存储介质包括计算机指令,当所述计算机指令在上述电子设备(第一电子设备或者第二电子设备)上运行时,使得电子设备执行如图9、图12、图13或图14中任一附图对应的描述中对应电子设备执行的各个功能或者步骤。
本申请实施例还提供一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行如图9、图12、图13或图14中任一附图所示的音频数据的通信方法。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本实施例所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方 式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:快闪存储器、移动硬盘、只读存储器、随机存取存储器、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本实施例的具体实施方式,但本实施例的保护范围并不局限于此,任何在本实施例揭露的技术范围内的变化或替换,都应涵盖在本实施例的保护范围之内。因此,本实施例的保护范围应以所述权利要求的保护范围为准。

Claims (17)

  1. 一种音频数据的通信方法,其特征在于,所述方法包括:
    第一电子设备根据第一传输参数向第二电子设备发送音频数据;其中,根据所述第一传输参数在单位时间发送的音频数据具有第一播放时长;
    响应于所述第二电子设备发送的第一信号,所述第一电子设备根据第二传输参数向所述第二电子设备发送音频数据;其中,根据所述第二传输参数在单位时间发送的音频数据具有第二播放时长,所述第二播放时长小于所述第一播放时长;
    响应于所述第二电子设备发送的第二信号,所述第一电子设备根据第三传输参数向所述第二电子设备发送音频数据;其中,根据所述第三传输参数在单位时间发送的音频数据具有第三播放时长,所述第三播放时长大于所述第一播放时长。
  2. 根据权利要求1所述的方法,其特征在于,所述第一信号是所述第二电子设备的待播放数据上溢时发送的;所述第二信号是所述第二电子设备的待播放数据下溢时发送的;
    其中,所述第二电子设备的待播放数据上溢,具体为:所述第二电子设备的缓存中的数据超过第一预设值;
    所述第二电子设备的待播放数据下溢,具体为:所述第二电子设备的缓存中的数据低于第二预设值。
  3. 根据权利要求2所述的方法,其特征在于,所述第二电子设备的缓存中的数据超过第一预设值,具体为:所述第二电子设备的缓存中的数据的大小超过所述第一预设值;
    所述第二电子设备的缓存中的数据低于第二预设值,具体为:所述第二电子设备的缓存中的数据的大小低于所述第二预设值。
  4. 根据权利要求2所述的方法,其特征在于,所述第二电子设备的缓存中的数据超过第一预设值,具体为:所述第二电子设备的缓存中的数据的待播放时长超过所述第一预设值;
    所述第二电子设备的缓存中的数据低于第二预设值,具体为:所述第二电子设备的缓存中的数据的待播放时长低于所述第二预设值。
  5. 根据权利要求2所述的方法,其特征在于,所述第二电子设备的缓存中的数据超过第一预设值,具体为:所述第二电子设备的缓存中的音频数据包的个数大于所述第一预设值;
    所述第二电子设备的缓存中的数据低于第二预设值,具体为:所述第二电子设备的缓存中的音频数据包的个数小于所述第二预设值。
  6. 根据权利要求1-5中任意一项所述的方法,其特征在于,所述第一信号是第一指示消息,所述第一指示消息用于指示所述第二电子设备的待播放数据上溢;
    所述第二信号是第二指示消息,所述第二指示消息用于指示所述第二电子设备的待播放数据下溢。
  7. 根据权利要求1-5中任意一项所述的方法,其特征在于,所述第一信号是第一调整请求,所述第一调整请求用于请求所述第一电子设备调小单位时间向所述第二电子设备发送的音频数据的播放时长;
    所述第二信号是第二调整请求,所述第二调整请求用于请求所述第一电子设备调大单位时间向所述第二电子设备发送的音频数据的播放时长。
  8. 根据权利要求1-5中任意一项所述的方法,其特征在于,所述第一信号中包括所述第二传输参数;所述第二信号中包括所述第三传输参数。
  9. 根据权利要求1-8中任意一项所述的方法,其特征在于,根据所述第二传输参数发送的音频数据包中音频数据的播放时长,等于根据所述第一传输参数发送的音频数据包中音频数据的播放时长;
    根据所述第二传输参数发送的音频数据包中音频数据的脉冲编码调制PCM采样率,小于根据所述第一传输参数发送的音频数据包中音频数据的PCM采样率;
    根据所述第二传输参数发送的音频数据包中音频数据的数据量,小于根据所述第一传输参数发送的音频数据包中音频数据的数据量;所述数据量为每个音频数据包中包括的音频数据的大小。
  10. 根据权利要求1-9中任意一项所述的方法,其特征在于,根据所述第三传输参数发送的音频数据包中音频数据的播放时长,等于根据所述第一传输参数发送的音频数据包中音频数据的播放时长;
    根据所述第三传输参数发送的音频数据包中音频数据的PCM采样率,大于根据所述第一传输参数发送的音频数据包中音频数据的PCM采样率;
    根据所述第三传输参数发送的音频数据包中音频数据的数据量,大于根据所述第一传输参数发送的音频数据包中音频数据的数据量;所述数据量为每个音频数据包中包括的音频数据的大小。
  11. 根据权利要求1-8中任意一项所述的方法,其特征在于,根据所述第二传输参数发送的音频数据包中音频数据的数据量,等于根据所述第一传输参数发送的音频数据包中音频数据的数据量;所述数据量为每个音频数据包中包括的音频数据的大小;
    根据所述第二传输参数发送的音频数据包中音频数据的PCM采样率,大于根据所述第一传输参数发送的音频数据包中音频数据的PCM采样率;
    根据所述第二传输参数发送的音频数据包中音频数据的播放时长,小于根据所述第一传输参数发送的音频数据包中音频数据的播放时长。
  12. 根据权利要求1-8或11中任意一项所述的方法,其特征在于,根据所述第三传输参数发送的音频数据包中音频数据的数据量,等于根据所述第一传输参数发送的音频数据包中音频数据的数据量;所述数据量为每个音频数据包中包括的音频数据的大小;
    根据所述第三传输参数发送的音频数据包中音频数据的PCM采样率,小于根据所述第一传输参数发送的音频数据包中音频数据的PCM采样率;
    根据所述第三传输参数发送的音频数据包中音频数据的播放时长,大于根据所述第一传输参数发送的音频数据包中音频数据的播放时长。
  13. 根据权利要求1-8中任意一项所述的方法,其特征在于,根据所述第二传输参数发送的音频数据包的时间间隔,大于根据所述第一传输参数发送的音频数据包的时间间隔。
  14. 根据权利要求1-8或13中任意一项所述的方法,其特征在于,根据所述第三传输参数发送的音频数据包的时间间隔,小于根据所述第一传输参数发送的音频数据包的 时间间隔。
  15. 一种电子设备,其特征在于,所述电子设备是第一电子设备,所述电子设备包括:处理器、存储器和通信接口;所述存储器和所述通信接口与所述处理器耦合;所述存储器用于存储计算机程序代码;所述计算机程序代码包括计算机指令,当所述处理器执行上述计算机指令时,所述电子设备执行如权利要求1-14任意一项所述的方法。
  16. 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在第一电子设备上运行时,使得所述第一电子设备执行如权利要求1-14中任一项所述的方法。
  17. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-14中任一项所述的方法。
PCT/CN2018/123656 2018-12-25 2018-12-25 一种音频数据的通信方法及电子设备 WO2020132907A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880098111.7A CN112771828B (zh) 2018-12-25 2018-12-25 一种音频数据的通信方法及电子设备
PCT/CN2018/123656 WO2020132907A1 (zh) 2018-12-25 2018-12-25 一种音频数据的通信方法及电子设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/123656 WO2020132907A1 (zh) 2018-12-25 2018-12-25 一种音频数据的通信方法及电子设备

Publications (1)

Publication Number Publication Date
WO2020132907A1 true WO2020132907A1 (zh) 2020-07-02

Family

ID=71127574

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/123656 WO2020132907A1 (zh) 2018-12-25 2018-12-25 一种音频数据的通信方法及电子设备

Country Status (2)

Country Link
CN (1) CN112771828B (zh)
WO (1) WO2020132907A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112040457A (zh) * 2020-08-26 2020-12-04 广州番禺巨大汽车音响设备有限公司 一种tws无线蓝牙耳机的配对连接方法、装置及系统
CN113709619A (zh) * 2021-08-31 2021-11-26 Oppo广东移动通信有限公司 音频处理方法、装置、用户终端及计算机可读介质
CN115240719A (zh) * 2021-04-23 2022-10-25 Oppo广东移动通信有限公司 缓存容量确定方法、装置、蓝牙播放设备及存储介质
WO2024119944A1 (zh) * 2022-12-07 2024-06-13 Oppo广东移动通信有限公司 参数配置方法、装置、音频设备组以及可读存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114173426B (zh) * 2021-11-30 2023-09-29 广州番禺巨大汽车音响设备有限公司 基于无线音频传输的无线音箱播放控制方法、装置及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064624A1 (en) * 2002-09-27 2004-04-01 Kabushiki Kaisha Toshiba Playback apparatus and access method of playback apparatus
CN102075514A (zh) * 2010-11-19 2011-05-25 王恒 Dsppa网络音频传输方法
CN103916367A (zh) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 一种传输多媒体数据的方法及装置
CN105681883A (zh) * 2016-01-07 2016-06-15 深圳Tcl数字技术有限公司 音频数据推送方法及系统

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999035876A1 (en) * 1998-01-02 1999-07-15 Nokia Networks Oy A method for synchronization adaptation of asynchronous digital data streams
EP1593107A4 (en) * 2003-02-13 2010-08-18 Nokia Corp METHOD OF SIGNALING CLIENT RATING CAPACITY IN MULTIMEDIA STREAMING
CN101002192A (zh) * 2004-07-27 2007-07-18 索尼株式会社 具有传输差错恢复的家庭网络系统
CN101681624A (zh) * 2007-05-21 2010-03-24 松下电器产业株式会社 声音编码以及再生装置
CN101409808B (zh) * 2008-10-15 2010-10-13 北京创毅视讯科技有限公司 一种音频重采样方法、装置及一种数字电视芯片
CN105245946B (zh) * 2014-07-10 2020-08-28 中兴通讯股份有限公司 可变码率媒体流的流量控制方法、装置以及系统
CN105847961A (zh) * 2016-03-29 2016-08-10 北京数码视讯科技股份有限公司 一种音频数据的处理方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064624A1 (en) * 2002-09-27 2004-04-01 Kabushiki Kaisha Toshiba Playback apparatus and access method of playback apparatus
CN102075514A (zh) * 2010-11-19 2011-05-25 王恒 Dsppa网络音频传输方法
CN103916367A (zh) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 一种传输多媒体数据的方法及装置
CN105681883A (zh) * 2016-01-07 2016-06-15 深圳Tcl数字技术有限公司 音频数据推送方法及系统

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112040457A (zh) * 2020-08-26 2020-12-04 广州番禺巨大汽车音响设备有限公司 一种tws无线蓝牙耳机的配对连接方法、装置及系统
CN115240719A (zh) * 2021-04-23 2022-10-25 Oppo广东移动通信有限公司 缓存容量确定方法、装置、蓝牙播放设备及存储介质
CN113709619A (zh) * 2021-08-31 2021-11-26 Oppo广东移动通信有限公司 音频处理方法、装置、用户终端及计算机可读介质
WO2024119944A1 (zh) * 2022-12-07 2024-06-13 Oppo广东移动通信有限公司 参数配置方法、装置、音频设备组以及可读存储介质

Also Published As

Publication number Publication date
CN112771828B (zh) 2022-10-18
CN112771828A (zh) 2021-05-07

Similar Documents

Publication Publication Date Title
CN112640505B (zh) 一种传输速率的控制方法及设备
US11778363B2 (en) Audio data transmission method applied to switching between single-earbud mode and double-earbud mode of TWS headset and device
CN112771890B (zh) 一种点对多点的数据传输方法及电子设备
CN112868244B (zh) 一种点对多点的数据传输方法及设备
CN112789867B (zh) 一种蓝牙连接方法及设备
CN112042212B (zh) 一种音频数据传输方法及电子设备
CN115426064B (zh) 音频数据的同步方法及设备
CN112789883B (zh) 一种速率控制方法、设备及计算机存储介质
CN112313929B (zh) 一种自动切换蓝牙音频编码方式的方法及电子设备
WO2020132907A1 (zh) 一种音频数据的通信方法及电子设备
WO2020113587A1 (zh) 一种使用蓝牙耳机进行通话的方法、设备及系统
CN113039822B (zh) 一种数据信道的建立方法及设备
WO2020118641A1 (zh) 一种麦克风mic切换方法及设备
CN113678481B (zh) 无线音频系统、音频通讯方法及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18944330

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18944330

Country of ref document: EP

Kind code of ref document: A1