WO2023273591A1 - Audio synchronization method, audio playing device and storage medium - Google Patents

Audio synchronization method, audio playing device and storage medium Download PDF

Info

Publication number
WO2023273591A1
WO2023273591A1 PCT/CN2022/090448 CN2022090448W WO2023273591A1 WO 2023273591 A1 WO2023273591 A1 WO 2023273591A1 CN 2022090448 W CN2022090448 W CN 2022090448W WO 2023273591 A1 WO2023273591 A1 WO 2023273591A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
audio
synchronization data
synchronization
playback
Prior art date
Application number
PCT/CN2022/090448
Other languages
French (fr)
Chinese (zh)
Inventor
许超杰
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023273591A1 publication Critical patent/WO2023273591A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/10Earpieces; Attachments therefor ; Earphones; Monophonic headphones
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/04Error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes

Definitions

  • the present application relates to the audio field, and in particular to an audio synchronization method, an audio playback device, and a storage medium.
  • the existing solution is to periodically send the local playback information of the main headset to the secondary headset during the initial synchronization and synchronization tracking stages, and the secondary headset uses the playback information of the primary headset and its own playback information The difference between them is used to determine the adjustment value of the playback progress, and based on the adjustment value, the playback speed of the secondary earphones is adjusted, so that the secondary earphones can follow the playback of the main earphones.
  • the existing solutions require the main earphone to periodically send playback information to the auxiliary earphones, which increases the burden on the data link between a pair of earphones, and may lead to lost data when the data link between a pair of earphones is not good. packets, leading to poor audio sync performance.
  • Embodiments of the present application provide an audio synchronization method, an audio playback device, and a storage medium, which can improve audio synchronization performance between earphones.
  • the embodiment of the present application proposes an audio synchronization method for an audio playback device, the method comprising:
  • the group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet;
  • the audio synchronization operation between the audio playback device and the audio source is implemented based on the at least one time stamp information and the at least one playback start time.
  • the embodiment of the present application proposes an audio playback device, the device includes:
  • the receiving unit is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
  • a playback unit configured to play the group of synchronization data packets
  • a recording unit configured to record at least one playback start time corresponding to the at least one synchronization data packet
  • a determining unit configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the connection between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time audio sync operation between them.
  • the embodiment of the present application proposes an audio playback device, the device includes: a receiver, a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, it realizes any of the above-mentioned Methods.
  • the embodiment of the present application provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the above is implemented.
  • Fig. 1 is a flow chart of an audio synchronization method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an exemplary synchronous playback provided by an embodiment of the present application
  • Fig. 3 is a schematic block diagram of initialization synchronization of an exemplary audio source and a TWS earphone provided by an embodiment of the present application;
  • FIG. 4 is a schematic diagram of an exemplary data flow information provided by an embodiment of the present application.
  • FIG. 5 is a structural schematic diagram 1 of an audio playback device 1 provided in an embodiment of the present application.
  • FIG. 6 is a second structural schematic diagram of an audio playback device 1 provided in an embodiment of the present application.
  • the embodiment of the present application proposes an audio synchronization method for an audio playback device, the method comprising:
  • the group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet;
  • the audio synchronization operation between the audio playback device and the audio source is implemented based on the at least one time stamp information and the at least one playback start time.
  • implementing the audio synchronization operation between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time includes:
  • the audio synchronization operation between the audio playback device and the audio source is implemented according to the target playback time difference and the initial playback time difference.
  • the determining the initial play time difference based on the at least one time stamp information and the at least one play start time includes:
  • the initial play time difference is determined according to the first play start time corresponding to the first played first synchronization data packet and the first time stamp information corresponding to the first synchronization data packet.
  • the determination of the target play time difference every preset time period based on the at least one time stamp information and the at least one play start time includes:
  • the target playing time difference is determined according to the second playing start time corresponding to the currently played second synchronization data packet and the second time stamp information corresponding to the second synchronization data packet every preset time period.
  • implementing the audio synchronization operation between the audio playback device and the audio source according to the target playback time difference and the initial playback time difference includes:
  • the audio playing speed of the audio playing device is not adjusted
  • the target playing time difference is greater than the initial playing time difference, then speed up the audio playing speed of the audio playing device;
  • the target play time difference is smaller than the initial play time difference, slow down the audio play speed of the audio play device.
  • the sequentially determining at least one timestamp information corresponding to the at least one synchronization data packet includes:
  • the data packet type is the first type, then sequentially search for the corresponding at least one timestamp information from the at least one synchronization data packet;
  • the data packet type is the second type, then sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet according to a preset data packet sending interval;
  • the data packet type is the third type, then determine a time stamp information corresponding to each synchronization data packet according to the preset playback speed, the last time stamp information corresponding to the last synchronization data packet, and the length of the last data packet, Obtain the at least one time stamp information.
  • the method after receiving a group of synchronization data packets sent by the audio source; before determining at least one time stamp information corresponding to the at least one synchronization data packet in sequence, the method further includes:
  • the audio playback device includes a first Bluetooth module
  • the audio source includes a second Bluetooth module
  • the audio playback device and the audio source are connected by the first Bluetooth module and the second Bluetooth module.
  • Bluetooth module to interact.
  • the number of the audio playback device is one or more.
  • the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet
  • the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended
  • the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
  • the embodiment of the present application proposes an audio playback device, the device includes:
  • the receiving unit is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
  • a playback unit configured to play the group of synchronization data packets
  • a recording unit configured to record at least one playback start time corresponding to the at least one synchronization data packet
  • a determining unit configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the connection between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time audio sync operation between them.
  • the determining unit is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
  • the determining unit is further configured to determine the initial Play time difference.
  • the determining unit is further configured to, every preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
  • the device further includes: an adjustment unit;
  • the adjustment unit is configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; The audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, slow down the audio playback speed of the audio playback device.
  • the determining unit is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, then sequentially search from the at least one synchronization data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
  • the device further includes: a calculation unit and a compensation unit;
  • the calculation unit is used to calculate a frequency error and a clock error between the audio source and the audio playback device;
  • the compensation unit is configured to compensate the system frequency of the audio playback device based on the frequency error; and compensate the system clock of the audio playback device based on the clock error.
  • the audio playback device includes a first bluetooth module
  • the audio source includes a second bluetooth module
  • the audio playback device and the audio source are connected by the first bluetooth module and the second bluetooth module.
  • Bluetooth module to interact.
  • the number of the audio playback device is one or more.
  • the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet
  • the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended
  • the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
  • the embodiment of the present application proposes an audio playback device, the device includes: a receiver, a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, the following method is implemented:
  • the processor is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
  • the processor is further configured to determine the initial Play time difference.
  • the processor is further configured to, every preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
  • the processor is further configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; if the target playback time difference is greater than the initial playback time difference time difference, then speed up the audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, then slow down the audio playback speed of the audio playback device.
  • the processor is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, then sequentially search from the at least one synchronization data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
  • the processor is further configured to calculate a frequency error and a clock error between the audio source and the audio playback device; compensate the system frequency of the audio playback device based on the frequency error; and based on The clock error compensates the system clock of the audio playback device.
  • the audio playback device includes a first bluetooth module
  • the audio source includes a second bluetooth module
  • the audio playback device and the audio source are connected by the first bluetooth module and the second bluetooth module.
  • Bluetooth module to interact.
  • the number of the audio playback device is one or more.
  • the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet
  • the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended
  • the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
  • the embodiment of the present application provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the above is implemented.
  • An embodiment of the present application provides an audio synchronization method, an audio playback device, and a storage medium.
  • the method includes: receiving a group of synchronization data packets sent by an audio source; wherein, a group of synchronization data packets includes at least one synchronization data packet; and Determine in turn at least one timestamp information corresponding to at least one synchronization data packet; play a group of synchronization data packets, and record at least one start playback time of at least one synchronization data packet; realize audio based on at least one timestamp information and at least one start playback time Audio sync operation between playback device and audio source.
  • the audio source sends a group of synchronization data packets to the audio playback device, and the audio playback device realizes the communication between the audio playback device and the audio source based on the time stamp information determined by at least one synchronization data packet in a group of synchronization data packets
  • the audio is played synchronously, thereby achieving synchronous playback between a pair of audio playback devices, reducing the load on the data link between a pair of audio playback devices, and further reducing
  • the problem of out-of-sync playback caused by stabilization has improved the audio synchronization performance between headphones.
  • An embodiment of the present application provides a method for searching a network, which is applied to a terminal.
  • the terminal may be called user equipment (User Equipment, UE).
  • the terminal can be a personal communication service (Personal Communication Service, PCS) phone, a cordless phone, a session initiation protocol (Session Initiation Protocol, SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant) Assistant, PDA) and other equipment
  • the terminal can also be a smart phone, tablet computer, palmtop computer, mobile station (Mobile Station, MS), mobile terminal (Mobile Terminal) and so on, the terminal can be connected via the wireless access network (Radio Access Network, RAN) communicates with one or more network devices.
  • RAN Radio Access Network
  • the terminal can be a mobile phone (or called a "cellular" phone) or a computer with terminal equipment, etc., for example, the terminal can also be a portable, pocket, hand-held, computer built-in or vehicle-mounted mobile device, which are connected to wireless The access network exchanges voice and/or data.
  • the terminal can also be a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle device, a wearable device, a terminal in a future evolving network, etc., which are not limited in the implementation of this application.
  • An embodiment of the present application provides an audio synchronization method for an audio playback device.
  • the audio playback device may be a device capable of wireless audio playback such as a True Wireless Stereo (TWS) headset, a Bluetooth speaker, etc., wherein the audio
  • the playback device includes a first Bluetooth module, and the audio source includes a second Bluetooth module, and the audio playback device and the audio source interact through the first Bluetooth module and the second Bluetooth module, as shown in Figure 1, the method may include:
  • S101 Receive a group of synchronization data packets sent by an audio source; wherein, a group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one time stamp information corresponding to the at least one synchronization data packet.
  • the audio source sends an audio data stream supported by the Bluetooth standard to the audio playback device through the second Bluetooth module.
  • the audio data stream is composed of a group of synchronous data packets, and a group of synchronous data packets includes at least one synchronous data packet , wherein the audio source can be a Bluetooth device such as a tablet computer, a mobile phone, a personal computer (Personal Computer, PC), a notebook computer, and a wearable device.
  • the audio source sends audio streams to the left and right TWS earphones at the same time.
  • the audio playback device receives the audio data stream through the first Bluetooth module, and then the audio playback device sequentially determines a time stamp information corresponding to each synchronization data packet in the audio data stream, and obtains the time stamp information corresponding to at least one synchronization data packet. At least one timestamp information.
  • the data packet types of the synchronous data packet may include Broadcast Isochronous Stream (Broadcast Isochronous Stream, BIS)/connection-oriented synchronous data Stream (Connected Isochronous Stream, CIS) data packets (that is, the first type of synchronous data packets), Bluetooth connection-oriented synchronous data (Synchronous Connection-Oriented, SCO) data packets / extended Bluetooth connection-oriented synchronous data (Extended Synchronous Connection-Oriented , ESCO) data packets (i.e.
  • the specific can be carried out according to the actual situation
  • the embodiment of the present application does not limit the specific data packet type, it only needs to meet the Bluetooth standard support.
  • the BIS/CIS audio data packet itself carries timestamp information and the sequence number information of the data packet, if it is determined that the data packet type is the first type, then it is directly searched from at least one synchronous data packet in turn. Corresponding at least one timestamp information.
  • the Bluetooth SCO/ESCO audio data packet only contains the serial number information of the data packet, and the Bluetooth SCO/ESCO audio data packet is sent at a time interval of 7.5ms, if it is determined that the data packet If the type is the second type, at least one time stamp information corresponding to at least one synchronization data packet is sequentially determined according to the preset data packet sending interval. Afterwards, at least one time stamp information can be respectively filled into corresponding data packets, so as to participate in the subsequent audio synchronization process.
  • the initial value of the index of the Bluetooth SCO/ESCO audio data packet is 0, and after receiving a Bluetooth SCO/ESCO audio data packet at every preset data packet transmission interval, the value of the index is increased by one, and then, according to index realizes the calculation of the timestamp information corresponding to the synchronization data packet, as shown in formula (1),
  • time_stamp index*7.5ms (1)
  • time_stamp is timestamp information, and for possible packet loss, the operation of formula (2) needs to be completed.
  • the Bluetooth A2DP audio data packet only contains the serial number information of the data packet, and the sending time interval of the Bluetooth A2DP audio data packet is inconsistent, if it is determined that the data packet type is the third type, then according to the preset The playback speed, the last time stamp information corresponding to the last synchronization data packet and the length of the last data packet are determined to determine a time stamp information corresponding to each synchronization data packet to obtain at least one time stamp information.
  • the time_stamp information is calculated according to the packet length of the received Bluetooth A2DP audio packet, as shown in formula (3),
  • time_stamp(n) time_stamp(n-1)+length(n-1)/play_speed (3)
  • time_stamp(n) represents the timestamp information of the nth synchronization data packet
  • length(n) represents the packet data length of the nth synchronization data
  • play_speed represents the playback speed.
  • an initial alignment between the audio source and the audio playback device is performed first, and then at least one time stamp information corresponding to at least one synchronization data packet is sequentially determined.
  • the initial alignment process between the audio source and the audio playback device includes: calculating the frequency error and clock error between the audio source and the audio playback device; compensating the system frequency of the audio playback device based on the frequency error; and compensating the audio frequency based on the clock error The system clock of the playback device. Further, frequency alignment and clock alignment between the audio source and the audio playback device are realized.
  • the audio source includes an application (Application, AP) module, a digital signal processor (DSP, Digital Signal Processor) module and a Bluetooth (Bluetooth, BT) module, wherein the DSP module is provided with a An audio phase-locked loop (Phase Locked Loop, PLL) device that controls the speed of audio playback.
  • the TWS headset includes a codec (COder-DECoder, CODEC) module, a DSP module, and a BT module.
  • the DSP module is also equipped with an audio PLL device .
  • the BT module of the audio source sends the mobile phone initialization frequency offset and the mobile phone initialization clock offset to the BT module of the TWS earphone, as well as a synchronous playback instruction.
  • S102 Play a group of synchronization data packets, and record at least one start playing time of at least one synchronization data packet.
  • each synchronization data packet After determining at least one time stamp information corresponding to at least one data packet, receive a synchronous playback instruction sent by the audio source, and play a group of synchronous data packets based on the synchronous playback instruction, and record during the playback of the group of synchronous data packets
  • the start playing time of each synchronization data packet is obtained at least one start playing time corresponding to at least one synchronization data packet.
  • the audio synchronization operation between the audio playback device and the audio source is realized based on at least one timestamp information and at least one start time.
  • the initial play time difference and the target play time difference of each preset time period are determined respectively; Audio sync operation between sources.
  • the initial playback time difference is determined according to the first playback start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet.
  • the time point play_time(1) to start playing is set to time_stamp(1) (that is, the first timestamp information corresponding to the first synchronization data packet) plus A fixed audio processing delay audio_process_delay, the audio processing delay is the initial playback time difference, which is used as a benchmark for playback tracking.
  • playback tracking is performed based on the above-mentioned audio processing delay. Specifically, for each preset time period, according to the second The start time of playing and the second time stamp information corresponding to the second synchronization data packet are used to determine the target playing time difference.
  • the frequency difference between the audio source and the audio playback device may be caused by the difference of the crystal itself, temperature and other factors. And with the accumulation of time, the frequency difference will be reflected in the playback progress between the left and right ears. Therefore, the preset time period for playback tracking is set in advance, and when the preset time period arrives, the second synchronization of the current playback is determined. data packet, determine the second start time and second time stamp information corresponding to the second synchronous data packet, and then determine the target play time difference based on the second start time and the second time stamp information.
  • the difference between the second start playing time and the second time stamp information is calculated, and the difference is the target playing time difference.
  • the audio playback device compares the target playback time difference with the initial playback time difference, and if the target playback time difference is equal to the initial playback time difference, the audio playback speed of the audio playback device is not adjusted; if the target playback time difference is greater than the initial playback time difference, then Speed up the audio playback speed of the audio playback device; if the target playback time difference is smaller than the initial playback time difference, slow down the audio playback speed of the audio playback device.
  • the target playback time difference can be compared with the initial playback time difference by calculating the difference between the target playback time difference and the initial playback time difference, and comparing the difference with 0.
  • the specific comparison method can be based on actual The selection is made according to the situation, and the embodiment of the present application does not make specific limitations.
  • the embodiment of this application proposes an exemplary audio synchronization method for TWS earphones.
  • the specific data flow information is shown in Figure 4.
  • the data flow consists of a set of synchronization data packets with serial number 1-serial number 14 , each synchronous data packet includes the corresponding timestamp information and data volume.
  • the number of audio playback devices can be one or more, that is, the audio source can implement the audio synchronization process of one or more audio playback devices at the same time, only the audio source broadcasts a Group synchronization data packets and synchronous playback instructions, one or more audio playback devices can realize audio synchronization by themselves according to a set of synchronization data packets received, and for multi-link multi-audio playback scenarios, it can realize synchronization between multiple devices Playing, there is no need for a device to distribute to other devices, which greatly improves the convenience and real-time performance of audio synchronization.
  • this application directly realizes the synchronization of the audio playback progress between the TWS earphones and the mobile phone based on the time stamp information carried in a group of synchronization data packets sent by the audio source, without the need for interaction between the earphones, which reduces the need for interaction between the earphones.
  • the load of the data link reduces the playback out-of-sync problem caused by the unstable air interface link transmission between the earphones.
  • the embodiment of the present application provides an audio playback device 1 .
  • the device 1 includes:
  • the receiving unit 10 is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
  • Playing unit 11 is used for playing described one group of synchronous data packets
  • a recording unit 12 configured to record at least one playback start time corresponding to the at least one synchronization data packet
  • the determination unit 13 is configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the audio playback device and the audio source based on the at least one timestamp information and the at least one start playing time Audio synchronization between operations.
  • the determining unit 13 is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
  • the determining unit 13 is further configured to determine the initial playback time according to the first playback start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet. Play time difference.
  • the determining unit 13 is further configured to, at intervals of a preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
  • the device 1 further includes: an adjustment unit;
  • the adjustment unit is configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; The audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, slow down the audio playback speed of the audio playback device.
  • the determining unit 13 is further configured to determine the data packet type corresponding to the at least one synchronous data packet; if the data packet type is the first type, then sequentially search for the at least one synchronous data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
  • the device 1 further includes: a calculation unit and a compensation unit;
  • the calculation unit is used to calculate a frequency error and a clock error between the audio source and the audio playback device;
  • the compensation unit is configured to compensate the system frequency of the audio playback device based on the frequency error; and compensate the system clock of the audio playback device based on the clock error.
  • the audio playback device includes a first Bluetooth module
  • the audio source includes a second Bluetooth module
  • the audio playback device and the audio source are connected by the first Bluetooth module and the second Bluetooth module. Modules interact.
  • the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet
  • the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended Bluetooth A connection-oriented synchronous data ESCO data packet
  • the third type of synchronous data packet is a Bluetooth Audio Transmission Model Protocol A2DP data packet.
  • An audio playback device receives a group of synchronous data packets sent by an audio source; wherein, a group of synchronous data packets includes at least one synchronous data packet; and sequentially determines at least one corresponding to at least one synchronous data packet Timestamp information; play a set of synchronization data packets, and record at least one start time of at least one synchronization data packet; realize audio synchronization between an audio playback device and an audio source based on at least one time stamp information and at least one start time .
  • the audio source sends a group of synchronization data packets to the audio playback device, and the audio playback device implements audio based on the time stamp information determined by at least one synchronization data packet in a group of synchronization data packets.
  • the audio between the playback device and the audio source is played synchronously, thereby achieving synchronous playback between a pair of audio playback devices, reducing the load on the data link between a pair of audio playback devices, and reducing the load caused by a pair of audio playback devices.
  • the problem of out-of-sync playback caused by the unstable transmission of the air interface link between them improves the audio synchronization performance between the earphones.
  • Fig. 6 is a schematic diagram of the composition and structure of an audio playback device 1 provided by the embodiment of the present application II.
  • the device 1 of this embodiment includes: Receiver 14 , processor 15 , memory 16 and communication bus 17 .
  • the above-mentioned playback unit 11, recording unit 12, determination unit 13, calculation unit and compensation unit can be realized by a processor 15 located on the audio playback device 1, and the above-mentioned receiving unit 10 can be implemented by a processor located on the device 1 Receiver 14 realizes, and above-mentioned processor 15 can be application-specific integrated circuit (ASIC, Application Specific Integrated Circuit), DSP, digital signal processing image processing device (DSPD, Digital Signal Processing Device), programmable logic image processing device (PLD, At least one of Programmable Logic Device), Field Programmable Gate Array (FPGA, Field Programmable Gate Array), CPU, controller, microcontroller, and microprocessor. It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment.
  • ASIC Application Specific Integrated Circuit
  • DSP digital signal processing image processing device
  • DSPD Digital Signal Processing Device
  • PLD programmable logic image processing device
  • FPGA Field Programmable Gate Array
  • CPU controller, microcontroller,
  • the above-mentioned communication bus 17 is used to realize connection and communication between the receiver 14, the processor 15 and the memory 16; the above-mentioned receiver 14 is used to receive a group of synchronous data packets sent by the audio source; wherein, At least one synchronous data packet is included in the group of synchronous data packets; the above-mentioned processor 15 implements the following audio synchronization method when executing the running program stored in the memory 16:
  • the processor 15 is further configured to determine the initial play time difference and the target play time difference every preset time period based on the at least one time stamp information and the at least one play start time, respectively.
  • Time difference realize the audio synchronization operation between the audio playback device and the audio source according to the target playback time difference and the initial playback time difference.
  • the processor 15 is further configured to, according to the first playing start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet , to determine the initial playback time difference.
  • the processor 15 is further configured to, every preset time period, according to the second start time corresponding to the currently played second synchronization data packet and the second synchronization data packet corresponding The second timestamp information to determine the target play time difference.
  • the processor 15 is further configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; if the target playback time difference If the target playback time difference is greater than the initial playback time difference, then adjust the audio playback speed of the audio playback device; if the target playback time difference is smaller than the initial playback time difference, then slow down the audio playback speed of the audio playback device.
  • the processor 15 is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, sequentially from the at least one synchronization data packet Find the corresponding at least one timestamp information in the synchronization data packet; if the data packet type is the second type, then determine at least one time stamp corresponding to the at least one synchronization data packet in sequence according to the preset data packet sending interval information; if the data packet type is the third type, then determine a timestamp corresponding to each synchronization data packet according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet, and the length of the last data packet information, to obtain the at least one time stamp information.
  • the processor 15 is also configured to calculate a frequency error and a clock error between the audio source and the audio playback device; compensate the audio playback device based on the frequency error system frequency; and compensating the system clock of the audio playback device based on the clock error.
  • the audio playback device includes a first Bluetooth module
  • the audio source includes a second Bluetooth module
  • the audio playback device and the audio source are connected by the first Bluetooth module and the audio source.
  • the second bluetooth module interacts.
  • the number of the audio playback device is one or more.
  • the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet
  • the second type of synchronous data packet is a connection-oriented synchronous SCO data packet packet or an extended Bluetooth connection-oriented synchronization data ESCO data packet
  • the third type of synchronization data packet is a Bluetooth Audio Transmission Model Protocol A2DP data packet.
  • An embodiment of the present application provides a storage medium on which a computer program is stored.
  • the computer-readable storage medium stores one or more programs.
  • the one or more programs can be executed by one or more processors and are applied to audio In the playback device, the computer program realizes the above audio synchronization method.
  • the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk, etc.) ) includes several instructions to make an image display device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in various embodiments of the present disclosure.
  • a storage medium such as ROM/RAM, magnetic disk, optical disk, etc.

Abstract

Provided in the embodiments of the present application are an audio synchronization method, an audio playing device and a storage medium. The method comprises: receiving a group of synchronization data packets sent by an audio source, wherein the group of synchronization data packets comprises at least one synchronization data packet, and sequentially determining at least one piece of timestamp information corresponding to the at least one synchronization data packet; playing the group of synchronization data packets, and recording at least one playing start time of the at least one synchronization data packet; and on the basis of the at least one piece of timestamp information and the at least one playing start time, implementing an audio synchronization operation between an audio playing device and the audio source.

Description

一种音频同步方法及音频播放设备、存储介质An audio synchronization method, audio playback device, and storage medium
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202110723845.3、申请日为2021年06月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。This application is based on a Chinese patent application with application number 202110723845.3 and a filing date of June 29, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated into this application by reference.
技术领域technical field
本申请涉及音频领域,尤其涉及一种音频同步方法及音频播放设备、存储介质。The present application relates to the audio field, and in particular to an audio synchronization method, an audio playback device, and a storage medium.
背景技术Background technique
为了实现无线蓝牙耳机的左右耳音频同步,现有的方案是在初始同步和同步跟踪阶段,将主耳机的本地播放信息定期发送给副耳机,副耳机根据主耳机的播放信息和自身的播放信息之间的差值来确定播放进度的调整值,并基于调整值对副耳机的播放快慢进行调整,进而实现副耳机对主耳机的播放跟随。In order to realize the audio synchronization of the left and right ears of the wireless Bluetooth headset, the existing solution is to periodically send the local playback information of the main headset to the secondary headset during the initial synchronization and synchronization tracking stages, and the secondary headset uses the playback information of the primary headset and its own playback information The difference between them is used to determine the adjustment value of the playback progress, and based on the adjustment value, the playback speed of the secondary earphones is adjusted, so that the secondary earphones can follow the playback of the main earphones.
然而,现有的方案需要主耳机定期向副耳机发送播放信息,增加了一对耳机之间的数据链路负担,在一对耳机之间的数据链路不好的情况下,可能会导致丢包,进而导致音频同步性能差的问题。However, the existing solutions require the main earphone to periodically send playback information to the auxiliary earphones, which increases the burden on the data link between a pair of earphones, and may lead to lost data when the data link between a pair of earphones is not good. packets, leading to poor audio sync performance.
发明内容Contents of the invention
本申请实施例提供一种音频同步方法及音频播放设备、存储介质,能够提高耳机之间的音频同步性能。Embodiments of the present application provide an audio synchronization method, an audio playback device, and a storage medium, which can improve audio synchronization performance between earphones.
本申请的技术方案是这样实现的:The technical scheme of the present application is realized like this:
第一方面,本申请实施例提出一种用于音频播放设备的音频同步方法,所述方法包括:In the first aspect, the embodiment of the present application proposes an audio synchronization method for an audio playback device, the method comprising:
接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;并依次确定所述至少一个同步数据包对应的至少一个时间戳信息;Receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet;
播放所述一组同步数据包,并记录所述至少一个同步数据包的至少一个开始播放时间;Play the group of synchronization data packets, and record at least one start playing time of the at least one synchronization data packet;
基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。The audio synchronization operation between the audio playback device and the audio source is implemented based on the at least one time stamp information and the at least one playback start time.
第二方面,本申请实施例提出一种音频播放设备,所述设备包括:In the second aspect, the embodiment of the present application proposes an audio playback device, the device includes:
接收单元,用于接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;The receiving unit is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
播放单元,用于播放所述一组同步数据包;a playback unit, configured to play the group of synchronization data packets;
记录单元,用于记录所述至少一个同步数据包对应的至少一个开始播放时间;A recording unit, configured to record at least one playback start time corresponding to the at least one synchronization data packet;
确定单元,用于依次确定所述至少一个同步数据包对应的至少一个时间戳信息;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。A determining unit, configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the connection between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time audio sync operation between them.
第三方面,本申请实施例提出一种音频播放设备,所述设备包括:接收器、处理器、存储器及通信总线;所述处理器执行存储器存储的运行程序时实现如上述任一项所述的方法。In the third aspect, the embodiment of the present application proposes an audio playback device, the device includes: a receiver, a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, it realizes any of the above-mentioned Methods.
第四方面,本申请实施例提出一种存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一项所述的方法。In a fourth aspect, the embodiment of the present application provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the above is implemented.
附图说明Description of drawings
图1为本申请实施例提供的一种音频同步方法的流程图;Fig. 1 is a flow chart of an audio synchronization method provided by an embodiment of the present application;
图2为本申请实施例提供的一种示例性的同步播放的示意图;FIG. 2 is a schematic diagram of an exemplary synchronous playback provided by an embodiment of the present application;
图3为本申请实施例提供的一种示例性的音频源和TWS耳机的初始化同步示意框图;Fig. 3 is a schematic block diagram of initialization synchronization of an exemplary audio source and a TWS earphone provided by an embodiment of the present application;
图4为本申请实施例提供的一种示例性的数据流信息的示意图;FIG. 4 is a schematic diagram of an exemplary data flow information provided by an embodiment of the present application;
图5为本申请实施例提供的一种音频播放设备1的结构示意图一;FIG. 5 is a structural schematic diagram 1 of an audio playback device 1 provided in an embodiment of the present application;
图6为本申请实施例提供的一种音频播放设备1的结构示意图二。FIG. 6 is a second structural schematic diagram of an audio playback device 1 provided in an embodiment of the present application.
具体实施方式detailed description
第一方面,本申请实施例提出一种用于音频播放设备的音频同步方法,所述方法包括:In the first aspect, the embodiment of the present application proposes an audio synchronization method for an audio playback device, the method comprising:
接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;并依次确定所述至少一个同步数据包对应的至少一个时间戳信息;Receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet;
播放所述一组同步数据包,并记录所述至少一个同步数据包的至少一个开始播放时间;Play the group of synchronization data packets, and record at least one start playing time of the at least one synchronization data packet;
基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。The audio synchronization operation between the audio playback device and the audio source is implemented based on the at least one time stamp information and the at least one playback start time.
在上述方法中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作,包括:In the above method, implementing the audio synchronization operation between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time includes:
基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;Based on the at least one time stamp information and the at least one start playing time, respectively determine the initial playing time difference and the target playing time difference every preset time period;
根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。The audio synchronization operation between the audio playback device and the audio source is implemented according to the target playback time difference and the initial playback time difference.
在上述方法中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间,确定初始播放时差,包括:In the above method, the determining the initial play time difference based on the at least one time stamp information and the at least one play start time includes:
根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。The initial play time difference is determined according to the first play start time corresponding to the first played first synchronization data packet and the first time stamp information corresponding to the first synchronization data packet.
在上述方法中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间,确定每隔预设时间段的目标播放时差,包括:In the above method, the determination of the target play time difference every preset time period based on the at least one time stamp information and the at least one play start time includes:
每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。The target playing time difference is determined according to the second playing start time corresponding to the currently played second synchronization data packet and the second time stamp information corresponding to the second synchronization data packet every preset time period.
在上述方法中,所述根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作,包括:In the above method, implementing the audio synchronization operation between the audio playback device and the audio source according to the target playback time difference and the initial playback time difference includes:
若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;If the target playing time difference is equal to the initial playing time difference, the audio playing speed of the audio playing device is not adjusted;
若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;If the target playing time difference is greater than the initial playing time difference, then speed up the audio playing speed of the audio playing device;
若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。If the target play time difference is smaller than the initial play time difference, slow down the audio play speed of the audio play device.
在上述方法中,所述依次确定所述至少一个同步数据包对应的至少一个时间戳信息,包括:In the above method, the sequentially determining at least one timestamp information corresponding to the at least one synchronization data packet includes:
确定所述至少一个同步数据包对应的数据包类型;determining a data packet type corresponding to the at least one synchronization data packet;
若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;If the data packet type is the first type, then sequentially search for the corresponding at least one timestamp information from the at least one synchronization data packet;
若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;If the data packet type is the second type, then sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet according to a preset data packet sending interval;
若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。If the data packet type is the third type, then determine a time stamp information corresponding to each synchronization data packet according to the preset playback speed, the last time stamp information corresponding to the last synchronization data packet, and the length of the last data packet, Obtain the at least one time stamp information.
在上述方法中,所述接收音频源发送的一组同步数据包之后;所述依次确定所述至少一个同步数据包对应的至少一个时间戳信息之前,所述方法还包括:In the above method, after receiving a group of synchronization data packets sent by the audio source; before determining at least one time stamp information corresponding to the at least one synchronization data packet in sequence, the method further includes:
计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;calculating a frequency error and a clock error between the audio source and the audio playback device;
基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。Compensating the system frequency of the audio playback device based on the frequency error; and compensating the system clock of the audio playback device based on the clock error.
在上述方法中,所述音频播放设备包括第一蓝牙模块,所述音频源 包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。In the above method, the audio playback device includes a first Bluetooth module, the audio source includes a second Bluetooth module, and the audio playback device and the audio source are connected by the first Bluetooth module and the second Bluetooth module. Bluetooth module to interact.
在上述方法中,所述音频播放设备的数量为一个或者多个。In the above method, the number of the audio playback device is one or more.
在上述方法中,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。In the above method, the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended The Bluetooth connection-oriented synchronous data ESCO data packet; the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
第二方面,本申请实施例提出一种音频播放设备,所述设备包括:In the second aspect, the embodiment of the present application proposes an audio playback device, the device includes:
接收单元,用于接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;The receiving unit is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
播放单元,用于播放所述一组同步数据包;a playback unit, configured to play the group of synchronization data packets;
记录单元,用于记录所述至少一个同步数据包对应的至少一个开始播放时间;A recording unit, configured to record at least one playback start time corresponding to the at least one synchronization data packet;
确定单元,用于依次确定所述至少一个同步数据包对应的至少一个时间戳信息;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。A determining unit, configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the connection between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time audio sync operation between them.
在上述设备中,所述确定单元,还用于基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。In the above device, the determining unit is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
在上述设备中,所述确定单元,还用于根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。In the above device, the determining unit is further configured to determine the initial Play time difference.
在上述设备中,所述确定单元,还用于每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。In the above device, the determining unit is further configured to, every preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
在上述设备中,所述设备还包括:调整单元;In the above device, the device further includes: an adjustment unit;
所述调整单元,用于若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。The adjustment unit is configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; The audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, slow down the audio playback speed of the audio playback device.
在上述设备中,所述确定单元,还用于确定所述至少一个同步数据包对应的数据包类型;若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一 个时间戳信息。In the above device, the determining unit is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, then sequentially search from the at least one synchronization data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
在上述设备中,所述设备还包括:计算单元和补偿单元;In the above device, the device further includes: a calculation unit and a compensation unit;
所述计算单元,用于计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;The calculation unit is used to calculate a frequency error and a clock error between the audio source and the audio playback device;
所述补偿单元,用于基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。The compensation unit is configured to compensate the system frequency of the audio playback device based on the frequency error; and compensate the system clock of the audio playback device based on the clock error.
在上述设备中,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。In the above device, the audio playback device includes a first bluetooth module, the audio source includes a second bluetooth module, and the audio playback device and the audio source are connected by the first bluetooth module and the second bluetooth module. Bluetooth module to interact.
在上述设备中,所述音频播放设备的数量为一个或者多个。In the above device, the number of the audio playback device is one or more.
在上述设备中,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。In the above device, the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended The Bluetooth connection-oriented synchronous data ESCO data packet; the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
第三方面,本申请实施例提出一种音频播放设备,所述设备包括:接收器、处理器、存储器及通信总线;所述处理器执行存储器存储的运行程序时实现以下方法:In the third aspect, the embodiment of the present application proposes an audio playback device, the device includes: a receiver, a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, the following method is implemented:
依次确定所述至少一个同步数据包对应的至少一个时间戳信息;播放所述一组同步数据包,并记录所述至少一个同步数据包的至少一个开始播放时间;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。Determine in turn at least one timestamp information corresponding to the at least one synchronization data packet; play the group of synchronization data packets, and record at least one start playing time of the at least one synchronization data packet; based on the at least one timestamp information and the at least one start time to implement audio synchronous operation between the audio playback device and the audio source.
在上述设备中,所述处理器,还用于基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。In the above device, the processor is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
在上述设备中,所述处理器,还用于根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。In the above device, the processor is further configured to determine the initial Play time difference.
在上述设备中,所述处理器,还用于每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。In the above device, the processor is further configured to, every preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
在上述设备中,所述处理器,还用于若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。In the above device, the processor is further configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; if the target playback time difference is greater than the initial playback time difference time difference, then speed up the audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, then slow down the audio playback speed of the audio playback device.
在上述设备中,所述处理器,还用于确定所述至少一个同步数据包对应的数据包类型;若所述数据包类型为第一类型,则依次从所述至少一个 同步数据包中查找对应的所述至少一个时间戳信息;若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。In the above device, the processor is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, then sequentially search from the at least one synchronization data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
在上述设备中,所述处理器,还用于计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。In the above device, the processor is further configured to calculate a frequency error and a clock error between the audio source and the audio playback device; compensate the system frequency of the audio playback device based on the frequency error; and based on The clock error compensates the system clock of the audio playback device.
在上述设备中,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。In the above device, the audio playback device includes a first bluetooth module, the audio source includes a second bluetooth module, and the audio playback device and the audio source are connected by the first bluetooth module and the second bluetooth module. Bluetooth module to interact.
在上述设备中,所述音频播放设备的数量为一个或者多个。In the above device, the number of the audio playback device is one or more.
在上述设备中,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。In the above device, the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended The Bluetooth connection-oriented synchronous data ESCO data packet; the third type of synchronous data packet is the Bluetooth Audio Transmission Model Protocol A2DP data packet.
第四方面,本申请实施例提出一种存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一项所述的方法。In a fourth aspect, the embodiment of the present application provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the above is implemented.
本申请实施例提供了一种音频同步方法及音频播放设备、存储介质,该方法包括:接收音频源发送的一组同步数据包;其中,一组同步数据包中包括至少一个同步数据包;并依次确定至少一个同步数据包对应的至少一个时间戳信息;播放一组同步数据包,并记录至少一个同步数据包的至少一个开始播放时间;基于至少一个时间戳信息和至少一个开始播放时间实现音频播放设备和音频源之间的音频同步操作。采用上述实现方案,音频源向音频播放设备发送一组同步数据包,音频播放设备基于一组同步数据包中的至少一个同步数据包确定出的时间戳信息实现音频播放设备与音频源之间的音频同步播放,进而实现一对音频播放设备之间的同步播放,减少了一对音频播放设备之间的数据链路的负荷,进而减少了由于一对音频播放设备之间的空口链路传输不稳定带来的播放不同步的问题,进而提高了耳机之间的音频同步性能。An embodiment of the present application provides an audio synchronization method, an audio playback device, and a storage medium. The method includes: receiving a group of synchronization data packets sent by an audio source; wherein, a group of synchronization data packets includes at least one synchronization data packet; and Determine in turn at least one timestamp information corresponding to at least one synchronization data packet; play a group of synchronization data packets, and record at least one start playback time of at least one synchronization data packet; realize audio based on at least one timestamp information and at least one start playback time Audio sync operation between playback device and audio source. Using the above implementation scheme, the audio source sends a group of synchronization data packets to the audio playback device, and the audio playback device realizes the communication between the audio playback device and the audio source based on the time stamp information determined by at least one synchronization data packet in a group of synchronization data packets The audio is played synchronously, thereby achieving synchronous playback between a pair of audio playback devices, reducing the load on the data link between a pair of audio playback devices, and further reducing The problem of out-of-sync playback caused by stabilization has improved the audio synchronization performance between headphones.
应当理解,此处描述的具体实施例仅仅用以解释本申请。并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application. It is not intended to limit the application.
本申请实施例提供了一种搜网方法,应用于终端。在一些实施例中,终端可以称之为用户设备(User Equipment,UE)。该终端可以为个人通信业务(Personal Communication Service,PCS)电话、无绳电话、会话发起协议(Session Initiation Protocol,SIP)话机、无线本地环路(Wireless Local Loop,WLL)站、个人数字助理(Personal Digital Assistant,PDA)等设备, 该终端也可以为智能手机、平板电脑、掌上电脑、移动台(Mobile Station,MS)、移动终端(Mobile Terminal)等等,该终端可以经无线接入网(Radio Access Network,RAN)与一个或多个网络设备进行通信。例如,终端可以是移动电话(或称为“蜂窝”电话)或具有终端设备的计算机等,例如,终端还可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语音和/或数据。终端还可以为有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、可穿戴设备,未来演进的网络中的终端等,本申请实施不作限定。An embodiment of the present application provides a method for searching a network, which is applied to a terminal. In some embodiments, the terminal may be called user equipment (User Equipment, UE). The terminal can be a personal communication service (Personal Communication Service, PCS) phone, a cordless phone, a session initiation protocol (Session Initiation Protocol, SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant) Assistant, PDA) and other equipment, the terminal can also be a smart phone, tablet computer, palmtop computer, mobile station (Mobile Station, MS), mobile terminal (Mobile Terminal) and so on, the terminal can be connected via the wireless access network (Radio Access Network, RAN) communicates with one or more network devices. For example, the terminal can be a mobile phone (or called a "cellular" phone) or a computer with terminal equipment, etc., for example, the terminal can also be a portable, pocket, hand-held, computer built-in or vehicle-mounted mobile device, which are connected to wireless The access network exchanges voice and/or data. The terminal can also be a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle device, a wearable device, a terminal in a future evolving network, etc., which are not limited in the implementation of this application.
本申请实施例提供一种用于音频播放设备的音频同步方法,该音频播放设备可以为真无线蓝牙耳机(True Wireless Stereo,TWS)耳机、蓝牙音箱等可实现无线音频播放的设备,其中,音频播放设备中包括第一蓝牙模块,且音频源包括第二蓝牙模块,音频播放设备与音频源之间通过第一蓝牙模块和第二蓝牙模块进行交互,如图1所示,该方法可以包括:An embodiment of the present application provides an audio synchronization method for an audio playback device. The audio playback device may be a device capable of wireless audio playback such as a True Wireless Stereo (TWS) headset, a Bluetooth speaker, etc., wherein the audio The playback device includes a first Bluetooth module, and the audio source includes a second Bluetooth module, and the audio playback device and the audio source interact through the first Bluetooth module and the second Bluetooth module, as shown in Figure 1, the method may include:
S101、接收音频源发送的一组同步数据包;其中,一组同步数据包中包括至少一个同步数据包;并依次确定至少一个同步数据包对应的至少一个时间戳信息。S101. Receive a group of synchronization data packets sent by an audio source; wherein, a group of synchronization data packets includes at least one synchronization data packet; and sequentially determine at least one time stamp information corresponding to the at least one synchronization data packet.
本申请实施例中,音频源通过第二蓝牙模块向音频播放设备发送蓝牙标准支持的音频数据流,该音频数据流由一组同步数据包组成,一组同步数据包中包括至少一个同步数据包,其中,音频源可以为平板电脑、手机、个人计算机(Personal Computer,PC)、笔记本电脑、可穿戴设备等蓝牙设备。如图2所示,音频源同时向左右两只TWS耳机发送音频流。In the embodiment of the present application, the audio source sends an audio data stream supported by the Bluetooth standard to the audio playback device through the second Bluetooth module. The audio data stream is composed of a group of synchronous data packets, and a group of synchronous data packets includes at least one synchronous data packet , wherein the audio source can be a Bluetooth device such as a tablet computer, a mobile phone, a personal computer (Personal Computer, PC), a notebook computer, and a wearable device. As shown in Figure 2, the audio source sends audio streams to the left and right TWS earphones at the same time.
本申请实施例中,音频播放设备通过第一蓝牙模块接收音频数据流,之后,音频播放设备依次确定音频数据流中每一个同步数据包对应的一个时间戳信息,得到至少一个同步数据包对应的至少一个时间戳信息。In the embodiment of the present application, the audio playback device receives the audio data stream through the first Bluetooth module, and then the audio playback device sequentially determines a time stamp information corresponding to each synchronization data packet in the audio data stream, and obtains the time stamp information corresponding to at least one synchronization data packet. At least one timestamp information.
本申请实施例中,不同数据包类型对应了不同形式的时间戳获取策略,其中,目前、同步数据包的数据包类型可包括广播同步数据流(Broadcast Isochronous Stream,BIS)/面向连接的同步数据流(Connected Isochronous Stream,CIS)数据包(即第一类型的同步数据包)、蓝牙面向连接同步数据(Synchronous Connection-Oriented,SCO)数据包/扩展的蓝牙面向连接同步数据(Extended Synchronous Connection-Oriented,ESCO)数据包(即第二类型的同步数据包)和蓝牙音频传输模型协定(Advanced Audio Distribution Profile,A2DP)数据包(即第三类型的同步数据包)等,具体的可以根据实际情况进行选择,本申请实施例不限定具体的数据包类型,只需满足蓝牙标准支持即可。In the embodiment of the present application, different data packet types correspond to different forms of time stamp acquisition strategies, wherein, at present, the data packet types of the synchronous data packet may include Broadcast Isochronous Stream (Broadcast Isochronous Stream, BIS)/connection-oriented synchronous data Stream (Connected Isochronous Stream, CIS) data packets (that is, the first type of synchronous data packets), Bluetooth connection-oriented synchronous data (Synchronous Connection-Oriented, SCO) data packets / extended Bluetooth connection-oriented synchronous data (Extended Synchronous Connection-Oriented , ESCO) data packets (i.e. the second type of synchronous data packets) and Bluetooth audio transmission model agreement (Advanced Audio Distribution Profile, A2DP) data packets (i.e. the third type of synchronous data packets), etc., the specific can be carried out according to the actual situation Optional, the embodiment of the present application does not limit the specific data packet type, it only needs to meet the Bluetooth standard support.
需要说明的是,由于BIS/CIS音频数据包中本身携带了时间戳信息和数据包的序列号信息,则若判断出数据包类型为第一类型,则直接依次从至少一个同步数据包中查找对应的至少一个时间戳信息。It should be noted that, since the BIS/CIS audio data packet itself carries timestamp information and the sequence number information of the data packet, if it is determined that the data packet type is the first type, then it is directly searched from at least one synchronous data packet in turn. Corresponding at least one timestamp information.
需要说明的是,由于蓝牙SCO/ESCO音频数据包中仅包含了数据包的 序列号信息,且蓝牙SCO/ESCO音频数据包是按照7.5ms的时间间隔发送数据包的,则若判断出数据包类型为第二类型,则根据预设数据包发送间隔,依次确定至少一个同步数据包对应的至少一个时间戳信息。之后可以分别将至少一个时间戳信息填充至对应的数据包中,以参与后续的音频同步过程。It should be noted that since the Bluetooth SCO/ESCO audio data packet only contains the serial number information of the data packet, and the Bluetooth SCO/ESCO audio data packet is sent at a time interval of 7.5ms, if it is determined that the data packet If the type is the second type, at least one time stamp information corresponding to at least one synchronization data packet is sequentially determined according to the preset data packet sending interval. Afterwards, at least one time stamp information can be respectively filled into corresponding data packets, so as to participate in the subsequent audio synchronization process.
具体的,蓝牙SCO/ESCO音频数据包的index的初始值为0,在每隔预设数据包发送间隔、接收到一个蓝牙SCO/ESCO音频数据包后,将index的值加一,之后,根据index实现同步数据包对应的时间戳信息的计算,如公式(1)所示,Specifically, the initial value of the index of the Bluetooth SCO/ESCO audio data packet is 0, and after receiving a Bluetooth SCO/ESCO audio data packet at every preset data packet transmission interval, the value of the index is increased by one, and then, according to index realizes the calculation of the timestamp information corresponding to the synchronization data packet, as shown in formula (1),
time_stamp=index*7.5ms             (1)time_stamp=index*7.5ms (1)
其中,time_stamp为时间戳信息,对于可能出现的丢包情况,需要完成公式(2)的操作。Among them, time_stamp is timestamp information, and for possible packet loss, the operation of formula (2) needs to be completed.
index=index+1                  (2)index=index+1 (2)
需要说明的是,由于蓝牙A2DP音频数据包中仅包含了数据包的序列号信息,且蓝牙A2DP音频数据包的发送时间间隔不一致,则若判断出数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到至少一个时间戳信息。It should be noted that, since the Bluetooth A2DP audio data packet only contains the serial number information of the data packet, and the sending time interval of the Bluetooth A2DP audio data packet is inconsistent, if it is determined that the data packet type is the third type, then according to the preset The playback speed, the last time stamp information corresponding to the last synchronization data packet and the length of the last data packet are determined to determine a time stamp information corresponding to each synchronization data packet to obtain at least one time stamp information.
具体的,根据接收到的蓝牙A2DP音频数据包的数据包长度来计算time_stamp信息,如公式(3)所示,Specifically, the time_stamp information is calculated according to the packet length of the received Bluetooth A2DP audio packet, as shown in formula (3),
time_stamp(n)=time_stamp(n-1)+length(n-1)/play_speed    (3)time_stamp(n)=time_stamp(n-1)+length(n-1)/play_speed (3)
其中,time_stamp(n)表示第n个同步数据包的时间戳信息;length(n)表示第n个同步数据的包数据长度;play_speed表示播放速度。Wherein, time_stamp(n) represents the timestamp information of the nth synchronization data packet; length(n) represents the packet data length of the nth synchronization data; play_speed represents the playback speed.
进一步地,在接收到音频源发送的一组同步数据包之后,先进行音频源与音频播放设备之间的初始对齐,之后才依次确定至少一个同步数据包对应的至少一个时间戳信息。Further, after receiving a group of synchronization data packets sent by the audio source, an initial alignment between the audio source and the audio playback device is performed first, and then at least one time stamp information corresponding to at least one synchronization data packet is sequentially determined.
具体的,音频源与音频播放设备之间的初始对齐过程包括:计算音频源和音频播放设备之间的频率误差和时钟误差;基于频率误差补偿音频播放设备的系统频率;并基于时钟误差补偿音频播放设备的系统时钟。进而实现音频源和音频播放设备之间的频率对齐和时钟对齐。Specifically, the initial alignment process between the audio source and the audio playback device includes: calculating the frequency error and clock error between the audio source and the audio playback device; compensating the system frequency of the audio playback device based on the frequency error; and compensating the audio frequency based on the clock error The system clock of the playback device. Further, frequency alignment and clock alignment between the audio source and the audio playback device are realized.
示例性的,如图3所示,音频源包括应用(Application,AP)模块、数字信号处理器(DSP,Digital Signal Processor)模块和蓝牙(Bluetooth,BT)模块,其中,DSP模块中设置有用于控制音频播放快慢的音频锁相环(Phase Locked Loop,PLL)器件,TWS耳机包括编码译码器(COder-DECoder,CODEC)模块、DSP模块和BT模块,其中,DSP模块同样设置有音频PLL器件。音频源的BT模块向TWS耳机的BT模块发送手机初始化频率偏移量和手机初始化时钟偏移量,以及同步播放指令。Exemplarily, as shown in Figure 3, the audio source includes an application (Application, AP) module, a digital signal processor (DSP, Digital Signal Processor) module and a Bluetooth (Bluetooth, BT) module, wherein the DSP module is provided with a An audio phase-locked loop (Phase Locked Loop, PLL) device that controls the speed of audio playback. The TWS headset includes a codec (COder-DECoder, CODEC) module, a DSP module, and a BT module. The DSP module is also equipped with an audio PLL device . The BT module of the audio source sends the mobile phone initialization frequency offset and the mobile phone initialization clock offset to the BT module of the TWS earphone, as well as a synchronous playback instruction.
S102、播放一组同步数据包,并记录至少一个同步数据包的至少一个 开始播放时间。S102. Play a group of synchronization data packets, and record at least one start playing time of at least one synchronization data packet.
在确定出至少一个数据包对应的至少一个时间戳信息之后,接收音频源发送的同步播放指令,并基于同步播放指令播放一组同步数据包,在播放该一组同步数据包的过程中,记录每一个同步数据包的开始播放时间,得到至少一个同步数据包对应的至少一个开始播放时间。After determining at least one time stamp information corresponding to at least one data packet, receive a synchronous playback instruction sent by the audio source, and play a group of synchronous data packets based on the synchronous playback instruction, and record during the playback of the group of synchronous data packets The start playing time of each synchronization data packet is obtained at least one start playing time corresponding to at least one synchronization data packet.
S103、基于至少一个时间戳信息和至少一个开始播放时间实现音频播放设备和音频源之间的音频同步操作。S103. Realize an audio synchronization operation between the audio playback device and the audio source based on at least one time stamp information and at least one playback start time.
在播放一组同步数据包,并实时记录至少一个同步数据包的至少一个开始播放时间之后,基于至少一个时间戳信息和至少一个开始播放时间实现音频播放设备和音频源之间的音频同步操作。After playing a group of synchronization data packets and recording at least one start time of at least one synchronization data packet in real time, the audio synchronization operation between the audio playback device and the audio source is realized based on at least one timestamp information and at least one start time.
本申请实施例中,基于至少一个时间戳信息和至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据目标播放时差和初始播放时差实现音频播放设备和音频源之间的音频同步操作。In the embodiment of the present application, based on at least one timestamp information and at least one start playing time, the initial play time difference and the target play time difference of each preset time period are determined respectively; Audio sync operation between sources.
本申请实施例中,根据首个播放的第一同步数据包对应的第一开始播放时间和第一同步数据包对应的第一时间戳信息,确定初始播放时差。In the embodiment of the present application, the initial playback time difference is determined according to the first playback start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet.
需要说明的是,为了实现音频源与音频播放设备之间的同步,启动播放的时间点play_time(1)设置为time_stamp(1)(即第一同步数据包对应的第一时间戳信息)加上一个固定的音频处理时延audio_process_delay,该音频处理时延即为初始播放时差,其作用是作为播放跟踪的基准。It should be noted that, in order to achieve synchronization between the audio source and the audio playback device, the time point play_time(1) to start playing is set to time_stamp(1) (that is, the first timestamp information corresponding to the first synchronization data packet) plus A fixed audio processing delay audio_process_delay, the audio processing delay is the initial playback time difference, which is used as a benchmark for playback tracking.
本申请实施例中,在播放一组同步数据包的过程中,基于上述音频处理时延进行播放跟踪,具体的,每个预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和第二同步数据包对应的第二时间戳信息,确定目标播放时差。In the embodiment of the present application, in the process of playing a group of synchronous data packets, playback tracking is performed based on the above-mentioned audio processing delay. Specifically, for each preset time period, according to the second The start time of playing and the second time stamp information corresponding to the second synchronization data packet are used to determine the target playing time difference.
需要说明的是,在播放一组同步数据包的过程中,在经历了一定的播放时间之后,由于晶体本身的差异、温度等因素的影响可能造成音频源和音频播放设备之间的频率差异,且随着时间的累积,频率差异就会体现在左右耳之间的播放进度上,由此,预先设置播放跟踪的预设时间段,在预设时间段到达时,确定当前播放的第二同步数据包,确定第二同步数据包对应的第二开始播放时间和第二时间戳信息,之后,基于第二开始播放时间和第二时间戳信息,确定目标播放时差。It should be noted that, in the process of playing a group of synchronous data packets, after a certain playing time, the frequency difference between the audio source and the audio playback device may be caused by the difference of the crystal itself, temperature and other factors. And with the accumulation of time, the frequency difference will be reflected in the playback progress between the left and right ears. Therefore, the preset time period for playback tracking is set in advance, and when the preset time period arrives, the second synchronization of the current playback is determined. data packet, determine the second start time and second time stamp information corresponding to the second synchronous data packet, and then determine the target play time difference based on the second start time and the second time stamp information.
本申请实施例中,计算第二开始播放时间和第二时间戳信息的差值,该差值即为目标播放时差。In the embodiment of the present application, the difference between the second start playing time and the second time stamp information is calculated, and the difference is the target playing time difference.
本申请实施例中,音频播放设备将目标播放时差与初始播放时差进行比较,若目标播放时差等于初始播放时差,则不调整音频播放设备的音频播放速度;若目标播放时差大于初始播放时差,则调快音频播放设备的音频播放速度;若目标播放时差小于初始播放时差,则调慢音频播放设备的音频播放速度。In the embodiment of the present application, the audio playback device compares the target playback time difference with the initial playback time difference, and if the target playback time difference is equal to the initial playback time difference, the audio playback speed of the audio playback device is not adjusted; if the target playback time difference is greater than the initial playback time difference, then Speed up the audio playback speed of the audio playback device; if the target playback time difference is smaller than the initial playback time difference, slow down the audio playback speed of the audio playback device.
需要说明的是,可以通过计算目标播放时差与初始播放时差的差值、 并将该差值与0进行比较的方式,来将目标播放时差与初始播放时差进行比较,具体的比较方式可根据实际情况进行选择,本申请实施例不做具体的限定。It should be noted that the target playback time difference can be compared with the initial playback time difference by calculating the difference between the target playback time difference and the initial playback time difference, and comparing the difference with 0. The specific comparison method can be based on actual The selection is made according to the situation, and the embodiment of the present application does not make specific limitations.
基于上述实施例,本申请实施例提出一种示例性的TWS耳机的音频同步方法,具体的数据流信息如图4所示,数据流由序列号1-序列号14的一组同步数据包组成,每一个同步数据包中都包括对应的时间戳信息和数据量,在开始播放数据流信息时,记录序列号1的同步数据包的开始播放时间1并获取序列号1的同步数据包的时间戳1,计算开始播放时间1和时间戳1的差值1;确定隔预设时间段的同步数据包的序列号11,并记录序列号11的同步数据包的开始播放时间11并获取序列号11的同步数据包的时间戳11,计算开始播放时间11和时间戳11的差值11,之后,计算差值11和差值1之间的播放误差,若播放误差等于0,说明TWS耳机和手机的播放进度一致,此时不需要进行调整;若播放误差大于0,说明TWS耳机的播放进度滞后,需要调快TWS耳机的音频PLL;若播放误差小于0,说明TWS耳机的播放进度超前,需要调慢TWS耳机的音频PLL。Based on the above embodiments, the embodiment of this application proposes an exemplary audio synchronization method for TWS earphones. The specific data flow information is shown in Figure 4. The data flow consists of a set of synchronization data packets with serial number 1-serial number 14 , each synchronous data packet includes the corresponding timestamp information and data volume. When starting to play the data stream information, record the start playback time 1 of the synchronous data packet with serial number 1 and obtain the time of the synchronous data packet with serial number 1 Stamp 1, calculate the difference 1 between the start time 1 and the time stamp 1; determine the sequence number 11 of the synchronization data packet separated by the preset time period, and record the start time 11 of the synchronization data packet with the sequence number 11 and obtain the sequence number The time stamp 11 of the synchronous data packet of 11, calculate the difference 11 between the start time of playback 11 and the time stamp 11, and then calculate the playback error between the difference 11 and the difference 1, if the playback error is equal to 0, it means that the TWS headset and The playback progress of the mobile phone is consistent, and no adjustment is required at this time; if the playback error is greater than 0, it means that the playback progress of the TWS headset is lagging behind, and the audio PLL of the TWS headset needs to be adjusted faster; if the playback error is less than 0, it means that the playback progress of the TWS headset is ahead. The audio PLL of the TWS headset needs to be slowed down.
需要说明的是,音频播放设备的数量可以为一个或者多个,即,音频源可以同时实现一个或者多个音频播放设备的音频同步过程,只需音频源向待音频同步的音频播放设备广播一组同步数据包和同步播放指令,一个或者多个音频播放设备根据接收到的一组同步数据包即可自行实现音频同步,对于多链路多音频播放的场景,能实现多设备之间的同步播放,无需有一个设备分发给其他设备,极大的提高了音频同步的便捷性和实时性。It should be noted that the number of audio playback devices can be one or more, that is, the audio source can implement the audio synchronization process of one or more audio playback devices at the same time, only the audio source broadcasts a Group synchronization data packets and synchronous playback instructions, one or more audio playback devices can realize audio synchronization by themselves according to a set of synchronization data packets received, and for multi-link multi-audio playback scenarios, it can realize synchronization between multiple devices Playing, there is no need for a device to distribute to other devices, which greatly improves the convenience and real-time performance of audio synchronization.
可以理解的是,本申请直接基于音频源发送的一组同步数据包携带的时间戳信息实现TWS耳机和手机之间的音频播放进度的同步,无需进行耳机之间的交互,减少了耳机之间数据链路的负荷,减小了由于耳机之间空口链路传输不稳定带来的播放不同步问题。It can be understood that this application directly realizes the synchronization of the audio playback progress between the TWS earphones and the mobile phone based on the time stamp information carried in a group of synchronization data packets sent by the audio source, without the need for interaction between the earphones, which reduces the need for interaction between the earphones. The load of the data link reduces the playback out-of-sync problem caused by the unstable air interface link transmission between the earphones.
本申请实施例提供一种音频播放设备1。如图5所示,该设备1包括:The embodiment of the present application provides an audio playback device 1 . As shown in Figure 5, the device 1 includes:
接收单元10,用于接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;The receiving unit 10 is configured to receive a group of synchronization data packets sent by the audio source; wherein, the group of synchronization data packets includes at least one synchronization data packet;
播放单元11,用于播放所述一组同步数据包;Playing unit 11, is used for playing described one group of synchronous data packets;
记录单元12,用于记录所述至少一个同步数据包对应的至少一个开始播放时间;A recording unit 12, configured to record at least one playback start time corresponding to the at least one synchronization data packet;
确定单元13,用于依次确定所述至少一个同步数据包对应的至少一个时间戳信息;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。The determination unit 13 is configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the audio playback device and the audio source based on the at least one timestamp information and the at least one start playing time Audio synchronization between operations.
可选的,所述确定单元13,还用于基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。Optionally, the determining unit 13 is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the The target playback time difference and the initial playback time difference enable an audio synchronization operation between the audio playback device and the audio source.
可选的,所述确定单元13,还用于根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。Optionally, the determining unit 13 is further configured to determine the initial playback time according to the first playback start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet. Play time difference.
可选的,所述确定单元13,还用于每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。Optionally, the determining unit 13 is further configured to, at intervals of a preset time period, according to the second playback start time corresponding to the currently played second synchronization data packet and the second time stamp corresponding to the second synchronization data packet information to determine the target play time difference.
可选的,所述设备1还包括:调整单元;Optionally, the device 1 further includes: an adjustment unit;
所述调整单元,用于若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。The adjustment unit is configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; The audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, slow down the audio playback speed of the audio playback device.
可选的,所述确定单元13,还用于确定所述至少一个同步数据包对应的数据包类型;若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。Optionally, the determining unit 13 is further configured to determine the data packet type corresponding to the at least one synchronous data packet; if the data packet type is the first type, then sequentially search for the at least one synchronous data packet The corresponding at least one timestamp information; if the data packet type is the second type, sequentially determine the at least one timestamp information corresponding to the at least one synchronization data packet according to the preset data packet sending interval; if the The data packet type is the third type, then according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the described At least one timestamp information.
可选的,所述设备1还包括:计算单元和补偿单元;Optionally, the device 1 further includes: a calculation unit and a compensation unit;
所述计算单元,用于计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;The calculation unit is used to calculate a frequency error and a clock error between the audio source and the audio playback device;
所述补偿单元,用于基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。The compensation unit is configured to compensate the system frequency of the audio playback device based on the frequency error; and compensate the system clock of the audio playback device based on the clock error.
可选的,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。Optionally, the audio playback device includes a first Bluetooth module, the audio source includes a second Bluetooth module, and the audio playback device and the audio source are connected by the first Bluetooth module and the second Bluetooth module. Modules interact.
可选的,所述音频播放设备的数量为一个或者多个。Optionally, there is one or more audio playback devices.
可选的,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。Optionally, the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is a connection-oriented synchronous SCO data packet or an extended Bluetooth A connection-oriented synchronous data ESCO data packet; the third type of synchronous data packet is a Bluetooth Audio Transmission Model Protocol A2DP data packet.
本申请实施例提供的一种音频播放设备,接收音频源发送的一组同步数据包;其中,一组同步数据包中包括至少一个同步数据包;并依次确定至少一个同步数据包对应的至少一个时间戳信息;播放一组同步数据包,并记录至少一个同步数据包的至少一个开始播放时间;基于至少一个时间戳信息和至少一个开始播放时间实现音频播放设备和音频源之间的音频同步操作。由此可见,本实施例提出的音频播放设备,音频源向音频播放设 备发送一组同步数据包,音频播放设备基于一组同步数据包中的至少一个同步数据包确定出的时间戳信息实现音频播放设备与音频源之间的音频同步播放,进而实现一对音频播放设备之间的同步播放,减少了一对音频播放设备之间的数据链路的负荷,进而减少了由于一对音频播放设备之间的空口链路传输不稳定带来的播放不同步的问题,进而提高了耳机之间的音频同步性能。An audio playback device provided by an embodiment of the present application receives a group of synchronous data packets sent by an audio source; wherein, a group of synchronous data packets includes at least one synchronous data packet; and sequentially determines at least one corresponding to at least one synchronous data packet Timestamp information; play a set of synchronization data packets, and record at least one start time of at least one synchronization data packet; realize audio synchronization between an audio playback device and an audio source based on at least one time stamp information and at least one start time . It can be seen that, in the audio playback device proposed in this embodiment, the audio source sends a group of synchronization data packets to the audio playback device, and the audio playback device implements audio based on the time stamp information determined by at least one synchronization data packet in a group of synchronization data packets. The audio between the playback device and the audio source is played synchronously, thereby achieving synchronous playback between a pair of audio playback devices, reducing the load on the data link between a pair of audio playback devices, and reducing the load caused by a pair of audio playback devices. The problem of out-of-sync playback caused by the unstable transmission of the air interface link between them improves the audio synchronization performance between the earphones.
图6为本申请实施例提供的一种音频播放设备1的组成结构示意图二,在实际应用中,基于上述实施例的同一公开构思下,如图6所示,本实施例的设备1包括:接收器14、处理器15、存储器16及通信总线17。Fig. 6 is a schematic diagram of the composition and structure of an audio playback device 1 provided by the embodiment of the present application II. In practical applications, based on the same disclosed concept of the above embodiment, as shown in Fig. 6, the device 1 of this embodiment includes: Receiver 14 , processor 15 , memory 16 and communication bus 17 .
在具体的实施例的过程中,上述播放单元11、记录单元12、确定单元13、计算单元和补偿单元可由位于音频播放设备1上的处理器15实现,上述接收单元10可由位于设备1上的接收器14实现,上述处理器15可以为特定用途集成电路(ASIC,Application Specific Integrated Circuit)、DSP、数字信号处理图像处理装置(DSPD,Digital Signal Processing Device)、可编程逻辑图像处理装置(PLD,Programmable Logic Device)、现场可编程门阵列(FPGA,Field Programmable Gate Array)、CPU、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本实施例不作具体限定。In the process of a specific embodiment, the above-mentioned playback unit 11, recording unit 12, determination unit 13, calculation unit and compensation unit can be realized by a processor 15 located on the audio playback device 1, and the above-mentioned receiving unit 10 can be implemented by a processor located on the device 1 Receiver 14 realizes, and above-mentioned processor 15 can be application-specific integrated circuit (ASIC, Application Specific Integrated Circuit), DSP, digital signal processing image processing device (DSPD, Digital Signal Processing Device), programmable logic image processing device (PLD, At least one of Programmable Logic Device), Field Programmable Gate Array (FPGA, Field Programmable Gate Array), CPU, controller, microcontroller, and microprocessor. It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment.
在本申请实施例中,上述通信总线17用于实现接收器14、处理器15和存储器16之间的连接通信;上述接收器14,用于接收音频源发送的一组同步数据包;其中,所述一组同步数据包中包括至少一个同步数据包;上述处理器15执行存储器16中存储的运行程序时实现如下的音频同步方法:In the embodiment of the present application, the above-mentioned communication bus 17 is used to realize connection and communication between the receiver 14, the processor 15 and the memory 16; the above-mentioned receiver 14 is used to receive a group of synchronous data packets sent by the audio source; wherein, At least one synchronous data packet is included in the group of synchronous data packets; the above-mentioned processor 15 implements the following audio synchronization method when executing the running program stored in the memory 16:
依次确定所述至少一个同步数据包对应的至少一个时间戳信息;播放所述一组同步数据包,并记录所述至少一个同步数据包的至少一个开始播放时间;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。Determine in turn at least one timestamp information corresponding to the at least one synchronization data packet; play the group of synchronization data packets, and record at least one start playing time of the at least one synchronization data packet; based on the at least one timestamp information and the at least one start time to implement audio synchronous operation between the audio playback device and the audio source.
进一步地,在上述实施例中,所述处理器15,还用于基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。Further, in the above embodiment, the processor 15 is further configured to determine the initial play time difference and the target play time difference every preset time period based on the at least one time stamp information and the at least one play start time, respectively. Time difference: realize the audio synchronization operation between the audio playback device and the audio source according to the target playback time difference and the initial playback time difference.
进一步地,在上述实施例中,所述处理器15,还用于根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。Further, in the above embodiment, the processor 15 is further configured to, according to the first playing start time corresponding to the first synchronous data packet played first and the first time stamp information corresponding to the first synchronous data packet , to determine the initial playback time difference.
进一步地,在上述实施例中,所述处理器15,还用于每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。Further, in the above embodiment, the processor 15 is further configured to, every preset time period, according to the second start time corresponding to the currently played second synchronization data packet and the second synchronization data packet corresponding The second timestamp information to determine the target play time difference.
进一步地,在上述实施例中,所述处理器15,还用于若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度; 若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。Further, in the above embodiment, the processor 15 is further configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; if the target playback time difference If the target playback time difference is greater than the initial playback time difference, then adjust the audio playback speed of the audio playback device; if the target playback time difference is smaller than the initial playback time difference, then slow down the audio playback speed of the audio playback device.
进一步地,在上述实施例中,所述处理器15,还用于确定所述至少一个同步数据包对应的数据包类型;若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。Further, in the above-mentioned embodiment, the processor 15 is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, sequentially from the at least one synchronization data packet Find the corresponding at least one timestamp information in the synchronization data packet; if the data packet type is the second type, then determine at least one time stamp corresponding to the at least one synchronization data packet in sequence according to the preset data packet sending interval information; if the data packet type is the third type, then determine a timestamp corresponding to each synchronization data packet according to the preset playback speed, the last timestamp information corresponding to the last synchronization data packet, and the length of the last data packet information, to obtain the at least one time stamp information.
进一步地,在上述实施例中,所述处理器15,还用于计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。Further, in the above embodiment, the processor 15 is also configured to calculate a frequency error and a clock error between the audio source and the audio playback device; compensate the audio playback device based on the frequency error system frequency; and compensating the system clock of the audio playback device based on the clock error.
进一步地,在上述实施例中,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。Further, in the above embodiment, the audio playback device includes a first Bluetooth module, the audio source includes a second Bluetooth module, and the audio playback device and the audio source are connected by the first Bluetooth module and the audio source. The second bluetooth module interacts.
进一步地,在上述实施例中,所述音频播放设备的数量为一个或者多个。Further, in the above embodiment, the number of the audio playback device is one or more.
进一步地,在上述实施例中,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。Further, in the above embodiment, the first type of synchronous data packet is a broadcast synchronous data stream BIS or a connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is a connection-oriented synchronous SCO data packet packet or an extended Bluetooth connection-oriented synchronization data ESCO data packet; the third type of synchronization data packet is a Bluetooth Audio Transmission Model Protocol A2DP data packet.
本申请实施例提供一种存储介质,其上存储有计算机程序,上述计算机可读存储介质存储有一个或者多个程序,上述一个或者多个程序可被一个或者多个处理器执行,应用于音频播放设备中,该计算机程序实现如上述音频同步的方法。An embodiment of the present application provides a storage medium on which a computer program is stored. The computer-readable storage medium stores one or more programs. The one or more programs can be executed by one or more processors and are applied to audio In the playback device, the computer program realizes the above audio synchronization method.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品 的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台图像显示设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本公开各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the related technology. The computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk, etc.) ) includes several instructions to make an image display device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in various embodiments of the present disclosure.
以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application.

Claims (20)

  1. 一种用于音频播放设备的音频同步方法,所述方法包括:An audio synchronization method for an audio playback device, the method comprising:
    接收音频源发送的一组同步数据包,其中,所述一组同步数据包包括至少一个同步数据包;并依次确定所述至少一个同步数据包对应的至少一个时间戳信息;Receiving a group of synchronization data packets sent by the audio source, wherein the group of synchronization data packets includes at least one synchronization data packet; and sequentially determining at least one timestamp information corresponding to the at least one synchronization data packet;
    播放所述一组同步数据包,并记录所述至少一个同步数据包的至少一个开始播放时间;Play the group of synchronization data packets, and record at least one start playing time of the at least one synchronization data packet;
    基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。The audio synchronization operation between the audio playback device and the audio source is implemented based on the at least one time stamp information and the at least one playback start time.
  2. 根据权利要求1所述的方法,其中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作,包括:The method according to claim 1, wherein said implementing the audio synchronization operation between the audio playback device and the audio source based on the at least one timestamp information and the at least one start playback time comprises:
    基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;Based on the at least one time stamp information and the at least one start playing time, respectively determine the initial playing time difference and the target playing time difference every preset time period;
    根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作。The audio synchronization operation between the audio playback device and the audio source is implemented according to the target playback time difference and the initial playback time difference.
  3. 根据权利要求2所述的方法,其中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间,确定初始播放时差,包括:The method according to claim 2, wherein said determining an initial play time difference based on said at least one time stamp information and said at least one play start time comprises:
    根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。The initial play time difference is determined according to the first play start time corresponding to the first played first synchronization data packet and the first time stamp information corresponding to the first synchronization data packet.
  4. 根据权利要求2所述的方法,其中,所述基于所述至少一个时间戳信息和所述至少一个开始播放时间,确定每隔预设时间段的目标播放时差,包括:The method according to claim 2, wherein, based on the at least one time stamp information and the at least one start playing time, determining the target playing time difference every preset time period comprises:
    每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。The target playing time difference is determined according to the second playing start time corresponding to the currently played second synchronization data packet and the second time stamp information corresponding to the second synchronization data packet every preset time period.
  5. 根据权利要求2所述的方法,其中,所述根据所述目标播放时差和所述初始播放时差实现所述音频播放设备和所述音频源之间的音频同步操作,包括:The method according to claim 2, wherein said implementing the audio synchronization operation between the audio playback device and the audio source according to the target playback time difference and the initial playback time difference comprises:
    若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;If the target playing time difference is equal to the initial playing time difference, the audio playing speed of the audio playing device is not adjusted;
    若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;If the target playing time difference is greater than the initial playing time difference, then speed up the audio playing speed of the audio playing device;
    若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。If the target play time difference is smaller than the initial play time difference, slow down the audio play speed of the audio play device.
  6. 根据权利要求1所述的方法,其中,所述依次确定所述至少一个 同步数据包对应的至少一个时间戳信息,包括:The method according to claim 1, wherein said determining at least one timestamp information corresponding to said at least one synchronous data packet in turn comprises:
    确定所述至少一个同步数据包对应的数据包类型;determining a data packet type corresponding to the at least one synchronization data packet;
    若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;If the data packet type is the first type, then sequentially search for the corresponding at least one timestamp information from the at least one synchronization data packet;
    若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;If the data packet type is the second type, then sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet according to a preset data packet sending interval;
    若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。If the data packet type is the third type, then determine a time stamp information corresponding to each synchronization data packet according to the preset playback speed, the last time stamp information corresponding to the last synchronization data packet, and the length of the last data packet, Obtain the at least one time stamp information.
  7. 根据权利要求1所述的方法,其中,所述接收音频源发送的一组同步数据包之后;所述依次确定所述至少一个同步数据包对应的至少一个时间戳信息之前,所述方法还包括:The method according to claim 1, wherein, after receiving a group of synchronization data packets sent by the audio source; before determining at least one timestamp information corresponding to the at least one synchronization data packet in sequence, the method further comprises :
    计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;calculating a frequency error and a clock error between the audio source and the audio playback device;
    基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。Compensating the system frequency of the audio playback device based on the frequency error; and compensating the system clock of the audio playback device based on the clock error.
  8. 根据权利要求1所述的方法,其中,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。The method according to claim 1, wherein the audio playback device includes a first Bluetooth module, the audio source includes a second Bluetooth module, and the audio playback device and the audio source are connected via the first Bluetooth module. The module interacts with the second Bluetooth module.
  9. 根据权利要求1所述的方法,其中,所述音频播放设备的数量为一个或者多个。The method according to claim 1, wherein the number of the audio playback devices is one or more.
  10. 根据权利要求6所述的方法,其中,所述第一类型的同步数据包为广播同步数据流BIS或面向连接的同步数据流CIS数据包;所述第二类型的同步数据包为面向连接同步SCO数据包或扩展的蓝牙面向连接同步数据ESCO数据包;所述第三类型的同步数据包为蓝牙音频传输模型协定A2DP数据包。The method according to claim 6, wherein the first type of synchronous data packet is broadcast synchronous data stream BIS or connection-oriented synchronous data stream CIS data packet; the second type of synchronous data packet is connection-oriented synchronous An SCO data packet or an extended Bluetooth connection-oriented synchronous data ESCO data packet; the third type of synchronous data packet is a Bluetooth Audio Transmission Model Protocol A2DP data packet.
  11. 一种音频播放设备,所述设备包括:An audio playback device, the device comprising:
    接收单元,用于接收音频源发送的一组同步数据包,其中,所述一组同步数据包中包括至少一个同步数据包;A receiving unit, configured to receive a group of synchronization data packets sent by the audio source, wherein the group of synchronization data packets includes at least one synchronization data packet;
    播放单元,用于播放所述一组同步数据包;a playback unit, configured to play the group of synchronization data packets;
    记录单元,用于记录所述至少一个同步数据包对应的至少一个开始播放时间;A recording unit, configured to record at least one playback start time corresponding to the at least one synchronization data packet;
    确定单元,用于依次确定所述至少一个同步数据包对应的至少一个时间戳信息;基于所述至少一个时间戳信息和所述至少一个开始播放时间实现所述音频播放设备和所述音频源之间的音频同步操作。A determining unit, configured to sequentially determine at least one timestamp information corresponding to the at least one synchronization data packet; realize the connection between the audio playback device and the audio source based on the at least one timestamp information and the at least one playback start time audio sync operation between them.
  12. 根据权利要求11所述的设备,其中,The apparatus of claim 11, wherein,
    所述确定单元,还用于基于所述至少一个时间戳信息和所述至少一个开始播放时间,分别确定初始播放时差和每隔预设时间段的目标播放时差;根据所述目标播放时差和所述初始播放时差实现所述音频播放设 备和所述音频源之间的音频同步操作。The determining unit is further configured to respectively determine an initial play time difference and a target play time difference every preset time period based on the at least one time stamp information and the at least one play start time; according to the target play time difference and the set The initial playback time difference realizes the audio synchronization operation between the audio playback device and the audio source.
  13. 根据权利要求12所述的设备,其中,The apparatus of claim 12, wherein,
    所述确定单元,还用于根据首个播放的第一同步数据包对应的第一开始播放时间和所述第一同步数据包对应的第一时间戳信息,确定所述初始播放时差。The determining unit is further configured to determine the initial playing time difference according to the first playing start time corresponding to the first played first synchronization data packet and the first time stamp information corresponding to the first synchronization data packet.
  14. 根据权利要求12所述的设备,其中,The apparatus of claim 12, wherein,
    所述确定单元,还用于每隔预设时间段,根据当前播放的第二同步数据包对应的第二开始播放时间和所述第二同步数据包对应的第二时间戳信息,确定所述目标播放时差。The determining unit is further configured to determine the second playback start time corresponding to the second synchronization data packet currently played and the second time stamp information corresponding to the second synchronization data packet every preset time period. Target play time difference.
  15. 根据权利要求12所述的设备,其中,所述装置还包括:调整单元;The apparatus according to claim 12, wherein the device further comprises: an adjustment unit;
    所述调整单元,用于若所述目标播放时差等于所述初始播放时差,则不调整所述音频播放设备的音频播放速度;若所述目标播放时差大于所述初始播放时差,则调快所述音频播放设备的音频播放速度;若所述目标播放时差小于所述初始播放时差,则调慢所述音频播放设备的音频播放速度。The adjustment unit is configured to not adjust the audio playback speed of the audio playback device if the target playback time difference is equal to the initial playback time difference; The audio playback speed of the audio playback device; if the target playback time difference is less than the initial playback time difference, slow down the audio playback speed of the audio playback device.
  16. 根据权利要求11所述的设备,其中,The apparatus of claim 11, wherein,
    所述确定单元,还用于确定所述至少一个同步数据包对应的数据包类型;若所述数据包类型为第一类型,则依次从所述至少一个同步数据包中查找对应的所述至少一个时间戳信息;若所述数据包类型为第二类型,则根据预设数据包发送间隔、依次确定所述至少一个同步数据包对应的至少一个时间戳信息;若所述数据包类型为第三类型,则根据预设播放速度、上一个同步数据包对应的上一个时间戳信息和上一个数据包长度,确定每一个同步数据包对应的一个时间戳信息,得到所述至少一个时间戳信息。The determining unit is further configured to determine the data packet type corresponding to the at least one synchronization data packet; if the data packet type is the first type, then sequentially search for the corresponding at least one synchronization data packet from the at least one synchronization data packet. A time stamp information; if the data packet type is the second type, at least one time stamp information corresponding to the at least one synchronization data packet is sequentially determined according to the preset data packet sending interval; if the data packet type is the second type Three types, according to the preset playback speed, the last time stamp information corresponding to the last synchronization data packet and the length of the last data packet, determine a time stamp information corresponding to each synchronization data packet, and obtain the at least one time stamp information .
  17. 根据权利要求11所述的设备,其中,所述设备还包括:计算单元和补偿单元;The device according to claim 11, wherein the device further comprises: a calculation unit and a compensation unit;
    所述计算单元,用于计算所述音频源和所述音频播放设备之间的频率误差和时钟误差;The calculation unit is used to calculate a frequency error and a clock error between the audio source and the audio playback device;
    所述补偿单元,用于基于所述频率误差补偿所述音频播放设备的系统频率;并基于所述时钟误差补偿所述音频播放设备的系统时钟。The compensation unit is configured to compensate the system frequency of the audio playback device based on the frequency error; and compensate the system clock of the audio playback device based on the clock error.
  18. 根据权利要求11所述的设备,其中,所述音频播放设备包括第一蓝牙模块,所述音频源包括第二蓝牙模块,所述音频播放设备和所述音频源之间通过所述第一蓝牙模块和所述第二蓝牙模块进行交互。The device according to claim 11, wherein the audio playback device includes a first Bluetooth module, the audio source includes a second Bluetooth module, and the audio playback device and the audio source are connected via the first Bluetooth module. The module interacts with the second Bluetooth module.
  19. 一种音频播放设备,所述设备包括:接收器、处理器、存储器及通信总线;所述处理器执行存储器存储的运行程序时实现如权利要求1-10任一项所述的方法。An audio playback device, the device comprising: a receiver, a processor, a memory, and a communication bus; when the processor executes a running program stored in the memory, the method according to any one of claims 1-10 is implemented.
  20. 一种存储介质,其上存储有计算机程序,该计算机程序被处理 器执行时实现如权利要求1-10任一项所述的方法。A storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of claims 1-10 is realized.
PCT/CN2022/090448 2021-06-29 2022-04-29 Audio synchronization method, audio playing device and storage medium WO2023273591A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110723845.3A CN115549832A (en) 2021-06-29 2021-06-29 Audio synchronization method, audio playing device and storage medium
CN202110723845.3 2021-06-29

Publications (1)

Publication Number Publication Date
WO2023273591A1 true WO2023273591A1 (en) 2023-01-05

Family

ID=84692465

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/090448 WO2023273591A1 (en) 2021-06-29 2022-04-29 Audio synchronization method, audio playing device and storage medium

Country Status (2)

Country Link
CN (1) CN115549832A (en)
WO (1) WO2023273591A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007124380A (en) * 2005-10-28 2007-05-17 Nec Corp Stereophonic output system, stereophonic output method, and program for stereophonic output
CN108200495A (en) * 2018-01-23 2018-06-22 恒玄科技(上海)有限公司 A kind of method realized bluetooth headset and be played simultaneously
CN108495239A (en) * 2018-01-17 2018-09-04 深圳聚点互动科技有限公司 Method, apparatus, equipment and the storage medium that more equipment room audio precise synchronizations play
US20200137699A1 (en) * 2018-10-26 2020-04-30 TAP Sound System SAS Synchronization method for synchronizing clocks of a bluetooth device
CN111918261A (en) * 2020-08-13 2020-11-10 南京中感微电子有限公司 Bluetooth audio equipment synchronous playing method and system and Bluetooth audio master and slave equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007124380A (en) * 2005-10-28 2007-05-17 Nec Corp Stereophonic output system, stereophonic output method, and program for stereophonic output
CN108495239A (en) * 2018-01-17 2018-09-04 深圳聚点互动科技有限公司 Method, apparatus, equipment and the storage medium that more equipment room audio precise synchronizations play
CN108200495A (en) * 2018-01-23 2018-06-22 恒玄科技(上海)有限公司 A kind of method realized bluetooth headset and be played simultaneously
US20200137699A1 (en) * 2018-10-26 2020-04-30 TAP Sound System SAS Synchronization method for synchronizing clocks of a bluetooth device
CN111918261A (en) * 2020-08-13 2020-11-10 南京中感微电子有限公司 Bluetooth audio equipment synchronous playing method and system and Bluetooth audio master and slave equipment

Also Published As

Publication number Publication date
CN115549832A (en) 2022-12-30

Similar Documents

Publication Publication Date Title
US11375312B2 (en) Method, device, loudspeaker equipment and wireless headset for playing audio synchronously
US10242693B2 (en) Wireless audio synchronization
EP1971905B1 (en) Media data synchronization in a wireless network
CN111147907B (en) Method, device and system for synchronously playing multiple intelligent terminals and intelligent terminal
CN110838854B (en) Bluetooth wireless device and method for using the same
CN109565466B (en) Lip sound synchronization method and device among multiple devices
US20090298420A1 (en) Apparatus and methods for time synchronization of wireless audio data streams
JP4411184B2 (en) Broadcast station synchronization method and portable terminal
US8351437B2 (en) Stereo bit clock tuning
CN110636600B (en) Audio synchronous playing method for wireless equipment
CN110636349B (en) Audio synchronous playing method for wireless equipment
WO2021175297A1 (en) Distributed data transmission method, apparatus and system
WO2021131582A1 (en) Synchronization device and synchronization method
US20180158468A1 (en) Device and method for synchronizing speakers
US20210337005A1 (en) Audio synchronization in wireless systems
WO2023273591A1 (en) Audio synchronization method, audio playing device and storage medium
US10805664B2 (en) Wireless audio synchronization
WO2007086564A1 (en) Broadcast station synchronization method and control device
WO2023273601A1 (en) Audio synchronization method, audio playback device, audio source, and storage medium
CN112911559A (en) Wireless data communication method, system, equipment and storage medium
CN112333610B (en) Audio playing method and device of Bluetooth TWS equipment
US20230102871A1 (en) Bluetooth voice communication system and related computer program product for generating stereo voice effect
CN112235685B (en) Sound box networking method and sound box system
CN116828585A (en) Audio synchronous playing method and system, audio equipment and storage medium
Kim et al. Precise synchronization mechanism in wireless devices

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: 22831418

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE