Atmosphere lamp control method and device and computer readable storage medium
By performing frame processing and feature data rating on the music signal, adjusting the lighting effect parameters of the ambient light, the problem of light mismatch between the music is solved, and the synchronous response between the light and the music is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202510684232.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, the lighting effects of the ambient light do not match the rhythm and melody of the music, resulting in a poor user experience.
By performing frame-based processing of the music signal to be played, the time domain feature data and frequency domain feature data of each frame of music signal are extracted, and the music emotions are scored based on these feature data to obtain emotional scores, and the lighting effect parameters are adjusted using the emotional scores to achieve a fine matching of the lighting effect and the music signal.
Improve the matching degree between lighting effects and music signals, synchronizes the light response with music, and enhances the user's experience.
Smart Images

Figure CN120529463A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicles, and more particularly, to a method, device, and computer-readable storage medium for controlling ambient light in the field of vehicles. Background Art
[0002] With the rapid development of automotive technology and consumers' increasing demand for a better driving experience, vehicles are equipped with ambient lighting systems to create a comfortable in-car environment. To further enhance the in-car ambiance, the function of synchronizing ambient lighting with music has been introduced, allowing the ambient lighting to dynamically adjust according to the rhythm and melody of the music.
[0003] However, in actual applications, the lighting atmosphere effect does not match the rhythm and melody of the music, resulting in a poor user experience. Summary of the Invention
[0004] The present application provides a method, device and computer-readable storage medium for controlling an atmosphere light. The present application scores the music emotion associated with each frame of music signal through the time domain feature data and frequency domain feature data of each frame of music signal. Based on the emotion score, the demand for music emotion of each frame of music signal can be determined. Based on the demand for music emotion, the degree of influence of different music emotions on lighting effects can be adjusted, thereby achieving fine control of lighting effect parameters and improving the matching degree between lighting effects and music signals.
[0005] In a first aspect, a method for controlling an atmosphere light is provided, the method comprising: performing frame processing on a music signal to be played to obtain multiple frames of music signals; obtaining time domain feature data and frequency domain feature data of each frame of the music signal; obtaining music emotions associated with each frame of the music signal; scoring the music emotions based on the time domain feature data and the frequency domain feature data to obtain an emotion score; determining lighting effect parameters corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data and the frequency domain feature data; and controlling the atmosphere light based on the lighting effect parameters.
[0006] By performing frame processing on the music signal to be played, multiple frames of music signals are obtained, and the music signal to be played is divided into short-term music signals. The time domain feature data and frequency domain feature data are extracted from the short-term music signals with higher accuracy. By obtaining the time domain feature data and frequency domain feature data of each frame of music signal, the music emotion associated with each frame of music signal is obtained, and the music emotion is scored based on the time domain feature data and frequency domain feature data to obtain an emotion score. The emotion score of the music emotion associated with each frame of music signal can be determined in real time based on the time domain feature data and frequency domain feature data related to the emotion. The emotion score is used as an intermediate variable for determining the lighting effect parameters, and the influence of different music emotions on the lighting effect can be more flexibly adjusted to achieve fine control of the lighting effect parameters. The lighting effect parameters corresponding to each frame of music signal are determined based on the music emotion, emotion score, time domain feature data and frequency domain feature data. The atmosphere light is controlled based on the lighting effect parameters. The original features of the music signal (such as music emotion, time domain feature data and frequency domain feature data) and the lighting effect parameters can be decoupled through the emotion score. The scores flexibly adjust the influence of different music emotions, time domain feature data and frequency domain feature data on the lighting effects, avoid the presence of abnormal features in the original features, and directly determine the lighting effect parameters based on the abnormal features, thereby improving the matching degree between the lighting effect and the music signal. The method scores the music emotion associated with each frame of music signal through the time domain feature data and frequency domain feature data of each frame of music signal. Based on the emotion score, the demand for music emotion of each frame of music signal can be determined. Based on the demand for music emotion, the degree of influence of different music emotions on the lighting effect can be adjusted, thereby achieving fine control of the lighting effect parameters and improving the matching degree between the lighting effect and the music signal. By determining the lighting effect parameters corresponding to each frame of music signal, the lighting effect parameters can be dynamically changed as the playback progress of each frame of music signal is made, so that the lighting response is more closely matched with the music signal. When playing music and using ambient lights in the vehicle, the lighting effect of the ambient light can be dynamically changed according to the music emotion, emotion score, time domain feature data and frequency domain feature data of the music signal, so that the user's auditory perception matches the visual perception, thereby improving the user experience.
[0007] In combination with the first aspect, in some possible implementations, the obtaining of time domain feature data and frequency domain feature data of each frame of music signal includes: obtaining the rhythm intensity, beat period, inter-frame energy difference and multiple sub-band energy ratios of each frame of music signal; determining the rhythm intensity and the beat period as the time domain feature data; and determining the energy difference and the multiple sub-band energy ratios as the frequency domain feature data.
[0008] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, obtaining the musical emotion associated with each frame of the music signal includes: segmenting the frequency band of each frame of the music signal to obtain multiple sub-bands; obtaining the preset musical emotion associated with each sub-band to obtain the musical emotion associated with each frame of the music signal.
[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the lighting effect parameters corresponding to each frame of the music signal are determined based on the music emotion, the emotion score, the time domain feature data and the frequency domain feature data, including: dividing the emotion score of the preset music emotion associated with each sub-band by the sum of the emotion scores of the preset music emotions associated with the multiple sub-bands to obtain multiple initial emotion weights; obtaining the music type of the music signal to be played; and determining the lighting effect parameters based on the music type, the multiple initial emotion weights, the time domain feature data, the frequency domain feature data and the preset music emotions associated with the multiple sub-bands.
[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, obtaining the music type of the music signal to be played includes: determining the average sub-band energy ratio of the same sub-band corresponding to each of the multiple frames of music signals to obtain multiple average sub-band energy ratios; determining the sub-band corresponding to the target value as the dominant frequency band of the music signal to be played, and the target value is the maximum value among the multiple average sub-band energy ratios; and determining the preset music type associated with the dominant frequency band as the music type of the music signal to be played.
[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the lighting effect parameters are determined based on the music type, the multiple initial emotion weights, the time domain feature data, the frequency domain feature data and the preset music emotions associated with the multiple sub-bands, including: correcting the multiple initial emotion weights according to the music type to obtain multiple target emotion weights; and determining the lighting effect parameters based on the multiple target emotion weights, the time domain feature data, the frequency domain feature data and the preset music emotions associated with the multiple sub-bands.
[0012] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the multiple initial emotional weights are corrected according to the music type to obtain multiple target emotional weights, including: increasing the first weight and reducing the second weight, the first weight being the initial emotional weight corresponding to the dominant frequency band in the multiple initial emotional weights, and the second weight including the initial emotional weights in the multiple initial emotional weights except the first weight.
[0013] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the lighting effect parameters include light hue, light saturation, light brightness and light change speed, and the lighting effect parameters are determined based on the preset music emotions associated with the multiple target emotion weights, the time domain feature data, the frequency domain feature data and the multiple sub-bands, including: obtaining the hue angles corresponding to each of the multiple preset music emotions to obtain multiple hue angles, and performing weighted operations on the multiple hue angles and the multiple target emotion weights to obtain the light hue; determining the light saturation according to the target emotion weight corresponding to the target sub-band and the frequency domain feature data, the target sub-band being the sub-band with the highest energy among the multiple sub-bands; determining the light brightness according to the time domain feature data and the frequency domain feature data; obtaining multiple preset speeds according to obtaining the preset speeds corresponding to each of the multiple preset music emotions, and determining the light change speed according to the multiple preset speeds, the multiple target emotion weights, the time domain feature data and the frequency domain feature data.
[0014] In a second aspect, a control device for an ambient light is provided, the device comprising:
[0015] A frame processing module is used to perform frame processing on the music signal to be played to obtain multiple frames of music signals;
[0016] A first acquisition module is used to acquire time domain feature data and frequency domain feature data of each frame of music signal;
[0017] A second acquisition module is used to acquire the music emotion associated with each frame of the music signal;
[0018] A scoring module, configured to score the music emotion based on the time domain feature data and the frequency domain feature data to obtain an emotion score;
[0019] a determination module, configured to determine the lighting effect parameters corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data, and the frequency domain feature data;
[0020] A control module is used to control the atmosphere light based on the lighting effect parameters.
[0021] In a third aspect, a vehicle is provided, comprising:
[0022] a memory for storing executable program code;
[0023] A processor is used to call and run the executable program code from the memory, so that the vehicle executes the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0024] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0025] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram showing a flow chart of a method for controlling an atmosphere lamp provided in an embodiment of the present application is shown;
[0027] Figure 2 A schematic structural diagram of a control device for an atmosphere lamp provided in an embodiment of the present application is shown;
[0028] Figure 3 A structural schematic diagram of a vehicle provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0029] The following will clearly and thoroughly describe the technical solutions in this application in conjunction with the accompanying drawings. In the description of the embodiments of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more than two.
[0030] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0031] With the rapid development of automotive technology and consumers' increasing demand for a better driving experience, vehicles are equipped with ambient lighting systems to create a comfortable in-car environment. To further enhance the in-car ambiance, the function of synchronizing ambient lighting with music has been introduced, allowing the ambient lighting to dynamically adjust according to the rhythm and melody of the music.
[0032] However, in actual applications, the lighting atmosphere effect does not match the rhythm and melody of the music, resulting in a poor user experience.
[0033] Based on the above problems, the present application provides a method, device and computer storage medium for controlling an atmosphere light. The present application extracts the time domain features and frequency domain features of each frame of music signal, scores the music emotion of each frame of music signal based on the time domain features and frequency domain features to obtain an emotion score, adjusts the effect parameters of the atmosphere light based on the emotion score, music emotion, time domain features and frequency domain features, and controls the atmosphere light through the effect parameters, that is, determines the emotion score of the music emotion of each frame of music signal through the time domain features and frequency domain features, uses the emotion score as an intermediate variable to determine the effect parameters to adjust the influence of different music emotions on the light, and converts the original features of the music signal (such as music emotion, time domain feature data and frequency domain features) into an emotion score. The association between the time domain feature data and the frequency domain feature data and the lighting effect parameters is decoupled, and the influence of different music emotions, time domain feature data and frequency domain feature data on the lighting effect is flexibly adjusted through the emotion score. When there are abnormal features in the original features, the lighting effect parameters are directly determined based on the abnormal features, which improves the matching degree between the lighting effect and the music signal, and thus the effect parameters can be more finely controlled. By adjusting the effect parameters of the atmosphere light by the music emotion, emotion score, time domain feature and frequency domain feature associated with the music signal, the lighting effect can be more matched with the actual emotion of the music signal, and the lighting effect and the music signal can be synchronized, thereby improving the matching degree between the lighting effect and the music signal.
[0034] Next, we introduce the control method of the atmosphere light provided by the embodiment of the present application. The control method of the atmosphere light provided by the embodiment of the present application is applied to the atmosphere light controller. Figure 1 As shown, Figure 1 A flow chart of a method for controlling an atmosphere lamp provided in an embodiment of the present application is shown. The method for controlling an atmosphere lamp provided in the present application includes the following S110 - S160 .
[0035] S110: Perform frame processing on the music signal to be played to obtain multiple frames of music signals.
[0036] The music signal to be played is a music signal that has been selected (such as selected by the user, or automatically recommended by the in-vehicle infotainment system based on the user's preferences) but has not yet started playing. The music signal to be played can be obtained from a device paired with the in-vehicle audio, or the in-vehicle infotainment system can be accessed to obtain the music signal to be played. In order to accurately control the lighting and make the lighting effects change with the real-time changes in the rhythm and melody of the music, after obtaining the music signal to be played, the music signal to be played can be divided into music signals corresponding to short-term segments, that is, the music signal to be played is framed to obtain multiple frames of music signals. In each frame of the music signal, the local characteristics and subtle changes of the music signal at different time points, such as changes in pitch, rhythm, intensity, etc., can be captured, thereby making the time domain feature data and frequency domain feature data extracted later more accurate. The lighting effect parameters are adjusted based on the more accurate time domain feature data and frequency domain feature data to achieve precise control of the lighting.
[0037] S120: Acquire time domain feature data and frequency domain feature data of each frame of music signal.
[0038] In order to quantify the local characteristics and subtle changes of each frame of music signal and determine the emotion of each frame of music signal, after obtaining multiple frames of music signal, the time domain feature data and frequency domain feature data of each frame of music signal are obtained. The time domain feature data reflects the characteristics of each frame of music signal changing over time. The time domain feature data can be calculated based on the original music signal. The frequency domain feature data is extracted by converting the time domain music signal into a frequency distribution (such as Fourier transform) to reflect the frequency component characteristics of the signal. When determining the emotion score in the later stage, the time domain feature data and frequency domain feature data of each frame of music signal are used as the basis for the emotion score to determine the importance of each frame of music signal in associating with the music emotion, thereby realizing the dynamic adjustment of the lighting effect parameters based on the local characteristics and subtle changes of each frame of music signal.
[0039] S130: Obtaining the music emotion associated with each frame of music signal.
[0040] Musical emotion is used to indicate the emotional state felt by the user when listening to music. Musical emotions include excitement, warmth, calmness, happiness, sadness, etc. In order to create a more immersive multi-sensory environment and increase the user's sense of immersion when listening to music, after obtaining multiple frames of music signals, the musical emotion associated with each frame of music signal is obtained. Using musical emotion as a determining factor of the lighting effect parameters can synchronize the lighting effect with the musical emotion, making the lighting atmosphere of the atmosphere light a visual extension of the expression of musical emotion.
[0041] When obtaining the musical emotion associated with each frame of music signal, the musical emotion associated with each frame of music signal can be pre-constructed, wherein the musical emotion associated with each frame of music signal can be determined based on the characteristics of each frame of music signal, such as determining the musical emotion associated with each frame of music signal based on the frequency band range. For example, as shown in Table 1, Table 1 shows an example of the relationship between a frame of music signal and a musical emotion provided in an embodiment of the present application:
[0042] Table 1
[0043]
[0044]
[0045] S140: Score the music emotion based on the time domain feature data and the frequency domain feature data to obtain an emotion score.
[0046] In order to make the lighting effects more compatible with the music emotions and to more flexibly adjust the effects of different music emotions on the lighting, the music emotions used to determine the lighting effect parameters are made closer to the real music emotions of each frame of music signal, and the music emotions associated with each frame of music signal are scored to obtain an emotion score. That is, the time domain feature data and frequency domain feature data related to the music emotions in each frame of music signal are used to determine the emotion score of the music emotions associated with each frame of music signal in real time. The emotion score is used as an intermediate variable for adjusting the lighting effects, and the importance of the music emotions associated with each frame of music signal can be adjusted, thereby adjusting the music emotions associated with each frame of music signal obtained, so that the music emotions used to determine the lighting effect parameters are closer to the real music emotions of each frame of music signal, thereby ensuring that the real music emotions are reflected in the lighting effects.
[0047] When scoring the music emotion associated with each frame of music signal, the time domain feature data and the frequency domain feature data can be spliced into joint feature data, the music emotion and the joint feature data can be input into the target emotion score model, and the music emotion and the joint feature data can be processed by the target emotion score model to obtain the emotion score of each music emotion. Among them, the target emotion score model is obtained after multiple rounds of fine-tuning using the joint feature data of multiple frames of music signals, each music emotion and emotion score in each frame of music signal. The target emotion score model is a type of deep learning model. For example, as shown in Table 2, Table 2 shows an example of the music emotion and the corresponding emotion score of the first frame of music signal in Table 1:
[0048] Table 2
[0049] Musical emotion associated with the first frame of music signal Sentiment score Passionate 80 points excited 60 points
[0050] S150: Determine lighting effect parameters corresponding to each frame of music signal based on the music emotion, emotion score, time domain feature data, and frequency domain feature data.
[0051] Lighting effect parameters are a series of technical indicators that control lighting effects. Lighting effect parameters directly affect the visual effects and atmosphere creation of ambient lighting. Lighting effect parameters include light hue, light saturation, light brightness and light change speed. Among them, light hue determines the color type of ambient lighting; light saturation refers to the vividness of the color, which refers to the purity or intensity of the color. The higher the saturation, the brighter the color, and the lower the saturation, the closer the color is to gray; light brightness is a physical quantity that describes the brightness of light and affects the user's perception of light intensity; light change speed refers to the rate of change of light hue, light saturation and light brightness, which describes the length of time required for light to transition from one state to another.
[0052] In order to make the lighting effect achieve more accurate emotional expression, the lighting effect parameters are jointly determined based on the music emotion, emotion score, time domain feature data and frequency domain feature data. For each frame of music signal, each music emotion is dynamically adjusted based on the emotion score, and the proportion of each music emotion in the entire frame of music signal is determined. If the emotion score is greater than or equal to the first preset emotion score threshold, the proportion of the emotion score can be increased. If the emotion score is less than the second preset emotion score threshold, the proportion of the emotion score can be reduced.
[0053] Determining the lighting effect parameters based on the music emotion, music emotion ratio, time domain feature data, and frequency domain feature data of each frame of music signal can be done by constructing a mapping relationship between preset music emotion, preset emotion ratio, preset time domain feature data, preset frequency domain feature data, and preset lighting effect parameters. After determining the music emotion, music emotion ratio, time domain feature data, and frequency domain feature data of each frame of music signal, the lighting effect parameters corresponding to each frame of music signal can be determined based on the mapping relationship between the music emotion, music emotion ratio, time domain feature data, and frequency domain feature data of each frame of music signal and the preset emotion type, preset emotion ratio, preset time domain feature data, and preset frequency domain feature data and the preset lighting effect parameters. For example, as shown in Table 3, Table 3 shows an example of a mapping relationship between a preset music emotion, a preset emotion ratio, preset time domain feature data, and preset frequency domain feature data and preset lighting effect parameters provided in an embodiment of the present application:
[0054] Table 3
[0055]
[0056]
[0057] Based on the music emotion, emotion score, time domain feature data and frequency domain feature data, the lighting effect parameters of each frame of the music signal are determined. The lighting effect parameters of each frame of the music signal can be dynamically determined to synchronize the lighting effect with the music signal. The music emotion is dynamically adjusted through the emotion score, and the association between the original characteristics of the music signal (such as music emotion, time domain feature data and frequency domain feature data) and the lighting effect parameters is decoupled to avoid the impact of abnormal fluctuations of a single factor in the original characteristics (such as music emotion, time domain feature data and frequency domain feature data) on the final lighting effect parameters. The emotion score is used as an intermediate variable of the lighting effect parameters, and the influence of different music emotions on the lighting effect is dynamically adjusted to improve the matching degree between the lighting effect and the music signal. The lighting effect parameters are determined through the music emotion, emotion score, time domain feature data and frequency domain feature data. While determining the matching of the lighting effect with the music emotion, the accuracy of the recognized music emotion is guaranteed.
[0058] S160: Control the ambient light based on the lighting effect parameters.
[0059] After determining the lighting effect parameters, the lighting effect parameters can be converted into corresponding control instructions, and the control instructions are sent to the atmosphere light controller. The atmosphere light controller determines the lighting effect parameters of the atmosphere light according to the control instructions, so that the atmosphere light creates an atmosphere that matches each frame of music signal.
[0060] The present embodiment provides a method for controlling an atmosphere lamp, which obtains multiple frames of music signals by performing frame processing on a music signal to be played, and divides the music signal to be played into short-term music signals. The time domain feature data and frequency domain feature data are extracted from the short-term music signals with higher accuracy. The music emotion associated with each frame of the music signal is obtained by obtaining the time domain feature data and frequency domain feature data of each frame of the music signal, and the music emotion is scored based on the time domain feature data and frequency domain feature data to obtain an emotion score. The emotion score of the music emotion associated with each frame of the music signal can be determined in real time based on the time domain feature data and frequency domain feature data related to the emotion. The emotion score is used as an intermediate variable for determining the lighting effect parameters, and the influence of different music emotions on the lighting effect can be more flexibly adjusted to achieve fine control of the lighting effect parameters. The lighting effect parameters corresponding to each frame of the music signal are determined based on the music emotion, the emotion score, the time domain feature data and the frequency domain feature data. The atmosphere lamp is controlled based on the lighting effect parameters, and the original features of the music signal (such as music emotion, time domain feature data and frequency domain feature data) and the lighting effect parameters can be decoupled by the emotion score. The method is used to flexibly adjust the influence of different music emotions, time domain feature data and frequency domain feature data on the lighting effects through the emotion score, avoid the existence of abnormal features in the original features, and directly determine the lighting effect parameters based on the abnormal features, thereby improving the matching degree between the lighting effect and the music signal. The method scores the music emotion associated with each frame of music signal through the time domain feature data and frequency domain feature data of each frame of music signal. Based on the emotion score, the demand for music emotion of each frame of music signal can be determined. Based on the demand for music emotion, the degree of influence of different music emotions on the lighting effect can be adjusted, thereby achieving fine control of the lighting effect parameters and improving the matching degree between the lighting effect and the music signal. By determining the lighting effect parameters corresponding to each frame of music signal, the lighting effect parameters can be dynamically changed as the playback progress of each frame of music signal is achieved, so that the lighting response is more closely matched with the music signal. When playing music and using ambient lights in the vehicle, the lighting effect of the ambient light can be dynamically changed according to the music emotion, emotion score, time domain feature data and frequency domain feature data of the music signal, so that the user's auditory perception matches the visual perception, thereby improving the user experience.
[0061] In one possible implementation, the time domain feature data and frequency domain feature data of each frame of the music signal are obtained, including: obtaining the rhythm intensity, beat period, inter-frame energy difference and multiple sub-band energy ratios of each frame of the music signal; determining the rhythm intensity and beat period as time domain feature data; and determining the energy difference and multiple sub-band energy ratios as frequency domain feature data.
[0062] The rhythm intensity is used to indicate the average amplitude value of each frame of music signal in the time domain, and is used to quantify the intensity of the music signal. When obtaining the rhythm intensity of each frame of music signal, the amplitude value of each sampling point on each frame of music signal can be obtained, and then the absolute values of the amplitude values of all sampling points are added to obtain the absolute value sum of the amplitude values. The rhythm intensity is obtained by dividing the absolute value sum of the amplitude values by the number of all sampling points of each frame of music signal. The number of all sampling points on each frame of music signal can be obtained by multiplying the sampling frequency and the duration of each frame of music signal. For example, if the sampling frequency is 44.08kHz and the duration of each frame of music signal is 25ms, the number of sampling points is 44.08kHz×25ms=1102, that is, the number of sampling points is 1102. Since the sudden change at the beginning and end of a single frame of music signal will introduce high-frequency noise (i.e., spectrum leakage) when the music signal is framed, in order to reduce the high-frequency noise introduced by the music signal during framing, the absolute values of the amplitude values of all sampling points can be windowed so that the two ends of the single frame of music signal can be smoothly attenuated. The specific calculation formula of the rhythm intensity is as follows:
[0063]
[0064] Among them, B is the rhythm intensity of each frame of the music signal, N is the number of all sampling points of each frame of the music signal, x(n) is the amplitude value of sampling point n, which represents the discretized amplitude value of the music signal, |x(n)| is the absolute value of the amplitude value of each sampling point. Because the music signal is an analog signal, it is an alternating positive and negative waveform. After taking the absolute value, the contribution of all sampling points is positive, and w(n) is the Hamming window function.
[0065] The amplitude of a music signal is related to its energy. The larger the amplitude, the higher the energy of the music signal. By calculating the mean of the absolute amplitude values of all sampling points in each frame of the music signal, a measure of the overall energy level of each frame of the music signal can be obtained, which is conducive to capturing the rhythm in each frame of the music signal. Since high-frequency noise is introduced into the music signal when it is framed, using a Hamming window function to process the absolute amplitude values of all sampling points can avoid the introduction of noise when directly using the mean of the absolute amplitude values to determine the rhythm intensity, making the rhythm of each frame of the music signal more prominent. Based on the mean of the absolute amplitude values of all sampling points and the product of the Hamming window, obtaining the rhythm intensity of each frame of the music signal also has lower computational complexity and is more adaptable to the resource limitations of the ambient light controller.
[0066] The beat period is used to indicate the time interval between adjacent beats in a music signal. When obtaining the beat period, the similarity between the music signal in the time window and the music signal after being delayed for a specific time can be obtained. The time window includes multiple frames of music signals. For example, the time window length can be set to 300ms, and the duration of each frame of music signal is 25ms. Then, the time window contains 12 frames of music signals. After obtaining the similarity between the music signal in the time window and the music signal after being delayed for a specific time, the specific time corresponding to the maximum similarity is determined as the beat period of each frame of music signal in the time window. The calculation formula of the beat period is as follows:
[0067]
[0068] Where T is the beat period, and ACF(s, t) is the autocorrelation function of the music signal s(n) at sampling point n, specifically:
[0069]
[0070] The autocorrelation function ACF(s, t) compares the similarity of the music signal at sampling point n and after a specific delay time t, where t is the specific delay time and N is the number of all sampling points of each frame of the music signal. It is used to find the specific delayed time t at which the autocorrelation function ACF(s, t) reaches its maximum value. If the ACF(s, t) of the music signal at sampling point n and sampling point n+t is larger, it means that the music signal at sampling point n and sampling point n+t is more similar. When the music signal is periodic, a peak will appear at the specific time t corresponding to the period. Finding the specific time t value at which ACF(s, t) is the maximum is the beat period T.
[0071] Since the duration of the beat cycle is greater than the duration of each frame of the music signal, the beat cycle is determined across frames, that is, the beat cycle of the music signal needs to be determined by multiple frames of music signals, and within the time window, the beat cycle of the music signal usually does not frequently mutate, and has the stable characteristics of the beat cycle. Therefore, all frame music signals within the time window can reuse the beat cycle. When determining the beat cycle, when analyzing the beat cycle through the autocorrelation function, it does not depend on the type of music, rhythm pattern or instrument timbre, etc., and is suitable for a wide range of scenarios (such as electronic music, classical music, percussion, etc.), and directly extracts the beat cycle from the time domain, avoiding errors caused by insufficient frequency domain resolution or misjudgment of the note starting point. Since high-frequency noise is introduced into the music signal during frame processing, the autocorrelation function highlights the strongest periodic part in the music signal containing noise or instantaneous interference, making the calculated beat cycle more reliable.
[0072] The entire music signal can be divided into time windows, and the beat period of each frame of the music signal in each time window can be determined according to the above method.
[0073] Inter-frame energy difference is used to quantify the energy change between frames and to retain the ability to detect transient events. The inter-frame energy difference is determined based on the ratio between the energy difference and the energy sum value, where the energy difference is the absolute difference between the energy of each frame of music signal and the energy of the adjacent previous frame of music signal, and the energy sum is the sum of the energy of each frame of music signal and the energy of the adjacent previous frame of music signal. The energy is the sum of the squares of the amplitude values of all sampling points in each frame of music signal. Determining the inter-frame energy difference based on the ratio between the energy difference and the energy sum value can avoid the higher volume in the music signal dominating the final musical emotion result, and can ensure that the lower volume part can also be paid attention to and analyzed, thereby obtaining a more comprehensive and accurate musical emotion result, and reducing the overhead of frequency domain transformation, which can ensure that the atmosphere light controller can quickly process the input music signal. The calculation formula for inter-frame energy difference is:
[0074]
[0075] Among them, △E(m) is the energy difference between frames, E(m) is the total energy of the music signal of the mth frame,
[0076]
[0077] Where x(n) is the amplitude value of sampling point n in each frame of music signal, N is the number of all sampling points in each frame of music signal, |E(m)-E(m-1)| is the absolute value of the difference between the total energy of the music signal in the mth frame and the total energy of the music signal in the adjacent previous frame (i.e., the m-1th frame), which is used to detect energy mutations (such as drum beats, note onsets, etc.), |E(m)+E(m-1)| is the sum of the total energy of the music signal in the mth frame and the total energy of the music signal in the m-1th frame, which is used to eliminate the influence of volume differences, and ∈ is used to prevent the denominator from being zero during silent frames. For example, if E(m)=100 and E(m-1)=90, then △E(m)=10 / 190=0.256, and if E(m)=10 and E(m-1)=9, then △E(m)=1 / 19=0.256. Among them, the inter-frame energy difference of the first frame of music signal can be directly preset, such as set to 0.
[0078] The sub-band energy ratio is used to distinguish the proportion of the energy of each sub-band in the entire frame music signal to the total energy. The frequency band of each frame music signal can be segmented to obtain multiple sub-bands. For example, assuming that the frequency band of the music signal is 0-20 kHz, it can be divided into multiple sub-bands as shown in Table 4. Table 4 shows an example of sub-band results after frequency band segmentation processing of a music signal provided in an embodiment of the present application:
[0079] Table 4
[0080]
[0081]
[0082] Each frame of music signal can be divided into sub-bands according to the frequency range of the sub-bands. The number of sub-bands into which each frame of music signal is divided will result in several sub-band energy ratios. For example, if the frequency band of a certain frame of music signal is 100-2000 Hz, it can be divided into two sub-bands of mid-low frequency and mid-frequency according to Table 4 above, and there will be two sub-band energy ratios. When determining the sub-band energy ratio, the first total energy in each sub-band is divided by the second total energy in the frequency band of each frame of music signal to obtain the energy ratio of each sub-band. The calculation formula of the sub-band energy ratio is as follows:
[0083]
[0084] Among them, E subi is the subband energy ratio of the ith subband in the mth frame music signal, E(i) is the total energy of the ith subband in the mth frame music signal, and E(m) is the total energy of the mth frame music signal.
[0085] By segmenting the frequency band of each frame of music signal, multiple sub-bands are obtained, which makes it easier to associate different musical emotions based on different frequency bands in the later stage. Each frame of music signal can be associated with multiple musical emotions, and the musical emotion of each frame of music signal can be determined more accurately. By dividing the first total energy in each sub-band by the second total energy in the frequency band of each frame of music signal, the energy ratio of each sub-band is obtained, which can provide weight information for the emotional weight of the musical emotion corresponding to each sub-band.
[0086] In order to eliminate the differences among rhythm intensity, beat period, inter-frame energy difference, and multiple sub-band energy ratios when calculating the emotion score, so that rhythm intensity, beat period, inter-frame energy difference, and multiple sub-band energy ratios can participate in the calculation fairly and prevent large-scale features (such as energy value) from dominating small-scale features (such as beat period), rhythm intensity, beat period, and inter-frame energy difference need to be normalized. The specific processing process is as follows:
[0087] (1) Rhythm intensity normalization
[0088]
[0089] Among them, B norm is the normalized rhythm intensity of each frame of music signal, B is the rhythm intensity of each frame of music signal, μB is the mean rhythm intensity of the training music signal set, B-μB is the centering to eliminate the absolute numerical deviation, σB is the standard deviation of the rhythm intensity of the training music signal set.
[0090] (2) Beat cycle normalization
[0091]
[0092] Among them, T norm The normalized beat period of each frame of music signal is μT, which is the average beat period of common music, such as 0.6s. σT covers the beats per minute (BPM) range of 30 to 200, such as 0.3s. Normalization is performed to adapt the input range of the control signal.
[0093] (3) Normalization of inter-frame energy difference
[0094] ΔE norm =ΔE(m)×a (9)
[0095] Where △E(m) is the energy difference between frames, a is the scaling factor, and the scaling factor can be an estimated value, such as 10, △E norm The inter-frame energy difference after normalization of each frame of music signal is linearly amplified by the scaling factor, which can avoid the excessively small value being ignored in the weighted calculation and still have a significant impact on the emotional weight.
[0096] In one possible implementation, obtaining the musical emotion associated with each frame of music signal includes: segmenting the frequency band of each frame of music signal to obtain multiple sub-bands; obtaining the preset musical emotion associated with each sub-band to obtain the musical emotion associated with each frame of music signal.
[0097] Since different frequency bands of music signals are associated with specific emotional states of the user, a mapping relationship between different sub-bands and preset music emotions can be pre-established, as shown in Table 5. Table 5 shows an example of a mapping relationship between different sub-bands and preset music emotions provided in an embodiment of the present application:
[0098] Table 5
[0099]
[0100]
[0101] Each frame of music signal is segmented and processed to obtain multiple sub-bands. The preset music emotion corresponding to each sub-band is determined according to the mapping relationship between the sub-bands and the preset music emotions, and multiple music emotions associated with each frame of music signal are obtained. The frequency band of each frame of music signal is divided into several sub-bands, and there are several music emotions associated with each frame of music signal. For example, in Table 5 above, the preset music emotion corresponding to the low frequency is excitement, the preset music emotion corresponding to the mid-low frequency is excitement, the preset music emotion corresponding to the mid-frequency is warmth, and the preset music emotion corresponding to the high frequency is calm. If the frequency band of a frame of music signal is divided into two sub-bands of mid-low frequency and mid-frequency, then the music emotions associated with the frame of music signal include excitement and warmth. That is, if each frame of music signal is divided into several sub-bands, the frame of music signal will have several corresponding emotions.
[0102] In one possible implementation, the lighting effect parameters corresponding to each frame of the music signal are determined based on the music emotion, emotion score, time domain feature data and frequency domain feature data, including: dividing the emotion score of the preset music emotion associated with each sub-band by the sum of the emotion scores of the preset music emotions associated with multiple sub-bands to obtain multiple initial emotion weights; obtaining the music type of the music signal to be played; and determining the lighting effect parameters based on the music type, multiple initial emotion weights, time domain feature data, frequency domain feature data and the preset music emotions associated with multiple sub-bands.
[0103] After determining the preset music emotion associated with each sub-band, the emotion score of each music emotion can be calculated based on the time domain feature data and the frequency domain feature data. Each time domain feature data and the frequency domain feature data can be multiplied by the characteristic coefficient corresponding to the music emotion and then added to obtain the emotion score of the music emotion. For example, assuming that the music emotion associated with a certain frame of music signal is passion, excitement, warmth, and calmness in Table 5, the process of calculating the emotion scores of these four music emotions can be:
[0104]
[0105] Among them, y1 is the passionate emotion score, y2 is the excited emotion score, y3 is the warm emotion score, and y4 is the calm emotion score. When calculating the excited emotion score, the mid-frequency band energy ratio is added. The mid-frequency band covers the mid-frequency energy of the music signal, which can enhance the richness and liveliness of the music, further strengthen the emotional expression of excitement, and increase emotional differentiation.
[0106] After determining the emotional score of each musical emotion, the emotional scores of the preset musical emotions associated with all sub-bands can be added together to obtain the emotional score sum. For example, the sum of the emotional scores is y, y=y1+y2+y3+y4. Then, each emotional score is divided by the emotional score sum to obtain the initial emotional weight of each musical emotion, as follows:
[0107]
[0108] Among them, W1 is the initial emotional weight of excitement, W2 is the initial emotional weight of excitement, W3 is the initial emotional weight of warmth, and W4 is the initial emotional weight of calmness.
[0109] Based on the sub-band energy ratio corresponding to each musical emotion and the accompanying characteristics of each musical emotion, the emotional weight of each musical emotion is determined to achieve differentiated representation of musical emotions, which can more comprehensively capture the complexity of musical emotions. Based on the association between sub-bands and musical emotions, the correlation relationship between music signals and musical emotions is established. Based on the sub-band energy ratio corresponding to each musical emotion and the accompanying characteristics of each musical emotion, the emotional weight of each musical emotion is determined, which can avoid strong coupling between musical emotions and lighting effect parameters. Using musical emotions as the intermediate carrier and emotional weight to quantify musical emotions can make the music signal and lighting effect parameters more matched.
[0110] There are many types of music, such as classical music, pop music, electronic music and folk music. Different music types can stimulate different emotional responses in users. The music type of the music signal to be played can be identified. For example, the music type of each music signal to be played can be pre-marked. When obtaining the music signal to be played, the music type corresponding to the music signal to be played is directly obtained. In order to make the determined music emotion closer to the actual emotion of the music signal and make the music signal and the lighting effect of the atmosphere light more matched, the music type is added when determining the lighting effect parameters. The lighting effect parameters are determined jointly based on the music type, multiple initial emotion weights, time domain feature data, frequency domain feature data and preset music emotions associated with multiple sub-bands, so that the music signal and the lighting effect of the atmosphere light can be more matched.
[0111] In one possible implementation, obtaining the music type of the music signal to be played includes: determining the average sub-band energy ratio of the same sub-band corresponding to multiple frames of music signals to obtain multiple average sub-band energy ratios; determining the sub-band corresponding to the target value as the dominant frequency band of the music signal to be played, and the target value is the maximum value among the multiple average sub-band energy ratios; and determining the preset music type associated with the dominant frequency band as the music type of the music signal to be played.
[0112] Since different frequency bands of music signals are associated with specific emotional states of users, and different music types are associated with specific emotional states of users, a mapping relationship between different sub-bands and preset music types can be pre-established, as shown in Table 6. Table 6 shows an example of a mapping relationship between different sub-bands and preset music types provided in an embodiment of the present application:
[0113] Table 6
[0114] Sub-band Preset music genres Low frequency (sub1) Electronics (such as kick drum, bass, etc.) Mid-low frequency (sub2) Rock, pop music (such as male vocals, rhythm guitar, etc.) Intermediate frequency (sub3) Folk songs (such as female vocals, lead guitar, etc.) High frequency (sub4) Classical, jazz (such as cymbals, violin, etc.)
[0115] After determining the energy ratio of each sub-band in all the frames of music signals, determine the average sub-band energy ratio of the same sub-band in different frames of music signals, then compare all the average sub-band energy ratios to determine the maximum value, determine the sub-band corresponding to the maximum value as the dominant frequency band of the music signal to be played, and determine the preset music type corresponding to the dominant frequency band as the music type. Exemplarily, the frequency band of each frame of music signal in the multiple frames of music signals corresponding to the music signal to be played can be divided into low frequency, mid-low frequency, mid frequency, and high frequency, the sub-band energy ratios corresponding to the low frequency of all the frames of music signals are added up and divided by the number of the frame music signals to obtain a first average sub-band energy ratio corresponding to the low frequency, the sub-band energy ratios corresponding to the mid-low frequency of all the frames of music signals are added up and divided by the number of the frame music signals to obtain a second average sub-band energy ratio corresponding to the mid-low frequency, the sub-band energy ratios corresponding to the mid-frequency of all the frames of music signals are added up and divided by the number of the frame music signals to obtain a The number of music signals is calculated to obtain a third average sub-band energy ratio corresponding to the intermediate frequency. The sub-band energy ratios corresponding to the high frequencies of all frames of music signals are added and divided by the number of frame music signals to obtain a fourth average sub-band energy ratio corresponding to the high frequencies. The first average sub-band energy ratio, the second average sub-band energy ratio, the third average sub-band energy ratio, and the fourth average sub-band energy ratio are calculated to determine the maximum value. The sub-band corresponding to the maximum value is determined as the dominant frequency band of the music signal to be played. The preset music type corresponding to the sub-band is determined as the music type of the music signal to be played. For example, if the determined dominant frequency band is low frequency and the preset music type associated with low frequency is electronic, then the music type of the music signal to be played is electronic.
[0116] In one possible implementation method, the lighting effect parameters are determined based on the music type, multiple initial emotion weights, time domain feature data, frequency domain feature data and preset music emotions associated with multiple sub-bands, including: correcting the multiple initial emotion weights according to the music type to obtain multiple target emotion weights; determining the lighting effect parameters based on the multiple target emotion weights, time domain feature data, frequency domain feature data and preset music emotions associated with multiple sub-bands.
[0117] In one possible implementation, multiple initial emotional weights are modified according to the music type to obtain multiple target emotional weights, including: increasing the first weight and reducing the second weight, the first weight being the initial emotional weight corresponding to the dominant frequency band among the multiple initial emotional weights, and the second weight including the initial emotional weights among the multiple initial emotional weights except the first weight.
[0118] After determining the target emotion weight, increase the target emotion weight and reduce the emotion weights other than the target emotion weight.
[0119] In order to avoid the inaccuracy of the emotional weight determined by a single frequency band, to make the influence of the emotional weight on the lighting more accurate, and to better match the final lighting presentation effect with the emotion conveyed by the entire music signal, after determining the emotional weight of the preset music emotion of each sub-band, the music type corresponding to the music signal to be played and the music emotion corresponding to the music type can be identified, and the mapping relationship between different music types and music emotions can be pre-established. For example, as shown in Table 7, Table 7 shows an example of the mapping relationship between different music types and music emotions provided in an embodiment of the present application:
[0120] Table 7
[0121] Music Genre Musical Emotion electronic Passionate Rock, pop excited ballad warmth Classical, Jazz calm
[0122] After identifying the music type of the music signal to be played, the music emotion corresponding to the music type is determined based on the music type and the mapping relationship between the music type and the music emotion. The music emotion that is the same as or similar to the music emotion is determined among all the music emotions of each frame of music signal obtained, and the emotion weight corresponding to the music emotion is determined as the target emotion weight. The emotion weight corresponding to the target emotion weight can be increased, and the emotion weights other than the target emotion weight in the emotion weight can be reduced, thereby obtaining the corrected target emotion weight. For example, assuming that the music type of the music signal to be played is determined to be electronic, the music emotion associated with electronic is excitement, then the emotional weight corresponding to excitement can be increased, and the emotional weights corresponding to excitement, warmth and calmness can be reduced. For example, the initial emotional weight corresponding to excitement is 0.6, the initial emotional weight corresponding to excitement is 0.2, the initial emotional weight corresponding to warmth is 0.12, and the initial emotional weight corresponding to calmness is 0.08. The emotional weight corresponding to excitement can be increased from 0.6 to 0.7, the emotional weight corresponding to excitement can be reduced from 0.2 to 0.15, the emotional weight corresponding to warmth can be reduced from 0.12 to 0.1, and the emotional weight corresponding to calmness can be reduced from 0.08 to 0.05.
[0123] In one possible implementation, the lighting effect parameters include light hue, light saturation, light brightness and light change speed. The lighting effect parameters are determined based on multiple target emotion weights, time domain feature data, frequency domain feature data and preset music emotions associated with multiple sub-bands, including: obtaining the hue angle corresponding to each of the multiple preset music emotions to obtain multiple hue angles, and performing weighted operations on the multiple hue angles and multiple target emotion weights to obtain the light hue; determining the light saturation according to the target emotion weight and frequency domain feature data corresponding to the target sub-band, the target sub-band being the sub-band with the highest energy among the multiple sub-bands; determining the light brightness according to the time domain feature data and the frequency domain feature data; obtaining multiple preset speeds according to the preset speeds corresponding to each of the multiple preset music emotions, and determining the light change speed according to the multiple preset speeds, multiple target emotion weights, time domain feature data and frequency domain feature data.
[0124] The hue angle is the angular position of a color relative to a reference point when the color is represented using a hue circle (also known as a color wheel), that is, all colors of the visible spectrum are measured from 0° to 360° on a circle. A mapping relationship between a preset musical emotion and a hue angle can be pre-established. For example, as shown in Table 8, Table 8 shows an example of a mapping relationship between a preset musical emotion and a hue angle provided in an embodiment of the present application:
[0125] Table 8
[0126]
[0127]
[0128] After determining the preset music emotion corresponding to each sub-band, the hue angle corresponding to each sub-band is determined based on the preset music emotion and the mapping relationship between the preset music emotion and hue. The hue angle corresponding to each sub-band is multiplied by the target emotion weight corresponding to each sub-band and then added to obtain the hue angle of each frame of music signal. The specific calculation formula is as follows:
[0129] H=H1×W1+H2×W2+H3×W3+H4×W4 (12)
[0130] Among them, H is the hue angle of each frame of music signal, H1 is the hue angle corresponding to the excitement in each frame of music signal, H2 is the hue angle corresponding to the excitement in each frame of music signal, H3 is the hue angle corresponding to the warmth in each frame of music signal, and H4 is the hue angle corresponding to the calmness in each frame of music signal; for example, the B of a certain frame of music signal norm =1.0, T norm =0.5, △E norm=8.0, W1=0.8, W2=0.1, W3=0, W4=0.1, then the determined hue angle H=0°x0.8+60°x0.1+240°x0.1=12°, the corresponding color in the hue wheel is orange-red, then the color of this frame of music signal is orange-red.
[0131] The hue angle corresponding to the music emotion is quantitatively controlled through the emotional weight to adjust the proportion of the hue angle corresponding to each music emotion in the final hue angle. The multiplication result of the hue angle corresponding to the music emotion and the emotional weight is added together, so that the music emotion and the emotional weight can be mapped to the hue value, thereby achieving the matching between the music signal and the hue.
[0132] After determining the hue angle of each frame of music signal, the corresponding color is determined in the hue circle according to the hue angle, and the ambient light color corresponding to each frame of music signal can be obtained.
[0133] After dividing each frame of music signal into multiple sub-bands, the energy of each sub-band can be determined according to formula (5). The sub-band with the highest energy among all sub-bands is determined as the target sub-band. The light saturation can be determined according to the target emotion weight and frequency domain feature data corresponding to the target sub-band. For example, the target sub-band is determined to be low frequency, and its light saturation is calculated as follows:
[0134] S=0.4+0.5×ΔE norm +0.1×W0 (13)
[0135] Among them, S is the light saturation, W0 is the emotional weight corresponding to the sub-band with the highest energy in the sub-band, which can be any one of W1 to W4, 0.4 is the light saturation coefficient, 0.5 is the contribution coefficient of the inter-frame energy difference to the light saturation, and 0.1 is the contribution coefficient of the target emotional weight to the light saturation. The light saturation coefficient, the contribution coefficient of the inter-frame energy difference to the light saturation, and the contribution coefficient of the target emotional weight to the light saturation can be adjusted according to actual needs. For example, B of a certain frame of music signal norm =1.0, T norm =0.5, △E norm =8.0, W1=0.8, W2=0.1, W3=0, W4=0.1, then the determined light saturation S=0.4+0.5x 0.8+0.1x 0.8=4.88.
[0136] The larger the energy difference between frames, the more dramatic the dynamic changes of the music signal in that frame, and the more dramatic the dynamic changes of the music signal, the higher the saturation is required; adding the emotional weight corresponding to the highest energy sub-band and the contribution coefficient of the target emotional weight to the light saturation to the saturation can enhance the color intensity of the high-energy frame music signal, and determining the saturation of each frame of music signal based on the emotional weight corresponding to the highest energy sub-band in the sub-band and the energy difference between frames can make the saturation dynamically change according to the emotional weight corresponding to the highest energy sub-band in the sub-band and the energy difference between frames, so that the saturation responds to the frame music signal, increases the color impact of the transient time, and makes the saturation more in line with the music dynamics.
[0137] According to the time domain characteristic data and frequency domain characteristic data, the light brightness is determined. The calculation formula is as follows:
[0138] L=0.3+0.5×B norm +0.2×ΔE norm (14)
[0139] Among them, L is the light brightness, 0.3 is the light brightness coefficient, 0.5 is the contribution coefficient of rhythm intensity to light brightness, and 0.2 is the contribution coefficient of inter-frame energy difference to light brightness. The light brightness coefficient, the contribution coefficient of rhythm intensity to light brightness, and the contribution coefficient of inter-frame energy difference to light brightness can be adjusted according to actual needs. For example, B of a certain frame of music signal norm =1.0, T norm =0.5, △E norm =8.0, W1=0.8, W2=0.1, W3=0, W4=0.1, then the determined light brightness L=0.3+0.5x1.0+0.2x8.0=2.4.
[0140] Since rhythm intensity can quantify the strength of each frame of the music signal, the inter-frame energy difference is used to quantify the energy change between frames. The light brightness is determined based on the rhythm intensity and inter-frame energy difference. This allows the light brightness to respond to the energy and rhythm of the music signal, improving the overall quality and immersion of the audio-visual experience.
[0141] Each preset music emotion corresponds to a preset speed. After determining all the music emotions associated with each frame of music signal, the preset speeds corresponding to all music emotions are obtained. The light change speed is determined based on the preset speed corresponding to each music emotion, the beat period, and the energy difference between frames. The calculation formula is as follows:
[0142]
[0143] Among them, V is the light change speed of each frame of music signal, V1 is the light change speed corresponding to the excitement in each frame of music signal, V2 is the light change speed corresponding to the excitement in each frame of music signal, V3 is the light change speed corresponding to the warmth in each frame of music signal, V4 is the light change speed corresponding to the calmness in each frame of music signal, 0.3 is the contribution coefficient of the inter-frame energy difference to the light change speed, 0.2 is the contribution coefficient of the beat cycle to the light change speed, the contribution coefficient of the inter-frame energy difference to the light change speed and the contribution coefficient of the beat cycle to the light change speed can be adjusted according to actual needs. For example, B of a certain frame of music signal norm =1.0, T norm =0.5, △E norm =8.0, W1=0.8, W2=0.1, W3=0, W4=0.1, then the determined light change speed V=2x0.8+1x0.1+0.3x 8.0+0.2x2=4.5.
[0144] The larger the energy difference between frames, the more dramatic the dynamic changes of the music signal in that frame. The more dramatic the dynamic changes of the music signal in that frame, the faster the flashing frequency of the light needs to be. Therefore, the speed of light change needs to be increased. The smaller the beat cycle, the faster the beat changes, and the speed of light change needs to be increased. The change speed corresponding to the music emotion is quantitatively controlled by the emotional weight to adjust the proportion of the change speed corresponding to each music emotion in the final change speed. On the basis of adding the multiplication result of the change speed corresponding to the music emotion and the emotional weight, the energy difference between frames and the beat cycle are integrated, so that the light change speed can match the emotional change while matching the rhythm of the music signal.
[0145] The following are device embodiments of the present application, which can be used to execute method embodiments of the present application.
[0146] like Figure 2 As shown, Figure 2 A schematic structural diagram of a control device for an atmosphere lamp provided in an embodiment of the present application is shown.
[0147] For example, Figure 2 As shown, the device 200 includes:
[0148] The frame processing module 210 is used to perform frame processing on the music signal to be played to obtain multiple frames of music signals;
[0149] A first acquisition module 220 is used to acquire time domain feature data and frequency domain feature data of each frame of music signal;
[0150] The second acquisition module 230 is used to obtain the music emotion associated with each frame of the music signal;
[0151] Scoring module 240, for scoring the music emotion based on the time domain feature data and the frequency domain feature data to obtain an emotion score;
[0152] A determination module 250 is configured to determine lighting effect parameters corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data, and the frequency domain feature data;
[0153] The control module 260 is used to control the ambient light based on the lighting effect parameters.
[0154] In a possible implementation, the first obtaining module 220 is further configured to:
[0155] Obtaining the rhythm intensity, beat period, inter-frame energy difference and multiple sub-band energy ratios of each frame of music signal;
[0156] determining the rhythm intensity and beat period as time domain feature data;
[0157] The energy difference and the multiple sub-band energy ratios are determined as frequency domain feature data.
[0158] In a possible implementation, the second obtaining module 230 is further configured to:
[0159] Segment the frequency band of each frame of music signal to obtain multiple sub-bands;
[0160] The preset music emotion associated with each sub-band is obtained, and the music emotion associated with each frame of music signal is obtained.
[0161] In one possible implementation, the determining module 250 is further configured to:
[0162] Dividing the emotion score of the preset music emotion associated with each sub-band by the sum of the emotion scores of the preset music emotions associated with multiple sub-bands to obtain multiple initial emotion weights;
[0163] Get the music type of the music signal to be played;
[0164] Lighting effect parameters are determined based on the music type, multiple initial emotion weights, time domain feature data, frequency domain feature data, and preset music emotions associated with multiple sub-bands.
[0165] In one possible implementation, the determining module 250 is further configured to:
[0166] determining an average sub-band energy ratio of a same sub-band corresponding to each of the multiple frames of music signals to obtain a plurality of average sub-band energy ratios;
[0167] Determine the sub-frequency band corresponding to the target value as the dominant frequency band of the music signal to be played, wherein the target value is the maximum value among multiple average sub-frequency band energy ratios;
[0168] The preset music type associated with the dominant frequency band is determined as the music type of the music signal to be played.
[0169] In one possible implementation, the determining module 250 is further configured to:
[0170] Multiple initial emotional weights are modified according to the music type to obtain multiple target emotional weights; lighting effect parameters are determined based on the multiple target emotional weights, time domain feature data, frequency domain feature data and preset music emotions associated with multiple sub-bands.
[0171] In one possible implementation, the determining module 250 is further configured to:
[0172] Increase the first weight and decrease the second weight, where the first weight is the initial emotion weight corresponding to the dominant frequency band among the multiple initial emotion weights, and the second weight includes the initial emotion weights among the multiple initial emotion weights except the first weight.
[0173] In one possible implementation, the determining module 250 is further configured to:
[0174] Acquire hue angles corresponding to a plurality of preset music emotions to obtain a plurality of hue angles, and perform weighted calculation on the plurality of hue angles and a plurality of target emotion weights to obtain a light hue;
[0175] Determine the light saturation based on the target emotion weight and frequency domain feature data corresponding to the target sub-band, where the target sub-band is the sub-band with the highest energy among multiple sub-bands;
[0176] Determine the light brightness based on the time domain characteristic data and the frequency domain characteristic data;
[0177] Based on obtaining the preset speeds corresponding to the multiple preset music emotions, multiple preset speeds are obtained, and the light change speed is determined based on the multiple preset speeds, multiple target emotion weights, time domain feature data and frequency domain feature data.
[0178] It should be noted that the control device for the atmosphere lamp provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when executing the control method for the atmosphere lamp. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0179] In addition, the control device for the atmosphere lamp provided in the above embodiment and the control method embodiment for the atmosphere lamp belong to the same concept. Therefore, for details not disclosed in the device embodiment of this specification, please refer to the control method embodiment of the atmosphere lamp provided in the above specification, which will not be repeated here.
[0180] like Figure 3 As shown, Figure 3 A structural schematic diagram of a vehicle provided in an embodiment of the present application is shown.
[0181] For example, Figure 3 As shown, the vehicle 300 includes: a memory 301 and a processor 302, wherein the memory 301 stores an executable program code 3011, and the processor 302 is used to call and execute the executable program code 3011 to perform a method for controlling an ambient light.
[0182] In addition, an embodiment of the present application also protects a device, which may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a method for controlling an atmosphere lamp provided in an embodiment of the present application.
[0183] In this embodiment, the device can be divided into functional modules based on the above-described method examples. For example, each functional module can be mapped to a specific functional module, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and represents only a logical functional division. In actual implementation, other division methods may be used.
[0184] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0185] It should be understood that the device provided in this embodiment is used to execute the above-mentioned method for controlling an atmosphere lamp, and thus can achieve the same effect as the above-mentioned implementation method.
[0186] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is used in a vehicle, the processing module may be used to control and manage the vehicle's movements, while the storage module may be used to support the vehicle's execution of relevant program codes.
[0187] The processing module may be a processor or controller that implements or executes the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processing system (DSP) and a microprocessor, and the storage module may be a memory.
[0188] In addition, the device provided in the embodiments of the present application can specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a method for controlling an atmosphere lamp provided in the above embodiment.
[0189] This embodiment also provides a computer-readable storage medium, which stores computer program code. When the computer program code runs on a computer, the computer executes the above-mentioned related method steps to implement a method for controlling an atmosphere lamp provided in the above embodiment.
[0190] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the method for controlling an atmosphere lamp provided in the above embodiment.
[0191] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0192] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0193] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0194] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for controlling an atmosphere lamp, characterized in that: The method comprises: Performing frame processing on the music signal to be played to obtain multiple frames of music signal; Obtaining time domain feature data and frequency domain feature data of each frame of music signal; Obtaining the musical emotion associated with each frame of the music signal; Scoring the music emotion based on the time domain feature data and the frequency domain feature data to obtain an emotion score; Determining a lighting effect parameter corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data, and the frequency domain feature data; The atmosphere light is controlled based on the lighting effect parameters.
2. The method according to claim 1, characterized in that The step of obtaining time domain feature data and frequency domain feature data of each frame of music signal includes: Obtaining the rhythm intensity, beat period, inter-frame energy difference and multiple sub-band energy ratios of each frame of the music signal; Determining the rhythm intensity and the beat period as the time domain feature data; The energy difference and the multiple sub-band energy ratios are determined as the frequency domain feature data.
3. The method according to claim 1, characterized in that The obtaining of the music emotion associated with each frame of the music signal comprises: Segmenting the frequency band of each frame of the music signal to obtain a plurality of sub-frequency bands; The preset music emotion associated with each sub-band is obtained to obtain the music emotion associated with each frame of the music signal.
4. The method according to claim 3, characterized in that The determining of the lighting effect parameters corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data, and the frequency domain feature data includes: Dividing the emotion score of the preset music emotion associated with each sub-frequency band by the sum of the emotion scores of the preset music emotions associated with the multiple sub-frequency bands to obtain multiple initial emotion weights; Obtaining the music type of the music signal to be played; The lighting effect parameters are determined based on the music type, the multiple initial emotion weights, the time domain feature data, the frequency domain feature data, and the preset music emotions associated with the multiple sub-frequency bands.
5. The method according to claim 4, characterized in that The obtaining of the music type of the music signal to be played includes: determining an average sub-band energy ratio of a same sub-band corresponding to each of the multiple frames of music signals to obtain a plurality of average sub-band energy ratios; determining a sub-frequency band corresponding to a target value as a dominant frequency band of the music signal to be played, wherein the target value is a maximum value among the plurality of average sub-frequency band energy ratios; The preset music type associated with the dominant frequency band is determined as the music type of the music signal to be played.
6. The method according to claim 5, characterized in that The determining of the lighting effect parameters based on the music type, the multiple initial emotion weights, the time domain feature data, the frequency domain feature data, and the preset music emotions associated with the multiple sub-bands includes: Modifying the multiple initial emotion weights according to the music type to obtain multiple target emotion weights; The lighting effect parameters are determined based on the multiple target emotion weights, the time domain feature data, the frequency domain feature data, and the preset music emotions associated with the multiple sub-frequency bands.
7. The method according to claim 6, characterized in that Modifying the multiple initial emotion weights according to the music type to obtain multiple target emotion weights includes: Increase the first weight and decrease the second weight, wherein the first weight is the initial emotion weight corresponding to the dominant frequency band among the multiple initial emotion weights, and the second weight includes the initial emotion weights among the multiple initial emotion weights except the first weight.
8. The method according to claim 6, characterized in that The lighting effect parameters include light hue, light saturation, light brightness, and light change speed. The determining of the lighting effect parameters based on the multiple target emotion weights, the time domain feature data, the frequency domain feature data, and the preset music emotions associated with the multiple sub-bands includes: Acquire hue angles corresponding to a plurality of preset music emotions to obtain a plurality of hue angles, and perform a weighted operation on the plurality of hue angles and the plurality of target emotion weights to obtain the light hue; Determining the light saturation according to a target emotion weight corresponding to a target sub-band and the frequency domain feature data, wherein the target sub-band is a sub-band with the highest energy among the multiple sub-bands; Determining the light brightness according to the time domain feature data and the frequency domain feature data; Based on obtaining the preset speeds corresponding to the multiple preset music emotions, multiple preset speeds are obtained, and the light change speed is determined based on the multiple preset speeds, the multiple target emotion weights, the time domain feature data and the frequency domain feature data.
9. A control device for an atmosphere light, characterized in that: The device comprises: A frame processing module is used to perform frame processing on the music signal to be played to obtain multiple frames of music signals; A first acquisition module is used to acquire time domain feature data and frequency domain feature data of each frame of music signal; A second acquisition module is used to acquire the music emotion associated with each frame of the music signal; A scoring module, configured to score the music emotion based on the time domain feature data and the frequency domain feature data to obtain an emotion score; a determination module, configured to determine the lighting effect parameters corresponding to each frame of the music signal based on the music emotion, the emotion score, the time domain feature data, and the frequency domain feature data; A control module is used to control the atmosphere light based on the lighting effect parameters.
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, the method according to any one of claims 1 to 8 is implemented.