Atmosphere lamp control method, electronic device and program product
By analyzing the frequency and loudness change rate of audio signals in real time and combining them with a beat recognition mechanism, the problem of excessively fast response and abrupt changes in existing ambient lighting control methods has been solved, achieving a more natural and rhythmic lighting effect.
Patent Information
- Application Number
- CN202511580164.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2025-12-12
AI Technical Summary
In existing technologies, ambient lighting control methods respond too quickly, change abruptly, lack rhythm, and cannot adapt to the rhythmic characteristics of different types of music, resulting in a poor user experience.
By acquiring PCM data of audio signals in real time, performing frequency domain analysis, extracting frequency and loudness information, calculating the rate of change of frequency and loudness, comparing it with preset thresholds, sending light update commands, and controlling light changes in conjunction with a beat recognition mechanism.
It achieves a smoother, more natural, and rhythmic ambient lighting control effect, enhancing the user experience.
Smart Images

Figure CN121126641A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive ambient lighting technology, and more particularly to an ambient lighting control method, electronic device, and program product. Background Technology
[0002] With the development of automotive interiors, ambient lighting, as one of the core devices for creating visual effects inside the car, has become an important means of enhancing immersive experiences through its linkage with audio signals, and has become an essential function in music-heavy scenarios. Currently, the commonly used technology in the market generally involves frequency domain conversion of audio signals, then directly mapping frequency information to color and loudness information to brightness, in order to drive the ambient lighting to present a musical rhythm effect.
[0003] However, these direct mapping algorithms generally suffer from problems such as overly fast response, abrupt changes, unnatural transitions, and a lack of rhythm, making it difficult to provide high-quality final results and meet the needs of end users. Because some music exhibits significant fluctuations in frequency and loudness between data frames, the lights flicker frequently, resulting in a poor experience for users inside the vehicle. Existing lighting control methods are ill-suited to the rhythmic characteristics of different types of music. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide an ambient lighting control method, electronic device and program product.
[0005] The present invention provides an ambient lighting control method, comprising: PCM data of the audio signal is acquired in real time while music is playing in the vehicle; Frequency domain analysis is performed on the PCM data corresponding to each audio frame to extract frequency and loudness information; By calculating the frequency and loudness information of a preset number of consecutive audio frames, the rate of change of frequency and the rate of change of loudness within a preset time period are calculated respectively. The rate of change of frequency and the rate of change of loudness are compared with their corresponding rate of change thresholds, respectively. If at least one of the frequency change rate and loudness change rate exceeds its corresponding change rate threshold, a corresponding light update command is sent to the ambient light control module.
[0006] In one of the optional technical solutions, the real-time acquisition of PCM data of audio signals during music playback in the vehicle includes: The audio signal is sampled based on a preset sampling rate to obtain sampled data; The sampled data is quantized to convert the time-continuous sampled data into time-discrete quantized data. The quantized data on the timeline is encoded and converted into corresponding binary data to obtain PCM data.
[0007] In one of the optional technical solutions, the step of performing frequency domain analysis on PCM data to extract frequency and loudness information includes: The frequency domain spectrum is obtained by transforming the PCM data of the snare audio frame using Fast Fourier Transform. Extract the principal frequency components and overall loudness level information of multiple frequencies from the frequency domain spectrum; Multiple frequency principal component information and multiple overall loudness level information are integrated to output frequency information and loudness information.
[0008] In one of the optional technical solutions, the calculation method for the frequency change rate includes: Select the frequency information corresponding to two adjacent audio frames and extract the first main frequency respectively. Second main frequency ; pass Calculations are performed to obtain the first main frequency. Second main frequency Number of keys spanned on a piano keyboard ; Number of keys spanned on a piano keyboard Used as the numerical value of the rate of change of frequency.
[0009] In one of the optional technical solutions, the loudness change rate is calculated by means of: Select the first loudness corresponding to the currently detected audio frame And the second loudness corresponding to the previous audio frame ; pass Calculate the rate of change of loudness .
[0010] In one of the optional technical solutions, after calculating the rate of change of frequency and the rate of change of loudness over a preset time period, the method further includes: Determine if the current music frame is a beat frame; If it is determined to be a beat frame, then temporarily increase the brightness or change the light color in the lighting control of the beat frame.
[0011] In one of the optional technical solutions, determining whether the current music frame is a beat frame includes: The corresponding short-time energy is calculated sequentially based on the waveform of each music frame; Calculate the energy difference between the short-time energy of the current music frame and the previous audio frame; If the energy difference is greater than the average plucking, then the current music frame is determined to meet the beat frame condition and is therefore considered a beat frame.
[0012] The present invention provides an electronic device, including a memory, a processor, and an electronic device program on the memory, wherein the processor executes the electronic device program to implement the steps of any of the aforementioned ambient light control methods.
[0013] The present invention provides an electronic device readable storage medium storing an electronic device program / instructions thereon, which, when executed by a processor, implements the steps of any of the aforementioned ambient light control methods.
[0014] The present invention provides an electronic device program product, including an electronic device program / instruction, which, when executed by a processor, implements the steps of any of the aforementioned ambient light control methods.
[0015] The above technical solution has the following beneficial effects: The ambient lighting control method provided by this invention performs frequency domain analysis on the PCM data of vehicle music to accurately extract frequency and loudness information. Then, it uses the frequency and loudness information to determine changes in the music and sends corresponding lighting update commands to the ambient lighting control module to control the lighting changes. This invention can achieve a smoother, more natural, and rhythmic control effect for music-inspired ambient lighting. Attached Figure Description
[0016] The disclosure of this invention will become more readily understood by referring to the accompanying drawings. It should be understood that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings: Figure 1 This is a flowchart of an ambient lighting control method provided in an embodiment of the present invention; Figure 2 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 3 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 4 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 5 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 6 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 7 A flowchart illustrating an ambient lighting control method according to another embodiment of the present invention; Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0017] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0018] Identical parts are indicated by the same reference numerals. It should be noted that the terms "front," "rear," "left," "right," "up," and "down" used in the following description refer to directions in the accompanying drawings, while the terms "inner" and "outer" refer to directions toward or away from the geometric center of a specific part, respectively.
[0019] like Figure 1 The illustration shows an ambient light control method according to an embodiment of the present invention, comprising the following steps: Step S101: Acquire PCM data of the audio signal in real time while the vehicle is playing music; Step S102: Perform frequency domain analysis on the PCM data corresponding to each audio frame to extract frequency and loudness information; Step S103: Calculate the frequency change rate and loudness change rate within a preset time period by calculating the frequency information and loudness information of a preset number of consecutive audio frames; Step S104: Compare the rate of change of frequency and the rate of change of loudness with the corresponding rate of change thresholds respectively; Step S105: If at least one of the frequency change rate and loudness change rate exceeds its corresponding change rate threshold, a corresponding light update command is sent to the ambient light control module.
[0020] This invention relates to an ambient lighting control method. More specifically, this invention addresses the coordinated interaction between vehicle interior ambient lighting and music playback. By introducing a rate-of-change constraint mechanism and a beat recognition mechanism, it suppresses the problem of unstable light effects caused by rapid fluctuations in audio signals, achieving a smoother, more natural, and rhythmic ambient lighting control effect.
[0021] Specifically, this invention can be applied to electronic devices with processing capabilities, such as in-vehicle multimedia hosts or ambient lighting control apps. For example, the in-vehicle multimedia host can perform music feature extraction, logical judgment, and send control signals to the ambient lighting module.
[0022] First, step S101 is executed. During music playback in the vehicle, the electronic controller unit samples the audio signal in real time through a microphone or player, sampling the audio signal based on a preset sampling rate to obtain sampled data. The sampled data is then quantized, converting the time-continuous sampled data into time-discrete quantized data. The quantized data on the timeline is encoded and converted into corresponding binary data to obtain PCM data. The sampling time window for each frame can be set to 60ms to ensure data real-time performance and processing efficiency.
[0023] Then, step S102 is executed to perform frequency domain analysis on the PCM data corresponding to each audio frame, extracting frequency and loudness information. Specifically, the PCM data of the current audio frame is transformed using a Fast Fourier Transform to obtain a frequency domain spectrum. Multiple frequency principal component information and overall loudness level information are extracted from the frequency domain spectrum. The multiple frequency principal component information and multiple overall loudness level information are then integrated to output the frequency and loudness information. This step converts the time-domain audio signal into frequency domain features, providing a foundation for subsequent rate of change calculations.
[0024] Next, step S103 is executed, which calculates the frequency change rate and loudness change rate within a preset time period by calculating the frequency and loudness information of a preset number of consecutive audio frames. The frequency change rate reflects the drasticness of pitch change, and the loudness change rate reflects the instantaneous amplitude of volume fluctuation. By quantifying these change rates, the system can identify the dynamic characteristics in the music.
[0025] Subsequently, step S104 is executed, comparing the frequency change rate and loudness change rate with their corresponding change rate thresholds. The change rate thresholds are preset based on musical characteristics; for example, the frequency change threshold is referenced to the number of keys spanned on a piano keyboard, and the loudness change threshold uses a relative change rate to ensure that only significant changes trigger a light update.
[0026] Finally, step S105 is executed: if at least one of the frequency change rate and loudness change rate exceeds its corresponding change rate threshold, a corresponding lighting update command is sent to the ambient lighting control module. Otherwise, the current lighting state is maintained to avoid light flickering caused by minor fluctuations and improve visual comfort.
[0027] The light update command can change the color, flashing frequency, and light intensity of the lights according to the music frequency and loudness, and the specific update method can be determined according to the preset change method.
[0028] In summary, the ambient lighting control method provided by this invention performs frequency domain analysis on the PCM data of vehicle music to accurately extract frequency and loudness information. Then, it uses the frequency and loudness information to determine changes in the music and sends corresponding lighting update commands to the ambient lighting control module to control the lighting changes. This invention can achieve a smoother, more natural, and rhythmic control effect for music-inspired ambient lighting.
[0029] This invention effectively suppresses the common problems of excessively fast response and abrupt changes in direct mapping algorithms by analyzing the frequency and loudness change rate of audio signals in real time and setting a threshold filtering mechanism, making the lighting changes smoother and more natural. At the same time, the introduction of a beat recognition mechanism further enhances the sense of rhythm and improves the immersive experience of music and light interacting together.
[0030] In one embodiment, such as Figure 2 As shown, step S101 includes: Step S201: Sample the audio signal based on a preset sampling rate to obtain sampled data; Step S202: Quantize the sampled data to convert the time-continuous sampled data into time-discrete quantized data; Step S203: Encode the quantized data on the timeline and convert them into corresponding binary data to obtain PCM data.
[0031] In this embodiment, PCM data acquisition is fundamental to music rhythm control. The in-vehicle multimedia host receives analog audio signals from a microphone or player via an audio input interface. First, it samples the signals at a fixed sampling rate, discretizing the continuous-time signal. Then, it quantizes the sampled points, mapping the amplitude value of each sampled point to a digital value. Finally, it generates a PCM data stream through encoding.
[0032] By converting audio data into PCM data, the integrity and real-time performance of the audio data are ensured, providing accurate input for subsequent frequency domain analysis. A 60ms time window is used for frame division, balancing processing latency and feature capture accuracy, avoiding excessive feature fluctuations due to an excessively short window or sluggish response due to an excessively long window.
[0033] In one embodiment, such as Figure 3 As shown, step S102 includes: Step S301: Transform the PCM data of the current audio frame using Fast Fourier Transform to obtain the frequency domain spectrum; Step S302: Extract the principal frequency components and overall loudness level information of multiple frequencies from the frequency domain spectrum; Step S303: Integrate multiple frequency principal component information and multiple overall loudness level information respectively, and output frequency information and loudness information.
[0034] In this embodiment, frequency domain analysis is key to extracting musical features. The Fast Fourier Transform (FFT) converts the time-domain PCM data into a frequency-domain spectrum, revealing the distribution of each frequency component. The system identifies the main frequency components from the spectrum, such as the dominant frequencies in the low, mid, and high frequency bands, as well as the overall loudness level. This information corresponds to the pitch and volume characteristics of the music, respectively.
[0035] By integrating multi-band information, the invention outputs comprehensive frequency and loudness information, providing structured data for calculating the rate of change. Compared with traditional direct mapping methods, this invention reduces data dimensionality and processing overhead through principal component extraction, while preserving core musical features, making the lighting response more closely aligned with the essence of music.
[0036] In one embodiment, such as Figure 4 As shown, the calculation method for the rate of change of frequency in step S103 includes: Step S401: Select the frequency information corresponding to two adjacent audio frames and extract the first main frequency respectively. Second main frequency ; Step S402: Through Calculations are performed to obtain the first main frequency. Second main frequency Number of keys spanned on a piano keyboard ; Step S403: Number of keys spanned on the piano keyboard Used as the numerical value of the rate of change of frequency.
[0037] In this embodiment, the frequency change rate calculation draws on the tonal patterns of a piano keyboard. Because the piano has a wide range and a uniform distribution of semitones, using it as a reference allows for an objective quantification of the degree of frequency change. Specifically, the dominant frequencies of adjacent audio frames are selected, and the number of semitone keys spanned between them is calculated using a logarithmic formula. .
[0038] Each piano octave, including both black and white keys, has 12 semitones. Each octave has 7 white keys and 5 black keys. The frequency ratio of adjacent keys on a piano keyboard is... That is, approximately 1.06.
[0039] Number of keys spanned on a piano keyboard The numerical value directly reflects the amplitude of pitch change, and the number of keys spanned on a piano keyboard. A higher value indicates a more significant frequency jump. (Based on the number of keys spanned on a piano keyboard.) Set a corresponding threshold, preferably 5.
[0040] when When the value is ≤5, the change is considered too small to trigger an update. The color change is triggered only at 5 o'clock, effectively filtering out subtle fluctuations and making the light response more musical. The threshold can be adjusted according to the actual situation, or other reference modes can be used to replace the number of keys spanned on the piano keyboard to adapt to different audio equipment, ambient lighting equipment and music styles.
[0041] In one embodiment, such as Figure 5 As shown, the calculation method for the loudness change rate in step S103 includes: Step S501: Select the first loudness corresponding to the currently detected audio frame. And the second loudness corresponding to the previous audio frame ; Step S502: Through Calculate the rate of change of loudness .
[0042] In this embodiment, the loudness change rate is expressed as a relative rate of change, representing the volume fluctuation amplitude as a percentage. The system continuously tracks the loudness values of adjacent frames, calculates the ratio of the absolute difference to the loudness of the previous frame, and obtains the loudness change rate. A higher loudness change rate indicates a more drastic change in volume. A threshold value for the loudness change rate can be set. ,For example > The system triggers a light update only when the volume is low, otherwise it maintains its current state, thus suppressing light flickering caused by minor fluctuations in loudness. This relative thresholding method adapts to music at different volume levels, avoiding the problem of a fixed threshold being too sensitive in soft passages or too insensitive in loud passages, thereby improving the system's robustness.
[0043] In one embodiment, after step S103, a beat detection and enhancement step is further included, such as... Figure 6 As shown, it specifically includes: Step S601: Determine whether the current music frame is a beat frame; Step S602: If it is determined to be a beat frame, then temporarily increase the brightness or change the light color in the light control of the beat frame.
[0044] In this embodiment, the beat enhancement mechanism further enhances the rhythmic feel of the music. Based on the basic rate of change control, the system adds a beat detection module, which identifies beat points by analyzing abrupt changes in audio energy. When a beat frame is identified, the light brightness is temporarily increased or its color is changed to highlight the musical accents; non-beat frames maintain a smooth transition.
[0045] By recognizing beat frames and synchronizing light changes with the rhythm of music, the audiovisual harmony is enhanced, solving the problem of a lack of rhythm in existing technologies. Simultaneously, the combination of beat detection and change rate thresholds forms a multi-layered control strategy, improving the naturalness and dynamism of the overall effect.
[0046] In one embodiment, such as Figure 7 As shown, step S601, determining whether the current music frame is a beat frame, includes: Step S701: Calculate the corresponding short-time energy according to the waveform of each music frame in sequence; Step S702: Calculate the energy difference between the short-time energy of the current music frame and the previous audio frame; Step S703: If the energy difference is greater than the average fluctuation, then the current music frame is determined to meet the beat frame condition and the current music frame is determined to be a beat frame.
[0047] In this embodiment, beat frame detection employs short-time energy analysis combined with dynamic threshold determination. First, the short-time energy of each audio frame is calculated to reflect signal strength; then, the energy difference between adjacent frames is calculated to capture energy jumps; finally, the average and standard deviation of the energy difference are calculated using a sliding window, and an adaptive threshold is set. If the energy difference exceeds the threshold and meets the minimum time interval constraint, it is determined to be a beat frame.
[0048] Specifically, the short-time energy is calculated as follows: ; in, Indicates the first The amplitude at each sampling point This represents the total number of sampling points in the current audio frame. For the first The short-time energy of a frame. By calculating the short-time energy, the energy difference can be calculated. The energy difference is calculated as follows: ; The short-time energy of the previous audio frame. The energy difference is calculated by measuring the average energy shift of the audio frame and then comparing whether the energy difference is significantly greater than the average shift to determine whether the current audio frame is a beat frame.
[0049] The determination of dynamic threshold can be based on the energy difference of the most recent frames. The data is stored in a sliding window. The mean and standard deviation corresponding to the sliding window are calculated. The mean is calculated as follows: ; Then calculate the standard deviation, which is done as follows: ; in, Indicates the length of the sliding window. Represents the average value of energy change. The standard deviation of energy change.
[0050] After calculating the mean and standard deviation, the dynamic threshold is calculated based on the mean and standard deviation. The dynamic threshold is calculated as follows: ; in, This is an adjustable sensitivity coefficient, which can be selected according to the actual situation. If the calculated energy difference... Greater than the dynamic threshold If the current audio frame contains a beat, it is identified as a beat frame.
[0051] Furthermore, to prevent duplicate detection, a "cooling-off time" constraint can be added to the beat frames, which is essentially a time constraint on the beat frames. A minimum beat interval threshold is predefined. For example, it can be set to 100ms, and then the current audio frame time can be used. Subtract the time of the last detected beat frame .
[0052] if Even if the energy difference of the current audio frame meets the beat frame condition, the current audio frame is not determined to be a beat frame.
[0053] In summary, the formula for determining the beat can be expressed as: .
[0054] By accurately identifying the presence of beat frames, it can adapt to the energy fluctuation characteristics of different music, avoiding false detections and missed detections, and ensuring the accuracy and real-time performance of beat recognition. By setting dynamic thresholds, the sensitivity of beat frame detection can be flexibly adjusted to adapt to various musical styles, ensuring that ambient lighting control is synchronized with the music.
[0055] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0056] like Figure 8 The diagram shows a hardware structure of an electronic device according to the present invention, including a memory 802, a processor 801, and an electronic device program on the memory 802. The processor 801 executes the electronic device program to implement the steps of the ambient light control method of any of the above embodiments.
[0057] Figure 8 Take the 801 processor as an example.
[0058] The electronic device may also include an input device 803 and a display device 804.
[0059] The processor 801, memory 802, input device 803 and display device 804 can be connected by a bus or other means. The figure shows an example of connection by bus.
[0060] The memory 802, as a non-volatile electronic device readable storage medium, can be used to store non-volatile software programs, non-volatile electronic device executable programs, and modules, such as the program instructions / modules corresponding to the ambient light control method in the embodiments of this application. The processor 801 executes various functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 802, thereby implementing the ambient light control method in the above embodiments.
[0061] The memory 802 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the ambient lighting control method. Furthermore, the memory 802 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 802 may optionally include memory remotely located relative to the processor 801, and these remote memories may be connected via a network to the apparatus performing the ambient lighting control method. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0062] The input device 803 can receive user clicks and generate signal inputs related to user settings and function control of the ambient lighting control method. The display device 804 may include a display screen or other display device.
[0063] When one or more modules are stored in the memory 802, and are run by one or more processors 801, the ambient light control method in any of the above method embodiments is executed.
[0064] The electronic device disclosed in this invention, when in operation, can execute all the steps of the aforementioned ambient lighting control method. It performs frequency domain analysis on the PCM data of the vehicle's music to accurately extract frequency and loudness information. Then, it uses the frequency and loudness information to determine changes in the music and sends corresponding lighting update commands to the ambient lighting control module to control the lighting changes. This invention can achieve a smoother, more natural, and rhythmic control effect for music-inspired ambient lighting.
[0065] An embodiment of the present invention provides an electronic device readable storage medium storing an electronic device program / instructions, which, when executed by a processor 801, implements all the steps of the ambient light control method described above.
[0066] In the context of this disclosure, a storage medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. The storage medium can be a machine-readable signal medium or a machine-readable storage medium. Optionally, the storage medium can be a non-transitory electronically readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD ROM), magnetic tape, floppy disk, and optical data storage device.
[0067] One embodiment of the present invention provides an electronic device program product, including an electronic device program / instruction, which, when executed by a processor, implements the steps of the ambient light control method described above.
[0068] By running the aforementioned electronic device program, all steps of the ambient lighting control method described above can be executed. Frequency domain analysis is performed on the PCM data of the vehicle's music to accurately extract frequency and loudness information. Then, changes in the music are determined using the frequency and loudness information, and corresponding lighting update commands are sent to the ambient lighting control module to control the lighting changes. This invention achieves a smoother, more natural, and rhythmic control effect for music-inspired ambient lighting.
[0069] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. An ambient lighting control method, characterized in that, include: PCM data of the audio signal is acquired in real time while music is playing in the vehicle; Frequency domain analysis is performed on the PCM data corresponding to each audio frame to extract frequency and loudness information; By calculating the frequency and loudness information of a preset number of consecutive audio frames, the rate of change of frequency and the rate of change of loudness within a preset time period are calculated respectively. The rate of change of frequency and the rate of change of loudness are compared with their corresponding rate of change thresholds, respectively. If at least one of the frequency change rate and loudness change rate exceeds its corresponding change rate threshold, a corresponding light update command is sent to the ambient light control module.
2. The ambient lighting control method according to claim 1, characterized in that, The PCM data for real-time acquisition of audio signals during music playback in the vehicle includes: The audio signal is sampled based on a preset sampling rate to obtain sampled data; The sampled data is quantized to convert the time-continuous sampled data into time-discrete quantized data. The quantized data on the timeline is encoded and converted into corresponding binary data to obtain PCM data.
3. The ambient lighting control method according to claim 1, characterized in that, The frequency domain analysis of the PCM data to extract frequency and loudness information includes: The frequency domain spectrum is obtained by transforming the PCM data of the snare audio frame using Fast Fourier Transform. Extract the principal frequency components and overall loudness level information of multiple frequencies from the frequency domain spectrum; Multiple frequency principal component information and multiple overall loudness level information are integrated to output frequency information and loudness information.
4. The ambient lighting control method according to claim 1, characterized in that, The calculation method for the frequency change rate includes: Select the frequency information corresponding to two adjacent audio frames and extract the first main frequency respectively. Second main frequency ; pass Calculations are performed to obtain the first main frequency. Second main frequency Number of keys spanned on a piano keyboard ; Number of keys spanned on a piano keyboard Used as the numerical value of the rate of change of frequency.
5. The ambient lighting control method according to claim 4, characterized in that, The calculation method for the loudness change rate includes: Select the first loudness corresponding to the currently detected audio frame And the second loudness corresponding to the previous audio frame ; pass Calculate the rate of change of loudness .
6. The ambient lighting control method according to claim 1, characterized in that, After calculating the rate of change of frequency and the rate of change of loudness over the preset time period, the method further includes: Determine if the current music frame is a beat frame; If it is determined to be a beat frame, then temporarily increase the brightness or change the light color in the lighting control of the beat frame.
7. The ambient lighting control method according to claim 6, characterized in that, The step of determining whether the current music frame is a beat frame includes: The corresponding short-time energy is calculated sequentially based on the waveform of each music frame; Calculate the energy difference between the short-time energy of the current music frame and the previous audio frame; If the energy difference is greater than the average plucking, then the current music frame is determined to meet the beat frame condition and is therefore considered a beat frame.
8. An electronic device, comprising a memory, a processor, and an electronic device program on the memory, characterized in that, The processor executes the electronic device program to implement the steps of the ambient light control method according to any one of claims 1-7.
9. An electronic device readable storage medium having an electronic device program / instructions stored thereon, characterized in that, When the electronic device program / instructions are executed by the processor, they implement the steps of the ambient light control method according to any one of claims 1-7.
10. An electronic device program product, comprising an electronic device program / instructions, characterized in that, When the electronic device program / instructions are executed by the processor, they implement the steps of the ambient light control method according to any one of claims 1-7.
Citation Information
Cited By
Lamp effect control method, sound equipment and atmosphere lamp device
CN122093997A
Light effect control method, sound and atmosphere lamp device
CN122093997B
Virtual object action generation method and apparatus, and computer device
CN122474078A