RGB light switching method and device, equipment and storage medium
By creating music following threads and lighting effect threads in Bluetooth speakers, using the difference algorithm to obtain the energy value of the music frequency points, and achieving smooth switching of light color and brightness, the problem of unstable lighting effect in the existing technology is solved and the user experience is improved.
Patent Information
- Application Number
- CN202411444971.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-28
AI Technical Summary
When existing Bluetooth speakers achieve differentiated lighting effects, they are prone to problems such as color jump, color mixing, flickering, and running water and grid flowing, resulting in a reduced user experience.
By creating music following threads and independent lighting effects threads, the difference algorithm is used to obtain the energy value of the music frequency point, and switch according to the switching control signal, the light color and brightness can be smoothly switched.
It realizes smooth switching of all light colors and brightness, improves user experience, and solves problems such as color jump, color mixing, flickering, and flowing water and grid.
Smart Images

Figure CN119545619A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of music lighting effect technology, and in particular to an RGB lighting switching method, device, equipment and storage medium. Background Art
[0002] Bluetooth speakers with multiple RGB lights are usually designed with light rings and light strips. RGB light strips use different currents connected to the light strips to change the color of the light strips and the color change frequency, thereby achieving a variety of lighting effects.
[0003] When existing Bluetooth speakers achieve differentiated lighting effects, the color, brightness, and speed are constantly changing, resulting in problems such as color jumping, color mixing, flickering, and flowing grids, which bring an uncomfortable experience to users. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose an RGB light switching method, device, equipment and storage medium to solve the problem that when existing Bluetooth speakers realize differentiated lighting effects, they have color jumping, color mixing, flickering, grid flowing, etc., which reduces the user experience.
[0005] In order to solve the above technical problems, the embodiment of the present application provides an RGB light switching method, comprising:
[0006] Step 100: Create a music following thread and an independent lighting effect thread, wherein the lighting effect thread includes a linked list, and the linked list includes a plurality of lighting effect structures, and initialize the lighting effect thread;
[0007] Step 200: the music following thread captures the music frequency, sends the captured music frequency to the lighting effect thread, uses a difference algorithm to obtain the energy value of the current music frequency, and sends the energy value of the current music frequency and the overall energy value to the lighting effect thread;
[0008] Step 300: After receiving the captured music frequency, the lighting effect thread initializes the current timer and lighting effect mode, creates a first timer, receives a switching control signal, switches according to the switching control signal, and uses the first timer to play the lighting effect according to the energy value of the current music frequency.
[0009] Furthermore, the step 100 includes:
[0010] Step 110: Initialize the linked list and select a corresponding linked list type as needed. The linked list types include a unidirectional linked list, a bidirectional linked list, and a circular linked list.
[0011] Step 120: Add lighting effect variables to the structure in the selected linked list, wherein the lighting effect variables include RGB lamp id, RGB lamp address, R value data, G value data, B value data and RGB lamp priority.
[0012] Further, step 200 includes:
[0013] Step 210: Obtain a music clip corresponding to the lighting effect, create a second timer, and use the second timer to periodically capture the low frequency point, medium-low frequency point, medium frequency point, and medium-high frequency point of the music clip respectively;
[0014] Step 220: Utilize the energy values obtained at the low frequency point, the mid-low frequency point, the mid-frequency point, and the mid-high frequency point, and calculate the energy value of the current music frequency point according to the difference algorithm.
[0015] Furthermore, the step 210 includes:
[0016] Step 211: using the second timer to set a first time threshold;
[0017] Step 212: at each interval of the first time threshold, sequentially obtain a first energy value of a low frequency point, a second energy value of a mid-low frequency point, a third energy value of a mid-frequency point, and a fourth energy value of a mid-high frequency point.
[0018] Furthermore, the step 220 includes:
[0019] Step 221: Obtain the overall energy value of the music clip using the first energy value, the second energy value, the third energy value, and the fourth energy value;
[0020] Step 222: using the first energy value and the second energy value to obtain a first energy difference value, using the second energy value and the third energy value to obtain a second energy difference value, and using the third energy value and the fourth energy value to obtain a third energy difference value;
[0021] Step 223: Determine whether the music clip is currently in an upward trend or a downward trend according to the first energy difference value, the second energy difference value, and the third energy difference value:
[0022] If the third energy difference value>the second energy difference value>the first energy difference value and the third energy difference value is greater than half of the overall energy value, then the third energy difference value is determined to be the energy value of the current music frequency point.
[0023] Furthermore, the step 300 includes:
[0024] Step 310, determining whether a lighting effect timer has been turned on, and if so, turning off the current lighting effect timer;
[0025] Step 320: determine whether a lighting effect mode is turned on. If so, turn off the current lighting effect mode and clear the screen.
[0026] Furthermore, after step 320, step 300 further includes:
[0027] Step 330: Use the second time threshold set by the first timer to run the switched lighting effect mode after the second time threshold is reached;
[0028] Step 340: Obtain the energy value of the current music frequency from the music following thread, determine the corresponding lighting effect according to the energy value of the current music frequency, and play it.
[0029] In order to solve the above problem, an RGB light switching device is provided, which adopts the above RGB light switching method, including:
[0030] A creation module, used to create a music following thread and create an independent lighting effect thread, wherein the lighting effect thread includes a linked list, and the linked list includes a plurality of lighting effect structures, and initializes the lighting effect thread;
[0031] A frequency capture module, used to capture the music frequency using the music following thread, send the captured music frequency to the lighting effect thread, use a difference algorithm to obtain the energy value of the current music frequency, and send the energy value of the current music frequency and the overall energy value to the lighting effect thread;
[0032] The switching module is used to initialize the current timer and lighting effect mode after the lighting effect thread receives the captured music frequency, create a first timer, receive a switching control signal, switch according to the switching control signal, and use the first timer to play the lighting effect according to the energy value of the current music frequency.
[0033] In order to solve the above technical problems, an embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the RGB light switching method described in the first aspect are implemented.
[0034] In order to solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor, the steps of the RGB light switching method described in the first aspect are implemented.
[0035] Compared with the prior art, the embodiment of the present application has the following technical effects: by using the music following thread to capture the music frequency, sending the captured music frequency to the lighting effect thread, and using the difference algorithm to obtain the energy value of the current music frequency, switching according to the switching control signal and playing the lighting effect according to the energy value of the current music frequency. It can achieve smooth switching of the color and brightness of all lights, bringing a better user experience to users, and solving the problem of reduced user experience caused by color jumping, color mixing, flickering, and water flowing in grids when realizing differentiated lighting effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 A schematic diagram of a specific implementation of an RGB light switching method in the present invention;
[0038] Figure 2 for Figure 1 A schematic diagram of a specific implementation of S100;
[0039] Figure 3 for Figure 1 A schematic diagram of a specific implementation after S200 in FIG.
[0040] Figure 4 for Figure 3 A schematic diagram of a specific implementation of S210;
[0041] Figure 5 for Figure 3 A schematic diagram of a specific implementation of S220;
[0042] Figure 6 for Figure 1 A schematic diagram of a specific implementation of S300;
[0043] Figure 7 for Figure 6 A schematic diagram of a specific implementation after S320 in FIG.
[0044] Figure 8 A schematic diagram of a specific implementation method of frequency point capture in the RGB light switching method of the present invention;
[0045] Fig. 9 This is a schematic diagram of the structure of an RGB light switching device in the present invention;
[0046] Fig.10 It is a schematic structural diagram of an embodiment of an electronic device according to the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the accompanying drawings in the invention to clearly and completely describe the technical solutions in 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 in the present invention, other embodiments obtained by ordinary technicians in this field without creative work are all within the scope of protection of the present invention.
[0048] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used in the specification of the application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0050] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0051] An RGB light switching method provided in an embodiment of the present application can be applied to an electronic device with the ability to run instructions or programs. The electronic device may be, but is not limited to, various servers, workstations, personal computers, laptops, etc. Running on different computing devices is only a difference in the execution subject of the scheme. People in the art can foresee that running on different computing devices can produce the same technical effect. The present invention is described in detail below through specific embodiments.
[0052] The purpose of the embodiments of the present application is to propose an RGB light switching method, device, equipment and storage medium to solve the problem that when existing Bluetooth speakers realize differentiated lighting effects, they have color jumping, color mixing, flickering, grid flowing, etc., which reduces the user experience.
[0053] In order to solve the above technical problems, the present application embodiment provides an RGB light switching method, such as Figure 1 , Figure 1 A schematic diagram of a specific implementation of an RGB light switching method in the present invention; comprising:
[0054] S100: Create a music following thread and an independent lighting effect thread. The lighting effect thread includes a linked list. The linked list includes multiple lighting effect structures. Initialize the lighting effect thread.
[0055] In some preferred embodiments, Figure 2 , Figure 2 for Figure 1 A schematic diagram of a specific implementation scheme of S100 in the figure; S100 includes: S110, initializing the linked list, selecting the corresponding linked list type according to the need, the linked list types include one-way linked list, two-way linked list and circular linked list; S120, adding lighting effect variables to the structure in the selected linked list, the lighting effect variables include RGB light id, RGB light address, R value data, G value data, B value data and RGB light priority.
[0056] In this embodiment, the data nodes in the linked list include multiple structures (light structures), and the member variables of the structures include RGB light id (light_id), RGB light address (light_address), R value data (data_r), G value data (data_g), B value data (data_b) and RGB light priority (prior).
[0057] By creating a music following thread and an independent lighting effect thread, the lighting effect thread and the music following thread transmit data, so that the music frequency and the energy value of the current music frequency can be obtained, thereby preparing for smooth switching.
[0058] In this embodiment, during the initialization phase, the lighting effect thread determines whether a message to start playing the lighting effect is received, and if it is confirmed that the message to start playing the lighting effect is received, a new timer is created and run, and the previous timer and lighting effect mode are turned off to clear the screen.
[0059] S200, create a music following thread, the music following thread captures the music frequency, sends the captured music frequency to the lighting effect thread, uses the difference algorithm to obtain the energy value of the current music frequency, and sends the energy value of the current music frequency and the overall energy value to the lighting effect thread.
[0060] In some preferred embodiments, Figure 3 , Figure 3 for Figure 1 A schematic diagram of a specific implementation method after S200 in the figure; S200 includes: S210, obtaining a music clip corresponding to the lighting effect, creating a second timer, and using the second timer to periodically capture the low frequency points, medium-low frequency points, medium frequency points, and medium-high frequency points of the music clip; S220, using the obtained energy values at the low frequency points, medium-low frequency points, medium frequency points, and medium-high frequency points, and calculating the energy value of the current music frequency point according to the difference algorithm.
[0061] Different audio signals have different frequencies. When the music contains rich low-frequency, mid-low-frequency, mid-frequency, and mid-high-frequency components, the control signal will switch the light color and adjust the brightness according to the signal strength of different frequency bands. For example, a low-frequency music signal may trigger a light effect of one color, and a high-frequency music signal may trigger a light effect of another color. The frequency of the music signal changes quickly and dramatically, which can easily lead to problems such as color jumping, color mixing, flickering, and flowing water.
[0062] In this embodiment, the created music following thread is used to periodically capture each frequency point, and the difference algorithm is used to calculate the energy value of the current music frequency point, so as to accurately obtain the energy value of the music frequency point corresponding to the lighting effect in real time, avoiding the problems of color jumping, color mixing, flickering, and flowing water.
[0063] In some optional embodiments, such as Figure 4 , Figure 4 for Figure 3 A schematic diagram of a specific implementation of S210 in the figure; S210 includes: S211, using a second timer to set a first time threshold; S212, at each interval of the first time threshold, sequentially obtaining a first energy value of a low frequency point, a second energy value of a mid-low frequency point, a third energy value of a mid-frequency point, and a fourth energy value of a mid-high frequency point.
[0064] In this embodiment, if Figure 8 , Figure 8 It is a schematic diagram of a specific implementation method of frequency point capture in the RGB light switching method of the present invention; the first time threshold can be set to 10ms, and the frequency points are: low frequency point 50HZ, medium-low frequency 100HZ, medium frequency point 250HZ, medium-high frequency 600HZ, and according to the second timer setting, the energy value of each frequency point is taken in turn every 10ms.
[0065] Specifically, the energy values of the low frequency point, mid-low frequency point, mid-frequency point, and mid-high frequency point are respectively the first energy value A, the second energy value B, the third energy value C, and the fourth energy value D. In this embodiment, the style of music can be determined according to the size of each energy value or by comparing the energy values.
[0066] Further, such as Figure 5 , Figure 5 for Figure 3 A schematic diagram of a specific implementation scheme of S220 in the figure; S220 includes: S221, using the first energy value, the second energy value, the third energy value, and the fourth energy value to obtain the overall energy value of the music clip; S222, using the first energy value and the second energy value to obtain a first energy difference, using the second energy value and the third energy value to obtain a second energy difference, and using the third energy value and the fourth energy value to obtain a third energy difference; S223, judging whether the music clip is currently in an upward trend or a downward trend based on the first energy difference, the second energy difference, and the third energy difference: if the third energy difference>the second energy difference>the first energy difference and the third energy difference is greater than half of the overall energy value, then judging that the third energy difference is the energy value of the current music frequency point.
[0067] like Figure 8 In this embodiment, the total energy required to play the music is E=A+B+C+D.
[0068] In this embodiment, the volume level of the music and the proportion of each frequency band are first determined, and then a difference operation is performed. The first energy difference, the second energy difference, and the third energy difference are respectively set to F, G, and H, then:
[0069] F = BA, G = CB, H = DC;
[0070] According to the first energy difference, the second energy difference and the third energy difference, it is determined whether the tune of the current music is in an upward trend or a downward trend if:
[0071] H>G>F, and H>E / 2, then H is the energy value of the current music frequency point captured,
[0072] According to the difference algorithm principle, the current is first determined, and the overall energy value E and the third energy difference H are sent to the lighting effect thread to play the lighting effect.
[0073] S300, after receiving the captured music frequency, the lighting effect thread initializes the current timer and lighting effect mode, creates a first timer, receives a switching control signal, switches according to the switching control signal, and uses the first timer to play the lighting effect according to the energy value of the current music frequency.
[0074] In a preferred embodiment, Figure 6, Figure 6 for Figure 1 A schematic diagram of a specific implementation of S300 in the embodiment; S300 includes: S310, determining whether a lighting effect timer has been turned on, and if so, turning off the current lighting effect timer; S320, determining whether a lighting effect mode has been turned on, and if so, turning off the current lighting effect mode and clearing the screen.
[0075] In this embodiment, the first timer for the lighting effect is opened / created, and before entering a new lighting effect mode, the opened timer is closed. Before entering a new lighting effect mode, all opened lighting effects are closed. The lighting effect mode is switched by pressing a button, and the currently running lighting effect thread will receive the button control instruction. After receiving the control instruction, the lighting effect thread switches to the specified lighting effect mode.
[0076] In a preferred embodiment, Figure 7 , Figure 7 for Figure 6 A schematic diagram of a specific implementation after S320 in FIG. 1 ; after S320, S300 further includes:
[0077] S330, using the second time threshold set by the first timer, after running the second time threshold, running the switched lighting effect mode; S340, obtaining the energy value of the current music frequency from the music following thread, determining the corresponding lighting effect according to the energy value of the current music frequency, and playing it.
[0078] In this embodiment, during operation, after the lighting effect thread receives the frequency data, it opens and creates a second timer and waits for the timer to be triggered. After the timer is triggered, it runs the specified lighting effect mode and waits for receiving external energy data, obtains the external energy value data of the current music frequency and processes it to determine whether the lighting effect needs to follow the changes in real time.
[0079] In order to solve the above problems, an RGB light switching device 400 is provided. Fig. 9 , Fig. 9 The structure diagram of an RGB light switching device in the present invention; an RGB light switching method adopted includes:
[0080] A creation module 401 is used to create a music following thread and an independent lighting effect thread, wherein the lighting effect thread includes a linked list, the linked list includes a plurality of lighting effect structures, and the lighting effect thread is initialized;
[0081] The frequency point grabbing module 402 is used to grab the music frequency point by using the music following thread, send the grabbed music frequency point to the lighting effect thread, use the difference algorithm to obtain the energy value of the current music frequency point, and send the energy value of the current music frequency point and the overall energy value to the lighting effect thread;
[0082] The switching module 403 is used to initialize the current timer and lighting effect mode after the lighting effect thread receives the captured music frequency, create a first timer, receive a switching control signal, switch according to the switching control signal, and use the first timer to play the lighting effect according to the energy value of the current music frequency.
[0083] In order to solve the above technical problems, an embodiment of the present application further proposes an electronic device, which adopts the following technical solution: it includes a processor, a network module and a memory, and the processor and the memory are interconnected through the network module.
[0084] The electronic device may be a computer, a server, a workstation or other device, or a mobile phone, a tablet, a vehicle-mounted mobile terminal or other device with program execution capability. The internal structure diagram of the electronic device may be as follows: Fig.10 As shown, Fig.10 It is a structural diagram of an embodiment of an electronic device according to the present application. The electronic device includes a processor, a memory and a network module. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, instructions or codes. The internal memory provides an environment for the operation of the operating system and instructions or codes in the non-volatile storage medium. When the instructions or codes are executed by the processor, one of the above-mentioned functions or steps based on RGB light switching is implemented. The network module of the electronic device may include a network interface and / or a wireless network module, and the electronic device may communicate with other devices or service platforms through the network module. In addition, the electronic device may also include a display screen and an input device, etc.
[0085] Among them, the memory is used to store a computer program, the computer program includes program instructions, the processor is configured to call the program instructions, and when the processor executes the instructions or codes, the steps of the intention recognition method based on artificial intelligence as described above are implemented.
[0086] In order to solve the above problems, the embodiment of the present application also proposes a computer-readable storage medium, which adopts the following technical solution: the computer-readable storage medium stores a computer program, which includes program instructions, and the program instructions are executed by the processor to implement Figures 1 to 7 The RGB light switching method provided in each step can be specifically referred to the implementation method provided in the above steps, which will not be repeated here.
[0087] The computer-readable storage medium may be an RGB light switching device provided in any of the aforementioned embodiments or an internal storage unit of the terminal device, such as a hard disk or memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device.
[0088] Furthermore, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0089] However, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art can understand that the electronic device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0090] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The electronic device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0091] Compared with the prior art, the embodiment of the present application has the following technical effects: by using the music following thread to capture the music frequency, sending the captured music frequency to the lighting effect thread, and using the difference algorithm to obtain the energy value of the current music frequency, switching according to the switching control signal and playing the lighting effect according to the energy value of the current music frequency. It can achieve smooth switching of the color and brightness of all lights, bringing a better user experience to users, and solving the problem of reduced user experience caused by color jumping, color mixing, flickering, and water flowing in grids when realizing differentiated lighting effects.
[0092] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A RGB light switching method, characterized in that it includes: Step 100: Create a music following thread and an independent lighting effect thread, wherein the lighting effect thread includes a linked list, and the linked list includes a plurality of lighting effect structures, and initialize the lighting effect thread; Step 200: the music following thread captures the music frequency, sends the captured music frequency to the lighting effect thread, uses a difference algorithm to obtain the energy value of the current music frequency, and sends the energy value of the current music frequency and the overall energy value to the lighting effect thread; Step 300: After receiving the captured music frequency, the lighting effect thread initializes the current timer and lighting effect mode, creates a first timer, receives a switching control signal, switches according to the switching control signal, and uses the first timer to play the lighting effect according to the energy value of the current music frequency.
2. The RGB light switching method according to claim 1, characterized in that: The step 100 comprises: Step 110: Initialize the linked list and select a corresponding linked list type as needed. The linked list types include a unidirectional linked list, a bidirectional linked list, and a circular linked list. Step 120: Add lighting effect variables to the structure in the selected linked list, wherein the lighting effect variables include RGB lamp id, RGB lamp address, R value data, G value data, B value data and RGB lamp priority.
3. The RGB light switching method according to claim 1, characterized in that: The step 200 includes: Step 210: Obtain a music clip corresponding to the lighting effect, create a second timer, and use the second timer to periodically capture the low frequency point, medium-low frequency point, medium frequency point, and medium-high frequency point of the music clip respectively; Step 220: Utilize the energy values obtained at the low frequency point, the mid-low frequency point, the mid-frequency point, and the mid-high frequency point, and calculate the energy value of the current music frequency point according to the difference algorithm.
4. The RGB light switching method according to claim 3, characterized in that: The step 210 includes: Step 211: using the second timer to set a first time threshold; Step 212: at each interval of the first time threshold, sequentially obtain a first energy value of a low frequency point, a second energy value of a mid-low frequency point, a third energy value of a mid-frequency point, and a fourth energy value of a mid-high frequency point.
5. The RGB light switching method according to claim 4, characterized in that: The step 220 includes: Step 221: Obtain the overall energy value of the music clip using the first energy value, the second energy value, the third energy value, and the fourth energy value; Step 222: using the first energy value and the second energy value to obtain a first energy difference value, using the second energy value and the third energy value to obtain a second energy difference value, and using the third energy value and the fourth energy value to obtain a third energy difference value; Step 223: Determine whether the music clip is currently in an upward trend or a downward trend according to the first energy difference value, the second energy difference value, and the third energy difference value: If the third energy difference value>the second energy difference value>the first energy difference value and the third energy difference value is greater than half of the overall energy value, then the third energy difference value is determined to be the energy value of the current music frequency point.
6. The RGB light switching method according to claim 1, characterized in that: The step 300 includes: Step 310, determining whether a lighting effect timer has been turned on, and if so, turning off the current lighting effect timer; Step 320: determine whether a lighting effect mode is turned on. If so, turn off the current lighting effect mode and clear the screen.
7. The RGB light switching method according to claim 6, characterized in that: After step 320, step 300 further includes: Step 330: Use the first timer to set a second time threshold, and after the second time threshold is reached, run the switched lighting effect mode; Step 340: Obtain the energy value of the current music frequency from the music following thread, determine the corresponding lighting effect according to the energy value of the current music frequency, and play it.
8. An RGB light switching device, using an RGB light switching method according to any one of claims 1 to 7, characterized in that: include: A creation module, used to create a music following thread and create an independent lighting effect thread, wherein the lighting effect thread includes a linked list, and the linked list includes a plurality of lighting effect structures, and initializes the lighting effect thread; A frequency capture module, used to capture the music frequency using the music following thread, send the captured music frequency to the lighting effect thread, use a difference algorithm to obtain the energy value of the current music frequency, and send the energy value of the current music frequency and the overall energy value to the lighting effect thread; The switching module is used to initialize the current timer and lighting effect mode after the lighting effect thread receives the captured music frequency, create a first timer, receive a switching control signal, switch according to the switching control signal, and use the first timer to play the lighting effect according to the energy value of the current music frequency.
9. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the RGB light switching method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the RGB light switching method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Lamp effect control method of lamp strip, sound equipment, atmosphere lamp device and robot
CN122421147A
A lamp effect control method of a lamp strip, a sound, an atmosphere lamp device and a robot
CN122421147B