Method, system and device for controlling atmosphere lamp to rhythm along with music and medium
By performing periodic sampling, smoothing processing, time-frequency conversion and weighted average processing on the audio signal, errors are eliminated, and the brightness conversion of the ambient light is controlled based on the audio reference line, the problem of poor rhythmic effects of the ambient lights in the prior art is solved, and better rhythmic effects and user experience are achieved.
Patent Information
- Application Number
- CN202311336853.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2025-04-18
AI Technical Summary
There are errors in the existing ambient lights that control the rhythm of the music, resulting in poor user experience, especially when the audio sound size changes, the rhythm effect and music deviation are more obvious.
By performing periodic sampling, smoothing processing, time-frequency conversion and weighted average processing on the audio signal, errors are eliminated, and the impact of audio sound size on rhythmic effect is eliminated based on the audio reference line, controlling the brightness transformation of the atmosphere light.
It achieves better rhythmic effects, reduces errors, and improves the user's visual experience.
Smart Images

Figure CN119855012A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of atmosphere light control, and in particular to a method, system, device and medium for controlling an atmosphere light to follow the rhythm of music. Background Art
[0002] With the development of science and technology, people's requirements for daily leisure and entertainment are getting higher and higher, and the atmosphere lighting technology is gradually widely used in our daily life, such as home decoration, art exhibitions, commercial displays, etc. The atmosphere lighting can not only switch the brightness simply through manual control, but also cooperate with background music to achieve rhythm, which is also one of the main applications. It can cooperate with background music to bring users an immersive music experience by switching parameters such as brightness and color.
[0003] Most of the existing solutions for controlling the ambient light to follow the rhythm of music are to collect the audio signal, process it through the operational amplifier circuit, obtain the audio sound amplitude, and then control the ambient light. This solution has certain disadvantages. The effect of following the rhythm of music based on the sound amplitude of the audio signal is not good, there is a certain error, and it brings an imperfect visual experience to the user. When the audio volume changes, the deviation between the rhythm effect and the music is more obvious. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art. The present invention provides a method, system, device and medium for controlling atmosphere lights to follow the rhythm of music. The errors are eliminated by periodically sampling, smoothing, time-frequency conversion and weighted averaging the audio line signal of the sample audio, and the influence of the audio sound volume on the rhythmic effect is eliminated based on the audio baseline. The brightness of the atmosphere lights is controlled to change quickly and slowly with the music to achieve a better rhythmic effect.
[0005] The present invention provides a method for controlling an atmosphere lamp to follow the rhythm of music, the method comprising:
[0006] Periodically sampling the audio signal of the specimen playing audio;
[0007] Smoothing the sampling result based on the windowing function to obtain the smoothed sampling result;
[0008] Performing time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing;
[0009] Performing weighted averaging processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio;
[0010] updating the audio baseline based on the weighted average processing result;
[0011] Acquire target playback audio, and determine the brightness level of the target playback audio based on the updated audio baseline;
[0012] The brightness of the ambient light is controlled based on the brightness level of the target played audio.
[0013] Furthermore, the periodic sampling of the audio line signal of the sample playing audio includes:
[0014] Perform 256-point periodic sampling on the audio signal of the sample playing audio to obtain the sampling result;
[0015] Performing signal amplification processing on the sampling result to obtain a sampling result after signal amplification processing;
[0016] Perform analog-to-digital conversion on the sampling result after the signal amplification processing to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
[0017] Furthermore, the smoothing of the sampling result based on the windowing function to obtain the smoothed sampling result includes:
[0018] The sampling result is read, and a 256-point Hamming window function is added to the sampling result for smoothing to obtain the smoothed sampling result.
[0019] Furthermore, performing time-frequency conversion on the sampling result after the smoothing process to obtain the sampling result after the time-frequency conversion process includes:
[0020] The sampling result after the smoothing process is subjected to discrete Fourier transform process, so as to convert the discrete signal of the sampling result after the smoothing process in the time domain into a complex number series in the frequency domain.
[0021] Further, performing weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio includes:
[0022] Obtaining the audio value and frequency range of the played audio corresponding to the sampling result after the time-frequency conversion processing;
[0023] Preset weighting coefficients for different frequency ranges, and calculate a weighted average value of the corresponding played audio based on the audio value, the frequency range, and the weighting coefficients for the corresponding frequency range;
[0024] A noise filtering threshold is preset, the weighted average value is compared with the noise filtering threshold, and the playback quality of the corresponding playback audio is determined based on the comparison result.
[0025] Further, updating the audio baseline based on the weighted average processing result includes:
[0026] Obtain a weighted average value of audio played by several samples, and take the maximum value of the weighted average values of audio played by several samples as the audio baseline.
[0027] Further, the controlling the brightness of the atmosphere light based on the brightness level of the target played audio includes:
[0028] A brightness buffer range is preset, and the brightness of the atmosphere light is controlled based on a difference between an initial brightness level of the atmosphere light and a target brightness level corresponding to the target playback audio, and in combination with the brightness buffer range.
[0029] The present invention also provides a system for controlling an atmosphere light to follow the rhythm of music, wherein:
[0030] A periodic sampling module, the periodic sampling module is used to periodically sample the audio signal of the sample playing audio;
[0031] A smoothing processing module, wherein the smoothing processing module is used to perform smoothing processing on the sampling result based on a windowing function to obtain the sampling result after smoothing processing;
[0032] A time-frequency conversion processing module, the time-frequency conversion processing module is used to perform time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing;
[0033] A weighted average processing module, the weighted average processing module is used to perform weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio;
[0034] An audio baseline updating module, the audio baseline updating module being used to update the audio baseline based on the weighted average processing result;
[0035] A brightness level determination module, the brightness level determination module is used to obtain a target playback audio and determine the brightness level of the target playback audio based on an audio baseline;
[0036] A brightness level control module, wherein the brightness level control module is used to control the brightness of the atmosphere light based on the brightness level of the target played audio.
[0037] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned method of controlling an atmosphere light to follow the rhythm of music.
[0038] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method of controlling an atmosphere light to follow the rhythm of music is implemented.
[0039] The present invention performs periodic sampling on audio signals at the same time interval, so that subsequent processing is easier to implement; performs smoothing processing based on a windowing function, so that the sampled audio signals are connected end to end, generates a periodic function, and reduces the influence of noise on the real audio signal; performs time-frequency conversion processing, converts the time domain signal of the audio signal into a frequency domain signal, so as to facilitate subsequent weighted average processing; performs weighted average processing, calibrates and corrects the sound Hertz interval corresponding to the middle, high and low bass and the results of actual music measurement to eliminate errors, and uses an audio baseline updated in real time to eliminate the influence of the sound volume change of the audio signal on the rhythmic effect, and controls the brightness change of the atmosphere light with the fast rise and slow fall of the music, so as to achieve a better rhythmic effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 is a flow chart of a method for controlling an atmosphere light to follow the rhythm of music in Embodiment 1 of the present invention;
[0042] Figure 2 This is a flow chart of periodically sampling an audio signal of a sample playback audio in the first embodiment of the present invention;
[0043] Figure 3 is a flow chart of performing weighted average processing on the sampling results after time-frequency conversion processing in the first embodiment of the present invention;
[0044] Figure 4 This is a structural diagram of a system for controlling the atmosphere light to move with the rhythm of music in the second embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In the present invention, it should be understood that terms such as "include" or "have" are intended to indicate the existence of features, numbers, steps, behaviors, components, parts or a combination thereof disclosed in the specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts or a combination thereof exist or are added.
[0047] It should also be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0048] Embodiment 1
[0049] Embodiment 1 of the present invention relates to a method for controlling an atmosphere lamp to follow the rhythm of music, the method comprising: periodically sampling an audio signal of a sample playback audio; smoothing the sampling result based on a windowing function to obtain the smoothed sampling result; performing time-frequency conversion on the smoothed sampling result to obtain the time-frequency conversion sampling result; performing weighted averaging on the sampling result after the time-frequency conversion to determine the playback quality of the corresponding playback audio; updating an audio baseline based on the weighted averaging result; obtaining a target playback audio, and determining the brightness level of the target playback audio based on the audio baseline; and controlling the brightness of the atmosphere lamp based on the brightness level of the target playback audio.
[0050] In an optional implementation of this embodiment, Figure 1 As shown, Figure 1 The flowchart of the method for controlling the atmosphere light to follow the rhythm of music in the first embodiment of the present invention is shown, comprising the following steps:
[0051] S101, periodically sampling the audio signal of the sample playing audio;
[0052] In an optional implementation of this embodiment, Figure 2 As shown, Figure 2 A flow chart of periodically sampling an audio signal of a sample playing audio in Embodiment 1 of the present invention is shown, comprising the following steps:
[0053] S201, perform 256-point periodic sampling on the audio line signal of the sample playing audio to obtain the sampling result;
[0054] In an optional implementation of this embodiment, the audio signal of the sample playback audio is sampled at 256 points based on a sampling channel of an ADC analog-to-digital converter.
[0055] Specifically, the sampling frequency, sampling time and sampling channel rules of the ADC analog-to-digital converter are configured. The 256-point periodic sampling is 256 samplings in 1 second, and the sampling frequency is 400 Hz, that is, the sampling time is 256 / 400=0.64 seconds.
[0056] S202, performing signal amplification processing on the sampling result to obtain a sampling result after the signal amplification processing;
[0057] In an optional implementation of this embodiment, the sampling result is subjected to signal amplification processing based on an operational amplifier to obtain the sampling result after signal amplification processing.
[0058] It should be noted that the sampling result at this time is not a periodic signal.
[0059] S203: Perform analog-to-digital conversion on the sampling result after the signal amplification processing to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
[0060] In an optional implementation of this embodiment, analog-to-digital conversion is performed on the sampling result after the signal amplification processing based on an ADC analog-to-digital converter to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
[0061] Here, the audio line signal of the specimen playing audio is sampled, amplified, and processed by analog-to-digital conversion in sequence to improve the efficiency of subsequent further signal processing.
[0062] S102, performing smoothing processing on the sampling result based on the windowing function to obtain the smoothed sampling result;
[0063] In an optional implementation of this embodiment, the sampling result is read, and a 256-point Hamming window function is added to the sampling result for smoothing to obtain the smoothed sampling result.
[0064] Specifically, the parameters of the Hamming window function are preset according to actual conditions, the sampling result is divided into several small segments based on the preset Hamming window function, and each small segment signal is multiplied by the corresponding window function value in the Hamming window function to obtain the sampling result after smoothing.
[0065] It should be noted that, since 256-point periodic sampling is performed in step S101 , a 256-point Hamming window function is added here to perform corresponding smoothing processing.
[0066] Here, the Hamming window function is used for smoothing, which realizes the filtering of the sampling results, effectively suppresses the amplitude and phase changes of the sampled signal, and reduces the correlation.
[0067] S103, performing time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing;
[0068] In an optional implementation of this embodiment, discrete Fourier transform processing is performed on the smoothed sampling result to convert the discrete signal of the smoothed sampling result in the time domain into a complex number series in the frequency domain.
[0069] S104, performing weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio;
[0070] In an optional implementation of this embodiment, Figure 3 As shown, Figure 3 A flow chart of performing weighted average processing on the sampling results after time-frequency conversion processing in Embodiment 1 of the present invention is shown, comprising the following steps:
[0071] S301, obtaining an audio value and a frequency range of the played audio corresponding to the sampling result after the time-frequency conversion process;
[0072] In an optional implementation of this embodiment, the playback audio corresponding to the sampling result after the time-frequency conversion processing is divided based on the preset frequency ranges of super high frequency, high frequency, mid-range, low frequency and super low frequency.
[0073] Specifically, the preset ultra-low frequency band is less than 20Hz, the preset bass frequency band is 20Hz-160Hz, that is, 3 times the frequency, the preset mid-frequency band is 160Hz-2500Hz, that is, 4 times the frequency, the preset treble frequency band is 2500Hz-20000Hz, that is, 3 times the frequency, and the preset ultra-high frequency band is greater than 20000Hz.
[0074] In an optional implementation of the present embodiment, after the playback audio corresponding to the sampling result after the time-frequency conversion processing is divided into five frequency range intervals, the audio value of each frequency range interval is calculated respectively, including an ultra-low frequency value, a low frequency value, a medium frequency value, a high frequency value and an ultra-high frequency value.
[0075] S302, presetting weighting coefficients for different frequency ranges, and calculating a weighted average value of the corresponding played audio based on the audio value, the frequency range, and the weighting coefficients for the corresponding frequency range;
[0076] In an optional implementation of this embodiment, weighting coefficients for five frequency ranges, namely, ultra-low frequency, low frequency, medium frequency, high frequency, and ultra-high frequency, are preset, and a weighted average value of the corresponding played audio is calculated based on the audio value of each frequency range.
[0077] Specifically, the calculation formula for the weighted average of the played audio includes:
[0078]
[0079] In the formula, is the weighted average of the played audio, W SL is the ultra-low frequency weighting coefficient, V SL is the ultra-low frequency value, W L is the low frequency weighting coefficient, V L is the low frequency value, W M is the intermediate frequency weighting coefficient, V M is the intermediate frequency value, W H is the high frequency weighting coefficient, V H is the high frequency value, W SH is the ultra-high frequency weighting coefficient, V SH is an ultra-high frequency value.
[0080] S303: preset a noise filtering threshold, compare the weighted average with the noise filtering threshold, and determine the playback quality of the corresponding playback audio based on the comparison result.
[0081] In an optional implementation of the present embodiment, a noise filter threshold is preset based on multiple factors such as the sampling accuracy of the ADC analog-to-digital converter chip and the noise level of the playback device, and the weighted average value calculated in step S302 is compared with the noise filter threshold, and the playback quality of the corresponding playback audio is judged based on the comparison result.
[0082] Specifically, if the weighted average value is greater than the noise filter value, it is considered that the playback quality is good; if the weighted average value is less than the noise filter value, it is considered that the playback quality is poor, there is noise, and it is discarded.
[0083] Preferably, in this embodiment, the noise filtering threshold is preset to 2.
[0084] S105, updating the audio baseline based on the weighted average processing result;
[0085] In an optional implementation of this embodiment, a weighted average value of several sample audio playbacks is obtained, and the maximum value of the weighted average values of the several sample audio playbacks is taken as the audio baseline.
[0086] Specifically, the above steps are repeated several times, and the maximum value of the weighted average values of the last 50 sample audios with good playback quality is taken as the audio baseline.
[0087] S106, obtaining a target playback audio, and determining a brightness level of the target playback audio based on the updated audio baseline;
[0088] In an optional implementation of this embodiment, the target playback audio is acquired, the playback quality of the target playback audio is determined based on the audio baseline updated in step S105 as a determination criterion, and the brightness level of the target playback audio is calculated.
[0089] Specifically, in this embodiment, there are seven preset brightness levels, which are level one, level two, level three, level four, level five, level six, and level seven from strong to weak. Here, it is determined whether the brightness level of the target audio playback is level one, level two, level three, level four, level five, level six, or level seven.
[0090] S107: Control the brightness of the ambient light based on the brightness level of the target played audio.
[0091] In an optional implementation of this embodiment, the brightness of the corresponding atmosphere light is controlled based on the brightness level of the target playback audio obtained in step S106.
[0092] In an optional implementation of this embodiment, a brightness buffer range is preset, based on the difference between the initial brightness level of the ambient light and the target brightness level corresponding to the target playback audio, and the brightness of the corresponding ambient light is controlled in combination with the brightness buffer range.
[0093] Specifically, the initial brightness level of the ambient light and the target brightness level corresponding to the target audio playback are determined. If the initial brightness level is greater than the target brightness level, the ambient light is controlled to a brightness level that is the initial brightness level minus 1.
[0094] Furthermore, if the initial brightness level is less than the target brightness level, it is determined whether the difference is 1. If it is less than or equal to 1, the initial brightness level is maintained; if it is greater than 1, the brightness level is controlled to the target brightness level.
[0095] The brightness buffer range is set here to prevent the ambient light from jittering and flickering when switching between similar brightness levels, which may cause flickering to the human eye and damage the human eye.
[0096] In summary, embodiment 1 of the present invention provides a method for controlling atmosphere lights to follow the rhythm of music, performs periodic sampling on audio signals, and performs sampling at the same time interval, so that subsequent processing is easier to implement; performs smoothing processing based on the Hamming window plus window function, realizes filtering processing of the sampling results, and at the same time connects the sampled audio signals end to end to generate a periodic function, thereby reducing the impact of noise on the real audio signal; performs time-frequency conversion processing, converts the time domain signal of the audio signal into a frequency domain signal, so as to facilitate subsequent weighted average processing; performs weighted average processing, calibrates and corrects the sound Hertz interval corresponding to the middle, high and low bass and the results of actual music measurement to eliminate errors, and uses a real-time updated audio baseline to eliminate the impact of the sound volume changes of the audio signal on the rhythmic effect, and presets a brightness buffer range to prevent jitter and flickering at similar brightness levels, and controls the brightness changes of the atmosphere lights to rise and fall quickly and slowly with the music to achieve better rhythmic effects.
[0097] Embodiment 2
[0098] The second embodiment of the present invention also relates to a system for controlling an atmosphere light to follow the rhythm of music, such as Figure 4 As shown, Figure 4 The structure diagram of the system for controlling the atmosphere light to follow the rhythm of music in the second embodiment of the present invention is shown, and the system includes:
[0099] A periodic sampling module 10, wherein the periodic sampling module 10 is used to periodically sample the audio signal of the sample playing audio;
[0100] In an optional implementation of the present embodiment, the periodic sampling of the audio signal of the specimen playing audio includes: performing 256-point periodic sampling on the audio line signal of the specimen playing audio to obtain a sampling result; performing signal amplification processing on the sampling result to obtain a sampling result after the signal amplification processing; performing analog-to-digital conversion on the sampling result after the signal amplification processing to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
[0101] In an optional implementation of this embodiment, the audio signal of the sample playback audio is sampled at 256 points based on a sampling channel of an ADC analog-to-digital converter.
[0102] In an optional implementation of this embodiment, the sampling result is subjected to signal amplification processing based on an operational amplifier to obtain the sampling result after signal amplification processing.
[0103] In an optional implementation of this embodiment, analog-to-digital conversion is performed on the sampling result after the signal amplification processing based on an ADC analog-to-digital converter to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
[0104] A smoothing processing module 20, wherein the smoothing processing module 20 is used to perform smoothing processing on the sampling result based on a windowing function to obtain the sampling result after smoothing processing;
[0105] In an optional implementation of this embodiment, the sampling result is read, and a 256-point Hamming window function is added to the sampling result for smoothing to obtain the smoothed sampling result.
[0106] Specifically, the parameters of the Hamming window function are preset according to actual conditions, the sampling result is divided into several small segments based on the preset Hamming window function, and each small segment signal is multiplied by the corresponding window function value in the Hamming window function to obtain the sampling result after smoothing.
[0107] A time-frequency conversion processing module 30, wherein the time-frequency conversion processing module 30 is used to perform time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing;
[0108] In an optional implementation of this embodiment, discrete Fourier transform processing is performed on the smoothed sampling result to convert the discrete signal of the smoothed sampling result in the time domain into a complex number series in the frequency domain.
[0109] A weighted average processing module 40, the weighted average processing module 40 is used to perform weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio;
[0110] In an optional implementation of the present embodiment, the audio value and frequency range of the playback audio corresponding to the sampling result after the time-frequency conversion processing are obtained; weighting coefficients for different frequency ranges are preset, and the weighted average value of the corresponding playback audio is calculated based on the audio value, frequency range and the weighting coefficient of the corresponding frequency range; a noise filtering threshold is preset, and the weighted average value is compared with the noise filtering threshold, and the playback quality of the corresponding playback audio is judged based on the comparison result.
[0111] In an optional implementation of this embodiment, the playback audio corresponding to the sampling result after the time-frequency conversion processing is divided based on the preset frequency ranges of super high frequency, high frequency, mid-range, low frequency and super low frequency.
[0112] Specifically, the preset ultra-low frequency band is less than 20Hz, the preset bass frequency band is 20Hz-160Hz, that is, 3 times the frequency, the preset mid-frequency band is 160Hz-2500Hz, that is, 4 times the frequency, the preset treble frequency band is 2500Hz-20000Hz, that is, 3 times the frequency, and the preset ultra-high frequency band is greater than 20000Hz.
[0113] In an optional implementation of the present embodiment, after the playback audio corresponding to the sampling result after the time-frequency conversion processing is divided into five frequency range intervals, the audio value of each frequency range interval is calculated respectively, including an ultra-low frequency value, a low frequency value, a medium frequency value, a high frequency value and an ultra-high frequency value.
[0114] In an optional implementation of this embodiment, weighting coefficients for five frequency ranges, namely, ultra-low frequency, low frequency, medium frequency, high frequency, and ultra-high frequency, are preset, and a weighted average value of the corresponding played audio is calculated based on the audio value of each frequency range.
[0115] Specifically, the calculation formula for the weighted average of the played audio includes:
[0116]
[0117] In the formula, is the weighted average of the played audio, W SL is the ultra-low frequency weighting coefficient, V SL is the ultra-low frequency value, W L is the low frequency weighting coefficient, V L is the low frequency value, W M is the intermediate frequency weighting coefficient, V M is the intermediate frequency value, W H is the high frequency weighting coefficient, V H is the high frequency value, W SH is the ultra-high frequency weighting coefficient, V SH is an ultra-high frequency value.
[0118] In an optional implementation of the present embodiment, a noise filter threshold is preset based on multiple factors such as the sampling accuracy of the ADC analog-to-digital converter chip and the noise level of the playback device, and the weighted average value calculated in step S302 is compared with the noise filter threshold, and the playback quality of the corresponding playback audio is judged based on the comparison result.
[0119] Specifically, if the weighted average value is greater than the noise filter value, it is considered that the playback quality is good; if the weighted average value is less than the noise filter value, it is considered that the playback quality is poor, there is noise, and it is discarded.
[0120] Preferably, in this embodiment, the noise filtering threshold is preset to 2.
[0121] An audio baseline updating module 50, wherein the audio baseline updating module 50 is used to update the audio baseline based on the weighted average processing result;
[0122] In an optional implementation of this embodiment, a weighted average value of several sample audio playbacks is obtained, and the maximum value of the weighted average values of the several sample audio playbacks is taken as the audio baseline.
[0123] Specifically, the above steps are repeated several times, and the maximum value of the weighted average values of the last 50 sample audios with good playback quality is taken as the audio baseline.
[0124] A brightness level determination module 60, the brightness level determination module 60 is used to obtain a target playback audio and determine the brightness level of the target playback audio based on an audio baseline;
[0125] In an optional implementation of this embodiment, the target playback audio is acquired, the playback quality of the target playback audio is determined based on the updated audio baseline as a determination criterion, and the corresponding brightness level is calculated.
[0126] Specifically, in this embodiment, there are seven preset brightness levels, which are level one, level two, level three, level four, level five, level six, and level seven from strong to weak. Here, it is determined whether the brightness level of the target audio playback is level one, level two, level three, level four, level five, level six, or level seven.
[0127] The brightness level control module 70 is used to control the brightness of the atmosphere light based on the brightness level of the target played audio.
[0128] In an optional implementation of this embodiment, the brightness of the corresponding atmosphere light is controlled based on the acquired brightness level of the target played audio.
[0129] In an optional implementation of this embodiment, a brightness buffer range is preset, and the brightness of the corresponding atmosphere light is controlled based on the size and difference of the initial brightness level of the atmosphere light and the target brightness level corresponding to the target playback audio, and in combination with the brightness buffer range.
[0130] Specifically, the initial brightness level of the ambient light and the target brightness level corresponding to the target audio playback are determined. If the initial brightness level is greater than the target brightness level, the ambient light is controlled to a brightness level that is the initial brightness level minus 1.
[0131] Furthermore, if the initial brightness level is less than the target brightness level, it is determined whether the difference is 1. If it is less than or equal to 1, the initial brightness level is maintained; if it is greater than 1, the brightness level is controlled to the target brightness level.
[0132] In summary, embodiment 2 of the present invention provides a system for controlling atmosphere lights to follow the rhythm of music, which is used to execute the method for controlling atmosphere lights to follow the rhythm of music in embodiment 1, periodically samples the audio signal, and samples at the same time interval to make subsequent processing easier to implement; smoothing processing is performed based on the Hamming window plus window function to achieve filtering processing of the sampling results, and at the same time, the sampled audio signals are connected end to end to generate a periodic function, thereby reducing the impact of noise on the real audio signal; time-frequency conversion processing is performed to convert the time domain signal of the audio signal into a frequency domain signal, which is convenient for subsequent weighted averaging processing; weighted averaging processing is performed to calibrate and correct the sound Hertz interval corresponding to the middle, high and low bass and the results of actual music measurement to eliminate errors, and a real-time updated audio baseline is used to eliminate the impact of the sound size changes of the audio signal on the rhythmic effect, and a brightness buffer range is preset to prevent jitter and flickering at similar brightness levels, and the brightness of the atmosphere light is controlled to change quickly and slowly with the music to achieve a better rhythmic effect.
[0133] Embodiment 3
[0134] Embodiment 3 of the present invention further relates to an electronic device, including a memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor executes the computer program to implement the steps of the method for controlling an atmosphere light to follow the rhythm of music in embodiment 1.
[0135] Embodiment 4
[0136] Embodiment 4 of the present invention further relates to a computer-readable storage medium, comprising a computer program, wherein when the computer program is executed by a processor, the method for controlling an atmosphere light to move with the rhythm of music in embodiment 1 is implemented.
[0137] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0138] In addition, the embodiments of the present invention are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for controlling an atmosphere light to follow the rhythm of music, characterized in that: The method comprises: Periodically sampling the audio signal of the specimen playing audio; Smoothing the sampling result based on the windowing function to obtain the smoothed sampling result; Performing time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing; Performing weighted averaging processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio; updating the audio baseline based on the weighted average processing result; Acquire target playback audio, and determine the brightness level of the target playback audio based on the updated audio baseline; The brightness of the ambient light is controlled based on the brightness level of the target played audio.
2. The method for controlling the atmosphere light to follow the rhythm of music as claimed in claim 1, characterized in that: The periodic sampling of the audio line signal of the sample playing audio comprises: Perform 256-point periodic sampling on the audio signal of the sample playing audio to obtain the sampling result; Performing signal amplification processing on the sampling result to obtain a sampling result after signal amplification processing; Perform analog-to-digital conversion on the sampling result after the signal amplification processing to obtain a digital signal corresponding to the sampling result after the signal amplification processing.
3. The method for controlling the atmosphere light to follow the rhythm of music as claimed in claim 1, characterized in that: The smoothing process is performed on the sampling result based on the windowing function to obtain the smoothed sampling result, which includes: The sampling result is read, and a 256-point Hamming window function is added to the sampling result for smoothing to obtain the smoothed sampling result.
4. The method for controlling the atmosphere light to follow the rhythm of music as claimed in claim 1, characterized in that: The performing time-frequency conversion on the sampling result after the smoothing process to obtain the sampling result after the time-frequency conversion process comprises: The sampling result after the smoothing process is subjected to discrete Fourier transform process, so as to convert the discrete signal of the sampling result after the smoothing process in the time domain into a complex number series in the frequency domain.
5. The method for controlling the atmosphere light to follow the rhythm of music as claimed in claim 1, characterized in that: The performing weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio includes: Obtaining the audio value and frequency range of the played audio corresponding to the sampling result after the time-frequency conversion processing; Preset weighting coefficients for different frequency ranges, and calculate a weighted average value of the corresponding played audio based on the audio value, the frequency range, and the weighting coefficients for the corresponding frequency range; A noise filtering threshold is preset, the weighted average value is compared with the noise filtering threshold, and the playback quality of the corresponding playback audio is determined based on the comparison result.
6. The method for controlling the atmosphere light to follow the rhythm of music as claimed in claim 5, characterized in that: The updating of the audio baseline based on the weighted average processing result comprises: Obtain a weighted average value of audio played by several samples, and take the maximum value of the weighted average values of audio played by several samples as the audio baseline.
7. The method for controlling the ambient light to follow the rhythm of music as claimed in claim 6, characterized in that: The controlling the brightness of the atmosphere light based on the brightness level of the target played audio includes: A brightness buffer range is preset, and the brightness of the atmosphere light is controlled based on a difference between an initial brightness level of the atmosphere light and a target brightness level corresponding to the target playback audio, and in combination with the brightness buffer range.
8. A system for controlling ambient lighting to follow the rhythm of music, characterized in that: The system comprises: A periodic sampling module, the periodic sampling module is used to periodically sample the audio signal of the sample playing audio; A smoothing processing module, wherein the smoothing processing module is used to perform smoothing processing on the sampling result based on a windowing function to obtain the sampling result after smoothing processing; A time-frequency conversion processing module, the time-frequency conversion processing module is used to perform time-frequency conversion processing on the sampling result after the smoothing processing to obtain the sampling result after the time-frequency conversion processing; A weighted average processing module, the weighted average processing module is used to perform weighted average processing on the sampling results after the time-frequency conversion processing to determine the playback quality of the corresponding playback audio; An audio baseline updating module, the audio baseline updating module being used to update the audio baseline based on the weighted average processing result; A brightness level determination module, the brightness level determination module is used to obtain a target playback audio and determine the brightness level of the target playback audio based on an audio baseline; A brightness level control module is used to control the brightness of the atmosphere light based on the brightness level of the target audio playback.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for controlling an atmosphere lamp to move with the rhythm of music as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for controlling an atmosphere light to move with the rhythm of music according to any one of claims 1 to 7 is implemented.