A LED lighting control method and device based on single chip microcomputer

Through DMA controller and fast Fourier transform technology, audio features are extracted and LED effects are dynamically adjusted, which solves the audio processing delay problem caused by limited memory of microcontrollers, and achieves efficient and real-time audio control LED lighting effects.

CN119300193BActive Publication Date: 2025-04-01JIANGMEN SIYU TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411508300.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-04-01
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

Due to limited memory and storage space, microcontrollers cannot effectively process large-capacity audio files in real time, resulting in too large delays when audio control LED lighting, which cannot meet the real-time control requirements.

Method used

The DMA controller regularly transfers audio data, performs fast Fourier transformation and simplified mode acquisition processing, extracts drum beats, vocals and volume characteristics, and dynamically adjusts the brightness or color of the LED.

Benefits of technology

It realizes efficient real-time acquisition and processing of audio data, dynamically adjusting LED effects when microcontroller resources are limited, improving the real-time and response speed of the system, and enhancing the user's visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119300193B_ABST
    Figure CN119300193B_ABST
Patent Text Reader

Abstract

This invention discloses a microcontroller-based LED lighting control method and device. The method includes: periodically transferring audio data using a DMA controller to obtain discrete audio data; performing a Fast Fourier Transform and simplified modulo operation on the discrete audio data to obtain audio frequency domain data; extracting drum beats from the audio frequency domain data to obtain drum beat markers; extracting human voices from the audio frequency domain data to obtain human voice markers; extracting volume from the discrete audio data to obtain volume surge markers; and dynamically controlling the brightness or color of the LED based on the drum beat markers, the human voice markers, and the volume surge markers. This invention effectively solves the technical problems of microcontrollers in terms of hardware resources, real-time performance, computing resources, LED control flexibility, and system response speed, achieving real-time synchronization of audio characteristics and LED lighting effects, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of audio control, and in particular to a LED light control method and device based on a single chip microcomputer. Background Art

[0002] Microcontrollers usually have limited memory (RAM) and storage space (ROM), and cannot process large audio files like PCs. Specifically, there are two reasons: first, memory limitation. The RAM of a microcontroller is usually only tens of KB, which cannot load the entire audio file at one time. Second, storage limitation. The ROM of a microcontroller is usually only hundreds of KB, which cannot store a large amount of audio data.

[0003] When audio processing needs to be done in real time, especially for controlling LED lights, any delay will affect the user experience. Specifically, traditional audio processing methods may take a long time to complete Fourier transform, amplitude modulus and other operations, resulting in insufficient real-time performance. In a single-chip microcomputer, if traditional audio processing algorithms (such as FFT, drum beat extraction, vocal extraction, etc.) are used, the computational complexity is high, which may cause the single-chip microcomputer to be unable to complete the processing in real time. And a long data processing cycle will not meet the requirements of real-time control of LEDs. Summary of the invention

[0004] The embodiment of the present invention provides a LED light control method and device based on a single chip microcomputer, which can efficiently collect and process audio data in real time and dynamically adjust the brightness or color of the LED according to the audio characteristics when the single chip microcomputer resources are limited.

[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a LED light control method based on a single chip microcomputer, comprising:

[0006] The audio data is transferred regularly through the DMA controller to obtain discrete audio data;

[0007] Performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data;

[0008] Performing drum beat extraction on the audio frequency domain data to obtain drum beat markers;

[0009] Extracting human voice from the audio frequency domain data to obtain a human voice marker;

[0010] Performing volume extraction on the discrete audio data to obtain a volume steep rise mark;

[0011] The brightness or color of the LED is dynamically controlled according to the drum mark, the vocal mark and the volume sudden rise mark.

[0012] In a possible implementation manner of the first aspect, the periodically transferring the audio data through the DMA controller to obtain discrete audio data specifically includes:

[0013] Each time the timer triggers a DMA request, the DMA controller moves the sampled audio data from the data register to the buffer in the microcontroller memory to obtain discrete audio data.

[0014] In a possible implementation manner of the first aspect, performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data specifically includes:

[0015] Performing a fast Fourier transform on the discrete audio data to obtain frequency domain components corresponding to different frequency points;

[0016] The real part and the imaginary part of the frequency domain component are squared and summed respectively to obtain the amplitude of the frequency domain component.

[0017] In a possible implementation manner of the first aspect, extracting drum beats from the audio frequency domain data to obtain drum beat markers specifically includes:

[0018] Calculate the average value of each domain value of the audio frequency domain data within the first preset frequency range as the current drum beat value of each domain value;

[0019] Obtaining an average value of each domain value of the previous audio frequency domain data within the first preset frequency range as a comparison drum beat value of each domain value;

[0020] Calculate the difference between the current drum beat value and the comparison drum beat value of each domain value;

[0021] If the difference value and the corresponding current drum beat value are both greater than the preset drum beat value, a drum beat mark is marked on the corresponding domain value.

[0022] In a possible implementation manner of the first aspect, extracting human voice from the audio frequency domain data to obtain a human voice marker specifically includes:

[0023] The average value of each domain value of the audio frequency domain data within the second preset frequency range is calculated as the human voice value of each domain value, and a human voice mark is marked on the domain value within the second preset frequency range and non-zero.

[0024] In a possible implementation manner of the first aspect, extracting the volume of the discrete audio data to obtain a volume sudden increase mark specifically includes:

[0025] Taking the maximum value in the discrete audio data as the current maximum volume;

[0026] Get the maximum value of the last discrete audio data as the maximum value of the comparison volume;

[0027] If the current maximum volume value is greater than the comparison maximum volume value, a volume steep increase mark is marked on the discrete audio data.

[0028] In a possible implementation manner of the first aspect, dynamically adjusting the brightness or color of an LED according to the drum mark, the human voice mark, and the volume sudden increase mark specifically includes:

[0029] Generate a plurality of LED effect frames according to the discrete audio data;

[0030] If the audio frequency domain data has the drum mark or the discrete audio data has the volume steep rise mark, skipping the plurality of LED effect frames for playback;

[0031] If the number of occurrences of the drum mark in the audio frequency domain data is greater than a first number threshold, performing leapfrogging playback on the plurality of LED effect frames;

[0032] If the vocal mark and the drum mark exist in the audio frequency domain data, and the value of the audio data corresponding to the vocal mark in the audio frequency domain data is lower than the preset vocal threshold, and the value of the audio data corresponding to the drum mark in the audio frequency domain data is higher than the preset drum threshold, the value of the audio data corresponding to the vocal mark in the audio frequency domain data is increased according to a preset ratio.

[0033] In a possible implementation manner of the first aspect, the performing frame skipping playback on the plurality of LED effect frames specifically includes:

[0034] After each LED effect frame is played, a first preset number of LED effect frames are skipped and then the next LED effect frame is played.

[0035] In a possible implementation manner of the first aspect, the performing spanning playback on the plurality of LED effect frames specifically includes:

[0036] A second preset number of LED effect frames are skipped, and then the remaining LED effect frames are played sequentially.

[0037] A second aspect of the embodiment of the present application provides an LED light control device based on a single chip microcomputer, comprising:

[0038] The discrete module is used to transfer audio data regularly through the DMA controller to obtain discrete audio data;

[0039] A transformation module, used for performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data;

[0040] A drum beat module, used to extract drum beats from the audio frequency domain data and obtain drum beat marks;

[0041] A vocal module, used to extract vocals from the audio frequency domain data and obtain vocal markers;

[0042] A steep rise module, used for extracting the volume of the discrete audio data and obtaining a steep rise mark of the volume;

[0043] The control module dynamically controls the brightness or color of the LED according to the drum mark, the vocal mark and the volume sudden rise mark.

[0044] Compared with the prior art, the embodiment of the present invention provides a single-chip microcomputer-based LED lighting control method and device, which use a DMA controller and a timer to collect audio data in real time, thereby ensuring the high efficiency and real-time performance of data collection; by simplifying the calculation steps (such as omitting square root operations, using numerical comparisons, etc.), the data processing time is reduced and the system response speed is improved; the brightness or color of the LED is dynamically adjusted according to audio features (drum beats, human voices, volume changes) to achieve synchronization between audio rhythm and lighting effects; and by using technologies such as sliding windows and frame skipping playback, memory usage and computing resources are optimized to ensure efficient operation of the system on the single-chip microcomputer. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a flow chart of a single chip microcomputer-based LED light control method provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of a process for obtaining drum mark and vocal mark is provided according to an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of a flow chart of obtaining a volume sudden increase mark is provided according to an embodiment of the present invention;

[0048] Figure 4 The present invention provides a schematic diagram of a process of dynamically controlling an LED according to an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] To solve the above problems, see Figure 1 An embodiment of the present invention provides a LED light control method based on a single chip microcomputer, comprising:

[0051] S10, regularly moving audio data through a DMA controller to obtain discrete audio data.

[0052] S11, performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data.

[0053] S12: extract drum beats from the audio frequency domain data to obtain drum beat marks.

[0054] S13: extracting human voice from the audio frequency domain data to obtain a human voice marker.

[0055] S14: extracting the volume of the discrete audio data to obtain a volume sudden increase mark.

[0056] S15. Dynamically control the brightness or color of the LED according to the drum mark, the vocal mark and the volume sudden increase mark.

[0057] The S10 uses a DMA controller for data transmission, reducing CPU intervention. The DMA controller can efficiently transfer audio data from the ADC to the memory, reducing the burden on the CPU and improving the efficiency of data transmission. The timer and DMA controller can be used together to achieve real-time audio data collection, ensuring that the system can obtain the latest audio data in a short time.

[0058] S11 uses an efficient FFT algorithm to convert time domain data into frequency domain data. The real and imaginary parts of the frequency domain components are squared and summed respectively, the square root operation is omitted, and the square sum is directly used as the amplitude. The FFT algorithm can quickly convert time domain data into frequency domain data and provide frequency distribution information of the audio signal. The simplified modulo processing omits the square root operation, reduces the calculation time, and improves the real-time processing capability of the system. Although the square root operation is omitted, the square sum can still accurately reflect the amplitude of the frequency domain component and does not affect subsequent data processing.

[0059] The purpose of S12 is to accurately identify the drum beat position in the audio, the purpose of S13 is to mark the human voice on the non-zero frequency domain component within the intermediate frequency range, and the purpose of S14 is to determine the volume change in the audio in real time. Finally, in S15, the brightness or color of the LED is dynamically adjusted according to the audio features (drum beats, human voice, volume change) extracted by S12-S14, thereby achieving the synchronization of audio rhythm and lighting effects.

[0060] Through the above method, audio data can be efficiently collected and processed in real time under limited microcontroller resources, and the brightness or color of the LED can be dynamically adjusted according to the audio characteristics. This method not only improves the real-time performance and response speed of the system, but also enhances the user's visual experience.

[0061] The following are the main technical effects of this method: the cooperation of the DMA controller and the timer realizes efficient data acquisition; by simplifying the calculation steps and using the sliding window technology, the use of memory and computing resources is optimized, ensuring that the system runs efficiently on the single-chip microcomputer and improving the real-time processing capability of the system; by summing the low-frequency and medium-frequency ranges and detecting volume changes, the audio features are accurately identified; the brightness or color of the LED is dynamically adjusted according to the audio features, and the synchronization of audio rhythm and lighting effects is achieved through frame skipping and cross-playing.

[0062] Exemplarily, the step of transferring audio data in a timely manner through a DMA controller to obtain discrete audio data specifically includes:

[0063] Each time the timer triggers a DMA request, the DMA controller moves the sampled audio data from the data register to the buffer in the microcontroller memory to obtain discrete audio data.

[0064] The period value of the timer can be calculated based on the required sampling rate (e.g. 44.1kHz). For example, for a sampling rate of 44.1kHz, the period of the timer should be 1 / 44100 seconds. Each time the timer expires, the DMA is triggered to move the ADC data once.

[0065] Then select a DMA channel connected to the audio ADC and configure the data register address of the audio ADC. It should be noted that the buffer address in the memory is used to store the sampled audio data. The transfer direction can be set from the peripheral to the memory. The data size of each transfer can be set to 16 bits or 32 bits.

[0066] The timer generates periodic interrupts or DMA requests at the preset sampling rate to ensure the real-time and accuracy of data acquisition. When the timer is triggered, the DMA controller automatically moves the audio ADC data from the data register to the buffer of the microcontroller memory, reducing CPU intervention and improving the efficiency of data transmission.

[0067] Then set a fixed-size data window, such as 1024 sample points. Each time new data is collected, only a part of the data window is updated, and the sliding window method is used to enhance real-time performance. The sliding window technology reduces the memory usage during each data collection, allowing the system to run efficiently with limited memory resources.

[0068] In this embodiment, the use of the DMA controller releases the CPU's computing resources, allowing it to focus on other tasks and improving the overall performance of the system; each time the timer generates a periodic interrupt or a DMA request, the DMA controller immediately moves the data to ensure the real-time and accuracy of the data; through the sliding window technology, only a part of the data window is updated each time, ensuring the integrity and continuity of the data.

[0069] Through the above steps and technical features, audio data can be efficiently collected in real time and stored in the microcontroller memory, providing a basis for subsequent audio processing and LED control.

[0070] Exemplarily, performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data specifically includes:

[0071] Performing a fast Fourier transform on the discrete audio data to obtain frequency domain components corresponding to different frequency points;

[0072] The real part and the imaginary part of the frequency domain component are squared and summed respectively to obtain the amplitude of the frequency domain component.

[0073] The efficient FFT algorithm is used to convert time domain data into frequency domain data, providing the frequency distribution information of the audio signal. The real and imaginary parts of the frequency domain components are squared and summed respectively, and the square root operation is omitted, and the square sum is directly used as the amplitude.

[0074] It should be noted that the data after FFT processing must also be processed by modulo to obtain the amplitude of the frequency domain component. The usual practice is to square, sum, and find the square root of the real and imaginary parts of the frequency domain component respectively to obtain the amplitude of the frequency domain component. However, since the square root operation is time-consuming for the microcontroller, in order to improve efficiency and real-time performance, the square root step is removed from the amplitude modulo step. It does not affect the subsequent data processing (drum beat extraction, voice extraction, LED control, etc.), but the overall frequency domain value becomes larger.

[0075] Through the above steps and technical features, discrete audio data can be efficiently subjected to fast Fourier transform and simplified modulo processing to obtain audio frequency domain data, providing a basis for subsequent audio feature extraction and LED control.

[0076] See also Figure 2 Exemplarily, the extracting drum beats from the audio frequency domain data to obtain drum beat markers specifically includes:

[0077] Calculate the average value of each domain value of the audio frequency domain data within the first preset frequency range as the current drum beat value of each domain value;

[0078] Obtaining an average value of each domain value of the previous audio frequency domain data within the first preset frequency range as a comparison drum beat value of each domain value;

[0079] Calculate the difference between the current drum beat value and the comparison drum beat value of each domain value;

[0080] If the difference value and the corresponding current drum beat value are both greater than the preset drum beat value, a drum beat mark is marked on the corresponding domain value.

[0081] First, define a low-frequency range (the first preset frequency range, such as 50Hz to 230Hz) specifically for drum beat extraction. This range usually contains the main frequency components of the drum sound. By focusing on the low-frequency range, the drum beat position in the audio can be identified more accurately. In music, sounds in the frequency range of 30Hz to 300Hz are usually regarded as the low-frequency range. The frequency range of sounds emitted by the snare drum, middle drum, and bass drum is usually also within this range. Considering the processing power of the microcontroller and the algorithm debugging results, selecting sounds in the frequency range of 50Hz to 230Hz as the frequency range of the drum beat can obtain better drum beat triggering.

[0082] Then, by calculating the difference between the current drum beat value and the comparison drum beat value, the transient changes of the drum beat can be captured. The average value calculation and the difference value calculation are simple and efficient, and can respond to the changes of the drum beats in the audio in real time. By setting the preset drum beat value, the accuracy and reliability of the drum beat marking are ensured. In addition, by comparing with historical data, the accuracy of drum beat recognition is improved and misjudgment is reduced.

[0083] It should be noted that a reasonable threshold setting can effectively filter out noise and improve the accuracy of drum beat recognition. The preset drum beat value can be adjusted based on the on-site equipment, sound source, drum beat trigger sensitivity desired by the user, and other comprehensive conditions. Adjusting the value will affect the difficulty of drum beat triggering. If the user feels that the drum beat is difficult to trigger, this value can be lowered. Conversely, if the drum beat is triggered too frequently, this value can be increased.

[0084] Through the above steps and technical features, the audio frequency domain data can be efficiently extracted for drum beats and drum beat markers can be obtained, providing a basis for subsequent audio feature extraction and LED control.

[0085] See also Figure 2 Exemplarily, the extracting human voice from the audio frequency domain data to obtain a human voice tag specifically includes:

[0086] The average value of each domain value of the audio frequency domain data within the second preset frequency range is calculated as the human voice value of each domain value, and a human voice mark is marked on the domain value within the second preset frequency range and non-zero.

[0087] First, define an intermediate frequency range (the second preset frequency range, such as 200Hz to 500Hz) specifically for human voice extraction. This range usually contains the main frequency components of human voice. By focusing on the intermediate frequency range, the human voice part in the audio can be identified more accurately. Since the frequency range of human voice is higher than that of drum beats, usually between 80Hz and 1KHz, considering the processing power of the microcontroller and the algorithm debugging results, selecting the sound in the frequency range of 200Hz to 500Hz as the frequency range of human voice can cover most of the trigger range of human voice.

[0088] Then calculate the sum of the amplitudes of all frequency domain components within the intermediate frequency range, and then take the average value as the human voice value of each domain value. Through the average value calculation, the frequency domain data is smoothed to reduce the influence of noise.

[0089] Then, the human voice mark is marked on the non-zero domain value within the intermediate frequency range. If the amplitude of a domain value is greater than zero, the human voice mark is marked on the domain value. The accuracy and reliability of the human voice mark are ensured by marking the non-zero domain value.

[0090] In summary, this embodiment can more accurately identify the human voice part in the audio by focusing on the mid-frequency range. By marking the non-zero domain value, the accuracy and reliability of the human voice marking are ensured; the average value calculation and the marking of the non-zero domain value are simple and efficient, and can respond to the human voice changes in the audio in real time; by marking the non-zero domain value, the accuracy and reliability of the human voice marking are ensured; by focusing on the mid-frequency range, the accuracy of human voice recognition is improved and misjudgment is reduced; reasonable non-zero domain value marking can effectively filter noise and improve the accuracy of human voice recognition.

[0091] Through the above steps and technical features, human voice can be efficiently extracted from audio frequency domain data and human voice markers can be obtained, providing a basis for subsequent audio feature extraction and LED control.

[0092] See also Figure 3 Exemplarily, the step of extracting the volume of the discrete audio data and obtaining a volume steep rise mark specifically includes:

[0093] Taking the maximum value in the discrete audio data as the current maximum volume;

[0094] Get the maximum value of the last discrete audio data as the maximum value of the comparison volume;

[0095] If the current maximum volume value is greater than the comparison maximum volume value, a volume steep increase mark is marked on the discrete audio data.

[0096] The calculation of volume involves the logarithmic calculation of the sound source power. Taking into account the resources and hardware performance of the microcontroller, and the application scenario of the microcontroller controlling the LED lighting effect, it is not necessary to use the absolute value of the volume. It is only necessary to know the volume change, such as whether the volume has risen or fallen. Therefore, the volume extraction is simplified to a numerical comparison of the audio data after the audio acquisition step, which only requires division operations and does not involve logarithmic operations, thereby reducing the performance load of the microcontroller and reducing the data processing cycle time.

[0097] Therefore, the maximum value can be found in the discrete audio data as the current maximum volume value, which can accurately reflect the volume change of the current audio data. The maximum value in the last discrete audio data is recorded as the maximum value of the comparison volume. By comparing it with the historical data, the volume change trend can be detected. Compare the current maximum volume value and the comparison volume maximum value. If the current maximum volume value is greater than the comparison volume maximum value, a volume steep rise mark is marked on the current discrete audio data. By marking the volume steep rise, the volume change in the audio can be responded to in real time, providing a basis for subsequent LED control.

[0098] By marking the sudden volume increase, the brightness or color of the LED can be adjusted in time to enhance the user's visual experience. By comparing the maximum values, the accuracy of volume change detection is improved and misjudgment is reduced. Every time new audio data is collected, the current and comparison volume maximum values ​​are updated in real time to ensure the real-time and accuracy of detection.

[0099] Through the above steps and technical features, the volume of discrete audio data can be efficiently extracted and the volume rise mark can be obtained, providing a basis for subsequent audio feature extraction and LED control.

[0100] See also Figure 4 For example, when the single-chip microcomputer detects that the data intensity of the discrete audio data is lower than the light effect silence threshold for a period of time, the brightness in the LED effect frame can be set to 0, so that the light effect displayed by the LED is silent. Once the intensity of the discrete audio data is detected to be restored to above the set value, the brightness of the LED will be restored to the bright state and the brightness value before the light effect is silenced. The setting value of the light effect silence threshold can be changed.

[0101] It should be noted that the light effect muting can achieve the effect that the LED light effect turns black when the audio signal strength is low (or lower than the set value), and the LED light effect is restored when the audio signal strength is high (or higher than the set value), making people feel that the LED light effect will change with the ups and downs of the music, thereby enhancing the correlation between audio data and LED light effects.

[0102] Exemplarily, dynamically adjusting the brightness or color of an LED according to the drum mark, the vocal mark, and the volume rise mark specifically includes:

[0103] Generate a plurality of LED effect frames according to the discrete audio data;

[0104] If the audio frequency domain data has the drum mark or the discrete audio data has the volume steep rise mark, skipping the plurality of LED effect frames for playback;

[0105] If the number of occurrences of the drum mark in the audio frequency domain data is greater than a first number threshold, performing leapfrogging playback on the plurality of LED effect frames;

[0106] If the vocal mark and the drum mark exist in the audio frequency domain data, and the value of the audio data corresponding to the vocal mark in the audio frequency domain data is lower than the preset vocal threshold, and the value of the audio data corresponding to the drum mark in the audio frequency domain data is higher than the preset drum threshold, the value of the audio data corresponding to the vocal mark in the audio frequency domain data is increased according to a preset ratio.

[0107] First, several LED effect frames can be generated based on discrete audio data. Each effect frame contains the brightness and color information of the LED, and can be designed according to different characteristics of the audio data, such as gradient, flashing, etc.

[0108] It should be noted that the LED effect frame is not generated by the microcontroller. In fact, the data of the LED effect frame can be pre-generated by a software on the PC and saved in a storage medium (such as an SD card), which can be read and used by the microcontroller when needed.

[0109] Then, by checking the existence of drum mark and volume surge mark, decide whether to skip frame playback. Frame skipping playback speeds up the playback speed and increases visual dynamics by skipping some frames; by checking the number of occurrences of drum mark, decide whether to skip playback. Skipping playback further speeds up the playback speed and enhances the visual effect by skipping more frames; by checking the existence of vocal mark and drum mark, as well as the corresponding audio data value, decide whether to increase the vocal data. The value of the audio data corresponding to the vocal mark is increased according to the preset ratio, thereby enhancing the impact of the vocal part on the visual effect of LED playback.

[0110] Through the above steps and technical features, the brightness or color of the LED can be efficiently and dynamically adjusted according to the audio characteristics, providing users with a rich and diverse visual experience.

[0111] Exemplarily, the performing frame skipping playback on the plurality of LED effect frames specifically includes:

[0112] After each LED effect frame is played, a first preset number of LED effect frames are skipped and then the next LED effect frame is played.

[0113] Compared with sequential playback, the frame number increments in frame skipping playback instead of one frame at a time to several frames at a time, so that the frame number value increases more within unit time while the frame rate remains unchanged. For observers, the LED lighting effect plays faster.

[0114] Determine the drum mark and the volume rise mark. If any of the marks exist, the LED light effect can be triggered to change speed, continue to accelerate, and play in a jumpy manner for a period of time. After the acceleration ends, the normal playback speed will be restored. Under the premise that the LED light playback speed remains unchanged, a certain number of frames are skipped to make the LED light effect look like running forward quickly. The advantage of this adjustment is that when the number of LED points controlled by the microcontroller has reached the hardware upper limit and the LED playback speed can no longer be increased, a similar speed change effect can be achieved by skipping frames.

[0115] Exemplarily, the step of performing cross-play on the plurality of LED effect frames specifically includes:

[0116] A second preset number of LED effect frames are skipped, and then the remaining LED effect frames are played sequentially.

[0117] Sequential playback is the most commonly used playback method, which plays one frame at a time in sequence. For example, an LED lighting effect has a total of 100 frames, and the playback method is to play the 1st frame, the 2nd frame, ... the 99th frame, the 100th frame in sequence. The leap playback is an instantaneous playback method after triggering a mutation, which jumps over half of the LED effect frame number to achieve the purpose of LED effect mutation. For example, an LED effect has a total of 100 frames, and the 1st frame, the 2nd frame, the 3rd frame are played, and (a mutation is triggered at this time) the 53rd frame, the 54th frame, ...

[0118] In practical applications, the accumulated number of drum marks can be determined first. When a certain number of drum marks is reached, the LED lighting effect mutation is triggered. The frame sequence of the LED lighting effect changes from sequential playback to leap playback. The number of frames in the current scene is leaped to half of the number of frames of the currently playing LED lighting effect to achieve a sudden change of the LED lighting effect. After leaping once, the sequential playback is restored until the next mutation is triggered.

[0119] In practical applications, the number of accumulated drum mark occurrences can be determined first, and when a certain number of times is reached, the LED lighting effect can be triggered to switch, and the next LED lighting effect can be switched randomly or sequentially in the preset LED lighting effect list to achieve the change of LED lighting effects.

[0120] Compared with the prior art, an LED lighting control device based on a single-chip microcomputer provided in an embodiment of the present invention uses a DMA controller and a timer to collect audio data in real time, thereby ensuring the high efficiency and real-time performance of data collection; reduces data processing time and improves system response speed by simplifying calculation steps (such as omitting square root operations, using numerical comparisons, etc.); dynamically adjusts the brightness or color of the LED according to audio features (drum beats, human voices, volume changes) to achieve synchronization between audio rhythm and lighting effects; optimizes memory usage and computing resources through technologies such as sliding windows and frame skipping playback, thereby ensuring efficient operation of the system on a single-chip microcomputer.

[0121] An embodiment of the present application provides an LED light control device based on a single chip microcomputer, comprising: a discrete module, a conversion module, a drum module, a human voice module, a steep rise module and a control module.

[0122] The discrete module is used to periodically transfer audio data through a DMA controller to obtain discrete audio data.

[0123] The transformation module is used to perform fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data.

[0124] The drum beat module is used to extract drum beats from the audio frequency domain data to obtain drum beat markers.

[0125] The human voice module is used to extract the human voice from the audio frequency domain data and obtain the human voice mark.

[0126] The steep rise module is used to extract the volume of the discrete audio data and obtain a steep rise mark of the volume.

[0127] The control module dynamically controls the brightness or color of the LED according to the drum mark, the vocal mark and the volume sudden rise mark.

[0128] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method embodiment and will not be described again here.

[0129] Compared with the prior art, an LED lighting control device based on a single-chip microcomputer provided in an embodiment of the present invention uses a DMA controller and a timer to collect audio data in real time, thereby ensuring the high efficiency and real-time performance of data collection; reduces data processing time and improves system response speed by simplifying calculation steps (such as omitting square root operations, using numerical comparisons, etc.); dynamically adjusts the brightness or color of the LED according to audio features (drum beats, human voices, volume changes) to achieve synchronization between audio rhythm and lighting effects; optimizes memory usage and computing resources through technologies such as sliding windows and frame skipping playback, thereby ensuring efficient operation of the system on a single-chip microcomputer.

[0130] An embodiment of the present application provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the LED light control method based on a single-chip microcomputer as described above.

[0131] The computer device may be a computing device such as a smart phone, a tablet computer, a desktop computer, and a cloud server. The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the figure is merely an example of a computer device and does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.

[0132] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0133] In some embodiments, the memory may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0134] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device implements the steps in the above-mentioned method embodiments when executing the computer device.

[0135] In several embodiments provided in the present application, it is understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.

[0136] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0137] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A LED lighting control method based on a single chip microcomputer, characterized in that: include: The audio data is transferred regularly through the DMA controller to obtain discrete audio data; Performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data; Performing drum beat extraction on the audio frequency domain data to obtain drum beat markers; Extracting human voice from the audio frequency domain data to obtain a human voice marker; Performing volume extraction on the discrete audio data to obtain a volume steep rise mark; Dynamically controlling the brightness or color of an LED according to the drum mark, the vocal mark, and the volume spike mark; The step of dynamically adjusting the brightness or color of the LED according to the drum mark, the human voice mark, and the volume rise mark specifically includes: Generate a plurality of LED effect frames according to the discrete audio data; If the audio frequency domain data has the drum mark or the discrete audio data has the volume steep rise mark, skipping the plurality of LED effect frames for playback; If the number of occurrences of the drum mark in the audio frequency domain data is greater than a first number threshold, performing leapfrogging playback on the plurality of LED effect frames; If the vocal mark and the drum mark exist in the audio frequency domain data, and the value of the audio data corresponding to the vocal mark in the audio frequency domain data is lower than the preset vocal threshold, and the value of the audio data corresponding to the drum mark in the audio frequency domain data is higher than the preset drum threshold, the value of the audio data corresponding to the vocal mark in the audio frequency domain data is increased according to a preset ratio.

2. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The method of regularly transferring audio data through the DMA controller to obtain discrete audio data specifically includes: Each time the timer triggers a DMA request, the DMA controller moves the sampled audio data from the data register to the buffer in the microcontroller memory to obtain discrete audio data.

3. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The step of performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data specifically includes: Performing a fast Fourier transform on the discrete audio data to obtain frequency domain components corresponding to different frequency points; The real part and the imaginary part of the frequency domain component are squared and summed respectively to obtain the amplitude of the frequency domain component.

4. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The extracting drum beats from the audio frequency domain data to obtain drum beat marks specifically includes: Calculate the average value of each domain value of the audio frequency domain data within the first preset frequency range as the current drum beat value of each domain value; Obtaining an average value of each domain value of the previous audio frequency domain data within the first preset frequency range as a comparison drum beat value of each domain value; Calculate the difference between the current drum beat value and the comparison drum beat value of each domain value; If the difference value and the corresponding current drum beat value are both greater than the preset drum beat value, a drum beat mark is marked on the corresponding domain value.

5. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The extracting human voice from the audio frequency domain data to obtain the human voice marker specifically includes: The average value of each domain value of the audio frequency domain data within the second preset frequency range is calculated as the human voice value of each domain value, and a human voice mark is marked on the domain value within the second preset frequency range and non-zero.

6. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The step of extracting the volume of the discrete audio data to obtain a volume steep rise mark specifically includes: Taking the maximum value in the discrete audio data as the current maximum volume; Get the maximum value of the last discrete audio data as the maximum value of the comparison volume; If the current maximum volume value is greater than the comparison maximum volume value, a volume steep increase mark is marked on the discrete audio data.

7. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The performing frame skipping and playing of the plurality of LED effect frames specifically includes: After each LED effect frame is played, a first preset number of LED effect frames are skipped and then the next LED effect frame is played.

8. The LED lighting control method based on a single chip microcomputer as claimed in claim 1, characterized in that: The performing spanning playback on the plurality of LED effect frames specifically includes: A second preset number of LED effect frames are skipped, and then the remaining LED effect frames are played sequentially.

9. A LED lighting control device based on a single chip microcomputer, characterized in that: include: The discrete module is used to transfer audio data regularly through the DMA controller to obtain discrete audio data; A transformation module, used for performing fast Fourier transform and simplified modulo processing on the discrete audio data to obtain audio frequency domain data; A drum beat module, used to extract drum beats from the audio frequency domain data and obtain drum beat marks; A vocal module, used to extract vocals from the audio frequency domain data and obtain vocal markers; A steep rise module, used for extracting the volume of the discrete audio data and obtaining a steep rise mark of the volume; A control module dynamically controls the brightness or color of the LED according to the drum mark, the vocal mark and the volume rise mark; The control module dynamically adjusts the brightness or color of the LED according to the drum mark, the human voice mark and the volume rise mark, specifically including: The control module generates a plurality of LED effect frames according to the discrete audio data; If the audio frequency domain data has the drum mark or the discrete audio data has the volume steep rise mark, skipping the plurality of LED effect frames for playback; If the number of occurrences of the drum mark in the audio frequency domain data is greater than a first number threshold, performing leapfrogging playback on the plurality of LED effect frames; If the vocal mark and the drum mark exist in the audio frequency domain data, and the value of the audio data corresponding to the vocal mark in the audio frequency domain data is lower than the preset vocal threshold, and the value of the audio data corresponding to the drum mark in the audio frequency domain data is higher than the preset drum threshold, the value of the audio data corresponding to the vocal mark in the audio frequency domain data is increased according to a preset ratio.

Citation Information

Patent Citations

  • Automobile music light rhythm system

    CN115837878A

  • Acousto-optic synchronization method and device, electronic equipment and computer readable storage medium

    CN116193683A

  • Audio processing method, electronic equipment and medium

    CN117577130A