Bluetooth audio playback control method, device, medium, chip and system
By establishing two independent basic piconets on Bluetooth slave devices and performing clock correspondence relationship conversion, the problem that existing Bluetooth technology cannot play audio data from two host devices at the same time is solved, and synchronous and mixed playback of audio data is realized.
Patent Information
- Application Number
- CN202410079574.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-01-19
AI Technical Summary
Existing Bluetooth technology cannot play audio data from two host devices at the same time, which limits usage scenarios and can only switch back and forth playback of audio data from two host devices.
By establishing two independent basic piconets on the Bluetooth slave device, and establishing a playback sequence based on the piconet clock of each Piconet, performing clock correspondence relationship conversion, and finally mixing and playing two audio data using the Bluetooth slave device clock as the reference. .
The Bluetooth slave device can play audio data from two host devices simultaneously, expanding the flexibility of usage scenarios and allowing the synchronous playback of two audio channels.
Smart Images

Figure CN118042351B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Bluetooth audio data processing, and in particular to a Bluetooth audio playback control method, device, medium, chip and system. Background Art
[0002] With the development of Bluetooth technology and the upgrade of usage scenarios, people are increasingly turning from using a single terminal device to using wearable devices to connect multiple terminals. Figure 1 As shown, the EDR (classic Bluetooth) baseband of the Bluetooth device Slave can establish a link with two terminal host devices (Master1, Master2). When one of the host devices Master1 initiates audio playback, the Bluetooth device Slave receives audio data 1 sent by the host device Master1, and starts to play the audio data 1 transmitted by the host device Master1, while maintaining a connection with the host device Master2. In the advanced audio playback mode (A2DP), when the host device Master2 initiates audio playback, the Bluetooth device Slave receives audio data 2 sent by the host device Master2. When the host device Master2 is determined to be the main playback data source, the playback switching process is turned on. The Bluetooth device Slave sends a pause playback command to the host device Master1 through the protocol stack, and stops the playback of audio data 1 on the Bluetooth device Slave, and then opens the player to play audio data 2. In other words, the Bluetooth device Slave cannot play audio data from two host devices at the same time, and the usage scenario is limited to switching back and forth between the audio data of the two host devices. Summary of the invention
[0003] Based on the above situation, the main purpose of the present invention is to provide a Bluetooth audio playback control method, device, medium, chip and system that can play audio data of two host devices at the same time.
[0004] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] The present invention provides a Bluetooth audio playback control method, the method comprising:
[0006] Step S100: The Bluetooth slave device establishes a connection with the first master device to form a basic piconet Piconet1, and the Bluetooth slave device establishes a connection with the second master device to form a basic piconet Piconet2;
[0007] Step S200: When the first master device and the second master device start audio playback and audio data is transmitted to the Bluetooth slave device, the Bluetooth slave device establishes a first playback sequence based on the piconet clock CLK1 of the basic piconet Piconet1, and establishes a second playback sequence based on the piconet clock CLK2 of the basic piconet Piconet2;
[0008] Step S300: according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1 and the piconet clock CLK2, converting the first play sequence and the second play sequence into a first to-be-mixed play sequence and a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS;
[0009] Step S400: Based on the Bluetooth slave device clock CLKS, the first to-be-mixed sound playing sequence and the second to-be-mixed sound playing sequence are mixed and played.
[0010] Preferably, the step S200 includes:
[0011] Step S201: Calculate the clock at which the Bluetooth slave device receives the audio packet sequence from the first master device according to the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1; and / or calculate the clock at which the Bluetooth slave device receives the audio packet sequence from the second master device according to the relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2;
[0012] Step S202: obtain the clock of the first playback sequence corresponding to the piconet clock CLK1 calculated based on the clock of the audio packet sequence from the first master device; and / or obtain the clock of the second playback sequence corresponding to the piconet clock CLK2 calculated based on the clock of the audio packet sequence from the second master device.
[0013] Preferably, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is synchronous transmission;
[0014] The audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, respectively, and the clocks corresponding to the piconet clock CLK1 are pt0, pt1, pt2...ptn, respectively, and the audio packet sequences p0, p1, p2...pn are decoded and processed to obtain the first play sequence;
[0015] The audio packet sequences received by the Bluetooth slave device from the second master device are p′0, p′1, p′2…p′n, respectively, and the clocks corresponding to the piconet clock CLK2 are pt′0, pt′1, pt′2…pt′n, respectively. The audio packet sequences p′0, p′1, p′2…p′n are decoded and processed to obtain the second play sequence;
[0016] The step S202 is specifically as follows:
[0017] Calculate and obtain the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; PTSn=ptn+L1, where L1 is the delay time of the play path of the Bluetooth slave device corresponding to the first master device; and / or
[0018] The second play sequence is calculated to correspond to the clocks PTS'0, PTS'1, PTS'2...PTS'n of the piconet clock CLK2; PTS'n=pt'n+L2, wherein L2 is the delay time of the play path of the Bluetooth slave device corresponding to the second master device.
[0019] Preferably, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is asynchronous transmission;
[0020] The Bluetooth slave device receives audio packets from the first master device in the following sequence: p0, p1, p2, ..., pn, p0 corresponds to the piconet clock CLK1, pt0, and pn corresponds to the piconet clock
[0021] The clock of CLK1 is The audio packet sequences p0, p1, p2, ..., pn are decoded and processed to obtain the second playback sequence;
[0022] The sequence of audio packets received by the Bluetooth slave device from the second master device is p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 is pt'0, p'n corresponds to the clock of the piconet clock CLK2 is The audio packet sequence p'0, p'1, p'2 ... p'n is decoded and processed to obtain the second playback sequence;
[0023] The step S202 is specifically as follows:
[0024] Calculate and obtain the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, samplerate1 is the sampling rate of the first master device, pcmsi For p i The number of PCM sampling cycles obtained by decoding, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device; and / or
[0025] Calculate and obtain the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, samplerate2 is the sampling rate of the second master device, pcms′ i For p i The number of PCM sampling cycles obtained by decoding, L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
[0026] Preferably, the step S300 specifically includes:
[0027] The clocks LPTS0, LPTS1, LPTS2, ..., LPTSn of the first to-be-mixed play sequence based on the Bluetooth slave device clock CLKS are calculated based on the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence based on the piconet clock CLK1, and the calculation method is:
[0028] LPTSn=PTSn-(baseoffset1+clkoffset1);
[0029] Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset;
[0030] The clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS are calculated based on the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence based on the piconet clock CLK2, and the calculation method is:
[0031] LPTS'n=PTS'n-(baseoffset2+clkoffset2);
[0032] Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
[0033] Preferably, the time base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband;
[0034] The time base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
[0035] Preferably, the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the first master device reference clock CLKM1 plus a time base offset and a peripheral device clock offset of 0; and / or
[0036] The relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the second master device reference clock CLKM2 plus a time base offset and a peripheral device clock offset whose value is 0.
[0037] Preferably, the Bluetooth device comprises a first Bluetooth device and a second Bluetooth device, wherein the first Bluetooth device is a master device relative to the second Bluetooth device;
[0038] The first Bluetooth device and the second Bluetooth device are both connected to the first master device and the second master device to form the basic piconet Piconet1 and the basic piconet Piconet2;
[0039] After the communication between the first Bluetooth device and the second Bluetooth device is confirmed, the same first play sequence and the same second play sequence are established in the first Bluetooth device and the second Bluetooth device respectively.
[0040] Preferably, the step S300 specifically includes:
[0041] The clocks L_LPTS0, L_LPTS1, L_LPTS2, ..., L_LPTSn of the first to-be-mixed play sequence based on the first Bluetooth device clock and the clocks R_LPTS0, R_LPTS1, R_LPTS2, ..., R_LPTSn of the first to-be-mixed play sequence based on the second Bluetooth device clock are calculated based on the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence based on the piconet clock CLK1, and the calculation method is:
[0042] L_LPTSn=PTSn-(baseoffset1+Lclkoffset1);
[0043] R_LPTSn=PTSn-(baseoffset1+Rclkoffset1);
[0044] Wherein, baseoffset1 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK1, Lclkoffset1 and Rclkoffset1 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK1 respectively;
[0045] The clocks L_LPTS′0, L_LPTS′1, L_LPTS′2…L_LPTS′n of the second to-be-mixed play sequence based on the first Bluetooth device clock and the clocks R_LPTS′0, R_LPTS′1, R_LPTS′2…R_LPTS′n of the second to-be-mixed play sequence based on the second Bluetooth device clock are calculated based on the clocks PTS′0, PTS′1, PTS′2…PTS′n of the second play sequence based on the piconet clock CLK2, and the calculation method is:
[0046] L_LPTS'n=PTS'n-(baseoffset2+Lclkoffset2);
[0047] R_LPTS'n=PTS'n-(baseoffset2+Rclkoffset2)
[0048] Wherein, baseoffset2 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK2, Lclkoffset2 and Rclkoffset2 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK2 respectively.
[0049] Preferably, the processing includes one or more of volume control, packet loss recovery, filtering and gain control.
[0050] The present invention also provides a Bluetooth audio playback device, which is used as a Bluetooth slave device to connect a first master device and a second master device, and the device includes:
[0051] A piconet module, used to establish a connection with the first master device and the second master device to form a basic piconet Piconet1 and a basic piconet Piconet2;
[0052] A first playing module, configured to establish a first playing sequence based on the piconet clock CLK1 of the basic piconet Piconet1 when the first master device starts audio playing and audio data is transmitted to the Bluetooth slave device;
[0053] A second playing module, configured to establish a second playing sequence based on the piconet clock CLK2 of the basic piconet Piconet2 when the second master device starts audio playing and audio data is transmitted to the Bluetooth slave device;
[0054] A first conversion module, configured to convert the first play sequence into a first to-be-mixed play sequence based on the Bluetooth slave device clock CLKS and the piconet clock CLK1 according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1;
[0055] A second conversion module, configured to convert the second play sequence into a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS and the piconet clock CLK2 according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK2;
[0056] The audio mixing module is used to mix and play the first to-be-mixed sound playing sequence and the second to-be-mixed sound playing sequence based on the Bluetooth slave device clock CLKS.
[0057] Preferably, the first playback module includes:
[0058] A first calculation module is configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the first master device based on a relationship between a reference clock CLKM1 of the first master device and the piconet clock CLK1; and / or
[0059] A second calculation module, configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the second master device according to a relationship between a reference clock CLKM2 of the second master device and the piconet clock CLK2;
[0060] A third calculation module is used to calculate the clock of the first play sequence corresponding to the piconet clock CLK1 according to the clock of the audio packet sequence from the first master device; and / or
[0061] The fourth calculation module is used to calculate the clock of the second play sequence corresponding to the piconet clock CLK2 according to the clock of the audio packet sequence from the second master device.
[0062] Preferably, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is synchronous transmission;
[0063] The audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, respectively, and the clocks corresponding to the piconet clock CLK1 are pt0, pt1, pt2...ptn, respectively, and the audio packet sequences p0, p1, p2...pn are decoded and processed to obtain the first play sequence;
[0064] The audio packet sequences received by the Bluetooth slave device from the second master device are p'0, p'1, p'2 ... p'n, respectively, and the clocks corresponding to the piconet clock CLK2 are pt'0, pt'1, pt'2 ... pt'n, respectively, and the audio packet sequences p'0, p'1, p'2 ... p'n are decoded and processed to obtain the second play sequence;
[0065] The third calculation module calculates the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; PTSn=ptn+L1, where L1 is the delay time of the play path of the Bluetooth slave device corresponding to the first master device; and / or
[0066] The fourth calculation module calculates the clocks PTS'0, PTS'1, PTS'2...PTS'n of the second play sequence corresponding to the piconet clock CLK2; PTS'n=pt'n+L2, where L2 is the delay time of the play path of the Bluetooth slave device corresponding to the second master device.
[0067] Preferably, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is asynchronous transmission;
[0068] The Bluetooth slave device receives audio packets from the first master device in the following sequences: p0, p1, p2, ..., pn. The clock of p0 corresponding to the piconet clock CLK1 is pt0. The clock of pn corresponding to the piconet clock CLK1 is The audio packet sequences p0, p1, p2, ..., pn are decoded and processed to obtain the second playback sequence;
[0069] The sequence of audio packets received by the Bluetooth slave device from the second master device is p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 is pt'0, p'n corresponds to the clock of the piconet clock CLK2 is The audio packet sequence p'0, p'1, p'2 ... p'n is decoded and processed to obtain the second playback sequence;
[0070] The third calculation module calculates and obtains the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, samplerate1 is the sampling rate of the first master device, pcms i For p i The number of PCM sampling cycles obtained by decoding, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device; and / or
[0071] The fourth calculation module calculates and obtains the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, samplerate2 is the sampling rate of the second master device, pcms′ i For p i The number of PCM sampling cycles obtained by decoding, L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
[0072] Preferably, the first conversion module calculates the clocks LPTS0, LPTS1, LPTS2...LPTSn of the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS0, PTS1, PTS2...PTSn of the first playback sequence based on the piconet clock CLK1, and the calculation method is:
[0073] LPTSn=PTSn-(baseoffset1+clkoffset1);
[0074] Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset;
[0075] The second conversion module calculates the clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second playback sequence based on the piconet clock CLK2, and the calculation method is:
[0076] LPTS'n=PTS'n-(baseoffset2+clkoffset2);
[0077] Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
[0078] Preferably, the time base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband;
[0079] The time base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
[0080] Preferably, the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the first master device reference clock CLKM1 plus a time base offset and a peripheral device clock offset of 0; and / or
[0081] The relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the second master device reference clock CLKM2 plus a time base offset and a peripheral device clock offset whose value is 0.
[0082] The present invention also provides a storage medium, comprising the Bluetooth audio playback device as described above; or the storage medium stores a computer program, and when the computer program is executed by a processor, the Bluetooth audio playback control method as described above can be implemented.
[0083] The present invention also provides a chip, including the Bluetooth audio playback device as described above; or including a storage medium storing a computer program, which can implement the Bluetooth audio playback control method as described above when executed by a processor.
[0084] The present invention provides a Bluetooth audio system, comprising the Bluetooth audio playback device as described above, a first master device and a second master device;
[0085] The Bluetooth audio playback device communicates with the first host device and the second host device via Bluetooth.
[0086] The present invention provides a Bluetooth audio playback control method, device, medium, chip and system. A Bluetooth slave device can synchronously receive audio from a first master device and a second master device and generate two-way audio playback sequences. Then, by selecting a reference clock for the audio on the Bluetooth slave device, CLK1 and CLK2 are mapped to it respectively. Through the mapping relationship between the reference clock and CLK1 and CLK2, a playback sequence with the same time reference is generated to perform audio mixing, thereby effectively realizing the playback of two-way audio.
[0087] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] The preferred embodiments of the Bluetooth audio playback control method, device, medium, chip and system of the present invention will be described below with reference to the accompanying drawings.
[0089] Figure 1 The figure is a schematic diagram of a process of a Bluetooth device processing audio data from two host devices in the prior art.
[0090] Figure 2 The present invention is a flowchart of a Bluetooth audio playback control method.
[0091] Figure 3 for Figure 2 Detailed step flow chart of step S200.
[0092] Figure 4 Schematic diagram of the relationship between the first master device reference clock and the piconet clock CLK1.
[0093] Figure 5 Schematic diagram of the relationship between the first master device reference clock and the piconet clock CLK1.
[0094] Figure 6 Schematic diagram of the relationship between the piconet clocks CLK1, CLK2 and the Bluetooth slave device clock CLKS. DETAILED DESCRIPTION
[0095] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the following detailed description of the present invention, some specific details are described in detail. In order to avoid confusing the essence of the present invention, known methods, processes, procedures, and components are not described in detail.
[0096] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0097] Unless the context clearly requires otherwise, throughout the specification and claims, the words "include", "comprising" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, in the sense of "including but not limited to".
[0098] In the description of the present invention, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0099] The present invention provides a Bluetooth audio playback control method, which is specifically a Bluetooth slave device one-to-many audio playback control. The system architecture for implementing the method includes a Bluetooth slave device and multiple master devices connected to the Bluetooth slave device. It can be understood that the number of master devices is at least two. The present invention takes two master devices connected to the Bluetooth slave device as an example for explanation, and does not limit the number of master devices to two. When the number of master devices is two, the Bluetooth slave device outputs a mixture of two-channel audio data. When the number of master devices is more than two, the Bluetooth slave device outputs a mixture of more than two-channel audio data.
[0100] See also Figure 2 The present invention provides a Bluetooth audio playback control method, which includes steps S100 to S400.
[0101] In step S100, the Bluetooth slave device establishes a connection with the first master device to form a basic piconet Piconet1, and the Bluetooth slave device establishes a connection with the second master device to form a basic piconet Piconet2.
[0102] In step S200, when the first master device and the second master device start audio playback and audio data is transmitted to the Bluetooth slave device, the Bluetooth slave device establishes a first playback sequence based on the piconet clock CLK1 of the basic piconet Piconet1, and establishes a second playback sequence based on the piconet clock CLK2 of the basic piconet Piconet2.
[0103] In step S300, according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1 and the piconet clock CLK2, the first play sequence and the second play sequence are converted into a first to-be-mixed play sequence and a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS.
[0104] In step S400, the first sequence to be mixed and played and the second sequence to be mixed and played are mixed and played based on the Bluetooth slave device clock CLKS.
[0105] As an embodiment, the Bluetooth slave device may be a Bluetooth speaker (such as a portable Bluetooth speaker), a Bluetooth neckband headset, a headset or a TWS headset, etc.
[0106] As an embodiment, the first host device and / or the second host device may be a mobile phone, a tablet computer, a PDA, a desktop computer, or a television, etc.
[0107] It can be understood that the basic piconet channel is used for communication between connected devices during normal operation, that is, the Bluetooth slave device communicates with the first master device and the second master device through the basic piconet Piconet1 and the basic piconet Piconet2.
[0108] It can be understood that in the present invention, when the user or instruction controls the first device and the second device to start audio playback, the Bluetooth slave device simultaneously receives audio data from the first device and the second device, and establishes a first playback sequence and a second playback sequence. After the audio is turned on, the audio data is transmitted to the Bluetooth slave device via the Advanced Audio Protocol (A2DP) or the SCO link (call).
[0109] See also Figure 3 As an embodiment, step S200 includes step S201 and step S202.
[0110] In step S201, based on the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1, the clock for the Bluetooth slave device to receive the audio packet sequence from the first master device is calculated; and / or based on the relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2, the clock for the Bluetooth slave device to receive the audio packet sequence from the second master device is calculated.
[0111] See also Figure 4 As an embodiment, the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the reference clock CLKM1 of the first master device plus a time base offset (baseoffset_1) and a peripheral device clock offset of 0. For example, the Bluetooth slave device receives audio packet sequences p0, p1, p2...pn from the first master device, and the clocks corresponding to the piconet clock CLK1 are pt0, pt1, pt2...ptn, respectively. The clocks of the audio packet sequences p0, p1, p2...pn are obtained by adding a time base offset (baseoffset_1) and a peripheral device clock offset of 0 to the clocks based on the reference clock CLKM1.
[0112] See also Figure 5As an embodiment, the relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the reference clock CLKM2 of the second master device plus a time base offset and a peripheral device clock offset of 0. For example, the Bluetooth slave device receives audio packet sequences p′0, p′1, p′2…p′n from the second master device, and the clocks corresponding to the piconet clock CLK1 are p′0, p′1, p′2…p′n respectively. The clocks of the audio packet sequences p′0, p′1, p′2…p′n are obtained by adding a time base offset (baseoffset_2) and a peripheral device clock offset of 0 to the clocks based on the reference clock CLKM2.
[0113] As an embodiment, in step S202, the clock of the first playback sequence corresponding to the piconet clock CLK1 is obtained by calculating based on the clock of the audio packet sequence from the first master device; and / or the clock of the second playback sequence corresponding to the piconet clock CLK2 is obtained by calculating based on the clock of the audio packet sequence from the second master device.
[0114] As an embodiment, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is a synchronous transmission type (SCO / LE Audio) or an asynchronous transmission type (ACL).
[0115] In the case of synchronous transmission, the audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, which correspond to the clocks of the micro-net clock CLK1, respectively, pt0, pt1, pt2...ptn. After decoding and processing, the audio packet sequences p0, p1, p2...pn are obtained to obtain the first playback sequence.
[0116] In the case of synchronous transmission, as an embodiment, the step S202 is specifically: calculate the clocks PTS0, PTS1, PTS2...PTSn of the first playback sequence corresponding to the micro-network clock CLK1; PTSn=ptn+L1, wherein L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device.
[0117] It can be understood that L1 is the duration of the audio data from the first master device from the time it is received by the Bluetooth slave device to the time it is mixed, or the duration of the audio data from the first master device from the time it is received by the Bluetooth slave device to the time it is converted into the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS, or the duration of the Bluetooth slave device receiving the audio packet sequence / performing audio decoding to digital-to-analog conversion (DAC after mixing) output.
[0118] In the case of synchronous transmission, the audio packet sequences received by the Bluetooth slave device from the second master device are p′0, p′1, p′2...p′n, which correspond to the clocks of the micro-network clock CLK2, respectively, pt′0, pt′1, pt′2...pt′n. After decoding and processing, the audio packet sequence p′0, p′1, p′2...p′n is obtained to obtain the second playback sequence.
[0119] In the case of synchronous transmission, as an embodiment, the step S202 is specifically: calculate the clocks PTS′0, PTS′1, PTS′2...PTS′n of the second playback sequence corresponding to the micro-network clock CLK2; PTS'n=pt'n+L2, wherein L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
[0120] It can be understood that L2 is the duration of the audio data from the second master device from being received by the Bluetooth slave device to before mixing, or the duration of the audio data from the second master device from being received by the Bluetooth slave device to before being converted into the second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS.
[0121] In the case of asynchronous transmission, the Bluetooth slave device receives audio packet sequences from the first master device, namely p0, p1, p2, ..., pn, where p0 corresponds to the clock of the piconet clock CLK1 as pt0, and pn corresponds to the clock of the piconet clock CLK1 as The second play sequence is obtained after decoding and processing the audio packet sequence p0, p1, p2, ..., pn. Wherein, samplerate1 is the sampling rate of the first master device, pcms i For p i The number of PCM sampling cycles obtained by decoding. In the present invention, the clock of the corresponding audio packet sequence is resampled to the time axis of synchronous transmission through the audio's own sampling rate and the number of audio PCM sampling cycles (pcms) decoded and received in p1, p2, p3...pn. The number of PCM sampling cycles of the first master device from p0 to pi (the maximum value of i is equal to n) * the sampling rate of the first master device, that is, the time consumed from p0 to pn is obtained, and pt0 plus this time length can obtain the clock ptn corresponding to pn.
[0122] In the case of asynchronous transmission, as an embodiment, the step S202 is specifically: calculating and obtaining the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device.
[0123] It can be understood that L1 is the duration of the audio data from the first master device from being received by the Bluetooth slave device to before mixing, or the duration of the audio data from the first master device from being received by the Bluetooth slave device to before being converted into the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS.
[0124] Similarly to the above analysis, in the case of asynchronous transmission, the Bluetooth slave device receives the audio packet sequence from the second master device as p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 as pt'0, p'n corresponds to the clock of the piconet clock CLK2 as The second play sequence is obtained after decoding and processing the audio packet sequence p'0, p'1, p'2...p'n. Wherein, samplerate2 is the sampling rate of the second master device, pcms' i For p i The number of PCM sampling periods obtained by decoding.
[0125] In the case of asynchronous transmission, as an embodiment, the step S202 is specifically: calculating and obtaining the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
[0126] It can be understood that L2 is the duration of the audio data from the second master device from the time it is received by the Bluetooth slave device to the time it is mixed, or the duration of the audio data from the second master device from the time it is received by the Bluetooth slave device to the time it is converted into a second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS, or the duration of the Bluetooth slave device receiving the audio packet sequence / performing audio decoding to digital-to-analog conversion (DAC after mixing) output.
[0127] As an embodiment, the processing performed after decoding the audio packet sequence received by the Bluetooth slave device includes one or more of volume control, packet loss repair, filtering and gain control.
[0128] It can be understood that the playback path for receiving the audio data from the first host device is relatively independent from the playback path for receiving the audio data from the second host device. As an embodiment, the settings of the two playback paths are the same.
[0129] After the Bluetooth slave device generates the audio playback sequences PTSn and PTS′n corresponding to the first master device and the second master device respectively, since their respective reference clocks CLK1 and CLK2 are different, mixed playback based on time is impossible, and it is necessary to select the unified reference clock CLKS for the audio on the Bluetooth slave device, map CLK1 and CLK2 to it respectively, and generate a playback sequence with the same time base for audio mixing, that is, it is necessary to unify the time base of the two audio data through step S300.
[0130] As an embodiment, step S300 specifically includes: calculating the clocks LPTS0, LPTS1, LPTS2...LPTSn of the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS0, PTS1, PTS2...PTSn of the first playback sequence based on the piconet clock CLK1, and the calculation method is:
[0131] LPTSn=PTSn-(baseoffset1+clkoffset1);
[0132] Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset;
[0133] The clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS are calculated based on the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence based on the piconet clock CLK2, and the calculation method is:
[0134] LPTS'n=PTS'n-(baseoffset2+clkoffset2);
[0135] Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
[0136] See also Figure 6 ,It can be understood that the Bluetooth slave clock adds a time base offset and the ,peripheral device clock offset is close to the piconet clock.
[0137] Specifically in the present invention, a time base offset baseoffset1 and an offset clkoffset1 are added to the Bluetooth slave device clock CLKS to generate a close CLK1′ (CLK1′=CLKS+baseoffset1+clkoffset1). The natural drift of the clock will cause the CLK1′ clock and the piconet clock CLK1 to have an instantaneous deviation of no more than 1us (20ppm), that is, CLK1′≈CLK1, that is, CLK1≈CLKS+baseoffset1+clkoffset1. The corresponding relationship between CLKS and CLK1 of the Bluetooth slave device is:
[0138] CLKS≈CLK1-(baseoffset1+clkoffset1);
[0139] According to the correspondence between CLKS and CLK1, the clocks PTS0, PTS1, PTS2...PTSn of the first playback sequence based on the piconet clock CLK1 are converted into the clocks LPTS0, LPTS1, LPTS2...LPTSn of the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS, LPTSn=PTSn-(baseoffset1+clkoffset1), wherein baseoffset1 and clkoffset1 are respectively the time base offset and peripheral device clock offset of the Bluetooth slave device relative to the piconet clock CLK1.
[0140] Similarly to the above analysis, the corresponding relationship between the CLKS of the Bluetooth slave device and the piconet clock CLK2 is:
[0141] CLKS≈CLK2-(baseoffset2+clkoffset2);
[0142] According to the correspondence between CLKS and CLK2, the clocks PTS′0, PTS′1, PTS′2...PTS′n of the first playback sequence based on the micro-network clock CLK2 are converted into the clocks LPTS′0, LPTS′1, LPTS′2...LPTS′n of the second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS, LPTS'n=PTS'n-(baseoffset2+clkoffset2), wherein baseoffset2 and clkoffset2 are respectively the time base offset and peripheral device clock offset of the Bluetooth slave device relative to the micro-network clock CLK2.
[0143] As an embodiment, the time base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband.
[0144] As an embodiment, the time base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
[0145] As an embodiment, the Bluetooth device includes a first Bluetooth device and a second Bluetooth device, wherein the first Bluetooth device is a master device relative to the second Bluetooth device.
[0146] As an embodiment, the first Bluetooth device and the second Bluetooth device are Bluetooth headsets (such as TWS devices), specifically a Bluetooth left headset (L device) and a Bluetooth right headset (R device).
[0147] The first Bluetooth device and the second Bluetooth device are both connected to the first master device and the second master device to form the basic piconet Piconet1 and the basic piconet Piconet2; after the first Bluetooth device and the second Bluetooth device confirm communication, the same first play sequence and the second play sequence are established in the first Bluetooth device and the second Bluetooth device respectively.
[0148] It can be understood that when the first master device turns on the audio through control, the first Bluetooth device establishes the first play sequence like a Bluetooth slave device mentioned above. Since the L device and the R device formed in the basic piconet both monitor the first master device, the first play sequence generated based on the piconet 1 clock CLK1 is confirmed by the L device and the R device through communication, and the same play sequence is established and used in the L device and the R device respectively. The L device and the R device monitor the first master device respectively, and therefore obtain their respective clock offsets Lclkoffset1 and Rclkoffset1 through the baseband at their respective device ends.
[0149] Similarly to the above analysis, the conversion relationship can further obtain the clocks L_LPTS0, L_LPTS1, L_LPTS2...L_LPTSn and R_LPTS0, R_LPTS1, R_LPTS2...R_LPTSn of the playback sequence based on the local clocks of the L device and the R device:
[0150] PTSn=L_LPTSn+(baseoffset1+Lclkoffset1)=R_LPTSn+(baseoffset1+Rclkoffset1);
[0151] That is: L_LPTSn=PTSn-(baseoffset1+Lclkoffset1);
[0152] R_LPTSn=PTSn-(baseoffset1+Rclkoffset1);
[0153] Wherein, baseoffset1 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK1, Lclkoffset1 and Rclkoffset1 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK1, respectively.
[0154] Similarly to the above analysis, the corresponding relationship between the clock of the audio playback sequence of the second master device and its local clock is: PTS'n = L_LPTS'n + (baseoffset2 + Lclkoffset2) = R_LPTS'n + (baseoffset2 + Rclkoffset2);
[0155] That is: L_LPTS'n=PTS'n-(baseoffset2+Lclkoffset2);
[0156] R_LPTS'n=PTS'n-(baseoffset2+Rclkoffset2);
[0157] Wherein, baseoffset2 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK2, Lclkoffset2 and Rclkoffset2 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK2, respectively. The L device and the R device obtain their respective clock offsets Lclkoffset2 and Rclkoffset2 through the baseband at their respective device ends.
[0158] The L device and R device of the TWS network respectively realize true wireless stereo playback in the same piconet based on the local clock by corresponding the playback sequence with the piconet clock, and simultaneously mix and play the audio in another piconet connection.
[0159] The embodiment of the present invention further provides a Bluetooth audio playback device, which can be understood as a Bluetooth slave device. The Bluetooth slave device is connected to a first master device and a second master device.
[0160] The device includes a piconet module, a first playing module, a second playing module, a first conversion module, a second conversion module, and an audio mixing module. The functions of each module are described as follows.
[0161] The piconet module is used to establish a connection with the first master device and the second master device to form a basic piconet Piconet1 and a basic piconet Piconet2.
[0162] The first playing module is used to establish a first playing sequence based on the piconet clock CLK1 of the basic piconet Piconet1 when the first master device starts audio playing and audio data is transmitted to the Bluetooth slave device.
[0163] The second playing module is used to establish a second playing sequence based on the piconet clock CLK2 of the basic piconet Piconet2 when the second master device starts audio playing and audio data is transmitted to the Bluetooth slave device.
[0164] The first conversion module is configured to convert the first play sequence into a first to-be-mixed play sequence based on the Bluetooth slave device clock CLKS according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1.
[0165] The second conversion module is used to convert the second play sequence into a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK2.
[0166] The audio mixing module is used to mix and play the first to-be-mixed sound playing sequence and the second to-be-mixed sound playing sequence based on the Bluetooth slave device clock CLKS.
[0167] As an embodiment, the first playback module includes a first calculation module, a second calculation module, a third calculation module and a fourth calculation module, and the functions of each module are introduced as follows.
[0168] A first calculation module is configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the first master device based on a relationship between a reference clock CLKM1 of the first master device and the piconet clock CLK1; and / or
[0169] A second calculation module, configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the second master device according to a relationship between a reference clock CLKM2 of the second master device and the piconet clock CLK2;
[0170] A third calculation module is used to calculate the clock of the first play sequence corresponding to the piconet clock CLK1 according to the clock of the audio packet sequence from the first master device; and / or
[0171] The fourth calculation module is used to calculate the clock of the second play sequence corresponding to the piconet clock CLK2 according to the clock of the audio packet sequence from the second master device.
[0172] As an embodiment, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is synchronous transmission.
[0173] The audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, which correspond to the clocks of the piconet clock CLK1, respectively, pt0, pt1, pt2...ptn. The audio packet sequences p0, p1, p2...pn are decoded and processed to obtain the first playback sequence.
[0174] The audio packet sequences received by the Bluetooth slave device from the second master device are p′0, p′1, p′2...p′n, which correspond to the clocks of the micro-network clock CLK2, respectively, pt′0, pt′1, pt′2...pt′n. The audio packet sequence p′0, p′1, p′2...p′n is decoded and processed to obtain the second playback sequence.
[0175] The third calculation module calculates the clocks PTS0, PTS1, PTS2, ..., PTSn corresponding to the piconet clock CLK1 of the first play sequence; PTSn = ptn + L1, where L1 is the delay time of the play path of the Bluetooth slave device corresponding to the first master device. And / or
[0176] The fourth calculation module calculates the clocks PTS'0, PTS'1, PTS'2...PTS'n of the second play sequence corresponding to the piconet clock CLK2; PTS'n=pt'n+L2, where L2 is the delay time of the play path of the Bluetooth slave device corresponding to the second master device.
[0177] As an embodiment, the audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is asynchronous transmission.
[0178] The Bluetooth slave device receives audio packets from the first master device in the following sequences: p0, p1, p2, ..., pn. The clock of p0 corresponding to the piconet clock CLK1 is pt0. The clock of pn corresponding to the piconet clock CLK1 is The audio packet sequences p0, p1, p2, ..., pn are decoded and processed to obtain the second playback sequence.
[0179] The sequence of audio packets received by the Bluetooth slave device from the second master device is p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 is pt'0, p'n corresponds to the clock of the piconet clock CLK2 is The audio packet sequences p′0, p′1, p′2, ..., p′n are decoded and processed to obtain the second playing sequence.
[0180] The third calculation module calculates and obtains the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, samplerate1 is the sampling rate of the first master device, pcms i For p i The number of PCM sampling cycles obtained by decoding, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device.
[0181] and / or
[0182] The fourth calculation module calculates and obtains the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, samplerate2 is the sampling rate of the second master device, pcms′ i For p i The number of PCM sampling cycles obtained by decoding, L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
[0183] As an embodiment, the first conversion module calculates the clocks LPTS0, LPTS1, LPTS2...LPTSn of the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS0, PTS1, PTS2...PTSn of the first playback sequence based on the piconet clock CLK1, and the calculation method is:
[0184] LPTSn=PTSn-(baseoffset1+clkoffset1);
[0185] Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset.
[0186] The second conversion module calculates the clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second playback sequence based on the piconet clock CLK2, and the calculation method is:
[0187] LPTS'n=PTS'n-(baseoffset2+clkoffset2);
[0188] Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
[0189] As an embodiment, the base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband. The base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
[0190] As an embodiment, the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the first master device reference clock CLKM1 plus a time base offset and a peripheral device clock offset of 0. And / or
[0191] The relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the second master device reference clock CLKM2 plus a time base offset and a peripheral device clock offset whose value is 0.
[0192] It can be understood that the description contents in the aforementioned method embodiments of the present invention are all applicable to this embodiment.
[0193] An embodiment of the present invention further provides a storage medium, comprising the Bluetooth audio playback device as described above; or the storage medium stores a computer program, and when the computer program is executed by a processor, the Bluetooth audio playback control method as described above can be implemented.
[0194] An embodiment of the present invention further provides a chip, comprising the Bluetooth audio playback device as described above; or comprising a storage medium storing a computer program, which can implement the Bluetooth audio playback control method as described above when executed by a processor.
[0195] An embodiment of the present invention further provides a Bluetooth audio system, comprising the Bluetooth audio playback device as described above, a first host device and a second host device; the Bluetooth audio playback device communicates with the first host device and the second host device via Bluetooth.
[0196] It can be understood that the steps in the method provided by the present invention can be implemented by hardware and / or software. When implemented by software or software combined with hardware, the step content can be executed by different program logics.
[0197] Those skilled in the art will appreciate that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.
[0198] The flow chart and module diagram in the accompanying drawings illustrate the possible architecture, function and operation of the method, device, system and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0199] It should be understood that the above-mentioned embodiments are merely illustrative and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that can be made by those skilled in the art to the above-mentioned details will all be included in the scope of the claims of the present invention.
Claims
1. A Bluetooth audio playback control method, characterized in that: The method comprises: Step S100: The Bluetooth slave device establishes a connection with the first master device to form a basic piconet Piconet1, and the Bluetooth slave device establishes a connection with the second master device to form a basic piconet Piconet2; Step S200: When the first master device and the second master device start audio playback and audio data is transmitted to the Bluetooth slave device, the Bluetooth slave device establishes a first playback sequence based on the piconet clock CLK1 of the basic piconet Piconet1, and establishes a second playback sequence based on the piconet clock CLK2 of the basic piconet Piconet2; Step S300: according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1 and the piconet clock CLK2, converting the first play sequence and the second play sequence into a first to-be-mixed play sequence and a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS; Step S400: Based on the Bluetooth slave device clock CLKS, the first to-be-mixed sound playing sequence and the second to-be-mixed sound playing sequence are mixed and played.
2. The Bluetooth audio playback control method according to claim 1, characterized in that: The step S200 includes: Step S201: Calculate the clock at which the Bluetooth slave device receives the audio packet sequence from the first master device according to the relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1; and / or calculate the clock at which the Bluetooth slave device receives the audio packet sequence from the second master device according to the relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2; Step S202: derive the clock of the first play sequence corresponding to the piconet clock CLK1 according to the clock of the audio packet sequence from the first master device; and / or derive the clock of the second play sequence corresponding to the piconet clock CLK2 according to the clock of the audio packet sequence from the second master device.
3. The Bluetooth audio playback control method according to claim 2, characterized in that: The audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is synchronous transmission; The audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, respectively, and the clocks corresponding to the piconet clock CLK1 are pt0, pt1, pt2...ptn, respectively, and the audio packet sequences p0, p1, p2...pn are decoded and processed to obtain the first play sequence; The audio packet sequences received by the Bluetooth slave device from the second master device are p′0, p′1, p′2…p′n, respectively, and the clocks corresponding to the piconet clock CLK2 are pt′0, pt′1, pt′2…pt′n, respectively. The audio packet sequences p′0, p′1, p′2…p′n are decoded and processed to obtain the second play sequence; The step S202 is specifically as follows: Calculate and obtain the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; PTSn=ptn+L1, where L1 is the delay time of the play path of the Bluetooth slave device corresponding to the first master device; and / or The second play sequence is calculated to correspond to the clocks PTS'0, PTS'1, PTS'2...PTS'n of the piconet clock CLK2; PTS'n=pt'n+L2, wherein L2 is the delay time of the play path of the Bluetooth slave device corresponding to the second master device.
4. The Bluetooth audio playback control method according to claim 2, characterized in that: The audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is asynchronous transmission; The Bluetooth slave device receives audio packets from the first master device in the following sequence: p0, p1, p2, ..., pn, p0 corresponds to the piconet clock CLK1, pt0, and pn corresponds to the piconet clock The clock of CLK1 is The audio packet sequences p0, p1, p2, ..., pn are decoded and processed to obtain the second playback sequence; The sequence of audio packets received by the Bluetooth slave device from the second master device is p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 is pt'0, p'n corresponds to the clock of the piconet clock CLK2 is The audio packet sequence p'0, p'1, p'2 ... p'n is decoded and processed to obtain the second playback sequence; The step S202 is specifically as follows: Calculate and obtain the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, samplerate1 is the sampling rate of the first master device, pcms i is the number of PCM sampling cycles obtained by pi decoding, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device; and / or Calculate and obtain the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, samplerate2 is the sampling rate of the second master device, pcms′ i is the number of PCM sampling cycles obtained by pi decoding, and L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
5. The Bluetooth audio playback control method according to claim 3 or 4, characterized in that: The step S300 specifically includes: The clocks LPTS0, LPTS1, LPTS2, ..., LPTSn of the first to-be-mixed play sequence based on the Bluetooth slave device clock CLKS are calculated based on the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence based on the piconet clock CLK1, and the calculation method is: LPTSn=PTSn-(baseoffset1+clkoffset1); Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset; The clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS are calculated based on the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence based on the piconet clock CLK2, and the calculation method is: LPTS'n=PTS'n-(baseoffset2+clkoffset2); Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
6. The Bluetooth audio playback control method according to claim 5, characterized in that: The time base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband; The time base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
7. The Bluetooth audio playback control method according to claim 2, characterized in that: The relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the reference clock CLKM1 of the first master device plus a time base offset and a peripheral device clock offset of 0; and / or The relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the second master device reference clock CLKM2 plus a time base offset and a peripheral device clock offset whose value is 0.
8. The Bluetooth audio playback control method according to claim 3 or 4, characterized in that: The Bluetooth slave device includes a first Bluetooth device and a second Bluetooth device, wherein the first Bluetooth device is a master device relative to the second Bluetooth device; The first Bluetooth device and the second Bluetooth device are both connected to the first master device and the second master device to form the basic piconet Piconet1 and the basic piconet Piconet2; After the communication between the first Bluetooth device and the second Bluetooth device is confirmed, the same first play sequence and the same second play sequence are established in the first Bluetooth device and the second Bluetooth device respectively.
9. The Bluetooth audio playback control method according to claim 8, characterized in that: The step S300 specifically includes: The clocks L_LPTS0, L_LPTS1, L_LPTS2, ..., L_LPTSn of the first to-be-mixed play sequence based on the first Bluetooth device clock and the clocks R_LPTS0, R_LPTS1, R_LPTS2, ..., R_LPTSn of the first to-be-mixed play sequence based on the second Bluetooth device clock are calculated based on the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence based on the piconet clock CLK1, and the calculation method is: L_LPTSn=PTSn-(baseoffset1+Lclkoffset1); R_LPTSn=PTSn-(baseoffset1+Rclkoffset1); Wherein, baseoffset1 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK1, Lclkoffset1 and Rclkoffset1 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK1 respectively; The clocks L_LPTS′0, L_LPTS′1, L_LPTS′2…L_LPTS′n of the second to-be-mixed play sequence based on the first Bluetooth device clock and the clocks R_LPTS′0, R_LPTS′1, R_LPTS′2…R_LPTS′n of the second to-be-mixed play sequence based on the second Bluetooth device clock are calculated based on the clocks PTS′0, PTS′1, PTS′2…PTS′n of the second play sequence based on the piconet clock CLK2, and the calculation method is: L_LPTS'n=PTS'n-(baseoffset2+Lclkoffset2); R_LPTS'n=PTS'n-(baseoffset2+Rclkoffset2) Wherein, baseoffset2 is the time base offset of the first Bluetooth device clock or the second Bluetooth device clock relative to the piconet clock CLK2, Lclkoffset2 and Rclkoffset2 are the peripheral device clock offsets of the first Bluetooth device and the second Bluetooth device relative to the piconet clock CLK2 respectively.
10. The Bluetooth audio playback control method according to claim 3 or 4, characterized in that: The processing includes one or more of volume control, packet loss recovery, filtering and gain control.
11. A Bluetooth audio playback device, which is connected to a first master device and a second master device as a Bluetooth slave device, characterized in that: The device comprises: A piconet module, used to establish a connection with the first master device and the second master device to form a basic piconet Piconet1 and a basic piconet Piconet2; A first playing module, configured to establish a first playing sequence based on the piconet clock CLK1 of the basic piconet Piconet1 when the first master device starts audio playing and audio data is transmitted to the Bluetooth slave device; A second playing module, configured to establish a second playing sequence based on the piconet clock CLK2 of the basic piconet Piconet2 when the second master device starts audio playing and audio data is transmitted to the Bluetooth slave device; A first conversion module, configured to convert the first play sequence into a first to-be-mixed play sequence based on the Bluetooth slave device clock CLKS and the piconet clock CLK1 according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK1; A second conversion module, configured to convert the second play sequence into a second to-be-mixed play sequence based on the Bluetooth slave device clock CLKS and the piconet clock CLK2 according to the correspondence between the Bluetooth slave device clock CLKS and the piconet clock CLK2; The audio mixing module is used to mix and play the first to-be-mixed sound playing sequence and the second to-be-mixed sound playing sequence based on the Bluetooth slave device clock CLKS.
12. The Bluetooth audio playback device as claimed in claim 11, characterized in that: The first playback module includes: A first calculation module is configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the first master device based on a relationship between a reference clock CLKM1 of the first master device and the piconet clock CLK1; and / or A second calculation module, configured to calculate a clock at which the Bluetooth slave device receives an audio packet sequence from the second master device according to a relationship between a reference clock CLKM2 of the second master device and the piconet clock CLK2; A third calculation module is configured to calculate a clock of the first play sequence corresponding to the piconet clock CLK1 according to the clock of the audio packet sequence from the first master device; and / or The fourth calculation module is used to calculate the clock of the second play sequence corresponding to the piconet clock CLK2 according to the clock of the audio packet sequence from the second master device.
13. The Bluetooth audio playback device as claimed in claim 12, characterized in that: The audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is synchronous transmission; The audio packet sequences received by the Bluetooth slave device from the first master device are p0, p1, p2...pn, respectively, and the clocks corresponding to the piconet clock CLK1 are pt0, pt1, pt2...ptn, respectively, and the audio packet sequences p0, p1, p2...pn are decoded and processed to obtain the first play sequence; The audio packet sequences received by the Bluetooth slave device from the second master device are p'0, p'1, p'2 ... p'n, respectively, and the clocks corresponding to the piconet clock CLK2 are pt'0, pt'1, pt'2 ... pt'n, respectively, and the audio packet sequences p'0, p'1, p'2 ... p'n are decoded and processed to obtain the second play sequence; The third calculation module calculates the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; PTSn=ptn+L1, where L1 is the delay time of the play path of the Bluetooth slave device corresponding to the first master device; and / or The fourth calculation module calculates the clocks PTS'0, PTS'1, PTS'2...PTS'n of the second play sequence corresponding to the piconet clock CLK2; PTS'n=pt'n+L2, where L2 is the delay time of the play path of the Bluetooth slave device corresponding to the second master device.
14. The Bluetooth audio playback device as claimed in claim 12, wherein: The audio data transmission type between the first master device and / or the second master device and the Bluetooth slave device is asynchronous transmission; The Bluetooth slave device receives audio packets from the first master device in the following order: p0, p1, p2, ..., pn, where p0 corresponds to the clock of the piconet clock CLK1, pt0, and pn corresponds to the clock of the piconet clock CLK1, pt1, pt2, ..., pn ... The audio packet sequences p0, p1, p2, ..., pn are decoded and processed to obtain the second playback sequence; The sequence of audio packets received by the Bluetooth slave device from the second master device is p'0, p'1, p'2...p'n, p'0 corresponds to the clock of the piconet clock CLK1 is pt'0, p'n corresponds to the clock of the piconet clock CLK2 is The audio packet sequence p'0, p'1, p'2 ... p'n is decoded and processed to obtain the second playback sequence; The third calculation module calculates and obtains the clocks PTS0, PTS1, PTS2, ..., PTSn of the first play sequence corresponding to the piconet clock CLK1; Wherein, samplerate1 is the sampling rate of the first master device, pcms i is the number of PCM sampling cycles obtained by pi decoding, L1 is the delay time of the playback path of the Bluetooth slave device corresponding to the first master device; and / or The fourth calculation module calculates and obtains the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second play sequence corresponding to the piconet clock CLK2; Wherein, samplerate2 is the sampling rate of the second master device, pcms′ i is the number of PCM sampling cycles obtained by pi decoding, and L2 is the delay time of the playback path of the Bluetooth slave device corresponding to the second master device.
15. The Bluetooth audio playback device according to claim 13 or 14, characterized in that: The first conversion module calculates the clocks LPTS0, LPTS1, LPTS2, ..., LPTSn of the first to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS0, PTS1, PTS2, ..., PTSn of the first playback sequence based on the piconet clock CLK1, and the calculation method is: LPTSn=PTSn-(baseoffset1+clkoffset1); Wherein, baseoffset1 and clkoffset1 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset; The second conversion module calculates the clocks LPTS′0, LPTS′1, LPTS′2, ..., LPTS′n of the second to-be-mixed playback sequence based on the Bluetooth slave device clock CLKS according to the clocks PTS′0, PTS′1, PTS′2, ..., PTS′n of the second playback sequence based on the piconet clock CLK2, and the calculation method is: LPTS'n=PTS'n-(baseoffset2+clkoffset2); Wherein, baseoffset2 and clkoffset2 are respectively the time base offset of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset.
16. The Bluetooth audio playback device as claimed in claim 15, characterized in that: The time base offset baseoffset1 of the Bluetooth slave device relative to the piconet clock CLK1 and the peripheral device clock offset clkoffset1 are regularly updated via the Bluetooth baseband; The time base offset baseoffset2 of the Bluetooth slave device relative to the piconet clock CLK2 and the peripheral device clock offset clkoffset2 are regularly updated via the Bluetooth baseband.
17. The Bluetooth audio playback device as claimed in claim 12, wherein: The relationship between the reference clock CLKM1 of the first master device and the piconet clock CLK1 is: the piconet clock CLK1 is the reference clock CLKM1 of the first master device plus a time base offset and a peripheral device clock offset of 0; and / or The relationship between the reference clock CLKM2 of the second master device and the piconet clock CLK2 is: the piconet clock CLK2 is the second master device reference clock CLKM2 plus a time base offset and a peripheral device clock offset whose value is 0.
18. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, it can implement the Bluetooth audio playback control method as described in any one of claims 1-10.
19. A chip, characterized in that: A storage medium storing a computer program is included, and when the computer program is executed by a processor, the Bluetooth audio playback control method as described in any one of claims 1 to 10 can be implemented.
20. A Bluetooth audio system, characterized in that: Comprising the Bluetooth audio playback device according to any one of claims 11 to 17, a first master device and a second master device; The Bluetooth audio playback device communicates with the first host device and the second host device via Bluetooth.
Citation Information
Patent Citations
Audio control system
CN114173309A
Accurate audio delay playing method and device, and chip
CN117095706A