Multi-room audio synchronous playing method and system, storage medium and equipment
By collecting the speaker transmission rate and buffering level in real time and dynamically adjusting the audio compression rate and transmission speed, this method solves the problem in the existing technology of being unable to dynamically adjust the audio transmission strategy according to the network conditions, and achieves high-quality multi-room audio in a complex network environment. Audio is played synchronously.
Patent Information
- Application Number
- CN202411528746.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-01-24
AI Technical Summary
The existing multi-room audio synchronous playback technology cannot dynamically adjust the audio transmission strategy according to network conditions, resulting in playback stuttering or sound quality cannot be fully improved when the network environment is complex, and it is difficult to cope with poor network conditions of individual speakers.
By collecting the transmission rate and buffering level of each sub-speaker in real-time in a multi-room audio synchronized playback system, the audio compression rate and transmission speed are dynamically adjusted to ensure that the system can adaptively adjust according to network conditions to ensure smooth playback and improve sound quality.
When the network environment is poor, it is guaranteed to play smoothness, improve the sound quality when the network conditions are good, improve the robustness and user experience of the system, and optimize the system behavior through user feedback and machine learning.
Smart Images

Figure CN119363727A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of audio playback optimization, and in particular to a multi-room audio synchronous playback method, system, storage medium and device. Background Art
[0002] With the development of technology, people are no longer satisfied with the lossy audio data transmitted by Bluetooth. The lossless audio transmission system based on WiFi is becoming more and more widely used. In order to achieve better sound effects, multiple wireless speakers are usually combined into a multi-room audio playback system.
[0003] Existing multi-room audio synchronization playback technology usually adopts a fixed audio compression rate and transmission speed strategy, which cannot be dynamically adjusted according to network conditions. This method can work normally when the network environment is stable and the bandwidth is sufficient, but it has obvious shortcomings when facing a complex and changeable home network environment. When the network condition is poor, fixed high-bitrate audio transmission is prone to cause playback jams; when the network condition is good, it is impossible to fully utilize the available bandwidth to improve the sound quality. In addition, the existing technology often adopts a unified transmission strategy, which is difficult to deal with the situation where the network condition of individual speakers is poor, and it is easy to cause a single speaker to affect the overall playback quality. These problems seriously affect the user experience of multi-room audio synchronization playback, and a new solution that can dynamically adapt to changes in the network environment is urgently needed. Summary of the invention
[0004] The purpose of the present invention is to solve the shortcomings of the above-mentioned prior art and to provide a multi-room audio synchronous playback method, system, storage medium and device, which can adaptively adjust according to the actual network conditions, ensure smooth playback when the network is poor, and improve the sound quality when the network is good.
[0005] A method for synchronously playing multi-room audio includes the following steps: S1: Initialize the multi-room audio synchronous playback system, determine a main speaker among several speakers, obtain the maximum total network transmission rate, the number of sub-speakers, and the security cache level; S2: collects the real-time transmission rate and audio buffer level of each sub-speaker in real time; S3: Calculate the change in the compressed audio bit rate according to the real-time transmission rate of each sub-speaker, and dynamically adjust the audio compression rate; S4: Calculate the transmission speed change of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
[0006] Furthermore, in step S1, a main speaker is determined from among the plurality of speakers, including: One speaker is selected as the main speaker and the other speakers are selected as sub-speakers. The main speaker is responsible for receiving the audio source, compressing and distributing the audio, and the sub-speakers are responsible for receiving the compressed audio stream and playing it synchronously.
[0007] Furthermore, in step S1, parameter collection is performed to obtain the network maximum total transmission rate, the number of sub-speakers, and the security cache level, including: The main speaker pings all the sub-speakers to calculate the maximum total transmission rate allowed by the network, and sets a time interval to regularly measure the maximum total transmission rate of the network; The main speaker monitors the joining and leaving of the sub-speakers in real time. The main speaker broadcasts a detection packet to all sub-speakers at a predetermined interval and dynamically updates the number of sub-speakers after receiving a response. If a sub-speaker is detected to join: Recalculate the maximum total network transmission rate and the total number of sub-speakers; Assign an initial transmission speed to the sub-speaker and adjust the transmission speeds of other sub-speakers to ensure that the total transmission speed does not exceed the maximum total transmission rate of the network; First transmit a low-quality audio to the newly added sub-speaker to quickly build a buffer, and then gradually improve the sound quality; If the sub-speaker is detected to be exited, the processing includes: Recalculate the maximum total network transmission rate and the total number of sub-speakers; Allocate the bandwidth originally occupied by the exiting sub-speaker to other sub-speakers in proportion; Adjust the audio compression rate to improve the overall sound quality.
[0008] Furthermore, in step S2, the real-time transmission rate and audio buffer level of each sub-speaker are collected in real time, including: Counting the amount of data sent to each sub-speaker by the main speaker within a set time interval to calculate the real-time transmission rate of each sub-speaker; The main speaker periodically queries each sub-speaker for its current buffer level, wherein the sub-speaker presets an interface to send its current buffered audio data volume.
[0009] Further, in step S3, the change in the compressed audio bit rate is calculated according to the real-time transmission rate of each sub-speaker, and the dynamic adjustment of the audio compression rate further includes: Calculate the change in the compressed audio bit rate according to the real-time transmission rate of all sub-speakers, the ratio of the set transmission rate and the current buffer level; When the absolute value of the change in the compressed audio bit rate is greater than a preset dynamic compression rate adjustment threshold, the audio compression rate is adjusted: If the change in the compressed audio bit rate is positive, the audio compression rate is reduced to improve the sound quality; If the change in the compressed audio bit rate is negative, the audio compression rate is increased and the sound quality is reduced.
[0010] Preferably, the configuration of the preset dynamic compression rate adjustment threshold further includes: The dynamic compression rate adjustment threshold is dynamically set based on a preset basic compression rate adjustment threshold, wherein the dynamic compression rate adjustment threshold is in a linear function relationship with the current compressed audio bit rate.
[0011] Furthermore, in step S4, calculating the variation of the transmission speed of the sub-speaker box, and adjusting the transmission speed of each sub-speaker box further comprises: Calculating the transmission speed change of each sub-speaker according to the ratio of the buffer level of each sub-speaker to the safety buffer level; If the absolute value of the transmission speed change of the current sub-speaker is greater than a dynamic speed adjustment threshold, the transmission speed of the sub-speaker is adjusted: If the transmission speed change is positive, the transmission speed of the sub-speaker is increased; If the transmission speed change is negative, the sub-speaker transmission speed is reduced.
[0012] Preferably, the configuration of the dynamic speed adjustment threshold further includes: The dynamic speed adjustment threshold is dynamically set based on a basic speed adjustment threshold, wherein the dynamic speed adjustment threshold is in direct proportion to the ratio of the safety buffer level to the audio buffer level of each sub-speaker.
[0013] Furthermore, if a certain sub-speaker is detected to have a serious network delay, delay processing is performed, and the processing measures include: Suspend data transmission to the sub-speaker for a short period of time; During the pause period, the bandwidth originally allocated to the sub-speaker is reallocated to other sub-speakers; When the pause is over, the transmission will resume at the lowest quality and gradually increase in quality.
[0014] Further, this includes regular re-evaluation and adjustment of key system parameters: Recalculate the maximum total network transmission rate at fixed intervals; Dynamically adjust the security cache level based on network fluctuations over a period of time; By analyzing system operation data, the function used to calculate the change in compressed audio bit rate and the change in transmission speed is regularly optimized.
[0015] Furthermore, it also includes the introduction of user feedback mechanisms and machine learning models: Add a sound quality feedback control to the playback interface, and receive user feedback data through the sound quality feedback control; Record the system's current audio compression rate, the transmission speed of each speaker, and the buffer level when the user gives feedback; Adjust system parameters based on user feedback data; Using system operation data including at least network status and audio parameters as input data of the machine learning model, and using data including at least user feedback as output data of the machine learning model, to train the machine learning model; Data is collected regularly to regularly train the machine learning model to optimize parameter adjustments of the system.
[0016] Furthermore, it also includes encrypting the audio stream and control instructions, and introducing an identity authentication mechanism to ensure that only authorized devices can join the multi-room audio system.
[0017] In another aspect, a multi-room audio synchronization playback system is provided, comprising: The initialization and acquisition module is used to initialize the multi-room audio synchronous playback system, determine a main speaker among several speakers, obtain the maximum total network transmission rate, the number of sub-speakers, and the security cache level; Parameter sampling module, used to collect the real-time transmission rate and audio buffer level of each sub-speaker in real time; An audio compression rate adjustment module, used to calculate the change in the compressed audio bit rate according to the real-time transmission rate of each sub-speaker, and dynamically adjust the audio compression rate; The speaker transmission speed adjustment module is used to calculate the change in the transmission speed of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
[0018] In addition, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the multi-room audio synchronous playback method described in any one of the above items is implemented.
[0019] At the same time, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the multi-room audio synchronous playback methods described above.
[0020] Compared with the prior art, the present invention has the following beneficial effects: The present invention uses a real-time dynamic adjustment mechanism to automatically adjust the audio compression rate and the transmission speed of each speaker according to the network condition and the speaker buffer status, thereby ensuring smooth playback when the network environment is poor and improving the sound quality when the network condition is good. The present invention improves the robustness of the system by adjusting the transmission speed of each sub-speaker individually, and avoids the situation where a single speaker affects the overall playback quality. The present invention introduces a user feedback mechanism and a machine learning algorithm, enabling the system to continuously learn and optimize its behavior and provide a better user experience. In terms of security, the solution effectively protects user privacy and system security by implementing data encryption and device authentication. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 This is a flow chart of a multi-room audio synchronous playback method of the present invention; Figure 2 This is a flow chart of a real-time parameter acquisition method of the present invention; Figure 3 A flow chart of a regular optimization and feedback method of the present invention; Figure 4 This is a structural block diagram of a multi-room audio synchronous playback system of the present invention; Figure 5 The figure is a schematic diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] The present invention introduces a dynamic adjustment mechanism, which dynamically adjusts the audio compression rate and the transmission speed of each speaker by real-time monitoring of the network quality and the speaker buffer status. At the same time, by adjusting the transmission speed of each sub-speaker individually, the overall network resource utilization is effectively balanced, the adaptability and stability of the system are improved, and the overall playback quality is avoided from being affected by a single speaker. Overall, the stability, sound quality and user experience of multi-room audio synchronous playback are improved, and the complex network environment of the home is better adapted.
[0024] The specific implementation of the present invention is described below with reference to the accompanying drawings and embodiments.
[0025] like Figure 1 As shown, this embodiment provides a multi-room audio synchronous playback method, and the technical solution includes the following steps: S1: Initialize the multi-room audio synchronous playback system, determine a main speaker among several speakers, obtain the maximum total network transmission rate, the number of sub-speakers, and the security cache level Csafe; S2: collects the real-time transmission rate and audio buffer level of each sub-speaker in real time; S3: Calculate the change in the compressed audio bit rate according to the real-time transmission rate of each sub-speaker, and dynamically adjust the audio compression rate; S4: Calculate the transmission speed change of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
[0026] In step S1, determining a main speaker among a plurality of speakers includes: One speaker is selected as the main speaker and the other speakers are selected as sub-speakers. The main speaker is responsible for receiving the audio source, compressing and distributing the audio, and the sub-speakers are responsible for receiving the compressed audio stream and playing it synchronously.
[0027] The detailed steps of parameter collection in step S1 are as follows: Figure 2 As shown, obtaining the maximum total network transmission rate, the number of sub-speakers, and the security cache level Csafe includes: The main speaker calculates the maximum total transmission rate allowed by the network by pinging all the sub-speakers, and sets a time interval to regularly measure the maximum total transmission rate of the network; Real-time monitoring of the joining and exiting of sub-speakers. The main speaker broadcasts detection packets regularly, and the sub-speakers respond after receiving them, and dynamically update the number of sub-speakers n; Set the safety cache level Csafe. When the amount of audio data buffered by the sub-speaker reaches the level Csafe, the playback will not be affected by network fluctuations.
[0028] Specifically, considering the volatility of network conditions, the maximum total transmission rate should be measured regularly, for example, once every 5 minutes. The calculation formula is as follows: in, is the ping rate from the main speaker to the ith sub-speaker. In this embodiment, there are three sub-speakers in the system, and the rates obtained by the main speaker pinging the three sub-speakers are: S1 = 10Mbps, S2 = 8Mbps, S3 = 12Mbps, then .
[0029] Furthermore, the safe cache level Csafe refers to the minimum value that can ensure that the playback is not affected by network fluctuations when the amount of audio data buffered by the sub-speaker reaches this level. This value can be determined by experiment and can usually be set to the amount of audio data for 1-2 seconds. In this embodiment, the audio sampling rate is 44.1kHz and the bit depth is 16bit, then the amount of audio data for 1 second is: 44100 * 16 * 2 = 1,411,200 bits ≈ 176 KB, then Csafe can be set to 176 KB *1.5 = 264 KB.
[0030] Preferably, the real-time monitoring of the joining and exiting of sub-speakers further comprises: If a sub-speaker is detected, the following processing is performed: Recalculate the network's maximum total transmission rate Smax and the total number of sub-speakers n; Assign an initial transmission speed to the sub-speaker. The initial value can be set to Smax / n. At the same time, adjust the transmission speeds of other sub-speakers to ensure that the total transmission speed does not exceed the maximum total transmission rate Smax of the network. First transmit a low-quality audio to the newly added sub-speaker to quickly build up a buffer, and then gradually improve the sound quality.
[0031] In this embodiment, it is assumed that there are 2 sub-speakers, Smax = 10Mbps, and each sub-speaker is allocated 5Mbps. After the third sub-speaker is added: a) Recalculate Smax = 12Mbps, n = 3; b) Assign an initial transmission speed of 12 / 3 = 4Mbps to the new sub-speaker; c) Adjust the transmission speed of the two original sub-speakers to 4Mbps; d) First transmit 30 seconds of 64kbps audio to the new sub-speaker, and then increase the audio level every 10 seconds until it is consistent with the other speakers.
[0032] On the other hand, if the sub-speaker is detected to be exited, the processing to be performed includes: Recalculate the network's maximum total transmission rate Smax and the total number of sub-speakers n; Allocate the bandwidth originally occupied by the exiting sub-speaker to other sub-speakers in proportion; Adjust the audio compression rate to try to improve the overall sound quality.
[0033] In this embodiment, it is assumed that there are 3 sub-speakers, each of which is allocated 4Mbps bandwidth, and the total bandwidth is 12Mbps. After one of them exits: a) Recalculate and get n = 2; b) The 4Mbps of the exiting sub-speaker is evenly distributed to the remaining two speakers. The new bandwidth of each speaker is 4 + 4 / 2 = 6Mbps; c) Try to lower the audio compression rate, for example, adjust the compression rate from 0.5 to 0.4 to improve the sound quality.
[0034] In step S2, the real-time transmission rate and audio buffer level of the sub-speaker are sampled, including: The main speaker counts the amount of data sent to each sub-speaker within the set time interval to calculate the real-time transmission rate Sn of each sub-speaker; The main speaker periodically queries each sub-speaker for its current buffer level, that is, the audio buffer volume Cn, and the sub-speaker reports its current buffered audio data volume by setting an interface.
[0035] Among them, the sampling formula of the real-time transmission rate Sn is as follows: Sn = amount of data sent / sampling time interval.
[0036] In this embodiment, 1MB of data is sent to sub-speaker 1 in 1 second, then: S1 = 1MB / 1s = 8Mbps. At the same time, it is found that sub-speaker 1 currently buffers 352KB of audio data, then C1 = 352KB.
[0037] In step S3, the change in the compressed audio bit rate is calculated according to the real-time transmission rate of the sub-speaker, including: The change in the compressed audio bit rate ΔBps is calculated based on the real-time transmission rate of all sub-speakers, the ratio of the set transmission rates and the buffer level.
[0038] The calculation formula of the change ΔBps of the compressed audio bit rate is as follows: in, It is an empirically designed function that maps the transmission rate ratio and buffer level to the bit rate change.
[0039] Specifically, in this embodiment, there are currently 3 sub-speakers, and their They are 0.9, 1.1, and 1.0 respectively, and the average buffer level is 80% of Csafe. Design function as follows: , where k is the adjustment coefficient, then ΔBps = k *((0.9 + 1.1 + 1.0) / 3 - 1) * (0.8 - 0.5) = 0.01k.
[0040] The calculated ΔBps then dynamically adjusts the audio compression rate, including: The compression rate adjustment threshold is set according to the current audio bit rate, and when the change ΔBps of the compressed audio bit rate exceeds the compression rate adjustment threshold, the actual adjustment of the audio compression rate is performed, wherein: If the change ΔBps of the compressed audio bit rate is positive, the audio compression rate is reduced to improve the sound quality; If the change ΔBps of the compressed audio bit rate is negative, the audio compression rate is increased and the sound quality is reduced.
[0041] Specifically, the adjustment formula is: new compression rate = current compression rate * (1 - ΔBps). In this embodiment, the current compression rate is 0.5, ΔBps = 0.01, then the new compression rate = 0.5 * (1 - 0.01) = 0.495.
[0042] The step of setting the compression rate adjustment threshold according to the current audio bit rate further includes: To avoid frequent small adjustments, an adjustment threshold is set, and the compression rate adjustment threshold is dynamically set based on a basic threshold, where: If the current audio bit rate is low, set a smaller threshold; If the current audio bit rate is high, set a larger threshold.
[0043] In this embodiment, the threshold is set as: Threshold = Basic Threshold + k * Current Bit Rate, where the basic threshold is set to 0.01 and k is 0.001. If the current bit rate is 128 kbps, then the threshold = 0.01 + 0.001 * 128 = 0.138.
[0044] Further, in step S4, calculating the change in transmission speed of the sub-speaker includes: According to the buffering level of each sub-speaker box, the ratio of the safety buffering level and the buffering conditions of other sub-speakers, the transmission speed change ΔSsn of each sub-speaker box is calculated.
[0045] The calculation formula is as follows: in, It is an empirically designed function that maps the buffer level ratio and other speaker buffering conditions to the transmission speed change.
[0046] Specifically, in this embodiment, there are 3 sub-speakers in the system. They are 0.7, 1.2, and 0.9 respectively, and the design function f is as follows: Where k is the adjustment coefficient, for the first sub-speaker: ΔSs1 = k * (0.7 - 1) * (1 - 0.9 / 1.2) = -0.075k.
[0047] Then adjust the transmission speed of each sub-speaker, including: The speed adjustment threshold is set according to the buffer level. If the transmission speed change ΔSsn of the current sub-speaker is greater than the speed adjustment threshold, the transmission speed of the sub-speaker is adjusted, wherein: If the transmission speed change ΔSsn is positive, the transmission speed of the sub-speaker is increased; If the transmission speed change ΔSsn is negative, the sub-speaker transmission speed is reduced.
[0048] The adjustment formula is as follows: New transmission speed = current transmission speed * (1 + ΔSsn), In this embodiment, the current transmission speed of the sub-speaker 1 is 2Mbps, ΔSs1 = -0.075, then the new transmission speed = 2 * (1 - 0.075) = 1.85Mbps.
[0049] Wherein, setting the speed adjustment threshold according to the buffer level further comprises: To avoid frequent small adjustments, it is necessary to set a threshold for transmission speed adjustment. The speed adjustment threshold is dynamically set based on a basic threshold, where: If the buffer level is low, a smaller speed adjustment threshold is set; If the buffer level approaches or exceeds the safety level, a larger speed adjustment threshold is set.
[0050] Specifically, in this embodiment, the threshold is set as: threshold = basic threshold * (Csafe / Cn), where the basic threshold is set to 0.05, Csafe = 264KB, current Cn = 176KB, then the threshold = 0.05 * (264 / 176) = 0.075.
[0051] Additionally, we have to handle special cases, including severe network latency.
[0052] If a sub-speaker is detected to have severe network delay, for example, the transmission speed is lower than the audio bit rate for multiple consecutive times, delay processing is performed. The processing measures include: Suspend data transmission to the sub-speaker for a short period of time; During the pause period, the bandwidth originally allocated to the sub-speaker is reallocated to other sub-speakers; When the pause is over, the transmission will resume at the lowest quality and gradually increase in quality.
[0053] Specifically, in this embodiment, sub-speaker 1 detects severe network delay, and the system originally allocates 2 Mbps bandwidth to it.
[0054] a) Pause transmission to sub-speaker 1 for 5 seconds; b) 2Mbps is evenly distributed to other sub-speakers. For example, if there are two other sub-speakers, each will get an additional 1Mbps bandwidth. c) After 5 seconds, the transmission will resume at the lowest quality of 64 kbps, and the rate will be increased every 10 seconds until it reaches the normal level.
[0055] Furthermore, to maintain the best performance of the system, we need to perform regular optimization and feedback, such as Figure 3 shown.
[0056] First of all, it is necessary to regularly re-evaluate and adjust key system parameters, including: Recalculate the total maximum network transmission rate at fixed intervals to capture long-term changes in the home network environment, such as changes in available bandwidth caused by other devices going online or offline; Dynamically adjust the security cache level Csafe based on network fluctuations over a period of time; By analyzing system operation data, the function used to calculate the change in compressed audio bit rate ΔBps and the change in transmission speed ΔSsn is regularly optimized. .
[0057] Specifically, in this embodiment, the initial Smax is 10Mbps, and 12Mbps is measured again after 30 minutes. The system will adjust the total available bandwidth accordingly, allowing higher audio quality or more stable transmission; If the network fluctuates greatly in the past hour (such as the standard deviation exceeds 20% of the average value), Csafe will be increased by 10%. For example, the original Csafe is 264KB, and after adjustment it becomes 290KB; Analysis found that when the buffer level is lower than 70% of Csafe, the system response is not fast enough, and the function can be modified , increase the weight at low buffer levels: .
[0058] Furthermore, in order to optimize the user experience, a simple user feedback mechanism is implemented, including: Add a sound quality feedback button in the playback interface to report the sound quality and playback buffer status; Record the current system parameters when the user feedback is given, including audio compression rate, transmission speed of each speaker, and buffer level; Adjust system behavior based on user feedback.
[0059] In this embodiment, if the user reports "poor sound quality": a) The system temporarily increases the audio bitrate by 10% b) Monitor the playback status within 10 minutes c) If there is no freeze, keep the new audio bitrate; otherwise restore to the original state; If the user reports "unsmooth playback": a) The system immediately increases the audio compression rate by 10% b) Increase Csafe by 10% c) Monitor playback within 5 minutes d) If the fluency improves, keep the new settings; otherwise, restore the original state and try other adjustment strategies.
[0060] Furthermore, by introducing machine learning algorithms, we can learn from historical data and optimize system behavior, including: Collect and store system operation data, including network status, audio parameters, and user feedback; Regularly train machine learning models using collected data; Use the trained model to understand the parameter adjustments of the system.
[0061] In this embodiment, introducing a machine learning algorithm to optimize system behavior specifically includes: Step 1: Data collection. Data points are recorded every 5 minutes, including: timestamp, network speed Sn of each speaker, buffer level Cn of each speaker, current audio compression rate, and whether there is user feedback (poor sound quality / unsmooth playback). Step 2: Model training: Use the random forest algorithm to train the model to predict whether the user is likely to encounter problems under given network conditions and audio parameters. Step 3: Model application. Whenever the system wants to adjust parameters, it first uses the model to predict whether the adjustment may cause problems. If the model predicts that it may cause problems, the system will choose a more conservative adjustment plan. For example, the system originally planned to increase the audio bit rate from 128kbps to 160kbps. The model predicts that this may cause unsmooth playback. The system chooses a more moderate adjustment to increase the bit rate to 144kbps.
[0062] Furthermore, to protect user privacy and system security, the audio stream and control instructions are encrypted, and an authentication mechanism is introduced to ensure that only authorized devices can join the multi-room audio system.
[0063] In this embodiment, we use the AES-256 algorithm to encrypt the audio stream, use the RSA algorithm to encrypt the control instructions, and update the encryption key regularly. Specifically, in audio stream encryption, a random AES-256 key is generated, the secret key is used to encrypt the audio data, the AES key is encrypted using the RSA public key, and the encrypted AES key and the encrypted audio data are sent together; in control instruction encryption, the control instruction is directly encrypted using the RSA public key, and the sub-speaker uses the private key to decrypt and execute the instruction; for key updates, we generate a new AES-256 key every hour and update the RSA key pair every day.
[0064] An identity authentication mechanism is introduced to ensure that only authorized devices can join the multi-room audio system. In this embodiment, we implement a certificate-based device authentication mechanism, perform two-way authentication when the sub-speaker is first connected, and verify the device identity regularly. Specifically, when the device is first connected, the sub-speaker sends its digital certificate to the main speaker, the main speaker verifies the validity of the certificate, the main speaker generates a random challenge code, encrypts it with the public key of the sub-speaker and sends it, the sub-speaker decrypts the challenge code, calculates the response, encrypts it with the public key of the main speaker and sends it back, the main speaker verifies the response, and allows the connection if the authentication is successful. At the same time, the identity is verified regularly. Every 30 minutes, the main speaker sends a new random challenge code to each sub-speaker. The sub-speaker must respond correctly within 5 seconds, otherwise it will be disconnected.
[0065] Through the above steps, this embodiment implements a dynamic and adaptive multi-room audio synchronous playback system. The system can adjust the audio compression rate and transmission speed according to the real-time network conditions, effectively balancing the sound quality and playback fluency. At the same time, through user feedback and machine learning mechanisms, the system can continuously optimize its behavior and provide a better user experience. Finally, by implementing data encryption and identity authentication, the security of the system and user privacy are guaranteed. Compared with the traditional multi-room audio system with fixed parameters, this solution has stronger adaptability and stability, and can better cope with the complex and changeable home network environment.
[0066] In addition, this embodiment also discloses a multi-room audio synchronous playback system, such as Figure 2 As shown, including: The initialization and acquisition module is used to determine a main speaker among several speakers, collect parameters, and obtain the maximum total transmission rate of the network, the number of sub-speakers, and the security cache level Csafe; Parameter sampling module, used for real-time parameter sampling, sampling sub-speaker real-time transmission rate and audio buffer level; The audio compression rate adjustment module is used to calculate the change of the compressed audio bit rate according to the real-time transmission rate of the sub-speaker and dynamically adjust the audio compression rate; The speaker transmission speed adjustment module is used to calculate the change in the transmission speed of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
[0067] The functional implementation of each module in the above-mentioned multi-room audio synchronous playback system corresponds to the steps in the above-mentioned multi-room audio synchronous playback method embodiment, and its functions and implementation processes are not repeated here one by one.
[0068] like Figure 3 As shown, the electronic device includes a processor 14 and a memory 13. The memory 13 stores machine executable instructions that can be executed by the processor 14. The processor 14 executes the machine executable instructions to implement the above audio control method.
[0069] Further, Figure 3 The electronic device shown further includes a bus 12 and a communication interface 11 , and the processor 14 , the communication interface 11 and the memory 13 are connected via the bus 12 .
[0070] The memory 13 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 11 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 12 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0071] The processor 14 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 14. The above processor 14 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in this embodiment can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in this embodiment can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1001, and the processor 1000 reads the information in the memory 1001 and completes the steps of the audio control method in combination with its hardware.
[0072] The present disclosure also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. A computer program is stored in the computer-readable storage medium. When the computer program runs on a computer, the computer executes the steps of the audio control method.
[0073] Finally, it should be noted that the above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
[0074] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A multi-room audio synchronous playback method, characterized in that: The steps include: S1: Initialize the multi-room audio synchronous playback system, determine a main speaker among several speakers, obtain the maximum total network transmission rate, the number of sub-speakers, and the security cache level; S2: collects the real-time transmission rate and audio buffer level of each sub-speaker in real time; S3: Calculate the change in the compressed audio bit rate according to the real-time transmission rate of each sub-speaker, and dynamically adjust the audio compression rate; S4: Calculate the transmission speed change of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
2. The multi-room audio synchronous playback method according to claim 1, characterized in that: In step S1, a main speaker is determined from among a plurality of speakers, including: One speaker is selected as the main speaker and the other speakers are selected as sub-speakers. The main speaker is responsible for receiving the audio source, compressing and distributing the audio, and the sub-speakers are responsible for receiving the compressed audio stream and playing it synchronously.
3. The multi-room audio synchronous playback method according to claim 1, characterized in that: In step S1, the maximum total transmission rate of the network, the number of sub-speakers, and the security buffer level are obtained, including: The main speaker pings all the sub-speakers to calculate the maximum total transmission rate allowed by the network, and sets a time interval to regularly measure the maximum total transmission rate of the network; The main speaker monitors the joining and leaving of the sub-speakers in real time. The main speaker broadcasts a detection packet to all sub-speakers at a predetermined interval and dynamically updates the number of sub-speakers after receiving a response. If a sub-speaker is detected to join: Recalculate the maximum total network transmission rate and the total number of sub-speakers; Assign an initial transmission speed to the sub-speaker and adjust the transmission speeds of other sub-speakers to ensure that the total transmission speed does not exceed the maximum total transmission rate of the network; First transmit a low-quality audio to the newly added sub-speaker to quickly build a buffer, and then gradually improve the sound quality; If the sub-speaker is detected to be exited, the processing includes: Recalculate the maximum total network transmission rate and the total number of sub-speakers; Allocate the bandwidth originally occupied by the exiting sub-speaker to other sub-speakers in proportion; Adjust the audio compression rate to improve the overall sound quality.
4. The multi-room audio synchronous playback method according to claim 1, characterized in that: In step S2, the real-time transmission rate and audio buffer level of each sub-speaker are collected in real time, including: Counting the amount of data sent to each sub-speaker by the main speaker within a set time interval to calculate the real-time transmission rate of each sub-speaker; The main speaker periodically queries each sub-speaker for its current buffer level, wherein the sub-speaker presets an interface to send its current buffered audio data volume.
5. The multi-room audio synchronous playback method according to claim 4, characterized in that: In step S3, the change in the compressed audio bit rate is calculated according to the real-time transmission rate of each sub-speaker, and the dynamic adjustment of the audio compression rate further includes: Calculate the change in the compressed audio bit rate according to the real-time transmission rate of all sub-speakers, the ratio of the set transmission rate and the current buffer level; When the absolute value of the change in the compressed audio bit rate is greater than a preset dynamic compression rate adjustment threshold, the audio compression rate is adjusted: If the change in the compressed audio bit rate is positive, the audio compression rate is reduced to improve the sound quality; If the change in the compressed audio bit rate is negative, the audio compression rate is increased and the sound quality is reduced.
6. The multi-room audio synchronous playback method according to claim 5, characterized in that: The configuration of the preset dynamic compression rate adjustment threshold further includes: The dynamic compression rate adjustment threshold is dynamically set based on a preset basic compression rate adjustment threshold, wherein the dynamic compression rate adjustment threshold is in a linear function relationship with the current compressed audio bit rate.
7. The multi-room audio synchronous playback method according to claim 4, characterized in that: In step S4, calculating the change in transmission speed of the sub-speaker box, and adjusting the transmission speed of each sub-speaker box further includes: Calculating the transmission speed change of each sub-speaker according to the ratio of the buffer level of each sub-speaker to the safety buffer level; If the absolute value of the transmission speed change of the current sub-speaker is greater than a dynamic speed adjustment threshold, the transmission speed of the sub-speaker is adjusted: If the transmission speed change is positive, the transmission speed of the sub-speaker is increased; If the transmission speed change is negative, the sub-speaker transmission speed is reduced.
8. The multi-room audio synchronous playback method according to claim 7, characterized in that: The configuration of the dynamic speed adjustment threshold further includes: The dynamic speed adjustment threshold is dynamically set based on a basic speed adjustment threshold, wherein the dynamic speed adjustment threshold is in direct proportion to the ratio of the safety buffer level to the audio buffer level of each sub-speaker.
9. The multi-room audio synchronous playback method according to claim 1, characterized in that: If a sub-speaker is detected to have severe network delay, delay processing is performed. The processing measures include: Suspend data transmission to the sub-speaker for a short period of time; During the pause period, the bandwidth originally allocated to the sub-speaker is reallocated to other sub-speakers; When the pause is over, the transmission will resume at the lowest quality and gradually increase in quality.
10. The multi-room audio synchronous playback method according to claim 1, characterized in that: It also includes regular reassessment and adjustment of key system parameters: Recalculate the maximum total network transmission rate at fixed intervals; Dynamically adjust the security cache level based on network fluctuations over a period of time; By analyzing system operation data, the function used to calculate the change in compressed audio bit rate and the change in transmission speed is regularly optimized.
11. The multi-room audio synchronous playback method according to claim 1, characterized in that: It also includes the introduction of user feedback mechanisms and machine learning models: Add a sound quality feedback control to the playback interface, and receive user feedback data through the sound quality feedback control; Record the system's current audio compression rate, the transmission speed of each speaker, and the buffer level when the user gives feedback; Adjust system parameters based on user feedback data; Using system operation data including at least network status and audio parameters as input data of the machine learning model, and using data including at least user feedback as output data of the machine learning model, to train the machine learning model; Data is collected regularly to regularly train the machine learning model to optimize parameter adjustments of the system.
12. The multi-room audio synchronous playback method according to claim 1, characterized in that: It also includes encrypting audio streams and control commands, while introducing an authentication mechanism to ensure that only authorized devices can join the multi-room audio system.
13. A multi-room audio synchronous playback system, characterized in that: include: The initialization and acquisition module is used to initialize the multi-room audio synchronous playback system, determine a main speaker among several speakers, obtain the maximum total network transmission rate, the number of sub-speakers, and the security cache level; Parameter sampling module, used to collect the real-time transmission rate and audio buffer level of each sub-speaker in real time; An audio compression rate adjustment module, used to calculate the change in the compressed audio bit rate according to the real-time transmission rate of each sub-speaker, and dynamically adjust the audio compression rate; The speaker transmission speed adjustment module is used to calculate the change in the transmission speed of the sub-speaker and dynamically adjust the transmission speed of each sub-speaker.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the multi-room audio synchronous playback method according to any one of claims 1 to 12 is implemented.
15. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the multi-room audio synchronous playback method as described in any one of claims 1-12.
Citation Information
Cited By
Central control method and system for synchronously playing sound equipment in multiple rooms of hotel
CN119628988A
Audio playing method, device and system and storage medium
CN120916104A