Atmosphere lamp adjusting method and related equipment
By sampling and Fourier transforming the music audio, the target brightness and color value are calculated, and the brightness and color of the ambient lamp are adjusted, the problem that the existing technology cannot fully utilize the high sampling rate audio information, and a more accurate and widely applicable ambient lamp adjustment effect is achieved.
Patent Information
- Application Number
- CN202510002272.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-05-30
AI Technical Summary
The existing automotive ambient light music rhythm algorithm cannot make full use of high sampling rate audio information, resulting in the inability to accurately match the real music rhythm effects, making it difficult for users to have an immersive experience.
By sampling and Fourier transforming the music audio, the target audio data is obtained, and the target brightness value and target color value are calculated based on the data and the preset brightness and color intervals, and the brightness and color of the atmosphere light are adjusted.
It realizes the simplicity and effectiveness of the calculation method, reduces the complexity, makes the adjustment of the ambient lights widely applicable and versatile, and can be quickly transplanted and promoted to other models or digital audio equipment.
Smart Images

Figure CN120076121A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of automotive ambient light adjustment and control, and particularly to a method for adjusting ambient light and related devices. Background Art
[0002] In the current category of passenger vehicles, the music rhythm function of automotive ambient lights has become a cutting-edge hot topic. With the development of technology, applications that display specific effects through the music rhythm of automotive ambient lights have received much attention.
[0003] With the continuous increase in the audio signal sampling rate in current in-vehicle audio devices, it means that more accurate and rich audio information can be obtained. However, the existing music beat algorithms are relatively simple and single, resulting in the inability to fully utilize the advantages brought by the high sampling rate, making it difficult to fit the real music rhythm effect and making it difficult for users to have an immersive experience and sense of integration.
[0004] When adapting model algorithms in the prior art, they are usually trained and optimized for specific music types, and the features and patterns learned are only applicable to that specific music type. And there are significant differences in rhythm, melody, timbre, etc. among different music types. When applying this model algorithm to other music types, since this model algorithm has not been fully learned and optimized for the characteristics of other music types, its adaptation effect will be greatly weakened. It can be seen that these model algorithms may not be suitable for all music types.
[0005] Therefore, it is necessary to propose a method for adjusting ambient lights to solve the problem of limited adaptation scenarios. Summary of the Invention
[0006] A series of simplified concepts are introduced in the Summary of the Invention section, which will be further described in detail in the Detailed Description section. The Summary of the Invention section of this application does not mean to attempt to define the key features and essential technical features of the claimed technical solution, nor does it mean to attempt to determine the protection scope of the claimed technical solution.
[0007] This application specifically includes the following aspects:
[0008] In a first aspect, this application proposes a method for adjusting ambient lights, including:
[0009] Sampling the music audio to obtain initial audio data;
[0010] Performing a Fourier transform on the initial audio data to obtain target audio data;
[0011] Obtaining a target brightness value according to the target audio data and a preset brightness range;
[0012] Obtain a target color value according to the target audio data and a preset color range;
[0013] Based on the target brightness value and the target color value, correspondingly adjust the brightness and color of the atmosphere light.
[0014] In a feasible implementation manner, the performing a Fourier transform on the initial audio data to obtain target audio data includes:
[0015] Perform a fast Fourier transform on the initial audio data to obtain an array containing multiple elements;
[0016] Filter out the target audio data from the array containing multiple elements based on symmetry.
[0017] In a feasible implementation manner, the obtaining a target brightness value according to the target audio data and a preset brightness range includes:
[0018] Offset the target audio data according to a preset range to obtain offset data;
[0019] Calculate a target amplitude according to the offset data;
[0020] Determine the target brightness value according to the brightness range corresponding to the target amplitude.
[0021] In a feasible implementation manner, the offsetting the target audio data according to a preset range to obtain offset data includes:
[0022] Offset each byte data in the target audio data until each byte data is adjusted within the preset range to obtain an offset value;
[0023] Perform a bitwise AND operation on the offset value and the hexadecimal value 0xff to obtain the offset data.
[0024] In a feasible implementation manner, calculating the target amplitude according to the offset data is specifically the following formula:
[0025]
[0026] Where Wave is the target amplitude, NewWave n is the offset data, and i, n are the position numbers of the complex points in NewWave n in the complex points.
[0027] In a feasible implementation manner, the obtaining a target color value according to the target audio data and a preset color range includes:
[0028] Based on the target audio data, obtain multiple target frequency points;
[0029] Calculate the index values of the multiple target frequency points;
[0030] Based on the index values, obtain the frequency values of the multiple target frequency points;
[0031] Perform normalization processing on the frequency values to obtain multiple target frequency values;
[0032] Determine the target color value according to the color interval corresponding to the maximum value among the multiple target frequency values.
[0033] In a feasible implementation manner, based on the index values, obtaining the frequency values of the multiple target frequency points is specifically as the following formula:
[0034]
[0035] where freq is the frequency value of the target frequency point; rfv is the real part of the target frequency point; and ifv is the imaginary part of the target frequency point.
[0036] In a second aspect, the present application proposes an adjustment device for an ambient light, which is applied to the adjustment method for an ambient light according to any one of the above embodiments, and includes:
[0037] A data acquisition unit, configured to sample music audio to obtain initial audio data;
[0038] A data conversion unit, which performs Fourier transform on the initial audio data to obtain target audio data;
[0039] A brightness calculation unit, configured to obtain a target brightness value according to the target audio data and a preset brightness interval;
[0040] A color calculation unit, configured to obtain a target color value according to the target audio data and a preset color interval;
[0041] An ambient light control unit, configured to correspondingly adjust the brightness and color of the ambient light based on the target brightness value and the target color value.
[0042] In a third aspect, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, where when the processor executes the computer program stored in the memory, it implements the steps of the adjustment method for an ambient light according to any one of the first aspects above.
[0043] In a fourth aspect, the present application also proposes a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the adjustment method for an ambient light according to any one of the first aspects.
[0044] In summary, for the method for adjusting the ambient light proposed in the embodiments of the present application, through the processing and conversion of music audio, compared with the existing advanced ambient light rhythm algorithms, the calculation method is more concise and effective, with low complexity. In addition, the algorithm structure of the method for dynamically adjusting the ambient light according to the rhythm of automotive music proposed in the embodiments of the present application is simple, making it widely applicable and highly versatile, and it can be quickly transplanted and popularized to other vehicle models or other digital audio devices to output the same effect.
[0045] For the method for adjusting the ambient light proposed in the present application, other advantages, objectives, and features of the present application will be partially reflected by the following description, and partially will also be understood by those skilled in the art through the research and practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to limit this specification. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0047] Figure 1 It is a schematic flowchart of a method for adjusting an ambient light provided by an embodiment of the present application;
[0048] Figure 2 It is a schematic structural diagram of an apparatus for adjusting an ambient light provided by an embodiment of the present application;
[0049] Figure 3 It is a schematic structural diagram of an electronic device for adjusting an ambient light provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0050] In order to better understand the technical solutions provided by the embodiments of this specification, the technical solutions of the embodiments of this specification will be described in detail below through the drawings and specific embodiments. It should be understood that the specific features in the embodiments of this specification and the embodiments are detailed descriptions of the technical solutions of the embodiments of this specification, rather than limitations on the technical solutions of this specification. Without conflict, the technical features in the embodiments of this specification and the embodiments can be combined with each other.
[0051] In this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element. The term "more than two" includes two or more than two cases.
[0052] Please refer to Figure 1 , which is a schematic flow chart of a method for adjusting an ambient light provided by an embodiment of the present application, and specifically may include:
[0053] S110. Sample the music audio to obtain initial audio data.
[0054] Exemplarily, sampling refers to digitizing a signal on the time axis (horizontal axis). According to the Nyquist theorem, the present application samples the music audio at a frequency more than twice the highest audio frequency of the sound. This process is also called AD conversion (analog-to-digital conversion). Since the frequency that the human ear can hear is 20 Hz to 20 kHz, the general sampling frequency is 44.1 kHz, that is, 44,100 samples are taken in 1 second.
[0055] Furthermore, to convert the sound from an analog signal to a data signal, quantization and encoding are also required. Among them, quantization refers to digitizing the signal on the amplitude axis (vertical axis). For example, a 16-bit binary signal is used to represent a sample, and the representation range is [-32768, 32767]. That is to say, there are 65,536 possible values, so it is divided into 65,536 layers in amplitude, forming a plane rectangular coordinate system together with sampling. Encoding is to record the data after sampling and quantization according to a certain format, including information such as the sampling rate (sampleRate), quantization format (sampleFormat, also known as bit depth), and number of channels (channel).
[0056] S120. Perform a Fourier transform on the initial audio data to obtain target audio data.
[0057] Exemplarily, perform a Fourier transform on the initial audio data collected after sampling, convert it from the time domain to the frequency domain, and obtain target audio data.
[0058] S130. Obtain a target brightness value according to the target audio data and a preset brightness range.
[0059] Exemplarily, according to the target audio data and the preset brightness range, the brightness is distinguished, so as to determine the target brightness value corresponding to this brightness range according to the brightness of the preset brightness range.
[0060] S140. Obtain a target color value according to the target audio data and a preset color range.
[0061] Exemplarily, according to the target audio data and the preset color range, the color is distinguished, so as to determine the target color value corresponding to this color range according to the color of the preset color range.
[0062] S150. Based on the target brightness value and the target color value, correspondingly adjust the brightness and color of the ambient light.
[0063] Exemplarily, send the target brightness value and the target color value to the ambient light controller module through the CAN bus, so as to realize dynamically adjusting the color and brightness of the ambient light, enabling the ambient light to echo the music audio content and creating a more immersive experience.
[0064] In summary, for the adjustment method of the ambient light proposed in this application, the accuracy of the calculation result is ensured through the data processing of the music audio, and since there is no restriction on the type of the music audio and the calculation method is simple, it can be ensured that it is still flexibly adapted to various scenarios without weakening the adaptation effect.
[0065] In some examples, performing a Fourier transform on the initial audio data to obtain the target audio data includes:
[0066] Performing a fast Fourier transform on the initial audio data to obtain an array containing multiple elements;
[0067] Filtering out the target audio data from the array containing multiple elements based on symmetry.
[0068] Exemplarily, after performing a fast Fourier transform on the initial audio data, every 1024 real number points are put into an array to obtain an array containing 1024 elements, and each element is a complex number point. Based on the symmetry of the complex number points, the first 512 points are symmetric with the last 512 points, so only the first 513 points (including the 0th point) are taken as the target audio data, where the 0th point and the 512th point are real numbers, and the middle 511 points are complex numbers.
[0069] The target audio data obtained after fast Fourier transform is of the data type in bytes, and the target audio data is stored in a byte array with a size of 1024. There are a total of 1 + 1 + (1024 - 2) ÷ 2 = 513 valid complex points after the fast Fourier transform in the target audio data, as shown in Table 1 below:
[0070] Index 0 1 2 3 4 5 … n-2 n-1 Data <![CDATA[Rf 0 > <![CDATA[Rf (n-2) > <![CDATA[Rf 1 > <![CDATA[If 1 > <![CDATA[Rf 2 > <![CDATA[If 2 > … <![CDATA[Rf (n-1) / 2 > <![CDATA[If (n-1) / 2 >
[0071] Table 1
[0072] In Table 1, Rf represents the real part of the frequency point, Rfn represents the real part of the nth frequency point; If represents the imaginary part of the frequency point, Ifn represents the imaginary part of the nth frequency point, Index (index) represents the position number of the complex point in the array, starting from 0 and increasing sequentially to locate and distinguish different complex points in the array. Data represents the target audio data obtained after fast Fourier transform. The complex points with indexes 0 and 512 are real numbers, and most of the complex points corresponding to the remaining indexes are complex numbers (the middle 511 points except indexes 0 and 512 are complex numbers).
[0073] In some examples, according to the target audio data and the preset brightness interval, the target brightness value is obtained, including:
[0074] Offset the target audio data according to the preset interval to obtain offset data;
[0075] Calculate the target amplitude according to the offset data;
[0076] Determine the target brightness value according to the brightness interval corresponding to the target amplitude.
[0077] Exemplarily, for the target audio data Wave n , each data in it is offset and adjusted to the preset interval to obtain the offset data NewWave n . Perform an accumulation operation on the offset NewWave n and take the average value as the target amplitude obtained by averaging the brightness after the data change.
[0078] Further, the amplitude value has a corresponding relationship with the brightness value to a certain extent and can represent the brightness value to a certain extent. However, it is not rigorous and accurate enough to determine the brightness solely based on the amplitude value. Through operations such as collecting audio data and conducting simulation experiments, the present application evenly divides the brightness value into 10 brightness intervals, thereby making a more detailed distinction and quantification of the brightness. Then, the target amplitude value is corresponded with these brightness intervals. When the target amplitude value falls into its corresponding brightness interval, the target brightness value corresponding to this brightness interval will be presented. Furthermore, the presentation of the brightness can be made more hierarchical and regular, rather than directly determining the brightness only by the amplitude value.
[0079] In some examples, the target audio data is offset according to a preset interval to obtain offset data, including:
[0080] Offset each byte data in the target audio data until each byte data is adjusted into the preset interval to obtain an offset value;
[0081] Perform a bitwise AND operation on the offset value and the hexadecimal value 0xff to obtain the offset data.
[0082] Exemplarily, offset each byte data in the target audio data Wave n until each byte data is adjusted into the preset interval to obtain an offset value. Then perform a bitwise AND operation on the offset value and the hexadecimal value 0xff (decimal is 255) to obtain the offset data NewWave n to ensure that the offset data NewWave n is within the range of 0 to 255.
[0083] Specifically, since the data range of the byte type is -128 to 127, performing a bitwise AND operation on the offset value and the hexadecimal value 0xff (decimal is 255) can ensure that the offset data NewWave n is limited within the range of unsigned bytes, that is, 0 to 255. Among them, the offset data NewWave n is expressed as the following formula (1):
[0084] NewWave n =(Wave n +0x80)&0xFF (1).
[0085] In some examples, the target amplitude value is calculated according to the offset data, specifically as the following formula (2):
[0086]
[0087] In formula (2), Wave is the target amplitude value, and i and n represent the offset data NewWave nThe position numbers of multiple points in the complex plane, specifically representing the first array to the last array in NewWave n in
[0088] Exemplarily, perform an accumulation operation on the offset NewWave n and take the average value as the target amplitude obtained by averaging the brightness after data change.
[0089] In some examples, according to the target audio data and the preset color interval, obtain the target color value, including:
[0090] Based on the target audio data, obtain multiple target frequency points;
[0091] Calculate the index values of multiple target frequency points;
[0092] Based on the index values, obtain the frequency values of multiple target frequency points;
[0093] Normalize the frequency values to obtain multiple target frequency values;
[0094] Determine the target color value according to the color interval corresponding to the maximum value among multiple target frequency values.
[0095] Exemplarily, although the audible frequency range of the human ear is 20 Hz to 20 kHz, the sensitive area of the human ear only reaches 800 Hz, and the human ear is less sensitive to higher frequencies. Therefore, only the information at certain specific frequency points needs to be analyzed. In this application, it is preferred to analyze the information at 8 target frequency points, namely 40 Hz, 70 Hz, 100 Hz, 300 Hz, 500 Hz, 600 Hz, 700 Hz, and 800 Hz.
[0096] To obtain the frequency information of the target frequency points, calculate the index values of the corresponding arrays in the array generated after Fourier transform. Specifically, the calculation formula for the index value is:
[0097] Index = (frequency point ÷ sampling rate) × total number of frequency points (3);
[0098] Among them, since there are generally 1024 real numbers after Fourier transform and a total of 513 frequency point data are collected, but the first element represents the DC component (0 frequency) and is generally not calculated, so a total of 512 frequency point data can be considered to be collected.
[0099] After obtaining the index value of a certain target frequency point, since the data at the Index position in the array corresponds to the real part rfv of the target frequency point, and the data at Index + 1 corresponds to the imaginary part ifv of the target frequency point, the frequency of the target frequency point can be obtained by the following formula (4).
[0100] In some examples, based on the index value, the frequency values of multiple target frequency points are obtained, specifically as the following formula (4):
[0101]
[0102] In formula (4), freq is the frequency value of the target frequency point; rfv is the real part of the target frequency point; ifv is the imaginary part of the target frequency point.
[0103] Furthermore, since the target audio data is of the data type in bytes, and the data range of the byte type is from -128 to 127, the frequency value is normalized to obtain the target frequency value S, so that the frequency value is closer to [0, 255] and is more reasonable to use. The specific normalization is as the following formula (5):
[0104]
[0105] Determine the target color value according to the color interval corresponding to the maximum value among the multiple target frequency values.
[0106] The color of the atmosphere light is divided into multiple color intervals. Each target frequency value corresponds to a different color interval. The color interval corresponding to the maximum value among the target frequency values is selected, so that the atmosphere light presents the target color value corresponding to this color interval. Thus, the color of the atmosphere light is dynamically adjusted according to the change of the frequency value.
[0107] Based on the same inventive concept, in the embodiments of the present application, there is also provided an adjustment device for an atmosphere light corresponding to the adjustment method for an atmosphere light provided in the above embodiments. Since the principle of solving problems by the adjustment device for an atmosphere light in the embodiments of the present application is similar to that of the adjustment method for an atmosphere light in the above embodiments of the present application, the implementation of the adjustment device for an atmosphere light can refer to the implementation of the adjustment method for an atmosphere light, and the repeated parts will not be described again.
[0108] As Figure 2 shown Figure 2 is a schematic structural diagram of an adjustment device for an atmosphere light proposed by the present application. The device includes:
[0109] A data acquisition unit 21, configured to sample the music audio to obtain initial audio data;
[0110] A data conversion unit 22, configured to perform Fourier transform on the initial audio data to obtain target audio data;
[0111] A brightness calculation unit 23, configured to obtain a target brightness value according to the target audio data and a preset brightness interval;
[0112] A color calculation unit 24, configured to obtain a target color value according to the target audio data and a preset color interval;
[0113] An ambient light control unit 25 is configured to adjust the brightness and color of the ambient light corresponding to a target brightness value and a target color value.
[0114] In summary, for the ambient light adjustment device provided in this application, an initial audio data is sampled by a data acquisition unit 21; a data conversion unit 22 performs a Fourier transform on the initial audio data collected after sampling, converts it from the time domain to the frequency domain, and obtains target audio data; a brightness calculation unit 23 differentiates the brightness according to the target audio data and a preset brightness range, and thus determines a target brightness value corresponding to the brightness range according to the brightness in the preset brightness range; a color calculation unit 24 differentiates the color according to the target audio data and a preset color range, and thus determines a target color value corresponding to the color range according to the color in the preset color range; an ambient light control unit 25 sends the target brightness value and the target color value to an ambient light controller module through a CAN bus, thereby realizing dynamic adjustment of the color and brightness of the ambient light, enabling the ambient light to echo the music audio content, and creating a more immersive experience.
[0115] As Figure 3 shown, an embodiment of this application further provides an electronic device 300, including a processor 310, a memory 320, and a computer program 321 stored on the memory 320 and executable on the processor. When the processor 310 executes the computer program 321, the steps of any of the above methods for adjusting the ambient light are implemented.
[0116] Since the electronic device introduced in this embodiment is the device adopted for implementing a method for adjusting an ambient light in an embodiment of this application, based on the method introduced in the embodiment of this application, those skilled in the art can understand the specific implementation manners of the electronic device in this embodiment and their various variations. Therefore, the specific implementation of how this electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the device adopted by those skilled in the art to implement the method in the embodiment of this application belongs to the scope to be protected by this application.
[0117] In a specific implementation process, when the computer program 321 is executed by the processor, it can implement Figure 1 any of the implementation manners in the corresponding embodiments.
[0118] It should be noted that in the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0119] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, apparatus, or computer program product. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-readable program code.
[0120] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0121] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0123] The embodiments of the present application also provide a computer program product, which includes computer software instructions. When the computer software instructions run on a processing device, the processing device is caused to execute the process of the method for adjusting the atmosphere light.
[0124] A computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0125] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.
[0126] In several embodiments provided in the present application, it should be understood that the disclosed devices, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other may be through some interfaces, indirect couplings or communication connections of devices or units, and may be electrical, mechanical, or other forms.
[0127] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0128] In addition, in each embodiment of the present application, each functional unit can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0130] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present application.
[0131] Although the preferred embodiments of this specification have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of this specification.
[0132] Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, if these modifications and variations of this specification fall within the scope of the claims of this specification and their equivalent technologies, this specification is also intended to include these modifications and variations.
Claims
1. A method for adjusting an atmosphere lamp, characterized in that: include: Sampling the music audio to obtain initial audio data; Performing Fourier transform on the initial audio data to obtain target audio data; Obtaining a target brightness value according to the target audio data and a preset brightness range; Obtaining a target color value according to the target audio data and a preset color interval; Based on the target brightness value and the target color value, the brightness and color of the atmosphere light are adjusted accordingly.
2. The method for adjusting the atmosphere light according to claim 1, characterized in that: The performing Fourier transform on the initial audio data to obtain target audio data includes: Performing a fast Fourier transform on the initial audio data to obtain an array containing a plurality of elements; The target audio data is filtered out from the array comprising a plurality of elements based on symmetry.
3. The method for adjusting the atmosphere light according to claim 1, characterized in that: The step of obtaining a target brightness value according to the target audio data and a preset brightness range includes: The target audio data is offset according to a preset interval to obtain offset data; Calculate the target amplitude according to the offset data; The target brightness value is determined according to the brightness interval corresponding to the target amplitude.
4. The method for adjusting the atmosphere light according to claim 3, characterized in that: The step of offsetting the target audio data according to a preset interval to obtain offset data includes: Offsetting each byte data in the target audio data until each byte data is adjusted to be within the preset interval, thereby obtaining an offset value; The offset value is bitwise ANDed with the hexadecimal value 0xff to obtain the offset data.
5. The method for adjusting the atmosphere light according to claim 3, characterized in that: The target amplitude is calculated according to the offset data, which is specifically the following formula: Among them, Wave is the target amplitude, NewWave n is the offset data, i and n are NewWave n The position number of the complex point in .
6. The method for adjusting the atmosphere light according to claim 1, characterized in that: The step of obtaining a target color value according to the target audio data and a preset color interval includes: Based on the target audio data, obtaining multiple target frequency points; Calculate and obtain index values of a plurality of target frequency points; Based on the index value, obtaining frequency values of a plurality of the target frequency points; Normalizing the frequency values to obtain multiple target frequency values; The target color value is determined according to a color interval corresponding to a maximum value among the plurality of target frequency values.
7. The method for adjusting the atmosphere light according to claim 6, characterized in that: Based on the index value, the frequency values of the multiple target frequency points are obtained, which is specifically the following formula: Among them, freq is the frequency value of the target frequency point; rfv is the real part of the target frequency point; ifv is the imaginary part of the target frequency point.
8. An atmosphere light adjustment device, applied to the atmosphere light adjustment method according to any one of claims 1 to 7, characterized in that: include: A data acquisition unit, used for sampling the music audio to obtain initial audio data; A data conversion unit, performing Fourier transform on the initial audio data to obtain target audio data; A brightness calculation unit, configured to obtain a target brightness value according to the target audio data and a preset brightness interval; A color calculation unit, used for obtaining a target color value according to the target audio data and a preset color interval; The ambient light control unit is used to adjust the brightness and color of the ambient light accordingly based on the target brightness value and the target color value.
9. An electronic device, comprising: A memory and a processor, wherein the processor is used to implement the steps of the atmosphere lamp adjustment method as described in any one of claims 1 to 7 when executing the computer program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for adjusting the atmosphere light according to any one of claims 1 to 7 are implemented.