Lamp bank lamp effect control method based on sound effect change and related device

By setting up a ring light strip on the smart speaker device, and using PWM and DMA technology to calculate and control the color and rotation direction of the lamp beads, the problem of collaborative lighting control in the existing technology is solved, and the dynamic lighting effect under sound effect is achieved, improving the User experience.

CN119233503APending Publication Date: 2024-12-31GUANGZHOU PANYU JUDA CAR AUDIO EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411415131.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The control method of lighting modules in existing smart speaker devices is relatively simple, and it is difficult to achieve coordinated control of multi-section ring ambient lights, and regular lighting changes cannot be generated according to sound effects.

Method used

By setting up a ring light strip on the speaker device, establishing a communication connection with the DMA buffer using the PWM interface, calculating and refreshing the lighting effect mode, copying the light data to the DMA buffer using the DMA algorithm, controlling the color and rotation direction of the lamp beads, and according to the audio The energy value calculates the brightness and color of each lamp bead to achieve multiple lighting effects controls.

Benefits of technology

It realizes a variety of lighting effects controls on the ring light strip of the speaker equipment, improves the user experience, and can dynamically adjust the lighting rhythm and color according to the audio energy value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119233503A_ABST
    Figure CN119233503A_ABST
Patent Text Reader

Abstract

The invention discloses a lamp set lamp effect control method based on sound effect change and a related device, and the method comprises the steps: enabling a controller to control a PWM interface in sound box equipment to establish communication connection with a DMA buffer area when the sound box equipment is powered on; based on the current lamp effect mode, the positions of the head and tail lamps of the lamp set corresponding to each section of lamp strip in the at least one annular lamp strip and the color of the lamp beads at each position are obtained through calculation, and the positions are refreshed to a lamp data buffer area; and copying the lamp data in the lamp data buffer area to a DMA buffer area based on a DMA algorithm, and performing lamp effect enabling control on the at least one annular lamp strip through a PWM interface. In the embodiment of the invention, various lamp effect control on the annular lamp strip arranged on the sound box equipment is realized, and the use experience of a user on the sound box equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of lighting control, and in particular to a lighting effect control method of a lighting group based on sound effect changes and a related device. Background Art

[0002] In existing smart speaker devices, lighting modules are generally equipped, but the control of the lighting modules is generally set to several fixed modes, resulting in a general lighting atmosphere formed by the lighting modules; and such lighting modules are generally integrated, and the control required is relatively simple. If a ring-shaped atmosphere light module composed of multi-segment atmosphere lights is set in the smart speaker device, it is difficult to achieve coordinated control of the multi-segment atmosphere lights so that the multi-segment atmosphere lights can coordinately produce regular lighting changes according to the changes in sound effects. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the prior art. The present invention provides a lighting effect control method and related devices for a lighting group based on sound effect changes, which can realize multiple lighting effect control of a ring-shaped light strip arranged on a speaker device and improve the user experience of the speaker device.

[0004] In order to solve the above technical problems, an embodiment of the present invention provides a light group lighting effect control method based on sound effect changes, which is applied to at least one annular light strip arranged on a sound box device, wherein the annular light strip is divided into several sections, and each section is provided with a corresponding light group with the same lamp beads; the method comprises:

[0005] When the speaker device is powered on, the controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer;

[0006] Based on the current lighting effect mode, calculate and obtain the position of the head and tail lights of each light group corresponding to each light strip in at least one circular light strip and the color of the light beads at each position, and refresh them to the light data buffer;

[0007] Based on the DMA algorithm, the lamp data in the lamp data buffer is copied to the DMA buffer, and the lighting effect enabling control of the at least one annular lamp strip is performed through the PWM interface.

[0008] Optionally, the controller controls the PWM interface in the speaker device to establish a communication connection with a DMA buffer, including:

[0009] The controller performs initialization processing on the PWM interface to obtain an initialized PWM interface;

[0010] The controller performs initialization processing on the DMA buffer to obtain an initialized DMA buffer;

[0011] The controller establishes a mapping communication connection between the initialized PWM interface and the DMA interrupt in the initialized DMA buffer.

[0012] Optionally, the calculating based on the current lighting effect mode to obtain the position of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the color of the lamp beads at each position, and refreshing to the light data buffer, includes:

[0013] Determine the rotation direction of the lights of the light groups corresponding to each section of the at least one annular light strip according to the current light effect mode, wherein the rotation direction is forward rotation or reverse rotation;

[0014] According to the determined rotation direction of the lights of the light group corresponding to each section of the at least one circular light strip, the positions of the head and tail lights of the light group corresponding to each section of the at least one circular light strip are calculated using a preset rule; at the same time,

[0015] The color of the lamp bead at each position of the lamp group corresponding to each segment of the at least one annular lamp strip is calculated, the color is assigned to the corresponding lamp bead, and the color is refreshed to the lamp data buffer.

[0016] Optionally, the step of calculating the positions of the head and tail lights of the light groups corresponding to each section of the at least one annular light strip using a preset rule according to the determined light rotation direction of the light groups corresponding to each section of the at least one annular light strip includes:

[0017] When the light rotation direction of the light group corresponding to each section of the ring light strip is reversed, the speed of the position pointer data decreasing by 1 is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data is 0;

[0018] If the front position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the headlight position of the light group corresponding to each section of the light strip is reduced by 1, and the tail light position is increased by 1;

[0019] If the front position pointer data is not 0, the headlight position of the light group corresponding to each section of the light strip is reduced by 1, and the tail light position is increased by 1;

[0020] When the light rotation direction of the light group corresponding to each section of the light strip in the missing ring light strip rotates forward, the speed of adding 1 to the position pointer data is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data exceeds the light quantity of the light group;

[0021] If the front position pointer data exceeds the lamp quantity of the lamp group, the head pointer is assigned a value of 0, and the lamp head position is increased by 1, and the lamp tail position is reduced by 1;

[0022] If the front position pointer data does not exceed the lamp quantity of the lamp group, the lamp head position is increased by 1 and the lamp tail position is decreased by 1.

[0023] Optionally, the method for calculating the energy value of the audio data to be played includes:

[0024] The current energy value is set to 0, and it is determined whether the audio data to be played is interrupted in the first preset time interval;

[0025] If an interruption occurs, the energy value of the audio data to be played after DSP FFT conversion is obtained according to the three frequency bands of LOW / MIDDLE / HIGH;

[0026] Save the corresponding energy values ​​according to the three frequency bands of LOW / MIDDLE / HIGH, and calculate the average energy values ​​corresponding to the three frequencies;

[0027] The maximum average energy value corresponding to the three frequency bands is used as a reference value as the energy value of the audio data to be played;

[0028] If no interruption occurs, the energy value of the audio data to be played is 0.

[0029] Optionally, the calculation obtains the color of the lamp bead at each position of the lamp group corresponding to each segment of the at least one annular lamp strip, assigns the color to the corresponding lamp bead, and refreshes it to the lamp data buffer, including:

[0030] The corresponding energy value is obtained from the DSP at every second preset time interval, and the corresponding energy values ​​obtained by continuous sampling are obtained ten times to obtain the average value of the sampled energy;

[0031] Calculate the difference between the next sampling energy value and the sampling energy average value to obtain the energy difference;

[0032] Calculate the ratio of the energy difference to the set range value, and obtain the V value of the current lamp bead according to the ratio. The set range value is LOW / MIDDLE / HIGH.

[0033] Divide the V value of the current lamp bead by the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead;

[0034] According to the brightness value corresponding to each lamp bead, use the HSV to RGB formula to calculate the RGB value corresponding to each lamp bead;

[0035] Assign the RGB value corresponding to each lamp bead to the corresponding lamp bead and refresh it to the lamp data buffer.

[0036] Optionally, the step of copying the lamp data in the lamp data buffer to the DMA buffer based on a DMA algorithm and performing lighting effect enabling control on the at least one annular lamp strip through a PWM interface includes:

[0037] Enter the DMA buffer and disable DMA interrupt;

[0038] Copy the lamp data in the lamp data buffer to the DMA buffer;

[0039] The DMA interface controls the PWM interface to output corresponding control enable to the lamp beads of each section in at least one annular light strip according to the lamp data in the DMA buffer, and turns on DMA interrupt.

[0040] In addition, an embodiment of the present invention further provides a light group lighting effect control device based on sound effect changes, which is applied to at least one annular light strip arranged on a sound box device, wherein the annular light strip is divided into a plurality of sections, and a corresponding light group with the same lamp beads is arranged in each section; the device comprises:

[0041] Communication establishment module: used for the controller to control the PWM interface in the speaker device to establish a communication connection with the DMA buffer when the speaker device is powered on;

[0042] Refresh module: used to calculate the position of the head and tail lights of each light group corresponding to each light strip in at least one circular light strip and the color of the light beads at each position based on the current lighting effect mode, and refresh them to the light data buffer;

[0043] A control module is used to copy the lamp data in the lamp data buffer to the DMA buffer based on a DMA algorithm and to enable the lighting effect of the at least one annular lamp strip through a PWM interface.

[0044] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. In addition, an embodiment of the present invention further provides a method for controlling lighting effects of a lamp group as described in the above item when the program is executed by a processor.

[0045] In addition, an embodiment of the present invention further provides a controller, the controller comprising:

[0046] one or more processors;

[0047] Memory;

[0048] One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to: execute the lighting effect control method of the light group according to any one of the above.

[0049] In an embodiment of the present invention, when the speaker device is powered on, the PWM interface is firstly connected to the DMA buffer for communication; then, the positions of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the colors of the lamp beads at each position are calculated and refreshed to the light data buffer; finally, the light data in the light data buffer is copied to the DMA buffer through the DMA algorithm, and the lighting effect enabling control of at least one annular light strip is performed through the PWM interface; in this way, the control of the annular light strip of the speaker device is realized, and the lamp head position and the lamp tail position of the corresponding light group can be calculated according to different lighting effect modes and the energy value of the audio, and the color corresponding to each lamp bead is calculated, and the enabling control of the lamp beads is realized through the DMA algorithm, thereby realizing multiple lighting effect controls, and the color of each lamp bead and the lighting rhythm of the annular light strip can be controlled according to the energy value carried by the audio, thereby improving the user experience of the speaker device. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 is a flow chart of a method for controlling lighting effects of a lighting group based on sound effect changes in an embodiment of the present invention;

[0052] Figure 2 is a schematic diagram of the structure of a lighting effect control device for a lighting group based on sound effect changes in an embodiment of the present invention;

[0053] Figure 3 It is a schematic diagram of the structural composition of the controller in an embodiment of the present invention. DETAILED DESCRIPTION

[0054] 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.

[0055] For example, see Figure 1, a method for controlling light effects of light groups based on sound effect changes, applied to at least one annular light strip arranged on a sound box device, the annular light strip is divided into several sections, and a corresponding light group with the same lamp beads is arranged in each section; in the technical scheme of the present application, one or more annular light strips can be arranged on the sound box device, and it can be understood that the annular light strip can be circular, oval or square, which is not limited in the present application, and each annular light strip is divided into several sections, which can be divided evenly or randomly. In the present technical scheme, it is generally divided into three sections evenly, and each section is provided with a light group with the same or different number of lamp beads. In the present application, the number of lamp beads of the light group arranged in each section is the same; the method comprises:

[0056] S11: When the device is powered on, the controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer;

[0057] The controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer, including: the controller initializes the PWM interface to obtain an initialized PWM interface; the controller initializes the DMA buffer to obtain an initialized DMA buffer; the controller maps the initialized PWM interface to the DMA interrupt in the initialized DMA buffer to establish a communication connection.

[0058] Specifically, after the speaker device is powered on, it is generally necessary to initialize the hardware system of the speaker device, which can effectively ensure the transmission of subsequent control signals; that is, first the controller initializes the PWM (pulse width modulation) interface in the speaker device to form an initialized PWM interface; then the controller initializes the DMA (direct memory access) buffer to form an initialized DMA buffer; then the controller establishes a mapping communication connection between the initialized PWM interface and the DMA interrupt in the initialized DMA buffer.

[0059] At the same time, the controller will perform an initialization operation on the light array buffer to form an initialized light array buffer.

[0060] S12: The lighting effect mode calculates and obtains the position of the head and tail lights of each light strip corresponding to the light group in at least one circular light strip and the color of the light beads at each position, and refreshes them to the light data buffer;

[0061] In the specific implementation process of the present invention, the position of the head and tail lights of the light group corresponding to each section of the at least one annular light strip and the color of the lamp beads at each position are calculated based on the current lighting effect mode, and refreshed to the light data buffer, including: determining the light rotation direction of the light group corresponding to each section of the at least one annular light strip according to the current lighting effect mode, and the rotation direction is forward rotation or reverse rotation; according to the determined light rotation direction of the light group corresponding to each section of the at least one annular light strip, the position of the head and tail lights of the light group corresponding to each section of the at least one annular light strip is calculated using preset rules; at the same time, the color of the lamp beads at each position of the light group corresponding to each section of the at least one annular light strip is calculated, the color is assigned to the corresponding lamp beads, and refreshed to the light data buffer.

[0062] Furthermore, the method calculates the positions of the head and tail lights of the light groups corresponding to each section of the light strip in at least one annular light strip using preset rules according to the determined light rotation direction of the light groups corresponding to each section of the light strip in at least one annular light strip, including: when the light rotation direction of the light groups corresponding to each section of the light strip in at least one annular light strip rotates in the opposite direction, determines the speed of reducing the position pointer data by 1 according to the energy value of the audio data to be played, and determines whether the current position pointer data is 0; if the previous position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the position of the head lights of the light groups corresponding to each section of the light strip is reduced by 1. , the tail position of the lamp is increased by 1; if the front position pointer data is not 0, the head light position of the lamp group corresponding to each section of the light strip is reduced by 1, and the tail position of the lamp is increased by 1; when the light rotation direction of the lamp group corresponding to each section of the light strip in the least one annular light strip is forward, the speed of the position pointer data increasing by 1 is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data exceeds the light quantity of the lamp group; if the front position pointer data exceeds the light quantity of the lamp group, the head pointer is assigned a value of 0, and the head position of the lamp is increased by 1, and the tail position of the lamp is reduced by 1; if the front position pointer data does not exceed the light quantity of the lamp group, the head position of the lamp is increased by 1, and the tail position of the lamp is reduced by 1.

[0063] Furthermore, the method for calculating the energy value of the audio data to be played includes: setting the current energy value to 0, and determining whether the audio data to be played is interrupted in a first preset time interval; if an interruption occurs, obtaining the energy values ​​of the audio data to be played after DSP FFT conversion according to the three frequency bands of LOW / MIDDLE / HIGH; saving the corresponding energy values ​​according to the three frequency bands of LOW / MIDDLE / HIGH, and calculating the average energy values ​​corresponding to the three frequencies; using the maximum average energy values ​​corresponding to the three frequency bands as the reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0064] Furthermore, the calculation obtains the color of the lamp bead at each position of the lamp group corresponding to each section of the light strip in at least one annular light strip, assigns the color to the corresponding lamp bead, and refreshes it to the light data buffer, including: obtaining the corresponding energy value from the DSP at each second preset time interval, and continuously sampling the corresponding energy values ​​obtained ten times to obtain the sampled energy average value; calculating the difference between the next sampled energy value and the sampled energy average value to obtain the energy difference; calculating the ratio of the energy difference to the set range value, and obtaining the V value of the current lamp bead according to the ratio, and the set range value is LOW / MIDDLE / HIGH three levels; using the current V value of the lamp bead to divide the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead; according to the brightness value corresponding to each lamp bead, the HSV to RGB formula is used to calculate the RGB value corresponding to each lamp bead; assigning the RGB value corresponding to each lamp bead to the corresponding lamp bead, and refreshing it to the light data buffer.

[0065] Specifically, after completing the initialization and establishing the communication connection, the main loop enters the Music_LCD() function. At this time, it is necessary to first read the corresponding data according to the current lighting effect mode, and then calculate the lamp head and tail positions of the corresponding lamp group of each segment of the light strip in at least one ring light strip, and then calculate the color of the lamp beads at each position, and refresh the obtained data to the light data buffer.

[0066] First, after determining the current equivalent mode, the light rotation direction of the light group corresponding to each section of the at least one annular light strip can be determined according to the current equivalent mode, where the rotation direction is forward rotation or reverse rotation; then, according to the determined light rotation direction of the light group corresponding to each section of the at least one annular light strip, the preset rules are used to calculate the positions of the head and tail lights of the light group corresponding to each section of the at least one annular light strip; at the same time, the colors of the lamp beads at each position of the light group corresponding to each section of the at least one annular light strip are calculated, and these colors are assigned to the corresponding lamp beads, and finally refreshed to the light data buffer.

[0067] That is, first determine whether it is forward rotation or reverse rotation; if it is forward rotation, first enter the forward rotation function, and preset the counter value according to the current energy value level. The larger the energy value, the smaller the pre-designed value; when the counter exceeds the pre-designed value, first determine whether the current head pointer has reached the maximum light value. If it has reached it, the head pointer is 0, otherwise it is increased by 1; if the light ring displays multiple light lines, the head position of each light line must be increased by 1, and the tail position must be reduced by 1 (if it rotates in the opposite direction, the head position is reduced by 1, and the tail position is increased by 1); if the light ring rotates a certain number of times, the direction rotates in the opposite direction.

[0068] In the technical solution of this embodiment, when the direction of rotation of the lights of the light group corresponding to each section of the light strip in one of the less annular light strips rotates in the opposite direction, the speed of the position pointer data decreasing by 1 (i.e., the total value of the count is modified) is first determined according to the energy value of the audio data to be played, and then it is determined whether the current position pointer data is 0; if the previous position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the head light position of the light group corresponding to each section of the light strip is decreased by 1, and the tail light position is increased by 1; if the previous position pointer data is not 0, the corresponding position of each section of the light strip is The headlight position of the lamp group is reduced by 1, and the tail light position is increased by 1; when the light rotation direction of each section of the lamp strip corresponding to the lamp group in the least one annular light strip rotates in the positive direction, the speed of position pointer data addition by 1 is determined according to the energy value of the audio data to be played (that is, the total count value is modified), and it is judged whether the current position pointer data exceeds the light quantity of the lamp group; if the front position pointer data exceeds the light quantity of the lamp group, the head pointer is assigned a value of 0, and the head light position is increased by 1, and the tail light position is reduced by 1; if the front position pointer data does not exceed the light quantity of the lamp group, the head light position is increased by 1, and the tail light position is reduced by 1.

[0069] The energy value of the audio data to be played is calculated as follows: before each interruption, clear the value of the previous sample to 0; interrupt once every 20MS; when an interruption occurs, obtain the energy value after DSP FFT conversion according to the three frequency bands of LOW / MIDDLE / HIGH respectively; save the energy value according to the three frequency bands of LOW / MIDDLE / HIGH respectively; calculate the average value of the three frequency bands respectively; use the maximum value of the three frequency bands as the sampling reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0070] That is, the current energy value is set to 0, and it is determined whether the audio data to be played is interrupted in the first preset time interval; if an interruption occurs, the energy values ​​of the audio data to be played after DSPFFT conversion are obtained according to the three frequency bands of LOW / MIDDLE / HIGH; the corresponding energy values ​​are saved according to the three frequency bands of LOW / MIDDLE / HIGH, and the average energy values ​​corresponding to the three frequencies are calculated; the maximum average energy value corresponding to the three frequency bands is used as the reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0071] When calculating the color corresponding to each lamp bead, it is necessary to obtain the corresponding energy value from the DSP every 20MS; sample ten times continuously and calculate the average value. When sampling next time, calculate the difference between the sampled value and the average value; compare the difference with the set range value to get the V value of the current lamp, divide the V value by the number of lamps that need to be lit, and get the brightness of each subsequent lamp. The set range value is LOW / MIDDLE / HIGH. Then use the HSV to RGB formula to get the RGB value of each lamp, and then refresh the corresponding data of each lamp; that is, divide the V value of the current lamp bead by the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead; use the HSV to RGB formula to calculate the RGB value corresponding to each lamp bead according to the brightness value corresponding to each lamp bead; finally, assign the RGB value corresponding to each lamp bead to the corresponding lamp bead and refresh it to the lamp data buffer.

[0072] The calculation process using the HSV to RGB formula is as follows:

[0073] C = V * S;

[0074]

[0075] m=VC;

[0076]

[0077]

[0078] Among them, in the HSV conversion RGB formula, H represents chroma; S represents color saturation; V represents light intensity or brightness.

[0079] S13: Algorithm A copies the lamp data in the lamp data buffer to the DMA buffer and performs lighting effect enabling control on the at least one annular lamp strip through the PWM interface.

[0080] In the specific implementation process of the present invention, the DMA algorithm is based on copying the lamp data in the lamp data buffer to the DMA buffer and controlling the lighting effect of the at least one annular light strip through the PWM interface, including: entering the DMA buffer and turning off the DMA interrupt; copying the lamp data in the lamp data buffer to the DMA buffer; the DMA interface controls the PWM interface according to the lamp data in the DMA buffer to output corresponding control enable to the lamp beads of each section in the at least one annular light strip, and turning on the DMA interrupt.

[0081] Specifically, when controlling the ring light strip, after refreshing the light data, first enter the DMA_Channel (DMA buffer) and turn off the DMA interrupt. The light data in the light data buffer is copied to (or written to) DMABUFFER. After writing is completed, the DMA interface is connected to the PWM output enable, and then the DMA interrupt is turned on. The light array drives the light group through the WPM bus output; after the above tasks are completed, wait for the next array refresh.

[0082] In an embodiment of the present invention, when the speaker device is powered on, the PWM interface is firstly connected to the DMA buffer for communication; then, the positions of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the colors of the lamp beads at each position are calculated and refreshed to the light data buffer; finally, the light data in the light data buffer is copied to the DMA buffer through the DMA algorithm, and the lighting effect enabling control of at least one annular light strip is performed through the PWM interface; in this way, the control of the annular light strip of the speaker device is realized, and the lamp head position and the lamp tail position of the corresponding light group can be calculated according to different lighting effect modes and the energy value of the audio, and the color corresponding to each lamp bead is calculated, and the enabling control of the lamp beads is realized through the DMA algorithm, thereby realizing multiple lighting effect controls, and the color of each lamp bead and the lighting rhythm of the annular light strip can be controlled according to the energy value carried by the audio, thereby improving the user experience of the speaker device.

[0083] For example 2, please refer to Figure 2 , Figure 2 It is a schematic diagram of the structural composition of a lighting effect control device for a lighting group based on sound effect changes in an embodiment of the present invention.

[0084] like Figure 2 As shown, a light group lighting effect control device based on sound effect changes is applied to at least one annular light strip arranged on a sound box device, wherein the annular light strip is divided into several sections, and each section is provided with a corresponding light group with the same lamp beads; the device comprises:

[0085] Communication establishment module 21: used for the controller to control the PWM interface in the speaker device to establish a communication connection with the DMA buffer when the speaker device is powered on;

[0086] The controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer, including: the controller initializes the PWM interface to obtain an initialized PWM interface; the controller initializes the DMA buffer to obtain an initialized DMA buffer; the controller maps the initialized PWM interface to the DMA interrupt in the initialized DMA buffer to establish a communication connection.

[0087] Specifically, after the speaker device is powered on, it is generally necessary to initialize the hardware system of the speaker device, which can effectively ensure the transmission of subsequent control signals; that is, first the controller initializes the PWM (pulse width modulation) interface in the speaker device to form an initialized PWM interface; then the controller initializes the DMA (direct memory access) buffer to form an initialized DMA buffer; then the controller establishes a mapping communication connection between the initialized PWM interface and the DMA interrupt in the initialized DMA buffer.

[0088] At the same time, the controller will perform an initialization operation on the light array buffer to form an initialized light array buffer.

[0089] Refresh module 22: used to calculate and obtain the position of the head and tail lights of the light group corresponding to each section of the light strip in at least one circular light strip and the color of the light beads at each position based on the current lighting effect mode, and refresh them to the light data buffer;

[0090] In the specific implementation process of the present invention, the position of the head and tail lights of the light group corresponding to each section of the at least one annular light strip and the color of the lamp beads at each position are calculated based on the current lighting effect mode, and refreshed to the light data buffer, including: determining the light rotation direction of the light group corresponding to each section of the at least one annular light strip according to the current lighting effect mode, and the rotation direction is forward rotation or reverse rotation; according to the determined light rotation direction of the light group corresponding to each section of the at least one annular light strip, the position of the head and tail lights of the light group corresponding to each section of the at least one annular light strip is calculated using preset rules; at the same time, the color of the lamp beads at each position of the light group corresponding to each section of the at least one annular light strip is calculated, the color is assigned to the corresponding lamp beads, and refreshed to the light data buffer.

[0091] Furthermore, the method calculates the positions of the head and tail lights of the light groups corresponding to each section of the light strip in at least one annular light strip using preset rules according to the determined light rotation direction of the light groups corresponding to each section of the light strip in at least one annular light strip, including: when the light rotation direction of the light groups corresponding to each section of the light strip in at least one annular light strip rotates in the opposite direction, determines the speed of reducing the position pointer data by 1 according to the energy value of the audio data to be played, and determines whether the current position pointer data is 0; if the previous position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the position of the head lights of the light groups corresponding to each section of the light strip is reduced by 1. , the tail position of the lamp is increased by 1; if the front position pointer data is not 0, the head light position of the lamp group corresponding to each section of the light strip is reduced by 1, and the tail position of the lamp is increased by 1; when the light rotation direction of the lamp group corresponding to each section of the light strip in the least one annular light strip is forward, the speed of the position pointer data increasing by 1 is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data exceeds the light quantity of the lamp group; if the front position pointer data exceeds the light quantity of the lamp group, the head pointer is assigned a value of 0, and the head position of the lamp is increased by 1, and the tail position of the lamp is reduced by 1; if the front position pointer data does not exceed the light quantity of the lamp group, the head position of the lamp is increased by 1, and the tail position of the lamp is reduced by 1.

[0092] Furthermore, the method for calculating the energy value of the audio data to be played includes: setting the current energy value to 0, and determining whether the audio data to be played is interrupted in a first preset time interval; if an interruption occurs, obtaining the energy values ​​of the audio data to be played after DSP FFT conversion according to the three frequency bands of LOW / MIDDLE / HIGH; saving the corresponding energy values ​​according to the three frequency bands of LOW / MIDDLE / HIGH, and calculating the average energy values ​​corresponding to the three frequencies; using the maximum average energy values ​​corresponding to the three frequency bands as the reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0093] Furthermore, the calculation obtains the color of the lamp bead at each position of the lamp group corresponding to each section of the light strip in at least one annular light strip, assigns the color to the corresponding lamp bead, and refreshes it to the light data buffer, including: obtaining the corresponding energy value from the DSP at each second preset time interval, and continuously sampling the corresponding energy values ​​obtained ten times to obtain the sampled energy average value; calculating the difference between the next sampled energy value and the sampled energy average value to obtain the energy difference; calculating the ratio of the energy difference to the set range value, and obtaining the V value of the current lamp bead according to the ratio, and the set range value is LOW / MIDDLE / HIGH three levels; using the current V value of the lamp bead to divide the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead; according to the brightness value corresponding to each lamp bead, the HSV to RGB formula is used to calculate the RGB value corresponding to each lamp bead; assigning the RGB value corresponding to each lamp bead to the corresponding lamp bead, and refreshing it to the light data buffer.

[0094] Specifically, after completing the initialization and establishing the communication connection, the main loop enters the Music_LCD() function. At this time, it is necessary to first read the corresponding data according to the current lighting effect mode, and then calculate the lamp head and tail positions of the corresponding lamp group of each segment of the light strip in at least one ring light strip, and then calculate the color of the lamp beads at each position, and refresh the obtained data to the light data buffer.

[0095] First, after determining the current equivalent mode, the light rotation direction of the light group corresponding to each section of the at least one annular light strip can be determined according to the current equivalent mode, where the rotation direction is forward rotation or reverse rotation; then, according to the determined light rotation direction of the light group corresponding to each section of the at least one annular light strip, the preset rules are used to calculate the positions of the head and tail lights of the light group corresponding to each section of the at least one annular light strip; at the same time, the colors of the lamp beads at each position of the light group corresponding to each section of the at least one annular light strip are calculated, and these colors are assigned to the corresponding lamp beads, and finally refreshed to the light data buffer.

[0096] That is, first determine whether it is forward rotation or reverse rotation; if it is forward rotation, first enter the forward rotation function, and preset the counter value according to the current energy value level. The larger the energy value, the smaller the pre-designed value; when the counter exceeds the pre-designed value, first determine whether the current head pointer has reached the maximum light value. If it has reached it, the head pointer is 0, otherwise it is increased by 1; if the light ring displays multiple light lines, the head position of each light line must be increased by 1, and the tail position must be reduced by 1 (if it rotates in the opposite direction, the head position is reduced by 1, and the tail position is increased by 1); if the light ring rotates a certain number of times, the direction rotates in the opposite direction.

[0097] In the technical solution of this embodiment, when the direction of rotation of the lights of the light group corresponding to each section of the light strip in one of the less annular light strips rotates in the opposite direction, the speed of the position pointer data decreasing by 1 (i.e., the total value of the count is modified) is first determined according to the energy value of the audio data to be played, and then it is determined whether the current position pointer data is 0; if the previous position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the head light position of the light group corresponding to each section of the light strip is decreased by 1, and the tail light position is increased by 1; if the previous position pointer data is not 0, the corresponding position of each section of the light strip is The headlight position of the lamp group is reduced by 1, and the tail light position is increased by 1; when the light rotation direction of each section of the lamp strip corresponding to the lamp group in the least one annular light strip rotates in the positive direction, the speed of position pointer data addition by 1 is determined according to the energy value of the audio data to be played (that is, the total count value is modified), and it is judged whether the current position pointer data exceeds the light quantity of the lamp group; if the front position pointer data exceeds the light quantity of the lamp group, the head pointer is assigned a value of 0, and the head light position is increased by 1, and the tail light position is reduced by 1; if the front position pointer data does not exceed the light quantity of the lamp group, the head light position is increased by 1, and the tail light position is reduced by 1.

[0098] The energy value of the audio data to be played is calculated as follows: before each interruption, clear the value of the previous sample to 0; interrupt once every 20MS; when an interruption occurs, obtain the energy value after DSP FFT conversion according to the three frequency bands of LOW / MIDDLE / HIGH respectively; save the energy value according to the three frequency bands of LOW / MIDDLE / HIGH respectively; calculate the average value of the three frequency bands respectively; use the maximum value of the three frequency bands as the sampling reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0099] That is, the current energy value is set to 0, and it is determined whether the audio data to be played is interrupted in the first preset time interval; if an interruption occurs, the energy values ​​of the audio data to be played after DSPFFT conversion are obtained according to the three frequency bands of LOW / MIDDLE / HIGH; the corresponding energy values ​​are saved according to the three frequency bands of LOW / MIDDLE / HIGH, and the average energy values ​​corresponding to the three frequencies are calculated; the maximum average energy value corresponding to the three frequency bands is used as the reference value as the energy value of the audio data to be played; if no interruption occurs, the energy value of the audio data to be played is 0.

[0100] When calculating the color corresponding to each lamp bead, it is necessary to obtain the corresponding energy value from the DSP every 20MS; sample ten times continuously and calculate the average value. When sampling next time, calculate the difference between the sampled value and the average value; compare the difference with the set range value to get the V value of the current lamp, divide the V value by the number of lamps that need to be lit, and get the brightness of each subsequent lamp. The set range value is LOW / MIDDLE / HIGH. Then use the HSV to RGB formula to get the RGB value of each lamp, and then refresh the corresponding data of each lamp; that is, divide the V value of the current lamp bead by the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead; use the HSV to RGB formula to calculate the RGB value corresponding to each lamp bead according to the brightness value corresponding to each lamp bead; finally, assign the RGB value corresponding to each lamp bead to the corresponding lamp bead and refresh it to the lamp data buffer.

[0101] The calculation process using the HSV to RGB formula is as follows:

[0102] C = V * S;

[0103]

[0104] m=VC;

[0105]

[0106]

[0107] Among them, in the HSV conversion RGB formula, H represents chroma; S represents color saturation; V represents light intensity or brightness.

[0108] The control module 23 is used for copying the lamp data in the lamp data buffer to the DMA buffer based on the DMA algorithm and performing lighting effect enabling control on the at least one annular lamp strip through the PWM interface.

[0109] In the specific implementation process of the present invention, the DMA algorithm is based on copying the lamp data in the lamp data buffer to the DMA buffer and controlling the lighting effect of the at least one annular light strip through the PWM interface, including: entering the DMA buffer and turning off the DMA interrupt; copying the lamp data in the lamp data buffer to the DMA buffer; the DMA interface controls the PWM interface according to the lamp data in the DMA buffer to output corresponding control enable to the lamp beads of each section in the at least one annular light strip, and turning on the DMA interrupt.

[0110] Specifically, when controlling the ring light strip, after refreshing the light data, first enter the DMA_Channel (DMA buffer) and turn off the DMA interrupt. The light data in the light data buffer is copied to (or written to) the DMA BUFFER. After the writing is completed, the DMA interface is connected to the PWM output enable, and then the DMA interrupt is turned on. The light array drives the light group through the WPM bus output; after the above tasks are completed, wait for the next array refresh.

[0111] In an embodiment of the present invention, when the speaker device is powered on, the PWM interface is firstly connected to the DMA buffer for communication; then, the positions of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the colors of the lamp beads at each position are calculated and refreshed to the light data buffer; finally, the light data in the light data buffer is copied to the DMA buffer through the DMA algorithm, and the lighting effect enabling control of at least one annular light strip is performed through the PWM interface; in this way, the control of the annular light strip of the speaker device is realized, and the lamp head position and the lamp tail position of the corresponding light group can be calculated according to different lighting effect modes and the energy value of the audio, and the color corresponding to each lamp bead is calculated, and the enabling control of the lamp beads is realized through the DMA algorithm, thereby realizing multiple lighting effect controls, and the color of each lamp bead and the lighting rhythm of the annular light strip can be controlled according to the energy value carried by the audio, thereby improving the user experience of the speaker device.

[0112] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method for controlling the lighting effect of a lamp group of any one of the above embodiments is implemented. The computer-readable storage medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the storage device includes any medium that can store or transmit information in a readable form by a device (for example, a computer, a mobile phone), which can be a read-only memory, a disk or an optical disk, etc.

[0113] An embodiment of the present invention further provides a computer application program, which runs on a computer and is used to execute the lighting effect control method of a lamp group according to any one of the above embodiments.

[0114] also, Figure 3 It is a schematic diagram of the structural composition of the controller in an embodiment of the present invention.

[0115] The embodiment of the present invention further provides a controller, such as Figure 3 The controller includes a processor 302, a memory 303, an input unit 304, a display unit 305 and other devices. Those skilled in the art will understand that Figure 3 The controller structure device shown does not constitute a limitation on all devices, and may include more or fewer components than shown, or combine certain components. The memory 303 can be used to store the application 301 and each functional module, and the processor 302 runs the application 301 stored in the memory 303, thereby executing various functional applications and data processing of the device. The memory can be an internal memory or an external memory, or include both internal and external memories. The internal memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, or a random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a U disk, a magnetic tape, etc. The memory disclosed in the present invention includes but is not limited to these types of memories. The memory disclosed in the present invention is only used as an example and not as a limitation.

[0116] The input unit 304 is used to receive the input of the signal and the keyword input by the user. The input unit 304 may include a touch panel and other input devices. The touch panel can collect the touch operation of the user on or near it, and drive the corresponding connection device according to a pre-set program; other input devices may include but are not limited to one or more of a physical keyboard, a function key (such as a play control key, a switch key, etc.), a trackball, a mouse, a joystick, etc. The display unit 305 can be used to display the information input by the user or the information provided to the user and various menus of the terminal device. The display unit 305 can be in the form of a liquid crystal display, an organic light emitting diode, etc. The processor 302 is the control center of the terminal device, which uses various interfaces and lines to connect various parts of the entire device, and executes various functions and processes data by running or executing software programs and / or modules stored in the memory 303, and calling data stored in the memory.

[0117] As an embodiment, the controller includes: one or more processors 302, a memory 303, and one or more applications 301, wherein the one or more applications 301 are stored in the memory 303 and are configured to be executed by the one or more processors 302, and the one or more applications 301 are configured to execute the light group lighting effect control method in any one of the above embodiments.

[0118] In an embodiment of the present invention, when the speaker device is powered on, the PWM interface is firstly connected to the DMA buffer for communication; then, the positions of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the colors of the lamp beads at each position are calculated and refreshed to the light data buffer; finally, the light data in the light data buffer is copied to the DMA buffer through the DMA algorithm, and the lighting effect enabling control of at least one annular light strip is performed through the PWM interface; in this way, the control of the annular light strip of the speaker device is realized, and the lamp head position and the lamp tail position of the corresponding light group can be calculated according to different lighting effect modes and the energy value of the audio, and the color corresponding to each lamp bead is calculated, and the enabling control of the lamp beads is realized through the DMA algorithm, thereby realizing multiple lighting effect controls, and the color of each lamp bead and the lighting rhythm of the annular light strip can be controlled according to the energy value carried by the audio, thereby improving the user experience of the speaker device.

[0119] In addition, the above is a detailed introduction to a lamp group lighting effect control method based on sound effect changes and related devices provided by an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for controlling lighting effects of a lighting group based on sound effect changes, characterized in that: Applied to at least one annular light strip arranged on a sound box device, the annular light strip is divided into a plurality of sections, each section is provided with a corresponding light group of the same light beads; the method comprises: When the speaker device is powered on, the controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer; Based on the current lighting effect mode, calculate and obtain the position of the head and tail lights of each light group corresponding to each light strip in at least one circular light strip and the color of the light beads at each position, and refresh them to the light data buffer; Based on the DMA algorithm, the lamp data in the lamp data buffer is copied to the DMA buffer, and the lighting effect enabling control of the at least one annular lamp strip is performed through the PWM interface.

2. The lighting effect control method of a lamp group according to claim 1, characterized in that: The controller controls the PWM interface in the speaker device to establish a communication connection with the DMA buffer, including: The controller performs initialization processing on the PWM interface to obtain an initialized PWM interface; The controller performs initialization processing on the DMA buffer to obtain an initialized DMA buffer; The controller establishes a mapping communication connection between the initialized PWM interface and the DMA interrupt in the initialized DMA buffer.

3. The lighting effect control method of a lamp group according to claim 1, characterized in that: The method of calculating the positions of the head and tail lights of the light group corresponding to each section of the light strip in at least one annular light strip and the colors of the light beads at each position based on the current light effect mode, and refreshing them to the light data buffer, includes: Determine the rotation direction of the lights of the light groups corresponding to each section of the at least one annular light strip according to the current light effect mode, wherein the rotation direction is forward rotation or reverse rotation; According to the determined rotation direction of the lights of the light group corresponding to each section of the at least one circular light strip, the positions of the head and tail lights of the light group corresponding to each section of the at least one circular light strip are calculated using a preset rule; at the same time, The color of the lamp bead at each position of the lamp group corresponding to each segment of the at least one annular lamp strip is calculated, the color is assigned to the corresponding lamp bead, and the color is refreshed to the lamp data buffer.

4. The method for controlling the lighting effect of a lamp group according to claim 3, characterized in that: The method of calculating the positions of the head and tail lights of the light groups corresponding to each section of the at least one annular light strip using a preset rule according to the determined light rotation direction of the light groups corresponding to each section of the at least one annular light strip comprises: When the light rotation direction of the light group corresponding to each section of the ring light strip is reversed, the speed of the position pointer data decreasing by 1 is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data is 0; If the front position pointer data is 0, the head pointer in the position pointer data is assigned the maximum number of lights, and the headlight position of the light group corresponding to each section of the light strip is reduced by 1, and the tail light position is increased by 1; If the front position pointer data is not 0, the headlight position of the light group corresponding to each section of the light strip is reduced by 1, and the tail light position is increased by 1; When the light rotation direction of the light group corresponding to each section of the light strip in the missing ring light strip rotates forward, the speed of adding 1 to the position pointer data is determined according to the energy value of the audio data to be played, and it is determined whether the current position pointer data exceeds the light quantity of the light group; If the front position pointer data exceeds the lamp quantity of the lamp group, the head pointer is assigned a value of 0, and the lamp head position is increased by 1, and the lamp tail position is reduced by 1; If the front position pointer data does not exceed the lamp quantity of the lamp group, the lamp head position is increased by 1 and the lamp tail position is decreased by 1.

5. The lighting effect control method of a lamp group according to claim 4, characterized in that: The method for calculating the energy value of the audio data to be played includes: The current energy value is set to 0, and it is determined whether the audio data to be played is interrupted in the first preset time interval; If an interruption occurs, the energy value of the audio data to be played after DSPFFT conversion is obtained according to the three frequency bands of LOW / MIDDLE / HIGH; Save the corresponding energy values ​​according to the three frequency bands of LOW / MIDDLE / HIGH, and calculate the average energy values ​​corresponding to the three frequencies; The maximum average energy value corresponding to the three frequency bands is used as a reference value as the energy value of the audio data to be played; If no interruption occurs, the energy value of the audio data to be played is 0.

6. The lighting effect control method of a lamp group according to claim 3, characterized in that: The calculation obtains the color of the lamp bead at each position of the lamp group corresponding to each segment of the at least one annular lamp strip, assigns the color to the corresponding lamp bead, and refreshes it to the lamp data buffer, including: The corresponding energy value is obtained from the DSP at every second preset time interval, and the corresponding energy values ​​obtained by continuous sampling are obtained ten times to obtain the average value of the sampled energy; Calculate the difference between the next sampling energy value and the sampling energy average value to obtain the energy difference; Calculate the ratio of the energy difference to the set range value, and obtain the V value of the current lamp bead according to the ratio. The set range value is LOW / MIDDLE / HIGH. Divide the V value of the current lamp bead by the number of lamp beads that need to be lit to obtain the brightness value corresponding to each lamp bead; According to the brightness value corresponding to each lamp bead, use the HSV to RGB formula to calculate the RGB value corresponding to each lamp bead; Assign the RGB value corresponding to each lamp bead to the corresponding lamp bead and refresh it to the lamp data buffer.

7. The lighting effect control method of a lamp group according to claim 1, characterized in that: The method of copying the lamp data in the lamp data buffer to the DMA buffer based on the DMA algorithm and performing lighting effect enabling control on the at least one annular lamp strip through the PWM interface includes: Enter the DMA buffer and disable DMA interrupt; Copy the lamp data in the lamp data buffer to the DMA buffer; The DMA interface controls the PWM interface to output corresponding control enable to the lamp beads of each section in at least one annular light strip according to the lamp data in the DMA buffer, and turns on DMA interrupt.

8. A lighting effect control device for a lighting group based on sound effect changes, characterized in that: Applicable to at least one annular light strip arranged on a sound box device, the annular light strip is divided into several sections, each section is provided with a corresponding light group of the same light beads; the device comprises: Communication establishment module: used for the controller to control the PWM interface in the speaker device to establish a communication connection with the DMA buffer when the speaker device is powered on; Refresh module: used to calculate the position of the head and tail lights of each light group corresponding to each light strip in at least one circular light strip and the color of the light beads at each position based on the current lighting effect mode, and refresh them to the light data buffer; A control module is used to copy the lamp data in the lamp data buffer to the DMA buffer based on a DMA algorithm and to enable the lighting effect of the at least one annular lamp strip through a PWM interface.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the lighting effect control method of a lamp group as described in any one of claims 1 to 7 is implemented.

10. A controller, characterized in that: The controller comprises: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to: execute the lighting effect control method of the light group according to any one of claims 1 to 7.