CN115913431A - Method for synchronous playing of master and slave playing devices, slave playing device and playing system - Google Patents
Method for synchronous playing of master and slave playing devices, slave playing device and playing system Download PDFInfo
- Publication number
- CN115913431A CN115913431A CN202110966288.8A CN202110966288A CN115913431A CN 115913431 A CN115913431 A CN 115913431A CN 202110966288 A CN202110966288 A CN 202110966288A CN 115913431 A CN115913431 A CN 115913431A
- Authority
- CN
- China
- Prior art keywords
- playing
- slave
- master
- adjustment
- adjusted
- 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.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Indexing, Searching, Synchronizing, And The Amount Of Synchronization Travel Of Record Carriers (AREA)
Abstract
The invention discloses a method for synchronously playing master and slave playing devices, a slave playing device and a playing system, wherein when the initial time deviation is determined to be not zero, the master playing device and the slave playing device can be considered to be not synchronously played, at the moment, the slave playing device can adjust the current first playing speed according to the initial time deviation, and when the adjustment is determined to be completed, the first playing speed of the slave playing device is controlled, so that the master playing device and the slave playing device synchronously play the same data at the same playing speed, namely, the time deviation is used as a reference, the first playing speed of the slave playing device is adjusted, the time deviation of the master playing device and the slave playing device can be controlled within one sample point, more accurate adjustment is realized, and the master playing device and the slave playing device can effectively and synchronously play.
Description
Technical Field
The present invention relates to the field of audio technologies, and in particular, to a method for synchronously playing back audio data by a master playback device and a slave playback device, and a playback system.
Background
The speaker playing system may include: the main sound box and the slave sound box can play the same audio data; the master loudspeaker box and the slave loudspeaker box can not be played synchronously due to factors such as an audio data transmission mode or a data transmission network, and when the master loudspeaker box and the slave loudspeaker box are arranged at a short distance, the master loudspeaker box and the slave loudspeaker box are interfered with each other due to asynchronization, so that a user can not hear audio contents played by the master loudspeaker box and the slave loudspeaker box clearly, and the user experience is reduced.
Disclosure of Invention
The embodiment of the invention provides a method for synchronously playing by a master playing device and a slave playing device and a playing system, which can enable the master playing device and the slave playing device to synchronously play the same audio data.
In a first aspect, an embodiment of the present invention provides a method for synchronous playback by a master playback device and a slave playback device, where the method includes:
when the slave playing equipment receives an indication message which is sent by the master playing equipment and comprises a first sample point number and first corresponding time, determining a second sample point number and second corresponding time; wherein the first sample point number is: the number of sample points played in the data currently played by the main playing device is as follows: the number of sample points played in the data played currently by the slave playing device;
the slave playing equipment determines an initial time deviation according to the first sample point number and the first corresponding time, and the second sample point number and the second corresponding time;
when the initial time deviation is not zero, the slave playing equipment adjusts the current first playing speed according to the initial time deviation;
the slave playback device controls the adjusted first playback rate when it is determined that the adjustment is completed, such that: and the master playing device and the slave playing device synchronously play at the same playing speed.
In a second aspect, an embodiment of the present invention provides a slave playback device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the method provided by the embodiment of the invention according to the obtained program.
In a third aspect, an embodiment of the present invention provides a playback system, including: the slave playback device provided by the embodiment of the present invention is connected to the master playback device;
the main playback device is configured to: sending an indication message comprising a first sample point number and a first corresponding time to the slave playing device;
the slave playback device is configured to: and when the indication message is received, controlling the master playing device and the slave playing device to synchronously play at the same playing speed.
The invention has the following beneficial effects:
when it is determined that the initial time deviation is not zero, the master playing device and the slave playing device may not play synchronously, and at this time, the slave playing device may adjust the current first playing rate according to the initial time deviation, and when it is determined that the adjustment is completed, control the first playing rate of the slave playing device, so that the master playing device and the slave playing device both play the same data synchronously at the same playing rate, that is, adjust the first playing rate of the slave playing device with reference to the time deviation, so that the time deviation of the master playing device and the slave playing device may be controlled within one sample point, thereby achieving more accurate adjustment, and enabling the master playing device and the slave playing device to play effectively synchronously.
Drawings
Fig. 1 is a flowchart of a method for synchronous playback by a master playback device and a slave playback device according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of sample point numbers and corresponding times provided in an embodiment of the invention;
fig. 3 is a schematic diagram of collecting a first sample point number and a second sample point number provided in the embodiment of the present invention;
fig. 4 is a schematic structural diagram of a slave playback device provided in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a playing system provided in an embodiment of the present invention.
Detailed Description
The following describes in detail specific embodiments of a method for synchronous playing by a master playback device and a slave playback device, and a playback system according to an embodiment of the present invention, with reference to the accompanying drawings. It should be noted that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The inventor finds in research that, in the process of playing the same audio data by the master-slave playing device, the slave playing device may be slowed down or speeded up for some reasons, and thus the master-slave playing device cannot play synchronously.
In order to solve the problem, for the slave playback device, the sample point deviation of the playback between the slave playback device and the master playback device may be calculated, and the playback rate of the slave playback device may be adjusted based on the sample point deviation, so that the sample point deviation is zero, thereby achieving the purpose of synchronous playback.
However, in this method, the adjustment is performed based on the sample point deviation, and the values of the sample points are discrete and limited in precision, so that the adjusted effect is not ideal enough, that is, it can be determined that the master playback device and the slave playback device are not synchronous or aligned only when at least one sample point difference is reached between the master playback device and the slave playback device.
For example, taking a sampling rate of 48k as an example, the playback time of one sample point is 20.8us, that is, the synchronization deviation between the master playback device and the slave playback device reaches more than 20.8us, so that it can be determined that the master playback device and the slave playback device are not synchronized.
Therefore, the master and slave playing devices cannot play synchronously and accurately in this way.
Based on this, the embodiment of the present invention provides a method for synchronous playing of a master playback device and a slave playback device, which is used for more accurately and effectively implementing synchronous playing of the master playback device and the slave playback device.
Specifically, a method for synchronous playing by a master playing device and a slave playing device provided in an embodiment of the present invention, as shown in fig. 1, may include:
s101, when receiving an indication message which is sent by a main playing device and comprises a first sample point number and first corresponding time, a slave playing device determines a second sample point number and second corresponding time; wherein, the first sample point number is: the number of sample points played in the data currently played by the main playing device is as follows: the number of sample points played in the data currently played by the playing device;
specifically, the master playback device and the slave playback device mentioned in the embodiments of the present invention may be: the specific form of the master-slave playing device is not limited herein, and the devices such as a sound box or an earphone and the like can play audio.
Specifically, the played data mentioned in the embodiment of the present invention may be: the audio data or the non-audio data, such as, but not limited to, data corresponding to the time required to be played, etc., is not limited herein.
Specifically, for the main playback device, taking playing audio data as an example, when obtaining the first sample point number and the first corresponding time, the following manner may be adopted:
upon receiving new audio data, a first number of sample points and a first corresponding time are determined.
And, for the master playback device, assuming that the audio data a is currently being played, and the audio data of the slave playback device is forwarded by the master playback device, then:
when receiving the audio data B, determining the number of sample points (namely, the number of first sample points) played in the audio data A and a first corresponding time;
adding the determined first sample point number, the first corresponding time and the current second playing speed into the head information of the audio data B to form audio data B';
an indication message including the audio data B' is sent to the slave playback device.
It should be noted that, for the master playing device, when the first sample point number is determined, the indication message is immediately sent to the slave playing device, so that delay of a long time between the time of determining the first sample point number and the time of sending the indication message is avoided, and it is favorable to ensure that time deviation of the master playing device and the slave playing device can be controlled within one sample point, and further, it is favorable to implement accurate adjustment.
For the slave playback device, assuming that audio data a is currently being played as well, then:
when the indication message is received, determining the number of sample points (namely, a second sample point) played in the audio data A and a second corresponding time;
extracting audio data B, the first sample point number, the first corresponding time and the current second playing speed of the main playing device from the indication message;
then, based on the following contents introduced in S102 to S104, the master-slave playing device can synchronously play the audio data B; if the master-slave playing device does not play the audio data a when the slave playing device is adjusted, the master-slave playing device continues to synchronously play the audio data a, and then synchronously plays the audio data B.
For data to be played, a plurality of sample points may be included, and the sample points are played one by one, and the number of sample points is discrete, but the time is continuous, and each time a sample point is played, there may be a time. It should be noted that the sample points mentioned in the embodiments of the present invention refer to: the smallest unit of data unit processed in the playback device, for example, if it is audio data, it refers to the smallest audio data unit sent to the codec in a mono or multi-channel audio system; in the case of video data, this means a single frame of data that can be decoded.
As shown in FIG. 2, the numbers "0" to "8" in the figure respectively represent the number of sample points played, t 0 To t 8 The time corresponding to each sample point played is represented, and the playing time (represented by T0 in the figure) of each sample point can be 20.8us when the sampling rate is 48 k.
In addition, although fig. 2 illustrates only 8 sample points as an example, this does not mean that actual data includes only 8 sample points, and in an actual case, the number of sample points included in the data is not limited to this.
S102, the slave playing device determines an initial time deviation according to the first sample point number and the first corresponding time, and the second sample point number and the second corresponding time;
s103, when the initial time deviation is not zero, the slave playing equipment adjusts the current first playing speed according to the initial time deviation;
s104, the slave playing device controls the adjusted first playing speed when the adjustment is determined to be completed, so that: the master playing device and the slave playing device play synchronously at the same playing speed.
Therefore, when it is determined that the initial time deviation is not zero, the master playing device and the slave playing device are not played synchronously, at this time, the slave playing device can adjust the current first playing rate according to the initial time deviation, and when it is determined that the adjustment is completed, the first playing rate of the slave playing device is controlled, so that the master playing device and the slave playing device both play the same data synchronously at the same playing rate, that is, the first playing rate of the slave playing device is adjusted by taking the time deviation as a reference, so that the time deviation of the master playing device and the slave playing device can be controlled within one sample point, more accurate adjustment is realized, and the master playing device and the slave playing device can play effectively and synchronously.
Optionally, in this embodiment of the present invention, the second corresponding time is: the number of sample points played in the data played by the slave playing device at present is the corresponding time when the number of the second sample points;
the first corresponding time is: and the number of the played sample points in the data currently played by the main playing device is the time corresponding to the first sample point.
That is, for the slave playback device, when the slave playback device receives the instruction message, it is determined whether the sample point number changes, that is: taking the received indication message as a trigger condition for judgment, and judging immediately as long as the indication message is received;
if the change is judged, the time of the moment of the change is immediately collected; namely, the change of the number of sample points is used as a trigger condition of the acquisition time;
and taking the changed sample point number as a second sample point number, and taking the acquired time as second corresponding time.
Similarly, for the main playback device, when new data is received, it is determined whether the number of sample points changes, that is: taking the received new data as a trigger condition for judgment, and judging immediately as long as the new data is received;
if the change is judged, the time of the moment of the change is immediately collected; namely, the change of the number of sample points is used as a trigger condition of the acquisition time;
and taking the changed number of sample points as a first number of sample points, and taking the acquired time as a first corresponding time.
Therefore, the determined first sample point number and the first corresponding time are tightly bound, and the second sample point number and the second corresponding time are also tightly bound, so that the discrete error of the sample point number can be eliminated, and the adjustment precision is improved.
Specifically, in the embodiment of the present invention, the difference between the first sample point number and the second sample point number may be 1, that is: when the master playing device determines the first sample point number and the first corresponding time, the indication message can be sent to the slave playing device, so that the slave playing device can determine the second sample point number and the second corresponding time when receiving the indication message, the difference value between the first sample point number and the second sample point number can be very small, namely 1, so that after the current first playing speed of the slave playing device is adjusted based on the difference value, the time deviation of the master playing device and the slave playing device can be controlled within one sample point, more accurate adjustment is realized, and the master playing device and the slave playing device can effectively play synchronously.
Of course, in the implementation, in order to achieve higher precision, the difference between the first sample point number and the second sample point number may be determined according to the actual situation within the microsecond range of the deviation control, and is not limited herein.
Specifically, in the embodiment of the present invention, regardless of whether the main playback device collects the first sample point number and the first corresponding time, or collects the second sample point number and the second corresponding time from the playback device, the collection method may be implemented by software, or may be implemented by hardware;
when the method is realized through software, the number of sample points can be read circularly, whether the change occurs or not is judged, and the time is read immediately when the change occurs so as to finish the acquisition;
when the hardware is implemented, the number of sample points can be read circularly, whether the sample points change or not is judged, and when the number of the sample points change, the number of the sample points and the time at the moment are latched to finish acquisition.
Of course, in the specific implementation, the implementation may be realized by software or hardware according to actual needs, and is not limited herein.
Optionally, in the embodiment of the present invention, the method may further include:
and when the slave playing device determines that the initial time deviation is zero, keeping the current first playing speed unchanged.
Therefore, when the initial time deviation is determined to be zero, the playing of the master playing device and the slave playing device is in a synchronous state, and the first playing speed of the slave playing device does not need to be adjusted, so that the playing can be continued at the current first playing speed, and the master playing device and the slave playing device can continue to play synchronously.
Optionally, in this embodiment of the present invention, controlling the adjusted first playback rate when it is determined that the adjustment is completed includes:
when the indication message further comprises the current second playing speed of the main playing device and the adjustment is determined to be completed, determining the current second playing speed of the main playing device according to the indication message;
and continuously adjusting the adjusted first playing speed to be the current second playing speed.
When the slave playback device completes the adjustment of the first playback rate, the adjusted first playback rate needs to be controlled, which is because:
if the slave playing device does not adjust the adjusted first playing speed to the current second playing speed of the master playing device when the adjustment is completed, then:
if the first playing rate of the slave playing device is smaller than the current second playing rate of the master playing device, although the adjustment is completed before, after playing for a certain time, the master playing device and the slave playing device still play asynchronously, and the slave playing device plays slower than the master playing device;
or, if the first play rate of the slave play device is greater than the current second play rate of the master play device, although the adjustment is completed before, after playing for a certain time, the master play device and the slave play device still play asynchronously, and the slave play device plays faster than the master play device;
therefore, when the adjustment is completed, the slave playing device needs to adjust the first playing rate to the current second playing rate of the master playing device, so that the master playing device and the slave playing device both play at the current second playing rate, and synchronous playing is realized.
Optionally, in this embodiment of the present invention, determining an initial time offset according to the first number of sample points and the first corresponding time, and the second number of sample points and the second corresponding time specifically includes:
the initial time offset is determined using the following equation:
Δt=(s-m)/Sr-(t s -t m );
where Δ t represents an initial time deviation, m represents a first sample point number, s represents a second sample point number, sr represents a current first playback rate from the playback device, t represents a current first playback rate from the playback device m Denotes a first corresponding time, t s Representing a second corresponding time.
For example, as shown in fig. 3, the first sample point number collected by the main playback device (i.e. the dotted line 1 in fig. 3 may represent the collection time of the main playback device) is m, and the first corresponding time is t m The second number of sample points collected from the playback device (i.e. the dotted line 2 in fig. 3 may indicate the time of collection from the playback device) iss, the second corresponding time being t s (ii) a Wherein, t s Greater than t m S is greater than m; then:
when the first playing speed of the slave playing device is the same as the current second playing speed of the master playing device, the calculated delta t is 0, which indicates that the master playing device and the slave playing device are currently in a synchronous playing state, and the slave playing device does not have the situation of playing delay or playing advance;
when the first playing speed of the slave playing device is different from the current second playing speed of the master playing device, the calculated Δ t is not equal to 0, which indicates that the master playing device and the slave playing device are currently in an asynchronous playing state, and the slave playing device needs to adjust the first playing speed of the slave playing device when the playing is delayed or advanced.
Optionally, in the embodiment of the present invention, adjusting the current play rate according to the initial time offset specifically includes:
when the initial time deviation is larger than zero, reducing the current first playing speed; or, when the initial time deviation is less than zero, increasing the current first playing speed;
and monitoring the adjustment result according to a preset monitoring period, and when the adjustment is determined not to be completed according to the adjustment result, continuously adjusting the adjusted first playing rate according to the adjustment result until the adjustment is determined to be completed.
Specifically, when the current first playing speed is decreased or increased, the specific decrease value or increase value may be set according to a preset adjustment step length, or may be set randomly according to experience, needs, and adjustment efficiency, which is not limited herein.
That is, the current first play rate is first adjusted based on the initial time deviation, then the adjustment result is monitored based on the monitoring period, and it is determined whether the adjustment is completed or not according to the adjustment, and the adjustment is continued when the adjustment is not completed.
The reason for this is that:
the slave playing device needs a certain time when adjusting the first playing speed;
the slave playing device determines an initial time offset (denoted by Δ t) at a certain time (which may be denoted by tx), and assuming that a time interval during which the master playing device continuously transmits the indication message twice is denoted by Tb, before the time tx + Tb, the slave playing device may be adjusted to be synchronized and aligned with the master playing device, and then it is not necessary to adjust the first playing rate fast or slow down to avoid an increase in time offset fluctuation between the master playing device and the slave playing device;
therefore, the adjustment result needs to be monitored, and when the adjustment is determined to be completed according to the adjustment result, the adjustment is not needed, so that the time deviation is prevented from appearing again when the adjustment is continued, and the time deviation fluctuation between the master playback device and the slave playback device can be effectively reduced.
Specifically, in the embodiment of the present invention, the monitoring period is less than the time interval between two consecutive times of sending the indication message by the main playback device.
When the monitoring period is denoted by Tc and the time interval of the main playing device for continuously sending the indication message twice is denoted by Tb, tc is less than Tb.
And Tc can be set to be smaller, so that the monitoring can be carried out once in a short time, the interval between the monitoring is shortened, the adjustment result can be rapidly monitored, and the adjustment is not continued according to the initial time deviation when the adjustment is determined to be finished, so that the fluctuation of the time deviation between the master playing equipment and the slave playing equipment can be effectively reduced, and the aim of rapidly and effectively synchronizing the playing is fulfilled.
Specifically, the time interval between two consecutive transmissions of the indication message by the main playback device is not a fixed value, and may be randomly changed, so to implement effective monitoring, an empirical range of the time interval may be determined empirically, and then the size of the monitoring period may be determined based on the empirical range.
It should be noted that, if the slave playback device has not completed adjustment when receiving the next indication message sent by the master playback device, then for the slave playback device:
the number of second sample points and second corresponding time need to be collected again;
recalculating the initial time deviation according to the first sample point number and the first corresponding time in the received new indication message, and the second sample point number and the first corresponding time which are acquired again;
the adjustment is performed based on the recalculated initial time offset, i.e., the above S103 and S104 are performed again based on the recalculated initial time offset.
Optionally, in the embodiment of the present invention, monitoring the adjustment result according to a preset monitoring period specifically includes:
when the indication message further comprises a current second playing speed of the main playing device and reaches the monitoring period, determining the adjusted time deviation according to the adjusted first playing speed, the current second playing speed and the monitoring period;
and comparing the magnitude relation between the adjusted time deviation and the initial time deviation to determine an adjustment result.
That is to say, when the monitoring period is reached, the time deviation which has been adjusted can be determined, and at this time, the time deviation can be compared with the initial time deviation, so that the adjustment result of this time can be determined, whether the adjustment is completed or not can be determined subsequently, the fluctuation of the deviation between the master playback device and the slave playback device back and forth can be avoided, and the fast and effective synchronous playback can be realized.
Optionally, in the embodiment of the present invention, determining whether the adjustment is completed according to the adjustment result specifically includes:
judging whether the adjusted time deviation is equal to the initial time deviation or not;
if not, determining that the adjustment is not finished;
if so, determining that the adjustment is completed.
That is, when the adjusted time offset is equal to the initial time offset, it indicates that the initially determined initial time offset has been adjusted, and the current master-slave playback device has no time offset, so that it can be considered that the adjustment has been completed, and the adjustment is not continued according to the adjustment result, thereby avoiding the occurrence of larger offset fluctuation.
Optionally, in this embodiment of the present invention, when it is determined that the adjustment is not completed according to the adjustment result, the continuously adjusting the adjusted first play rate according to the adjustment result specifically includes:
if the absolute value of the adjusted time deviation is larger than the absolute value of the initial time deviation, reducing the adjusted first playing speed;
if the absolute value of the adjusted time deviation is smaller than the absolute value of the initial time deviation, the adjusted first playing speed is kept or increased.
That is, when the absolute value of the adjusted time deviation is greater than the absolute value of the initial time deviation, it indicates that the adjustment has been performed and increased, and therefore the adjustment needs to be performed again, and the adjusted first playing speed needs to be reduced;
when the absolute value of the adjusted time deviation is smaller than the absolute value of the initial time deviation, it indicates that the adjustment is not finished, and a certain time deviation still exists between the master playing device and the slave playing device, and the adjustment needs to be continued, so that the adjustment can be continued or the current first playing speed can be increased according to the current first playing speed until the adjustment is finished.
The following examples are given.
For example, assume that: the time interval of the main playing device sending the indication message twice continuously is 5s, the monitoring period can be set to be 1s, and 1s is less than 5s; if the initial time deviation Δ t is-900 us, the current second playing speed of the main playing device is 20/s, and the second playing speed of the main playing device is assumed to be always kept at 20/s, and the playing time corresponding to each sample point is 20us; at this time:
since Δ t <0, it indicates that the slave playback device is currently playing slowly (assuming that the slave playback device is currently playing at the first playback rate of 18/s), the first playback rate of the slave playback device needs to be adjusted faster to synchronize and align with the playback of the master playback device, and thus the first playback rate of the slave playback device can be increased to 30/s;
when the first monitoring period comes, that is, the first 1s comes, it is determined that the absolute value of the adjusted time deviation is 200us, which is 700us less than the absolute value of Δ t, which indicates that the current time has not been adjusted, that is, the slave playing device is slower than the master playing device, and the difference between the absolute value of the adjusted time deviation and the absolute value of the initial time deviation is larger, so that the first playing speed of the slave playing device can be continuously increased, that is, the first playing speed can be increased to 40/s, that is, the adjustment is continuously performed at the first playing speed of 40/s;
when the second monitoring period comes, that is, when the second 1s comes, in the time period from the first monitoring period to the second monitoring period, when the slave playing device plays at the first playing speed of 40/s, the absolute value of the adjusted time deviation is 400us, plus the adjusted 200us in the first monitoring period, the absolute value of the total adjusted time deviation is 600us, and the difference is 300us compared with the absolute value of Δ t, which indicates that the current adjustment is still not completed, that is, the slave playing device is still slower than the master playing device, and the adjustment can be continued at the current first playing speed of 40/s;
when the third monitoring period comes, that is, when the third 1s comes, in the time period from the second monitoring period to the third monitoring period, when the slave playing device plays at the first playing speed of 40/s, the absolute value of the adjusted time deviation is 400us, and then 600us adjusted in the first two monitoring periods are added, the absolute value of the total adjusted time deviation is 1000us and 100us more than the absolute value of Δ t, which indicates that the slave playing device plays faster than the master playing device, and the first playing speed of the slave playing device needs to be reduced, that is, the first playing speed of the slave playing device can be reduced from 40/s to 15/s, that is, the adjustment is continued at the first playing speed of 15/s;
when the fourth monitoring period comes, that is, the fourth 1s comes, in the time period from the third monitoring period to the fourth monitoring period, when the playing device plays at the first playing speed of 15/s, the absolute value of the adjusted time deviation is 100us, the adjusted 1000us in the previous three monitoring periods is subtracted from the currently adjusted 100us, the absolute value of the currently adjusted time deviation is determined to be 900us, and the absolute value is the same as the absolute value of Δ t, which indicates that the adjustment is completed, so that the adjustment completion can be determined.
Moreover, 1s of time remains until receiving the next indication message sent by the main playing device, so that the tuning is finished before receiving the next indication message sent by the main playing device; at this time, the slave playback device may adjust the current first playback rate (i.e. 15/s) back to the second playback rate (i.e. 20/s) of the master playback device to continue playing, and when the next indication message sent by the master playback device arrives, it may be determined that the master playback device has synchronized and aligned playing.
It should be noted that, optionally, for the master playback device, the second playback rate may change, but the change is generally small, so that under the condition that the second playback rate of the master playback device is assumed to be constant, the slave playback device may adjust based on the constant second playback rate to achieve the purpose of synchronous playback;
or, the slave playing device may further adjust according to the current second playing rate included in the indication message, so that the synchronization is more accurate and effective.
It should be further noted that, in the embodiment of the present invention, when the first play rate of the slave play device is adjusted, if the play rate of the slave play device is greatly different from the play rate of the master play device, a larger adjustment range may be used for adjustment (also may be understood as coarse adjustment), and if the play rate of the slave play device is smaller than the play rate of the master play device, a smaller adjustment range may be used for adjustment (also may be understood as fine adjustment), so as to quickly and effectively adjust the play rate of the slave play device, and thus the play of the master play device and the slave play device is synchronized.
Based on the same inventive concept, an embodiment of the present invention provides a slave playback device, where an implementation principle of the slave playback device is similar to an implementation principle of the foregoing method for synchronous playback by a master playback device and a slave playback device, and specific implementation manners of the slave playback device may refer to specific embodiments of the foregoing methods, and repeated descriptions are omitted.
Specifically, as shown in fig. 4, the slave playback device provided in the embodiment of the present invention may include:
a memory 401 for storing program instructions;
the processor 402 is used for calling the program instructions stored in the memory 401 and executing the above method according to the embodiment of the present invention according to the obtained program.
Based on the same inventive concept, an embodiment of the present invention provides a playing system, as shown in fig. 5, which may include: a master playback device 501, and the slave playback device 502 provided in the embodiment of the present invention;
the master playback device 501 is configured to: sending an indication message including the first sample point number and the first corresponding time to the slave playback device 502;
the slave playback device 502 is used to: upon receiving the instruction message, the master playback device 501 and the slave playback device 502 are controlled to perform synchronized playback at the same playback rate.
Among them, in the playback system, the number of settings of the slave playback devices may be at least one.
Moreover, there are 2 slave playback devices 502 shown in fig. 5, but this does not mean that the actual playback system includes only two slave playback devices 502, and here, only two slave playback devices 502 are taken as an example for description, and the specific number of slave playback devices 502 that can be set according to actual needs is not limited here.
Optionally, in an embodiment of the present invention, a manner of obtaining the same data played by the master playback device and the slave playback device may include:
mode 1:
specifically, when the master playback device acquires data from the audio output device, the acquired data is sent to the slave playback device.
That is, the master playback device directly obtains data from the audio output device, and the data played back from the slave playback device is forwarded by the master playback device.
Mode 2:
specifically, the master and slave playback devices both obtain data directly from the audio output device.
That is, the data played back from the playback device is not forwarded by the master playback device, but is directly retrieved from the audio output device.
Of course, in an actual situation, the manner of acquiring the data played by the master playback device and the slave playback device may be selected from the manner 1 and the manner 2 according to actual needs, and is not limited herein.
Optionally, in this embodiment of the present invention, when K1 (that is, K1 is an integer greater than 1) slave playback devices are provided, and K2 (that is, K2 is an integer greater than 1, and K2 is smaller than K1) slave playback devices play asynchronously with the master playback device, for each slave playback device of the K2 slave playback devices, the method provided by the embodiment of the present invention may be adopted to adjust the respective playback rate, so that each slave playback device may realize synchronous playback with the master playback device.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (11)
1. A method for synchronous playing of a master playing device and a slave playing device is characterized by comprising the following steps:
the method comprises the steps that when the slave playing equipment receives an indication message which comprises a first sample point number and first corresponding time and is sent by the master playing equipment, a second sample point number and second corresponding time are determined; wherein the first sample point number is: the number of sample points played in the data currently played by the main playing device is as follows: the number of sample points played in the data played currently by the slave playing device;
the slave playing equipment determines an initial time deviation according to the first sample point number and the first corresponding time, and the second sample point number and the second corresponding time;
when the initial time deviation is not zero, the slave playing equipment adjusts the current first playing speed according to the initial time deviation;
the slave playback device controls the adjusted first playback rate when it is determined that the adjustment is complete, such that: and the master playing device and the slave playing device perform synchronous playing at the same playing speed.
2. The method of claim 1, wherein the second corresponding time is: the number of sample points played in the data played by the slave playing device at present is the corresponding time when the number of the second sample points;
the first corresponding time is: and the number of the played sample points in the data currently played by the main playing device is the corresponding time when the number of the first sample points is equal to the number of the played sample points.
3. The method of claim 1, wherein determining an initial time offset according to the first number of sample points and a first corresponding time, and the second number of sample points and a second corresponding time comprises:
determining the initial time offset using the following equation:
Δt=(s-m)/Sr-(t s -t m );
where Δ t represents the initial time offset, m represents the number of the first sample points, s represents the number of the second sample points, sr represents the current first play rate of the slave play device, t represents the current first play rate of the slave play device m Representing said first corresponding time, t s Representing the second corresponding time.
4. The method of claim 1, wherein adjusting the current first playback rate according to the initial time offset comprises:
when the initial time deviation is larger than zero, reducing the current first playing speed; or, when the initial time deviation is less than zero, increasing the current first playing speed;
and monitoring an adjustment result according to a preset monitoring period, and when the adjustment is determined not to be completed according to the adjustment result, continuously adjusting the adjusted first playing rate according to the adjustment result until the adjustment is determined to be completed.
5. The method of claim 4, wherein monitoring the adjustment result according to a preset monitoring period specifically comprises:
when the indication message further comprises a current second playing speed of the main playing device and the monitoring period is reached, determining an adjusted time deviation according to the adjusted first playing speed, the current second playing speed and the monitoring period;
and comparing the magnitude relation between the adjusted time deviation and the initial time deviation to determine the adjustment result.
6. The method of claim 4, wherein determining whether the adjustment is complete based on the adjustment result comprises:
judging whether the adjusted time deviation is equal to the initial time deviation or not;
if not, determining that the adjustment is not finished;
if so, determining that the adjustment is completed.
7. The method of claim 4, wherein when it is determined that the adjustment is not completed according to the adjustment result, continuously adjusting the adjusted first playback rate according to the adjustment result, specifically comprising:
if the absolute value of the adjusted time deviation is larger than the absolute value of the initial time deviation, reducing the adjusted first playing speed;
if the absolute value of the adjusted time deviation is smaller than the absolute value of the initial time deviation, the adjusted first playing speed is kept or increased.
8. The method according to any of claims 4-7, wherein the monitoring period is less than a time interval between two consecutive transmissions of the indication message by the master playback device.
9. The method of claim 1, wherein controlling the adjusted first playback rate when it is determined that the adjustment is complete comprises:
when the indication message further comprises a current second playing speed of the main playing device and the adjustment is determined to be completed, determining the current second playing speed of the main playing device according to the indication message;
and continuously adjusting the adjusted first playing speed to the current second playing speed.
10. A slave playback device, comprising:
a memory for storing program instructions;
a processor for calling said program instructions stored in said memory to execute the method of any one of claims 1 to 9 in accordance with the obtained program.
11. A playback system, comprising: a master playback device, and the slave playback device of claim 10;
the main playback device is configured to: sending an indication message comprising a first sample point number and a first corresponding time to the slave playing equipment;
the slave playback device is configured to: and when the indication message is received, controlling the master playing device and the slave playing device to perform synchronous playing at the same playing speed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110966288.8A CN115913431A (en) | 2021-08-23 | 2021-08-23 | Method for synchronous playing of master and slave playing devices, slave playing device and playing system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110966288.8A CN115913431A (en) | 2021-08-23 | 2021-08-23 | Method for synchronous playing of master and slave playing devices, slave playing device and playing system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115913431A true CN115913431A (en) | 2023-04-04 |
Family
ID=86469723
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110966288.8A Pending CN115913431A (en) | 2021-08-23 | 2021-08-23 | Method for synchronous playing of master and slave playing devices, slave playing device and playing system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115913431A (en) |
-
2021
- 2021-08-23 CN CN202110966288.8A patent/CN115913431A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10809969B2 (en) | Systems and methods for audio playback | |
CN104464767B (en) | The method and audio frequency broadcast system that the audio of synchronous multiple playing devices plays | |
JP5068744B2 (en) | Synchronous audio / video decoding method and apparatus for network equipment | |
WO2016041445A1 (en) | Audio synchronous playing method, device and system | |
CN113300797B (en) | Multi-device self-adaptive audio synchronous playing method and processing terminal | |
WO2016145235A1 (en) | Location based services audio system | |
CN111817811A (en) | TWS earphone audio frequency synchronous playing method and system, TWS earphone | |
CN110636600B (en) | Audio synchronous playing method for wireless equipment | |
CN103220060A (en) | Time control apparatus, time control method, and program | |
CN110636349B (en) | Audio synchronous playing method for wireless equipment | |
CN103888748B (en) | For the video frame synchronization method of many viewpoint three-dimensional display systems | |
US10341773B2 (en) | Packet based delivery of multi-channel audio over wireless links | |
US20170125027A1 (en) | Packet Based Delivery of Multi-Channel Audio over Wireless Links | |
CN107454510B (en) | Bluetooth is to the audio sync playback method of case, system | |
CN115086732B (en) | Method and device for synchronizing audio and video data | |
CN109525873B (en) | Audio playing synchronization method and device | |
US7321799B2 (en) | Flexible interface for controlling a motion platform | |
CN116527977A (en) | Sound and picture synchronization method and device, electronic equipment and readable storage medium | |
CN115913431A (en) | Method for synchronous playing of master and slave playing devices, slave playing device and playing system | |
CN116233472B (en) | Audio and video synchronization method and cloud processing system | |
CN111726669B (en) | Distributed decoding equipment and audio and video synchronization method thereof | |
CN112235685B (en) | Sound box networking method and sound box system | |
CN113329382A (en) | Bluetooth-based time point synchronizing method, device and system | |
CN113535115A (en) | Audio playing method and device, electronic equipment and storage medium | |
CN114420149B (en) | Time compensation method of audio delayer, audio delayer and computer storage medium |
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 |