Loudspeaker calibration method and device, electronic equipment and storage medium

By using inertial sensors to obtain acceleration data in electronic devices to adjust the speaker gain value, the problem of speaker volume reduction is solved, self-calibration is achieved, and calibration efficiency and sound quality stability is improved.

CN120499580APending Publication Date: 2025-08-15VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510615946.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

During use, the volume of the electronic device speakers is reduced due to dust, power loss and other reasons, making it difficult for users to calibrate themselves, resulting in low calibration efficiency.

Method used

The inertial sensor is used to obtain acceleration data during the speaker output audio signal, and the gain value of the speaker is adjusted based on the acceleration data to achieve self-calibration.

Benefits of technology

No need for factory repair, improving speaker calibration efficiency and ensuring stability of volume and sound quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499580A_ABST
    Figure CN120499580A_ABST
Patent Text Reader

Abstract

The invention discloses a loudspeaker calibration method and device, electronic equipment and a storage medium, and belongs to the technical field of electronics. The method is applied to the electronic equipment, the electronic equipment comprises a loudspeaker and an inertial sensor which are arranged on the same circuit board, and the method comprises the following steps: in the process that the loudspeaker outputs an audio signal, acquiring acceleration data output by the inertial sensor; and adjusting a gain value of the loudspeaker based on the acceleration data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of electronic technology, and specifically relates to a speaker calibration method, device, electronic device and storage medium. Background Art

[0002] With the advancement of technology, electronic devices like smartphones are integrating more and more functions. In everyday, non-professional scenarios, electronic devices have gradually become substitutes for many common professional equipment. At the same time, as essential non-communication functions, speakers in electronic devices are becoming increasingly sophisticated in terms of sensitivity, sound quality, and external speaker effects, leading to higher and higher user expectations.

[0003] Although speakers in electronic devices are factory-tested, dust, power loss, magnetic field loss, and other factors can cause the actual volume to gradually decrease, resulting in poor sound quality. Users lacking the necessary expertise and equipment to test and calibrate speakers after a malfunction occurs, forcing them to return to the factory for repair, a time-consuming and labor-intensive process that inefficiently impacts calibration. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide a speaker calibration method, device, electronic device and storage medium, which can calibrate the speaker by the electronic device itself, thereby improving the efficiency of speaker calibration.

[0005] In a first aspect, embodiments of the present application provide a speaker calibration method, which is applied to an electronic device, the electronic device including a speaker and an inertial sensor disposed on the same circuit board, the method comprising:

[0006] While the speaker is outputting the audio signal, the acceleration data output by the inertial sensor is obtained;

[0007] Adjust the gain value of the speaker based on the acceleration data.

[0008] In a second aspect, an embodiment of the present application provides a speaker calibration device, characterized in that it is applied to an electronic device, the electronic device including a speaker and an inertial sensor arranged on the same circuit board, and the device includes:

[0009] An acquisition module, used to acquire acceleration data output by the inertial sensor during the process of the speaker outputting the audio signal;

[0010] The processing module is used to adjust the gain value of the speaker based on the acceleration data.

[0011] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0012] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0013] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method described in the first aspect.

[0014] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the method described in the first aspect.

[0015] In an embodiment of the present application, acceleration data output by an inertial sensor is obtained while the speaker is outputting an audio signal; the speaker gain is adjusted based on the acceleration data. According to this application, the electronic device can automatically calibrate the speaker based on the acceleration data collected by the inertial sensor, eliminating the need for factory repairs, thereby improving speaker calibration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a schematic diagram of an electronic device provided by some embodiments of the present application;

[0017] Figure 2 is a time domain waveform diagram of gyroscope data provided by some embodiments of the present application;

[0018] Figure 3 is a schematic diagram of fast Fourier transform results provided by some embodiments of the present application;

[0019] Figure 4 is a flowchart of a loudspeaker calibration method provided in some embodiments of the present application;

[0020] Figure 5 is a schematic diagram of a speaker calibration device provided in some embodiments of the present application;

[0021] Figure 6 is a block diagram of an electronic device provided by some embodiments of the present application;

[0022] Figure 7 This is a schematic diagram of the structure of an electronic device provided in some embodiments of the present application. DETAILED DESCRIPTION

[0023] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.

[0024] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0025] The speaker calibration method, device, electronic device, storage medium, and program product provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0026] The image display control method provided in this application can be applied to image browsing scenarios. Figures 1-4 The speaker calibration method provided in the embodiment of the present application is described in detail. It should be noted that the speaker calibration method provided in the embodiment of the present application can be executed by an electronic device. In the embodiment of the present application, the speaker calibration method provided in the embodiment of the present application is described by taking an electronic device executing the speaker calibration method as an example.

[0027] See also Figure 1 , is a schematic diagram of the structure of the electronic device provided in the embodiment of the present application, such as Figure 1 As shown, the electronic device includes a speaker 120 and an inertial sensor 130 provided on the same circuit board 110. The inertial sensor 130 includes but is not limited to sensors such as accelerometers and gyroscopes that can measure acceleration data of an object.

[0028] like Figure 1As shown, since speaker 120 is mounted on circuit board 110, when speaker 120 outputs an audio signal, the sound waves are transmitted to circuit board 110, causing it to vibrate. This vibration in turn drives inertial sensor 130 on circuit board 110 to move, causing the acceleration data output by inertial sensor 130 to change. Thus, the acceleration data output by inertial sensor 130 can reflect the influence of the frequency of the audio signal output by speaker 120.

[0029] In some embodiments of the present application, taking the inertial sensor 130 as a six-axis MEMS (Micro-Electro-Mechanical Systems) inertial sensor as an example, when the speaker 120 plays a piece of music with a spectrum within the range of 0 to 200 Hz at a volume greater than 0, the raw acceleration data in the three axes output by the gyroscope in the inertial sensor 130 is obtained, and based on the Y-axis component in the raw acceleration data, the following is obtained: Figure 2 The time domain waveform shown in the figure. The horizontal axis is time, the unit is s, and the vertical axis is amplitude. Figure 2 This shows the fluctuation of gyroscope data over time. Figure 2 The data shown in the figure is Fourier transformed to obtain Figure 3 Schematic diagram of the fast Fourier transform results shown. Figure 3 The horizontal axis is the frequency, in Hz, and the vertical axis is the amplitude, where the amplitude is represented by the least significant bit (LSB) of the gyroscope. Figure 3 As shown in the figure, the average amplitude is about 0.0015LSB and the peak amplitude is about 0.004LSB. Figure 3 The amplitude in is converted into the common unit of degrees per second, that is, dps, and the average amplitude is about 2dps, and the peak amplitude is about 4dps. By comparing the average amplitude and the peak amplitude with the background noise amplitude detected by the inertial sensor 130 when the speaker 120 is silent, it is determined that when the speaker 120 plays audio at a volume greater than 0, the data output by the inertial sensor 130 will be affected by the frequency of the audio played by the speaker 120, and the average amplitude is above the drift rate of the inertial sensor 130, meeting the minimum measurement accuracy. Based on this, it is determined that the data output by the inertial sensor can reflect the influence of the speaker playback frequency. Therefore, an embodiment of the present application provides a speaker calibration method for calibrating the speaker based on an inertial sensor. For electronic devices with built-in speakers and inertial sensors, such as mobile phones, the gain value of the speaker can be modified to achieve calibration of the speaker volume without introducing new hardware.

[0030] See also Figure 4, is a flow chart of a speaker calibration method provided in an embodiment of the present application, which can be applied to Figure 1 The electronic equipment shown. Figure 4 As shown, the method includes the following steps 410 to 420, which are described in detail below: Step 410. While the speaker is outputting an audio signal, obtain acceleration data output by the inertial sensor.

[0031] In some embodiments of the present application, when the electronic device determines that the speaker needs to be calibrated, it controls the speaker to output an audio signal, thereby obtaining acceleration data output by the inertial sensor during the process of the speaker outputting the audio signal.

[0032] In some embodiments of the present application, the user can decide whether the speaker needs to be calibrated. If the user decides that the speaker needs to be calibrated, the speaker calibration function of the electronic device is turned on. In this way, the electronic device determines that the speaker needs to be calibrated in response to the speaker calibration function being turned on.

[0033] In other embodiments of the present application, the electronic device may determine whether the speaker needs to be calibrated through a preset detection algorithm.

[0034] In other embodiments of the present application, the electronic device may calibrate the speaker using a timed calibration method. Based on this, the electronic device may determine that the speaker needs to be calibrated when it is determined that the calibration time of the speaker has arrived.

[0035] In some embodiments of the present application, as previously described, when a speaker outputs an audio signal, the output audio signal causes the circuit board to vibrate. This vibration in turn drives the inertial sensor mounted thereon to move, thereby changing the acceleration data output by the inertial sensor. In this case, the acceleration data output by the inertial sensor can reflect the influence of the frequency of the audio signal output by the speaker. Based on this, the electronic device obtains the acceleration data output by the inertial sensor while the speaker is outputting the audio signal.

[0036] Step 420: Adjust the gain value of the speaker based on the acceleration data.

[0037] In some embodiments of the present application, the gain value of a speaker indicates the degree to which the speaker amplifies an input electrical signal at a specific frequency. By adjusting the gain value of the speaker at a specific frequency, the volume of the audio signal output by the speaker at the specific frequency can be controlled.

[0038] The speaker calibration method provided in an embodiment of the present application is applied to an electronic device comprising a speaker and an inertial sensor disposed on the same circuit board. The method comprises: playing a preset audio signal to cause the speaker to output an audio signal; obtaining acceleration data output by the inertial sensor during the speaker output of the audio signal; and adjusting the speaker gain value based on the acceleration data. According to the present application, the electronic device can automatically calibrate its speaker based on the acceleration data collected by the inertial sensor, eliminating the need for factory repairs, thereby improving speaker calibration efficiency.

[0039] In some embodiments, when controlling a speaker to output an audio signal, the electronic device must ensure that the frequency and amplitude of the audio signal output by the speaker cause the inertial sensor to reach a detection threshold in order to obtain acceleration data output by the inertial sensor. For example, the electronic device may control the speaker to output the audio signal at a preset volume, with the preset volume ranging from 70% to 100% of the speaker's maximum volume.

[0040] In some embodiments of the present application, in order to avoid vibration interference from the external environment, the electronic device may prompt the user to place the electronic device on a stable surface before controlling the speaker to output an audio signal.

[0041] In some embodiments of the present application, to eliminate the effects of clutter interference and sound wave reflections, the electronic device may prompt the user to keep the surrounding environment quiet and remove obstacles within a preset range of the electronic device before controlling the speaker to output the audio signal. For example, the user may be prompted to avoid obstacles within a 50 cm diameter hemispherical area above the electronic device.

[0042] In some embodiments of the present application, before controlling a speaker to output an audio signal, the electronic device may first detect whether the environment within a preset range of the electronic device satisfies a preset calibration condition. If the calibration condition is determined to be satisfied, the speaker is directly controlled to output the audio signal. If the calibration condition is determined not to be satisfied, a prompt message is output to prompt the user to adjust the environment within the preset range around the electronic device until the calibration condition is satisfied. The calibration conditions include, but are not limited to: the electronic device is placed on a stable surface, there are no obstacles within the preset range of the electronic device, the sound volume within the preset range of the electronic device is lower than a preset decibel threshold, etc. The decibel threshold value range is [0,40].

[0043] Furthermore, in some embodiments of the present application, after starting to control the speaker to output an audio signal, the electronic device may also output a prompt message to remind the user not to touch the electronic device, so as to avoid calibration interruption or failure caused by touching the electronic device. For example, after starting to play a preset audio signal, the electronic device may display a prompt on the screen saying "Do not touch the device, data is being collected."

[0044] In this way, users can adjust the speaker's external sound effect at any time in a quiet and unobstructed environment.

[0045] In some embodiments, an audio signal for speaker calibration may be pre-set in the electronic device. Based on this, the electronic device may control the speaker to output the pre-set audio signal for calibration when determining that the speaker needs to be calibrated.

[0046] In some embodiments, an electronic device provides multiple speaker calibration modes adapted for different scenarios. Different speaker calibration modes correspond to audio signals in different frequency bands, and the audio signals in different frequency bands contain different frequency points. For example, the speaker calibration modes provided by the electronic device include a first mode, a second mode, and a third mode. The first mode is suitable for general scenarios, the second mode is suitable for music scenarios, and the third mode is suitable for video scenarios. The audio signal corresponding to the first mode is a first audio signal, which is a full-band audio signal that contains all frequency components within the audible range of the human ear. The audible frequency range of sound is typically between 20Hz and 20kHz, so full-band audio can cover the entire frequency range of 20Hz to 20kHz. The first mode has high calibration accuracy but takes a long time. The second mode corresponds to a second audio signal, which contains audio signals in a frequency band commonly used in music scenarios. For example, if the electronic device typically plays music in the frequency range of 250Hz-8kHz in music scenarios, the second audio signal is an audio signal that can cover the frequency range of 250Hz-8kHz. The second mode takes less time than the first mode. The audio signal corresponding to the third mode is a third audio signal, and the third audio signal includes audio signals in a frequency band commonly used in video scenarios. For example, if the electronic device typically plays audio in a video scenario between 80 Hz and 12 kHz, the third audio signal may include audio in the frequency range of 250 Hz and 8 kHz. Based on this, before the above step 410, the electronic device may first determine the currently used speaker calibration mode, and then control the speaker to output the audio signal corresponding to the currently used speaker calibration mode.

[0047] In some embodiments of the present application, before controlling a speaker to output an audio signal, an electronic device may display a speaker calibration mode selection interface. The speaker calibration mode selection interface includes various speaker calibration modes supported by the electronic device. A user can select a desired speaker calibration mode in the speaker calibration mode selection interface based on the actual scenario. In this way, the electronic device, in response to the user's selection, determines the user-selected speaker calibration mode as the currently used speaker calibration mode. For example, when calibrating a speaker in any scenario, a user can select a first mode as the speaker calibration mode to use. In response to the user's selection, the electronic device determines the first mode as the currently used speaker calibration mode. When calibrating a speaker in a music scenario using the electronic device to play music, a user can select a second mode as the speaker calibration mode to use. In response to the user's selection, the electronic device determines the second mode as the currently used speaker calibration mode. When calibrating a speaker in a video scenario using the electronic device to play a video, a user can select a third mode as the speaker calibration mode to use. In this way, a user can select the appropriate speaker calibration mode based on their actual needs, thereby making the speaker calibration more in line with the user's actual needs.

[0048] In other embodiments of the present application, the electronic device may determine the current scene and then determine the speaker calibration mode corresponding to the current scene as the currently used speaker calibration mode. For example, if the current scene is determined to be a music scene in which music is played, the second mode is determined to be the currently used speaker calibration mode. If the current scene is a video scene in which a video is played, the third mode is determined to be the currently used speaker calibration mode.

[0049] In some embodiments of the present application, the electronic device can determine the current scene based on the business currently being performed or performed before a preset time, and then determine the speaker calibration mode corresponding to the current scene as the currently used speaker calibration mode. For example, if the electronic device determines that the electronic device was on a call before a preset time, it determines that the current scene is a call scene, and thus determines the first mode applicable to the call scene as the currently used speaker calibration mode. If the electronic device determines that the electronic device was playing music before a preset time, it determines that the current scene is a music scene, and thus determines the second mode corresponding to the music scene as the currently used speaker calibration mode. If the electronic device determines that the electronic device was playing a video before a preset time, it determines that the current scene is a video scene, and thus determines the third mode corresponding to the video scene as the currently used speaker calibration mode.

[0050] This approach allows for speaker calibration using audio signals of varying frequencies to meet varying needs or scenarios, enhancing flexibility. Furthermore, using different audio signals for calibration in different scenarios allows the calibrated speakers to be more adaptable to the specific scenario.

[0051] In some embodiments, the speaker corresponds to different gain values at different frequency points. Therefore, the audio signal output by the speaker may include audio signals at multiple frequency points. Based on this, the gain values of the speaker at the multiple different frequency points may be adjusted separately in the above step 420. Wherein, the frequency point refers to a specific frequency value.

[0052] In some embodiments of the present application, in the above step 42, the following steps 4201 to 4202 are performed for each frequency point in the audio signal to calibrate the gain value of the speaker at each frequency point.

[0053] Step 4201: Obtain the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point.

[0054] In some embodiments of the present application, reference gain values of the speaker at multiple frequency points and reference acceleration data corresponding to the multiple frequency points are pre-stored in the electronic device. Based on this, the electronic device can obtain the reference gain values of the speaker at the frequency points and the reference acceleration data corresponding to the frequency points from the pre-stored data.

[0055] In some embodiments of the present application, the reference gain values of the speaker at multiple frequency points can be stored in the electronic device in the form of a preset gain curve, and the preset gain curve is used to indicate the correspondence between the initial gain value of the speaker and the frequency point. Among them, the initial gain value of the speaker can be the gain value set when the speaker leaves the factory. Based on this, for each frequency point, the electronic device can determine the gain value corresponding to the frequency point in the preset gain curve, that is, the initial gain value, as the reference gain value of the speaker at the frequency point. In some embodiments of the present application, before the electronic device leaves the factory, professional equipment is used to calibrate the gain values of the speaker at multiple frequency points to obtain initial gain values that meet the design requirements of the speaker. The preset gain curve is generated based on the initial gain values of the speaker at multiple frequency points obtained through calibration.

[0056] In some embodiments of the present application, professional equipment includes an audio analyzer, a power amplifier, an anechoic chamber, and other specialized equipment. The audio analyzer measures various parameters of the audio signal output by the speaker, the power amplifier provides the speaker with appropriate driving power, and the anechoic chamber eliminates interference from ambient noise to ensure the accuracy of the test results. When calibrating a speaker using professional equipment, the speaker to be calibrated is installed in the electronic device housing or test fixture, ensuring a secure fit and that the speaker's sound output port maintains proper acoustic connection with the external environment. The speaker is connected to the audio analyzer via an audio interface, and the power amplifier is connected to the speaker's drive circuit to form a complete test loop. Test parameters, such as the test frequency range, test signal amplitude, and sampling rate, are set in the audio analyzer and related test software. Generally, the test frequency range covers the speaker's operating frequency range, for example, from 20 Hz to 20 kHz. Then, audio test signals of varying frequencies and amplitudes are input sequentially, increasing the amplitude at each frequency until the speaker output reaches the specified volume level. The audio analyzer then measures the actual gain of the speaker at that frequency. If the actual gain value deviates from the target gain value, the gain value can be adjusted to the target gain value by adjusting the relevant register parameters in the audio driver chip or the software algorithm to change the speaker's drive current or voltage. In this way, the initial gain value of the speaker at multiple frequency points can be obtained.

[0057] In some embodiments of the present application, reference acceleration data corresponding to multiple frequency points may be stored in the electronic device in the form of a preset inertia curve. The preset inertia curve is used to collect initial acceleration data when the inertial sensor outputs an audio signal at the corresponding frequency point according to an initial gain value. Based on this, for each frequency point, the electronic device may determine the acceleration data corresponding to the frequency point in the pre-stored preset inertia curve, i.e., the initial acceleration data, as the reference acceleration data for that frequency point.

[0058] In some embodiments of the present application, after the speaker is calibrated using professional equipment, when the speaker and the inertial sensor are installed on the same circuit board of the electronic device, the electronic device plays the audio test signal used when the speaker was calibrated using professional equipment, and turns on the inertial sensor to record three-axis acceleration data, namely x-axis acceleration, y-axis acceleration, and z-axis acceleration. The initial acceleration data corresponding to each of the multiple frequency points can be obtained, and a preset inertia curve is generated based on the initial acceleration data corresponding to the multiple frequency points.

[0059] Step 4202. When the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a first threshold, the gain value of the speaker at the frequency point is adjusted with the reference gain value as the starting value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, thereby obtaining the gain value of the speaker at the frequency point, where the actual acceleration is the acceleration data corresponding to the frequency point output by the inertial sensor.

[0060] In some embodiments of the present application, for each frequency point, the acceleration data output by the inertial sensor while the speaker is outputting the audio signal at that frequency point is used as the actual acceleration data corresponding to that frequency point. After obtaining the actual acceleration data corresponding to the frequency point, the actual acceleration data is compared with the reference acceleration data corresponding to the frequency point to determine the difference between the two. The difference between the two is then compared with a preset first threshold. If the difference is greater than the first threshold, it is determined that the current volume of the speaker at that frequency point is significantly different from the volume at that frequency point when the speaker was first shipped from the factory, thereby determining that the gain value of the speaker at that frequency point needs to be calibrated to bring the volume of the speaker at that frequency point closer to the ideal volume when the speaker was shipped from the factory. If the difference is less than or equal to the first threshold, it is determined that the current volume of the speaker at that frequency point is close to the ideal volume when the speaker was first shipped from the factory, and the gain value for that frequency point can be adjusted without further adjustment, and the initial gain value for that frequency point when the speaker was first shipped from the factory can be directly determined as the gain value for that frequency point. The first threshold value can be set according to actual needs. The smaller the first threshold value, the closer the playback effect of the speaker after calibration is to the playback effect when the speaker is shipped from the factory.

[0061] In some embodiments of the present application, the Euclidean distance method can be used to determine the difference between the actual acceleration data and the corresponding reference acceleration data. For example, the actual acceleration data corresponding to the frequency point i includes the actual acceleration a of the x-axis. i,x , actual acceleration of the y-axis a i,y and the actual acceleration a on the z-axis i,z , the reference acceleration data corresponding to frequency point i includes the x-axis reference acceleration a 0i,x , y-axis reference acceleration a 0i,y and the actual acceleration a on the z-axis 0i,z , x-axis difference Δx=a i,x -α 0i,x , y-axis difference Δy=a i,y -a 0i,y , z-axis difference Δz=a i,z -a 0i,z , calculate the distance value d between the actual acceleration data and the corresponding reference acceleration data according to the following formula (1), and use d as the difference between the actual acceleration data and the corresponding reference acceleration data:

[0062]

[0063] In other embodiments of the present application, the mean absolute error method can be used to determine the difference between the actual acceleration data and the corresponding reference acceleration data. For example, the actual acceleration data corresponding to the frequency point i includes the actual acceleration a of the x-axis. i,x , actual acceleration of the y-axis a i,y and the actual acceleration a on the z-axis i,z , the reference acceleration data corresponding to frequency point i includes the x-axis reference acceleration a 0i,x , y-axis reference acceleration a 0i,y and the actual acceleration a on the z-axis 0i,z , absolute error of x-axis |e x |=|a i,x -a 0i,x |, y-axis absolute error |e y |=|a i,y -a 0i,y |, z-axis absolute error |e z |=|a i,z -a 0i,z |, calculate the mean absolute error (MAE) between the actual acceleration data and the corresponding reference acceleration data according to the following formula (2), and use MAE as the difference between the actual acceleration data and the corresponding reference acceleration data:

[0064]

[0065] It should be noted that in addition to using the Euclidean distance method and the mean absolute error method to determine the difference between the actual acceleration data and the corresponding reference acceleration data, other methods such as the root mean square error method can also be used to determine the difference between the actual acceleration data and the corresponding reference acceleration data, which are not listed here one by one.

[0066] In some embodiments of the present application, after obtaining the difference between the actual acceleration data corresponding to a frequency point and the reference acceleration data, the difference is compared with a first threshold. If it is determined that the difference is greater than the first threshold, the reference gain value of the speaker at the frequency point is used as the starting value to adjust the gain value at the frequency point. The adjustment includes increasing or decreasing the starting value. After adjusting the gain value at the frequency point, the acceleration data output by the inertial sensor when the speaker plays the audio signal at the frequency point is obtained, and the obtained acceleration data is continued to be used as the actual acceleration data corresponding to the frequency point and compared with the reference acceleration data at the frequency point to determine whether the difference between the two is greater than the first threshold. If the difference is still greater than the first threshold, the above steps are repeated to continue to increase or decrease the gain value based on the adjusted gain value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, and the final adjusted gain value is used as the gain value of the speaker at the frequency point.

[0067] In some embodiments of the present application, by executing the above steps 4201-4202 for each frequency point respectively, the calibrated gain value of the speaker at each frequency point can be obtained. Based on the calibrated gain values at multiple frequency points, a new gain curve called the calibrated gain curve can be generated and saved. By comparing the calibrated gain curve with the preset gain curve, the positive and negative gain adjustment values required by the speaker at each frequency point relative to the reference gain value at the factory can be obtained. In this way, when the electronic device subsequently plays audio, it can read the positive and negative gain adjustment values and send the corresponding positive and negative gain adjustment values to the speaker to compensate or reduce the gain of the played audio, so that the final sound volume played by the speaker is as close as possible to the ideal volume at the factory, thereby achieving a calibration effect.

[0068] By using the above method, the gain value of the speaker at multiple frequency points can be adjusted, so that the volume of the speaker at multiple frequency points is close to the ideal volume when it leaves the factory.

[0069] In some embodiments, after the speaker is calibrated, the calibrated gain curve and the preset gain curve are displayed, so that the user can intuitively understand the difference between the calibrated gain curve and the preset gain curve, thereby improving user experience.

[0070] In some embodiments, for each frequency point in the preset audio, after obtaining the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point, the following steps may be further performed:

[0071] When the error between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than the second threshold, a prompt message is output, where the prompt message is used to indicate that the speaker calibration has failed due to interference in the calibration environment.

[0072] In some embodiments of the present application, the second threshold is a pre-set value greater than the first threshold. Similarly, the specific value of the second threshold can also be set according to actual conditions.

[0073] In some embodiments of the present application, if the error between the actual acceleration data and the reference acceleration data is greater than the second threshold, it means that the difference between the two is large. At this time, this difference may be caused by large noise interference in the environment. Therefore, in this case, the calibration is paused, and a prompt message is output to indicate that the speaker calibration failed due to interference in the calibration environment, so as to prompt the user to adjust the surrounding environment. For example, at this time, the electronic device can output a prompt message "There is noise interference during calibration, please make sure the environment is quiet and do not touch the device". After outputting the prompt message, the currently acquired acceleration data can be cleared and the calibration can be restarted.

[0074] By adopting the above method, the problem of inaccurate calibration due to clutter interference can be avoided.

[0075] The speaker calibration method provided in the embodiment of the present application can be executed by a speaker calibration device. In the embodiment of the present application, the speaker calibration device provided in the embodiment of the present application is described by taking the speaker calibration method performed by the speaker calibration device as an example.

[0076] See also Figure 5 , is a schematic diagram of a speaker calibration device provided in an embodiment of the present application, such as Figure 5 As shown, the apparatus 500 includes the following modules:

[0077] An acquisition module 501 is configured to acquire acceleration data output by an inertial sensor during the process of the speaker outputting an audio signal;

[0078] The processing module 502 is configured to adjust a gain value of the speaker based on the acceleration data.

[0079] The speaker calibration device provided in an embodiment of the present application acquires acceleration data output by an inertial sensor while the speaker is outputting an audio signal and adjusts the speaker's gain based on the acceleration data. According to this application, an electronic device can automatically calibrate its speaker based on the acceleration data collected by the inertial sensor, eliminating the need for factory repairs and improving speaker calibration efficiency.

[0080] In some embodiments, the preset audio includes an audio signal of at least one frequency point;

[0081] The processing module 503 is specifically configured to:

[0082] For each frequency point, perform the following steps:

[0083] Determine the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point;

[0084] When the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a first threshold, the gain value of the speaker at the frequency point is adjusted with the reference gain value as the starting value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, thereby obtaining the gain value of the speaker at the frequency point, where the actual acceleration is the acceleration data corresponding to the frequency point output by the inertial sensor.

[0085] In some embodiments, the processing module 503 is specifically configured to:

[0086] When the error between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than the second threshold, a prompt message is output, where the prompt message is used to indicate that the speaker calibration has failed due to interference in the calibration environment.

[0087] In some embodiments, the processing module 503 is specifically configured to:

[0088] The gain value corresponding to the frequency point in the preset gain curve is determined as the reference gain value of the loudspeaker at the frequency point;

[0089] Determine the acceleration data corresponding to the frequency point in the preset inertia curve as the reference acceleration data corresponding to the frequency point;

[0090] The preset gain curve is used to indicate the correspondence between the initial gain value of the speaker and the frequency point, and the preset inertia curve is used to indicate the initial acceleration data collected by the inertial sensor when the speaker outputs an audio signal at the corresponding frequency point according to the initial gain value.

[0091] In some embodiments, the apparatus 500 further includes a control module configured to:

[0092] Before obtaining the acceleration data output by the inertial sensor, determine the currently used speaker calibration mode;

[0093] The speaker is controlled to play and output an audio signal corresponding to the preset audio in the speaker calibration mode.

[0094] The speaker calibration device in the embodiment of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.

[0095] The speaker calibration device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0096] The speaker calibration device provided in the embodiment of the present application can achieve Figure 4 To avoid repetition, the various processes implemented in the method embodiment are not described here.

[0097] Alternatively, as Figure 6 As shown, an embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602, wherein the memory 602 stores a program or instruction that can be run on the processor 601, and when the program or instruction is executed by the processor 601, the various steps of the above-mentioned speaker calibration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0098] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0099] Figure 7 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.

[0100] The electronic device 700 includes but is not limited to components such as a radio frequency unit 701 , a network module 702 , an audio output unit 703 , an input unit 704 , a sensor 705 , a display unit 706 , a user input unit 707 , an interface unit 708 , a memory 709 , and a processor 710 .

[0101] Those skilled in the art will understand that the electronic device 700 may also include a power source (such as a battery) to power each component, and the power source may be logically connected to the processor 710 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be repeated here.

[0102] In this embodiment of the present application, the audio output unit 703 includes a speaker, and the processor 710 is used to control the speaker to output audio signals.

[0103] In the embodiment of the present application, the sensor 705 includes an inertial sensor, which is used to collect acceleration data when the speaker outputs an audio signal.

[0104] The processor 710 is further configured to obtain acceleration data output by the inertial sensor and adjust a gain value of the speaker based on the acceleration data.

[0105] In some embodiments, the audio signal output by the speaker includes an audio signal of at least one frequency point;

[0106] The processor 710 is specifically configured to:

[0107] For each frequency point, perform the following steps:

[0108] Determine the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point;

[0109] When the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a first threshold, the gain value of the speaker at the frequency point is adjusted with the reference gain value as the starting value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, thereby obtaining the gain value of the speaker at the frequency point, where the actual acceleration is the acceleration data corresponding to the frequency point output by the inertial sensor.

[0110] In some embodiments, the processor 710 is specifically configured to:

[0111] When the error between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than the second threshold, a prompt message is output, where the prompt message is used to indicate that the speaker calibration has failed due to interference in the calibration environment.

[0112] In some embodiments, the processor 710 is specifically configured to:

[0113] The gain value corresponding to the frequency point in the preset gain curve is determined as the reference gain value of the loudspeaker at the frequency point;

[0114] Determine the acceleration data corresponding to the frequency point in the preset inertia curve as the reference acceleration data corresponding to the frequency point;

[0115] The preset gain curve is used to indicate the correspondence between the initial gain value of the speaker and the frequency point, and the preset inertia curve is used to indicate the initial acceleration data collected by the inertial sensor when the speaker outputs an audio signal at the corresponding frequency point according to the initial gain value.

[0116] In some embodiments, the processor 710 is further configured to:

[0117] Before obtaining the acceleration data output by the inertial sensor, determine the currently used speaker calibration mode;

[0118] The speaker is controlled to output an audio signal corresponding to the speaker calibration mode.

[0119] It should be understood that in an embodiment of the present application, the input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042, and the graphics processor 7041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 707 includes a touch panel 7071 and at least one of other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include two parts: a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an operating stick, which will not be repeated here.

[0120] The memory 709 can be used to store software programs and various data. The memory 709 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 709 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM), and a direct memory bus random access memory (DRRAM). The memory 709 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0121] Processor 710 may include one or more processing units. Optionally, processor 710 integrates an application processor and a modem processor. The application processor primarily handles operations related to the operating system, user interface, and application programs, while the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into processor 710.

[0122] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned speaker calibration method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0123] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0124] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned speaker calibration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0125] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0126] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned speaker calibration method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0127] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0129] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

Claims

1. A loudspeaker calibration method, characterized in that: Applied to an electronic device, the electronic device including a speaker and an inertial sensor disposed on the same circuit board, the method comprising: During the process of the speaker outputting the audio signal, acquiring acceleration data output by the inertial sensor; A gain value of the speaker is adjusted based on the acceleration data.

2. The method according to claim 1, characterized in that The audio signal includes an audio signal of at least one frequency point; The adjusting the gain value of the speaker based on the acceleration data includes: For each frequency point, perform the following steps respectively: Obtaining a reference gain value of the speaker at the frequency point and reference acceleration data corresponding to the frequency point; When the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a first threshold, the gain value of the speaker at the frequency point is adjusted with the reference gain value as a starting value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, thereby obtaining the gain value of the speaker at the frequency point, where the actual acceleration is the acceleration data corresponding to the frequency point output by the inertial sensor.

3. The method according to claim 2, characterized in that After obtaining the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point, the method further includes: When the error between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a second threshold, a prompt message is output, where the prompt message is used to indicate that the speaker calibration fails due to interference in the calibration environment.

4. The method according to claim 2, characterized in that The obtaining of the reference gain value of the speaker at the frequency point and the reference acceleration data corresponding to the frequency point includes: Determining the gain value corresponding to the frequency point in the preset gain curve as the reference gain value of the speaker at the frequency point; Determining the acceleration data corresponding to the frequency point in the preset inertia curve as the reference acceleration data corresponding to the frequency point; The preset gain curve is used to indicate the correspondence between the initial gain value of the speaker and the frequency point, and the preset inertia curve is used to indicate the initial acceleration data collected by the inertial sensor when the speaker outputs an audio signal at the corresponding frequency point according to the initial gain value.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Before acquiring the acceleration data output by the inertial sensor, determining a currently used speaker calibration mode; The speaker is controlled to output an audio signal corresponding to the speaker calibration mode.

6. A loudspeaker calibration device, characterized in that: Applied to electronic equipment, the electronic equipment includes a speaker and an inertial sensor arranged on the same circuit board, the device includes: an acquisition module, configured to acquire acceleration data output by the inertial sensor during the process of the speaker outputting an audio signal; A processing module is configured to adjust a gain value of the speaker based on the acceleration data.

7. The device according to claim 6, characterized in that The audio includes an audio signal of at least one frequency point; The processing module is specifically used to: For each frequency point, perform the following steps respectively: Determining a reference gain value of the speaker at the frequency point and reference acceleration data corresponding to the frequency point; When the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a first threshold, the gain value of the speaker at the frequency point is adjusted with the reference gain value as a starting value until the difference between the actual acceleration data corresponding to the frequency point and the reference acceleration data is less than or equal to the first threshold, thereby obtaining the gain value of the speaker at the frequency point, where the actual acceleration is the acceleration data corresponding to the frequency point output by the inertial sensor.

8. The device according to claim 7, characterized in that The processing module is specifically used to: When the error between the actual acceleration data corresponding to the frequency point and the reference acceleration data is greater than a second threshold, a prompt message is output, where the prompt message is used to indicate that the speaker calibration fails due to interference in the calibration environment.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the loudspeaker calibration method according to any one of claims 1 to 5 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the speaker calibration method according to any one of claims 1 to 5 are implemented.