CN112311521B - Equipment group audio synchronization method and device, electronic equipment and storage medium - Google Patents

Equipment group audio synchronization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112311521B
CN112311521B CN202011199619.1A CN202011199619A CN112311521B CN 112311521 B CN112311521 B CN 112311521B CN 202011199619 A CN202011199619 A CN 202011199619A CN 112311521 B CN112311521 B CN 112311521B
Authority
CN
China
Prior art keywords
time slot
phase deviation
slot phase
current
slave device
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202011199619.1A
Other languages
Chinese (zh)
Other versions
CN112311521A (en
Inventor
段志勇
李振
李凤阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KT MICRO Inc
Original Assignee
KT MICRO Inc
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 KT MICRO Inc filed Critical KT MICRO Inc
Priority to CN202011199619.1A priority Critical patent/CN112311521B/en
Publication of CN112311521A publication Critical patent/CN112311521A/en
Application granted granted Critical
Publication of CN112311521B publication Critical patent/CN112311521B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/0079Receiver details
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0602Systems characterised by the synchronising information used
    • H04J3/0617Systems characterised by the synchronising information used the synchronising signal being characterised by the frequency or phase
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones
    • H04R3/12Circuits for transducers, loudspeakers or microphones for distributing signals to two or more loudspeakers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Otolaryngology (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The application provides a device group audio synchronization method, a device, an electronic device and a storage medium, wherein the device group comprises a master device and at least one slave device, the master device and each slave device are connected through Bluetooth, and the method is applied to a first slave device of the at least one slave device and comprises the following steps: acquiring the current time slot phase deviation between a first slave device and the master device; calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the change degree of the current time slot phase deviation relative to the initial time slot phase deviation, and the initial time slot phase deviation represents the time slot phase deviation between the first slave equipment and the master equipment when the first slave equipment is connected with the master equipment; and adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment.

Description

Equipment group audio synchronization method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of bluetooth technologies, and in particular, to a device group audio synchronization method, device, electronic device, and storage medium.
Background
In various schemes of bluetooth audio transmission playing, the system is basically composed of several independent bluetooth audio entities, and because local crystal oscillators of the entities are independent and have unavoidable deviations, the problem of asynchronous audio playing between a sending source and a receiving playing device often occurs.
At present, a mode of synchronizing audio playing by a time stamp is mainly adopted to solve the problem that the synchronization accuracy is low due to the fact that audio phase deviation between master and slave devices of Bluetooth is continuously changed.
Disclosure of Invention
The embodiment of the application aims to provide a device group audio synchronization method, a device, an electronic device and a storage medium, which are used for solving the problem that the synchronization precision is low in the current mode of synchronizing audio playing through a time stamp because the audio phase deviation between master and slave Bluetooth devices is continuously changed.
In a first aspect, an embodiment of the present application provides a method for audio synchronization of a device group, where the device group includes a master device and at least one slave device, where the master device and each slave device are connected by bluetooth, and the method is applied to a first slave device of the at least one slave device, and includes: acquiring the current time slot phase deviation between the first slave device and the master device; calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the variation degree of the current time slot phase deviation relative to the initial time slot phase deviation, and the initial time slot phase deviation represents the time slot phase deviation between the first slave equipment and the master equipment when the first slave equipment is connected with the master equipment; and adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment.
In the above-designed device group audio synchronization method, the first frequency proportionality coefficient representing the degree of change of the current time slot phase deviation relative to the initial time slot phase deviation is obtained through the calculation of the current time slot phase deviation between the first slave device and the master device, and then the playing speed of the current audio data acquired by the first slave device is adjusted through the first frequency proportionality coefficient, so that the current audio data of the first slave device and the audio data corresponding to the master device are kept in synchronization.
In an optional implementation manner of the first aspect, the adjusting, according to the first frequency scaling factor, a playing speed of current audio data acquired by the first slave device includes: and performing asynchronous rate conversion on the current audio data acquired by the first slave device according to the first frequency proportionality coefficient so as to adjust the playing speed of the current audio data.
In the embodiment of the design, the current audio data acquired by the first slave device is subjected to asynchronous rate conversion according to the first frequency proportionality coefficient, so that the playing speed of the current audio data is correspondingly changed according to the change degree of the time slot phase deviation, the audio data playing is further synchronized, and the audio synchronization precision of the Bluetooth master-slave device is improved.
In an optional implementation manner of the first aspect, the adjusting, according to the first frequency scaling factor, a playing speed of current audio data acquired by the first slave device includes: and adjusting the frequency of the internal crystal oscillator of the first slave device according to the first frequency proportionality coefficient so as to adjust the playing speed of the audio decoder in the first slave device on the current audio data.
In the above designed embodiment, the frequency of the crystal oscillator in the first slave device is adjusted according to the first frequency proportionality coefficient to adjust the playing speed of the audio decoder in the first slave device on the current audio data, so that the time slot phase deviation between the first slave device and the master device is always maintained within a small range of the initial time slot phase deviation, further, the change of the phase difference between the first slave device and the audio playing of the master device is also maintained within a small range, and further, the current audio data acquired by the first slave device and the audio data corresponding to the master device are synchronously played.
In an optional implementation manner of the first aspect, the calculating a first frequency scaling factor according to the current slot phase deviation includes: acquiring a current count value, a second frequency proportionality coefficient and the initial time slot phase deviation, wherein the current count value is a count value obtained by taking the connection time between the first slave device and the master device as a timing starting point, and the second frequency proportionality coefficient is a frequency proportionality coefficient calculated by the first slave device in the last audio synchronization and is used for representing the change degree of the time slot phase deviation and the initial time slot phase deviation obtained in the last audio synchronization; and calculating the first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient.
In an optional implementation manner of the first aspect, the calculating the first frequency scaling factor according to the current count value, an initial slot phase deviation, a current slot phase deviation, and a second frequency scaling factor includes: calculating the sum of the current count value and the current time slot phase deviation to obtain a first value; calculating the sum of the product of the current count value and the second frequency proportionality coefficient and the initial time slot phase deviation to obtain a second numerical value; and calculating the first frequency proportionality coefficient according to the first value and the second value, wherein the first frequency proportionality coefficient is the ratio of the first value to the second value.
In an optional implementation manner of the first aspect, the calculating a first frequency scaling factor according to the current slot phase deviation includes: acquiring the initial time slot phase deviation; and calculating the first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation.
In an optional implementation manner of the first aspect, the acquiring a current slot phase deviation between the first slave device and the master device includes: acquiring a first moment when the first slave device receives a synchronous word of a current frame transmitted by the master device; acquiring the starting time of the current time slot of the internal clock of the first slave device at the first time; and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
In a second aspect, an embodiment of the present invention provides an apparatus for audio synchronization of a device group, where the device group includes a master device and at least one slave device, where the master device and each slave device are connected by bluetooth, and the apparatus is applied to a first slave device of the at least one slave device, and includes: an acquisition module, configured to acquire a current time slot phase deviation between the first slave device and the master device; the calculation module is used for calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the change degree of the current time slot phase deviation relative to the initial time slot phase deviation, and the initial time slot phase deviation represents the time slot phase deviation between the first slave equipment and the master equipment when the first slave equipment is connected with the master equipment; and the adjusting module is used for adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment.
In the above-designed device group audio synchronization device, the first frequency proportionality coefficient representing the degree of change of the current time slot phase deviation relative to the initial time slot phase deviation is obtained through the calculation of the current time slot phase deviation between the first slave device and the master device, and then the playing speed of the current audio data acquired by the first slave device is adjusted through the first frequency proportionality coefficient, so that the current audio data of the first slave device and the audio data corresponding to the master device are kept synchronous.
In an optional implementation manner of the second aspect, the adjusting module is specifically configured to perform asynchronous rate conversion on the current audio data acquired by the first slave device according to the first frequency scaling factor so as to adjust a playing speed of the current audio data.
In an optional implementation manner of the second aspect, the adjusting module is further specifically configured to adjust, according to the first frequency scaling factor, a frequency of an internal crystal oscillator of the first slave device to adjust a playing speed of the current audio data by an audio decoder inside the first slave device.
In an optional implementation manner of the second aspect, the calculating module is specifically configured to obtain a current count value, a second frequency scaling factor, and the initial time slot phase deviation, where the current count value is a count value obtained by using a connection time between the first slave device and the master device as a timing start point, and the second frequency scaling factor is a frequency scaling factor calculated by the first slave device during a previous audio synchronization, and is used to characterize a degree of change between the time slot phase deviation obtained during the previous audio synchronization and the initial time slot phase deviation; and calculating the first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient.
In an optional implementation manner of the second aspect, the calculating module is further specifically configured to obtain the initial slot phase deviation; and calculating the first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation.
In an optional implementation manner of the second aspect, the acquiring module is specifically configured to acquire a first time when the first slave device receives a synchronization word of a current frame transmitted by the master device; acquiring the starting time of the current time slot of the internal clock of the first slave device at the first time; and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
In a third aspect, an embodiment provides an electronic device comprising a memory storing a computer program and a processor that when executing the computer program performs the method of the first aspect, any optional implementation of the first aspect.
In a fourth aspect, embodiments provide a storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first aspect, any of the alternative implementations of the first aspect.
In a fifth aspect, embodiments provide a computer program product which, when run on a computer, causes the computer to perform the method of any of the alternative implementations of the first aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a first flowchart of an audio synchronization method for a device group according to an embodiment of the present application;
FIG. 2 is a second flowchart of a device group audio synchronization method according to an embodiment of the present application;
FIG. 3 is a third flowchart of a device group audio synchronization method according to an embodiment of the present application;
fig. 4 is a fourth flowchart of a device group audio synchronization method according to an embodiment of the present application;
fig. 5 is a fifth flowchart of a device group audio synchronization method according to an embodiment of the present application;
fig. 6 is a sixth flowchart of a device group audio synchronization method according to an embodiment of the present application;
fig. 7 is a seventh flowchart of a device group audio synchronization method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for audio synchronization of a device group according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon: 200-an acquisition module; 201-a calculation module; 202-an adjustment module; 3-an electronic device; 301-a processor; 302-memory; 303-communication bus.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
The embodiment of the application provides an audio synchronization method for a device group, wherein the device group comprises a master device and at least one slave device, the master device and the slave devices establish Bluetooth connection, for example, the device group can be a mobile phone and a Bluetooth headset, the mobile phone is the master device, the left and right headsets of Bluetooth headset are the slave devices, and the method is applied to any slave device after connection establishment, for example, a certain slave device is set as a first slave device, and as shown in fig. 1, the method specifically comprises the following steps:
step S100: the current time slot phase deviation between the first slave device and the master device is obtained.
Step S102: and calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the variation degree of the current time slot phase deviation relative to the initial time slot phase deviation.
Step S104: and adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment.
In step S100, a first slave device establishing bluetooth connection with a master device may acquire a current time slot phase deviation between the slave device and the master device, where the time slot phase deviation refers to a phase difference between time slots of the slave device and the master device, which is maintained by the slave device in a classical bluetooth protocol for implementing transmit-receive switching and frequency hopping synchronization with the master device, and is generally referred to as bit offset; under normal conditions, since the crystal oscillator in each device in the device group is independent, the phase difference is continuously increased or decreased along with time change, for example, the crystal oscillators in the mobile phone and the bluetooth headset in the example are independent, so that the phase difference between the three devices is changed, and the audio frequency between the devices in the device group is asynchronous due to the maintained phase difference change.
It has been described that the time slot phase deviation is different at different time points, so that the current time slot phase deviation needs to be obtained when the data or control frame sent by the master device is received, where the current time slot phase deviation can be obtained through the time slot phase deviation self-generated by the baseband chip inside the slave device when the data or control frame sent by the master device is received, and the current time slot phase deviation can also be determined more accurately by using the time slot clock with higher internal precision of the first slave device in the following manner, as shown in fig. 2, and the method includes the following steps:
Step S1000: and acquiring a first moment when the first slave device receives the synchronous word of the current frame transmitted by the master device.
Step S1001: the starting time of the current time slot of the internal clock of the first slave device at the first time is acquired.
Step S1002: and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
The foregoing has described that the timing at which the first slave device obtains the current slot phase deviation is when the first slave device receives the data or control frame sent by the master device, in step S1000, the present scheme may obtain the timing at which the first slave device receives the synchronization of the current frame (such as the data frame or the control frame) transmitted by the master device, and the present scheme describes that the first slave device is the first timing, specifically, the first slave device may generate a pulse when receiving the synchronization word of the current frame sent by the master device, and the present scheme may determine the timing at which the pulse is generated as the first timing, and execute step S1001 on the basis of the first timing.
In step S1001, the present scheme obtains a starting time of a current time slot of an internal clock of the slave device at a first time, specifically, a time slot clock clkn in the first slave device continuously updates the time slot, where the time slot includes a time slot start point, a time slot end point, and a time period from the time slot start point to the end point, and the step is to obtain the time slot start point of the current time slot or the starting time of the current time slot where the time slot clock in the slave device is located at the first time, and further execute step S1002.
In step S1002, the present solution calculates a current time slot phase deviation according to the first time acquired in step S1000 and the starting time of the current time slot acquired in step S1001, specifically, calculates a time difference from the starting time of the current time slot to the first time, and uses the calculated time difference as the current time slot phase deviation.
Step S102 may be performed after the current slot phase deviation is obtained as the step S102, and in step S102, the present scheme calculates a first frequency scaling factor according to the obtained current slot phase deviation, where the first frequency scaling factor characterizes a variation degree of the current slot phase deviation with respect to an initial slot phase deviation, where the initial slot phase deviation represents a slot phase deviation between a first slave device and a master device when the first slave device establishes a connection, the initial slot phase deviation may be obtained in the same manner as the previous step S100 for obtaining the current slot phase deviation when the first slave device establishes a connection, and after the initial slot phase deviation is obtained, the first frequency scaling factor may be stored, and may be stored in a register of the first slave device or the like.
Specifically, the foregoing manner of calculating the first frequency scaling factor according to the current slot phase deviation may include two manners, that is, first, the first frequency scaling factor may be directly calculated by the current slot phase deviation and the initial slot phase deviation, as shown in fig. 3, specifically:
Step S1020: an initial slot phase offset is obtained.
Step S1021: and calculating a first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation.
In step S1020, the present embodiment obtains the stored initial time slot phase deviation, and then step S1021 is executed to calculate the first frequency scaling factor according to the current time slot phase deviation and the initial time slot phase deviation, specifically, the first frequency scaling factor can be obtained by dividing the current time slot phase deviation by the initial time slot phase deviation.
Since the influence of the temperature of the internal device of the first slave device makes the first frequency scaling factor determined in the foregoing manner inaccurate, the calculation can be performed by the current slot phase deviation, the initial slot phase deviation and the PID algorithm, in which the initial slot phase deviation is used as the target value, specifically, as shown in fig. 4, the method includes the following steps:
step S1022: and acquiring the current count value, the second frequency proportionality coefficient and the initial time slot phase deviation.
Step S1023: and calculating a first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient.
In step S1022, the current count value is a count value obtained by taking a time point when the first slave device establishes connection with the master device as a timing start point, and specifically, the present solution may start timing when the first slave device establishes connection with the master device through a fine clock or a slot clock in the first slave device, and obtain the count value of the clock when executing step S1022 to obtain the current count value; or connecting a fine clock or a time slot clock in the slave device with an accumulator, starting timing accumulation when the first slave device is connected with the master device, and obtaining the accumulated value of the accumulator at the current moment to obtain the current count value when executing the step S1022; the second frequency scaling factor refers to a frequency scaling factor calculated by the first slave device during the last audio synchronization, which characterizes the degree of variation of the time slot phase deviation obtained during the last audio synchronization and the initial time slot phase deviation, in this scheme, after the first slave device establishes a connection with the master device, each time the data sent by the master device is obtained, the foregoing steps are executed to calculate the corresponding frequency scaling factor to enable the audio synchronization, and the last frequency scaling factor is needed to be used during the calculation of the current frequency scaling factor, where an initial value of the frequency scaling factor may be preset, for example, may be 1.
After the step S1022 is performed to obtain the current count value, the second frequency scaling factor, and the initial slot phase deviation, step S1023 may be performed.
In step S1023, the present scheme calculates a first frequency scaling factor according to the current count value, the initial slot phase deviation, the current slot phase deviation, and a second frequency scaling factor, wherein, as shown in fig. 5, the calculation process is specifically as follows:
step S10230: and calculating the sum of the current count value and the current time slot phase deviation to obtain a first numerical value.
Step S10231: and calculating the sum of the product of the current count value and the second frequency proportionality coefficient and the initial time slot phase deviation to obtain a second numerical value.
Step S10232: and calculating a first frequency proportionality coefficient according to the first value and the second value, wherein the first frequency proportionality coefficient is the ratio of the first value to the second value.
The steps S10230 to S10232 specifically include calculating a sum of the current count value and the current slot phase deviation to obtain a first value, calculating a sum of a product of the current count value and the second frequency scaling factor and the initial slot phase deviation to obtain a second value, and dividing the first value by the second value to obtain the first frequency scaling factor. After the first frequency proportionality coefficient is obtained, the first frequency proportionality coefficient can be stored and then used for calculating a second numerical value for obtaining the next audio synchronization when the next audio synchronization is performed.
In addition, it should be noted that, when the slot phase deviation is too large and is greater than one slot period but less than two slot periods, the obtained slot phase deviation value is equal to the actual slot phase deviation value minus the value of one slot period, for example, when one slot period is 625us, the actual slot phase deviation is 626us, but when the first slot phase deviation value obtained from the inside of the device is 2us, then in such a case, the present scheme performs the following operations:
when the time slot phase deviation is suddenly changed (particularly, suddenly changed from a large value to a small value, for example, 624 suddenly changed to 0) under the condition that the time slot phase deviation is continuously increased, adding the value of the time slot period into the current count value, and executing the process of calculating the first frequency proportionality coefficient;
when the value of the slot phase deviation is suddenly changed (specifically, suddenly changed from a small value to a large value, for example, 0 to 624) while the slot phase deviation is continuously reduced, the value of the slot period is increased in the current technical value, and the process of calculating the first frequency proportionality coefficient in the above steps is performed.
After the first frequency scaling factor is obtained by the calculation in the above step, step S104 may be executed to adjust the playing speed of the current audio data obtained by the first slave device according to the first frequency scaling factor, so that the current audio data obtained by the first slave device and the audio data corresponding to the master device are synchronously played. Specifically, the play speed adjustment may be performed in two manners, where, as shown in fig. 6, the first manner specifically includes the following steps:
Step S1040: and performing asynchronous rate conversion on the current audio data acquired by the first slave device according to the first frequency proportionality coefficient so as to adjust the playing speed of the current audio data.
In step S1040, the scheme may use the first frequency scaling factor as the extraction rate of asynchronous rate conversion, and then perform an asynchronous rate conversion algorithm, i.e. an ASRC algorithm on the received current audio data, so as to achieve audio synchronization between the first slave device and the master device, where the ASRC algorithm on the received audio data using the first frequency scaling factor may use an ASRC algorithm technology for processing the received audio data.
Specifically, the following two scenarios may be used for asynchronous rate conversion of audio data according to the number of extracted audio sampling points:
in the two calculation modes for calculating the first frequency proportionality coefficient, when the time slot phase deviation becomes larger, that is, when the current time slot phase deviation is larger than the initial time slot phase deviation, the current audio data of the slave equipment is lagged relative to the master equipment, and at the moment, the first frequency proportionality coefficient calculated by the calculation mode in the scheme is larger than 1; when the time slot phase deviation becomes smaller, that is, the current time slot phase deviation is smaller than the initial time slot phase deviation, the current audio data of the slave device is advanced relative to the master device, and at the moment, the first frequency proportionality coefficient calculated by the calculation mode in the scheme is smaller than 1; that is to say, whether the current audio data lags or advances relative to the audio data of the main device can be judged by whether the first frequency proportionality coefficient is greater than 1, and further, the advanced audio data playing speed is reduced or the lagged audio data playing speed is increased by an asynchronous rate conversion method, so that the audio data corresponding to the main device and the main device can realize playing synchronization.
In an alternative implementation of this embodiment, in addition to the foregoing method of using asynchronous rate conversion, step S104 may further implement synchronization of the current audio data of the first slave device with the audio data of the master device, which may include the following steps, as shown in fig. 7:
step S1041: and adjusting the frequency of the internal crystal oscillator of the first slave device according to the first frequency proportionality coefficient to adjust the playing speed of the audio decoder inside the first slave device on the current audio data.
In step S1041, the present solution may adjust the frequency of the local crystal oscillator in the first slave device according to the first frequency scaling factor, so that the frequency of the local crystal oscillator in the first slave device changes along with the change of the time slot phase deviation, where the adjustment of the local crystal oscillator frequency and the change of the time slot phase deviation are positively correlated, for example, if the current time slot phase deviation becomes larger relative to the initial time slot phase deviation, the crystal oscillator frequency of the first slave device is correspondingly increased, after the crystal oscillator frequency of the first slave device is increased, the decoding playing speed of the audio decoder in the first slave device on the current audio data will be affected, so that the played current audio data and the audio data played by the master device are synchronized.
In the above-designed device group audio synchronization method, the first frequency proportionality coefficient representing the degree of change of the current time slot phase deviation relative to the initial time slot phase deviation is obtained through the calculation of the current time slot phase deviation between the first slave device and the master device, and then the playing speed of the current audio data acquired by the first slave device is adjusted through the first frequency proportionality coefficient, so that the current audio data of the first slave device and the audio data corresponding to the master device are kept in synchronization.
Fig. 8 shows a schematic block diagram of an apparatus for audio synchronization of a device group according to the present application, and it should be understood that the apparatus corresponds to the embodiment of the method performed by the first slave device in fig. 1 to 7, and is capable of performing the steps involved in the method performed by the first slave device in the first embodiment, and specific functions of the apparatus may be referred to the above description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy. The device includes at least one software functional module that can be stored in memory in the form of software or firmware (firmware) or cured in an Operating System (OS) of the device. Specifically, the device comprises: an obtaining module 200, configured to obtain a current time slot phase deviation between the first slave device and the master device; a calculation module 201, configured to calculate a first frequency scaling factor according to the current time slot phase deviation, where the first frequency scaling factor represents a degree of change of the current time slot phase deviation relative to an initial time slot phase deviation, and the initial time slot phase deviation represents a time slot phase deviation between the first slave device and the master device when the first slave device establishes a connection; the adjusting module 202 is configured to adjust, according to the first frequency scaling factor, a playing speed of the current audio data acquired by the first slave device, so that synchronous playing is implemented between the current audio data acquired by the first slave device and the audio data corresponding to the master device.
In the above-designed device group audio synchronization device, the first frequency proportionality coefficient representing the degree of change of the current time slot phase deviation relative to the initial time slot phase deviation is obtained through the calculation of the current time slot phase deviation between the first slave device and the master device, and then the playing speed of the current audio data acquired by the first slave device is adjusted through the first frequency proportionality coefficient, so that the current audio data of the first slave device and the audio data corresponding to the master device are kept synchronous.
In an alternative implementation manner of this embodiment, the adjusting module 202 is specifically configured to perform asynchronous rate conversion on the current audio data obtained from the first slave device according to the first frequency scaling factor so as to adjust a playing speed of the current audio data.
In an optional implementation manner of this embodiment, the adjusting module 202 is further specifically configured to adjust, according to the first frequency scaling factor, a frequency of an internal crystal oscillator of the first slave device to adjust a playing speed of the current audio data by an audio decoder inside the first slave device.
In an alternative implementation manner of this embodiment, the calculating module 201 is specifically configured to obtain a current count value, a second frequency scaling factor, and an initial time slot phase deviation, where the current count value is a count value obtained by using a connection time established between the first slave device and the master device as a timing start point, and the second frequency scaling factor is a frequency scaling factor obtained by calculating during a previous audio synchronization, and is used to characterize a degree of change between the time slot phase deviation obtained during the previous audio synchronization and the initial time slot phase deviation; and calculating a first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient.
In an optional implementation manner of this embodiment, the calculating module 201 is further specifically configured to obtain an initial slot phase deviation; and calculating a first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation.
In an optional implementation manner of this embodiment, the obtaining module 200 is specifically configured to obtain a first time when the first slave device receives the sync word of the current frame transmitted by the master device; acquiring the starting time of the current time slot of the internal clock of the slave device at the first time; and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
As shown in fig. 9, the present application provides an electronic apparatus 3 including: processor 301 and memory 302, the processor 301 and memory 302 being interconnected and in communication with each other by a communication bus 303 and/or other form of connection mechanism (not shown), the memory 302 storing a computer program executable by the processor 301, the processor 301 executing the computer program when the computing device is running to perform the method in any of the aforementioned alternative implementations, e.g. steps S100 to S104: acquiring the current time slot phase deviation between the first slave device and the master device; calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the variation degree of the current time slot phase deviation relative to the initial time slot phase deviation; and adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment.
The present application provides a storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the preceding alternative implementations.
The storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as static random access Memory (Static Random Access Memory, SRAM), electrically erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
The application provides a computer program product which, when run on a computer, causes the computer to perform the method of any of the preceding alternative implementations.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
Further, the units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Furthermore, functional modules in various embodiments of the present application may be integrated together to form a single portion, or each module may exist alone, or two or more modules may be integrated to form a single portion.
It should be noted that the functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a computing device, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM) random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (7)

1. A method of device group audio synchronization, wherein the device group comprises a master device and at least one slave device, the master device and each slave device being connected by bluetooth, the method being applied to a first slave device of the at least one slave device, comprising:
acquiring the current time slot phase deviation between the first slave device and the master device;
calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the variation degree of the current time slot phase deviation relative to the initial time slot phase deviation, and the initial time slot phase deviation represents the time slot phase deviation between the first slave equipment and the master equipment when the first slave equipment is connected with the master equipment;
Adjusting the playing speed of the current audio data acquired by the first slave device according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave device and the audio data corresponding to the master device;
the calculating a first frequency scaling factor according to the current time slot phase deviation includes:
acquiring a current count value, a second frequency proportionality coefficient and the initial time slot phase deviation, wherein the current count value is a count value obtained by taking the moment of establishing connection between the first slave device and the master device as a timing starting point, and the second frequency proportionality coefficient is a frequency proportionality coefficient calculated by the first slave device in the last audio synchronization and is used for representing the change degree of the time slot phase deviation and the initial time slot phase deviation obtained in the last audio synchronization;
calculating the first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient;
or, the calculating a first frequency scaling factor according to the current time slot phase deviation includes:
acquiring the initial time slot phase deviation;
Calculating to obtain the first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation;
the obtaining the current time slot phase deviation between the first slave device and the master device comprises the following steps:
acquiring a first moment when the first slave device receives a synchronous word of a current frame transmitted by the master device;
acquiring the starting time of the current time slot of the internal clock of the first slave device at the first time;
and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
2. The method of claim 1, wherein adjusting the playback speed of the current audio data obtained by the first slave device according to the first frequency scaling factor comprises:
and performing asynchronous rate conversion on the current audio data acquired by the first slave device according to the first frequency proportionality coefficient so as to adjust the playing speed of the current audio data.
3. The method of claim 1, wherein adjusting the playback speed of the current audio data obtained by the first slave device according to the first frequency scaling factor comprises:
and adjusting the frequency of the internal crystal oscillator of the first slave device according to the first frequency proportionality coefficient so as to adjust the playing speed of the audio decoder in the first slave device on the current audio data.
4. The method of claim 1, wherein said calculating said first frequency scaling factor based on said current count value, an initial slot phase offset, a current slot phase offset, and a second frequency scaling factor comprises:
calculating the sum of the current count value and the current time slot phase deviation to obtain a first value;
calculating the sum of the product of the current count value and the second frequency proportionality coefficient and the initial time slot phase deviation to obtain a second numerical value;
and calculating the first frequency proportionality coefficient according to the first value and the second value, wherein the first frequency proportionality coefficient is the ratio of the first value to the second value.
5. A device group audio synchronization apparatus, wherein the device group includes a master device and at least one slave device, the master device and each slave device being connected by bluetooth, the apparatus being applied to a first slave device of the at least one slave device, comprising:
An acquisition module, configured to acquire a current time slot phase deviation between the first slave device and the master device;
the calculation module is used for calculating a first frequency proportionality coefficient according to the current time slot phase deviation, wherein the first frequency proportionality coefficient represents the change degree of the current time slot phase deviation relative to the initial time slot phase deviation, and the initial time slot phase deviation represents the time slot phase deviation between the first slave equipment and the master equipment when the first slave equipment is connected with the master equipment;
the adjusting module is used for adjusting the playing speed of the current audio data acquired by the first slave equipment according to the first frequency proportionality coefficient so as to realize synchronous playing of the current audio data acquired by the first slave equipment and the audio data corresponding to the master equipment;
the calculation module is specifically configured to obtain a current count value, a second frequency scaling factor, and the initial time slot phase deviation, where the current count value is a count value obtained by taking a time when the first slave device establishes connection with the master device as a timing start point, and the second frequency scaling factor is a frequency scaling factor calculated by the first slave device during a previous audio synchronization, and is used to characterize a degree of change between the time slot phase deviation obtained during the previous audio synchronization and the initial time slot phase deviation; calculating the first frequency proportionality coefficient according to the current count value, the initial time slot phase deviation, the current time slot phase deviation and the second frequency proportionality coefficient;
Or, the calculation module is specifically configured to obtain the initial time slot phase deviation; calculating to obtain the first frequency proportionality coefficient according to the current time slot phase deviation and the initial time slot phase deviation, wherein the first frequency proportionality coefficient is the ratio of the current time slot phase deviation to the initial time slot phase deviation;
the acquisition module is specifically configured to acquire a first moment when the first slave device receives a synchronization word of a current frame transmitted by the master device; acquiring the starting time of the current time slot of the internal clock of the first slave device at the first time; and calculating the current time slot phase deviation according to the first time and the starting time, wherein the current time slot phase deviation is the time difference between the first time and the starting time.
6. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the method of any of claims 1 to 4 when executing the computer program.
7. A storage medium having stored thereon a computer program, which when executed by a processor, implements the method of any of claims 1 to 4.
CN202011199619.1A 2020-10-30 2020-10-30 Equipment group audio synchronization method and device, electronic equipment and storage medium Active CN112311521B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011199619.1A CN112311521B (en) 2020-10-30 2020-10-30 Equipment group audio synchronization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011199619.1A CN112311521B (en) 2020-10-30 2020-10-30 Equipment group audio synchronization method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112311521A CN112311521A (en) 2021-02-02
CN112311521B true CN112311521B (en) 2023-11-17

Family

ID=74333449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011199619.1A Active CN112311521B (en) 2020-10-30 2020-10-30 Equipment group audio synchronization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112311521B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014078818A1 (en) * 2012-11-16 2014-05-22 Blackfire Research Corporation Common event-based multidevice media playback
CN104469413A (en) * 2014-12-30 2015-03-25 中山大学花都产业科技研究院 Local area network multi-terminal synchronous playing time deviation calculation improving method
CN105245976A (en) * 2015-09-30 2016-01-13 合一网络技术(北京)有限公司 Method and system for synchronously playing audio and video
CN105992025A (en) * 2015-02-15 2016-10-05 深圳市民展科技开发有限公司 Audio synchronous playing-based system time calibration method, audio synchronous playing method and devices
CN110784276A (en) * 2018-07-26 2020-02-11 集成装置技术公司 Zero offset clock distribution
CN111405336A (en) * 2019-08-09 2020-07-10 合肥炬芯智能科技有限公司 Multi-device synchronous playing method and system, electronic device and storage medium
CN111654350A (en) * 2020-07-07 2020-09-11 范雯 Method for detecting frequency deviation of communication transmission network element equipment
CN111817811A (en) * 2020-06-22 2020-10-23 芯原微电子(上海)股份有限公司 TWS earphone audio frequency synchronous playing method and system, TWS earphone

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104244399B (en) * 2014-09-15 2018-04-17 歌尔股份有限公司 The method of time synchronization, wireless device and wireless communication system between wireless device
CN107040327B (en) * 2017-06-14 2019-04-02 深圳市华信天线技术有限公司 Slave TDMA slot synchronous calibration method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014078818A1 (en) * 2012-11-16 2014-05-22 Blackfire Research Corporation Common event-based multidevice media playback
CN104937919A (en) * 2012-11-16 2015-09-23 黑焰研究公司 Common event-based multidevice media playback
CN104469413A (en) * 2014-12-30 2015-03-25 中山大学花都产业科技研究院 Local area network multi-terminal synchronous playing time deviation calculation improving method
CN105992025A (en) * 2015-02-15 2016-10-05 深圳市民展科技开发有限公司 Audio synchronous playing-based system time calibration method, audio synchronous playing method and devices
CN105245976A (en) * 2015-09-30 2016-01-13 合一网络技术(北京)有限公司 Method and system for synchronously playing audio and video
CN110784276A (en) * 2018-07-26 2020-02-11 集成装置技术公司 Zero offset clock distribution
CN111405336A (en) * 2019-08-09 2020-07-10 合肥炬芯智能科技有限公司 Multi-device synchronous playing method and system, electronic device and storage medium
CN111817811A (en) * 2020-06-22 2020-10-23 芯原微电子(上海)股份有限公司 TWS earphone audio frequency synchronous playing method and system, TWS earphone
CN111654350A (en) * 2020-07-07 2020-09-11 范雯 Method for detecting frequency deviation of communication transmission network element equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
晶振频率偏差补偿的无线传感器网络时间同步算法;王世军;徐朝农;安竹林;徐勇军;牛斗;;小型微型计算机系统(第11期);全文 *
王世军 ; 徐朝农 ; 安竹林 ; 徐勇军 ; 牛斗 ; .晶振频率偏差补偿的无线传感器网络时间同步算法.小型微型计算机系统.2008,(第11期),全文. *
电力系统中基于SDH的时间同步系统研究;陈宁;李洪涛;俞刚;;科学技术与工程(第16期);全文 *

Also Published As

Publication number Publication date
CN112311521A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
US7916758B2 (en) Method and system for precise-clock synchronization, and device for precise-clock frequency/time synchronization
US20150134764A1 (en) Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method
US8566632B2 (en) Multi-rate sampling for network receiving nodes using distributed clock synchronization
US10666417B1 (en) Time synchronization using timestamp exchanges
CN103563287B (en) Synchronization device and synchronization method
US10594424B2 (en) Time synchronization slave apparatus capable of adjusting time synchronization period, and method of determining time synchronization period
US10187280B2 (en) Using a two-way active measurement protocol to calculate one-way delay
WO2018104237A1 (en) Method, device, and computer program for improving synchronization of clocks in devices linked according to a daisy-chain topology
CN112911701B (en) Frequency offset control method and device, terminal and storage medium
CN115080495B (en) Time synchronization method and system for standard peripheral extension interface equipment
CN107800529B (en) Clock frequency synchronization method of network node
CN111510235A (en) Audio clock synchronization method, device, system, computer device and storage medium
US10069583B2 (en) Faster synchronization time and better master selection based on dynamic accuracy information in a network of IEEE 1588 clocks
JP6010802B2 (en) Time synchronization system, time synchronization method, slave node, and computer program
CN112311521B (en) Equipment group audio synchronization method and device, electronic equipment and storage medium
CN110661578B (en) Data recovery method and device
CN114157677A (en) Data synchronization method and related product
CN117112508B (en) File synchronization method and device based on serial numbers, computer equipment and storage medium
JP6800390B2 (en) Communication devices, communication systems, communication methods and communication programs
CN112511255B (en) Time synchronization method and device
JP5115265B2 (en) Information processing apparatus and timing synchronization method
JP6085864B2 (en) Time synchronization system, time synchronization method, slave node, and computer program
JP7114957B2 (en) Wireless communication device, program and time information acquisition method
CN114598412B (en) Clock synchronization processing method and device, electronic equipment, storage medium and product
CN112019288B (en) Time synchronization method, service single board and network equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant