Methods, devices, storage media and electronic equipment for detecting loudspeaker resonant frequencies

By using a time-domain method and a preset filter to fit the correspondence between current and voltage values, and updating the filter coefficients to determine the resonant frequency of the loudspeaker, the problem of high computational complexity in existing technologies is solved, and real-time detection with low computational complexity is achieved.

CN116506787BActive Publication Date: 2026-06-30SHANGHAI AWINIC TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI AWINIC TECH CO LTD
Filing Date
2023-05-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, methods for detecting the resonant frequency of a loudspeaker, such as frequency domain methods and FIR filters, involve excessive computation, resulting in slow calculations and making them difficult to implement on ordinary electronic devices.

Method used

The time-domain method is adopted, and the relationship between current and voltage values ​​is fitted using a preset filter. The resonant frequency is determined by iteratively updating the filter coefficients, which simplifies the iteration process and reduces the amount of computation.

Benefits of technology

It effectively reduces the amount of computation, reduces the occupation of electronic device resources, realizes the real-time acquisition of the speaker's resonant frequency and status, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506787B_ABST
    Figure CN116506787B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, storage medium, and electronic device for detecting the resonant frequency of a loudspeaker. Applied to a device including a processor, the method involves acquiring first current and first voltage values ​​of a loudspeaker at multiple moments, with the first current and first voltage values ​​acquired at a first moment. A first correspondence between the current and voltage values ​​is determined based on a first filter. A second voltage value is determined based on the first correspondence and the first current value, and this second voltage value indicates the loudspeaker voltage value predicted by the first filter at the first moment. Updated filter coefficients are determined using a preset iterative method based on the first and second voltage values. A second correspondence between the filter coefficients and the resonant frequency is determined based on the first filter. The target resonant frequency is then determined based on the second correspondence and the updated filter coefficients. This reduces computational load, saves operating resources of the electronic device, and improves computational performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, storage medium and electronic device for detecting the resonant frequency of a loudspeaker. Background Technology

[0002] During the loudspeaker manufacturing process, it is necessary to monitor the loudspeaker quality in real time to screen for faulty loudspeakers on the production line. Similarly, during loudspeaker use, it is essential to monitor their operational status in real time to facilitate maintenance. Typically, the loudspeaker's resonant frequency F0 is a direct parameter for determining its quality or operational status; therefore, it is crucial to verify the loudspeaker's resonant frequency F0 in real time.

[0003] Therefore, methods for detecting the resonant frequency of a loudspeaker typically employ frequency domain methods, such as performing FFT analysis on the voltage and current, or iteratively calculating the impedance curve using the transfer function of an FIR filter to obtain the resonant frequency F0. However, these two methods involve extremely large computational loads and place high demands on the performance of electronic equipment, making them difficult for users to apply and implement. Summary of the Invention

[0004] This application provides a method, apparatus, storage medium, and electronic device for detecting the resonant frequency of a loudspeaker, which solves the problem that the computational workload of calculating the resonant frequency using the frequency domain method or FIR filter is too high, resulting in slow calculation.

[0005] In a first aspect, embodiments of this application provide a loudspeaker resonant frequency detection method, applied to a device including a processor. The method includes: acquiring a first current value and a first voltage value of a loudspeaker at multiple moments, wherein the first current value and the first voltage value are acquired at a first moment; determining a first correspondence between the current value and the voltage value based on a first filter, and determining a second voltage value based on the first correspondence and the first current value, wherein the second voltage value is used to indicate the loudspeaker voltage value predicted by the first filter at a first moment; determining updated filter coefficients based on the first voltage value and the second voltage value using a preset iteration method; determining a second correspondence between the filter coefficients and the resonant frequency based on the first filter, and determining a target resonant frequency based on the second correspondence and the updated filter coefficients.

[0006] The method employs a time-domain approach, using a first filter (i.e., a preset filter) to fit and calculate a first correspondence between current and voltage values. Based on this first correspondence and the first current value (i.e., the current current value) acquired at the first moment (i.e., the current time), a second voltage value (i.e., the predicted voltage value at the first moment) is determined. Then, by combining the predicted voltage value with the first voltage value (i.e., the current voltage value) and the second voltage value (i.e., the predicted voltage value at the current moment), updated filter coefficients are iteratively derived, and the target resonant frequency is obtained based on these filter coefficients. Therefore, based on the similarity between the first filter and the speaker's impedance curve, the speaker's resonant frequency can be directly determined from the updated first filter coefficients, effectively simplifying the iteration process, reducing computational load, and avoiding the consumption of significant electronic equipment computing resources.

[0007] In some implementations of the first aspect above, determining the target resonant frequency based on the second correspondence and the updated filter coefficients includes: calculating the updated filter coefficients based on the second correspondence and determining the target resonant frequency, wherein the calculation process of the updated filter coefficients does not include calculating the impedance curve of the loudspeaker and the curve corresponding to the first filter.

[0008] In some implementations of the first aspect mentioned above, acquiring the first current value and the first voltage value of the speaker at multiple moments includes: acquiring the first current value and the first voltage value of the speaker at multiple moments using a preset signal sampling rate.

[0009] In some implementations of the first aspect above, calculating the updated filter coefficients based on the second correspondence and determining the target resonant frequency includes: calculating the updated filter coefficients based on the second correspondence at a preset frequency and determining the target resonant frequency, wherein the preset frequency is less than the preset signal sampling rate.

[0010] In some implementations of the first aspect described above, the first filter includes a peak filter.

[0011] In some implementations of the first aspect above, determining the updated filter coefficients based on the first voltage value and the second voltage value using a preset iteration method includes: determining an error voltage value based on the first voltage value and the second voltage value; and determining the updated filter coefficients based on the error voltage value using a preset iteration method.

[0012] In some implementations of the first aspect above, determining the error voltage value based on the first voltage value and the second voltage value includes: determining the error voltage value based on the first voltage value and the second voltage value using a preset calculation method, wherein the preset calculation method includes any one of the following: subtracting the second voltage value from the first voltage value; or subtracting the first voltage value from the second voltage value; or subtracting the second voltage value from the first voltage value using a weighted average; or subtracting the first voltage value from the second voltage value using a weighted average.

[0013] In some implementations of the first aspect above, the updated filter coefficients are determined based on the error voltage value using a preset iterative method, including: iteratively calculating the error voltage value using a gradient descent algorithm to determine the updated filter coefficients.

[0014] In some implementations of the first aspect above, the updated filter coefficients are determined based on the error voltage value using a preset iterative method, including: iteratively calculating the error voltage value using the least mean square algorithm to determine the updated filter coefficients.

[0015] Secondly, embodiments of this application also provide a loudspeaker resonant frequency detection device. The device includes a data acquisition module and at least one processor. The data acquisition module is used to acquire a first current value and a first voltage value of a loudspeaker at multiple moments, wherein the first current value and the first voltage value are acquired at a first moment. The processor is used to determine a first correspondence between the current value and the voltage value based on a first filter, and to determine a second voltage value based on the first correspondence and the first current value. The second voltage value is used to indicate the loudspeaker voltage value predicted by the first filter at a first moment. An updated filter coefficient is determined based on the first voltage value and the second voltage value using a preset iteration method. A second correspondence between the filter coefficients and the resonant frequency is determined based on the first filter. A target resonant frequency is determined based on the second correspondence and the updated filter coefficients.

[0016] Thirdly, embodiments of this application also provide a machine-readable medium, characterized in that the machine-readable medium stores instructions that, when executed on a machine, cause the machine to perform a loudspeaker resonant frequency detection method as described in any of the implementations of the first aspect above.

[0017] Fourthly, embodiments of this application also provide an electronic device for detecting the resonant frequency of a loudspeaker, comprising: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, one of the processors of the electronic device, for executing a loudspeaker resonant frequency detection method by executing instructions as described in any implementation of the first aspect above. Attached Figure Description

[0018] Figure 1This diagram illustrates a loudspeaker impedance profile according to some embodiments of this application.

[0019] Figure 2A A schematic diagram of the frame of a device 200 for detecting the resonant frequency of a loudspeaker is shown according to an embodiment of this application;

[0020] Figure 2B An interactive flowchart of a loudspeaker resonant frequency detection method is shown according to an embodiment of this application;

[0021] Figure 3 A schematic diagram of the service logic for updating peak filter coefficients is shown according to an embodiment of this application;

[0022] Figure 4 A schematic diagram illustrating a specific implementation method for determining a target resonant frequency is shown in this application embodiment;

[0023] Figure 5 A schematic diagram of the structure of an electronic device 100 is shown according to an embodiment of this application. Detailed Implementation

[0024] To facilitate understanding of the technical solutions provided in the embodiments of this application, the meanings of some related field terms involved in the embodiments of this application are explained below.

[0025] (1) Resonant frequency: In a circuit containing capacitors and inductors, if the capacitors and inductors are connected in parallel, it is possible that within a very short time period, the voltage of the capacitor gradually increases while the current gradually decreases; the current of the inductor gradually increases while the voltage of the inductor gradually decreases. Conversely, within another very short time period, the voltage of the capacitor gradually decreases while the current gradually increases; the current of the inductor gradually decreases while the voltage of the inductor gradually increases. The increase in voltage can reach a positive maximum value, and the decrease in voltage can reach a negative maximum value. Similarly, the direction of the current will change in the positive and negative directions during this process, which is called electrical oscillation of the circuit. When the sinusoidal frequency of the external input voltage of the resonant circuit reaches a certain specific frequency (i.e., the resonant frequency of the circuit), the inductive reactance and capacitive reactance of the resonant circuit are equal, Z = R, and the resonant circuit exhibits purely resistive properties, i.e., resonance. When resonance occurs, the resonant circuit amplifies the input by a factor of Q, where Q is the quality factor.

[0026] (2) Fast Fourier Transform (FFT): This is a general term for efficient and fast computation methods that utilize computers to calculate the Discrete Fourier Transform (DFT). Fourier analysis is the most fundamental method for signal analysis, and the Fourier Transform is the core of Fourier analysis. It transforms signals from the time domain to the frequency domain, allowing the study of the signal's spectral structure and variation patterns. The Fourier Transform, which presents a discrete form in both the time and frequency domains, is called the Discrete Fourier Transform (DTFT), transforming time-domain signal samples into samples in the discrete-time Fourier Transform (DTFT) frequency domain.

[0027] (3) Finite Impulse Response (FIR) Filter: Also known as a non-recursive filter, it is the most basic component in digital signal processing systems. It can guarantee arbitrary amplitude-frequency characteristics while having strictly linear phase-frequency characteristics. At the same time, its unit sample response is finite in length, thus the filter is a stable system. Therefore, FIR filters have wide applications in communication, image processing, pattern recognition and other fields.

[0028] (4) Quality Factor Q: The quality factor, also known as the Q factor, is a dimensionless parameter in physics and engineering. It is a physical quantity that represents the damping properties of an oscillator, and can also represent the magnitude of the oscillator's resonant frequency relative to its bandwidth. A high Q factor indicates that the oscillator loses energy at a slower rate and can vibrate for a longer period of time. For example, a simple pendulum moving in air has a high Q factor, while a simple pendulum moving in oil has a low Q factor. Oscillators with high Q factors generally have lower damping.

[0029] (5) Bandwidth: Also known as frequency range. The frequency components contained in a signal can be observed from the signal spectrum. The difference between the highest and lowest harmonic frequencies contained in a signal, that is, the frequency range possessed by the signal, is defined as the bandwidth of the signal. Therefore, it can be said that the larger the frequency variation range of a signal, the wider its bandwidth.

[0030] (6) Normalization: Normalization is a dimensionless processing method that transforms the absolute values ​​of physical system values ​​into relative values. It is an effective way to simplify calculations and reduce the size of quantities. For example, after normalizing each frequency value in a filter to the cutoff frequency, the frequencies are all relative values ​​of the cutoff frequency and have no dimension. After normalizing the impedance to the internal resistance of the power supply, each impedance becomes a relative impedance value, and the dimension of "ohm" is also eliminated. After all the calculations are completed, denormalization restores everything to its original state.

[0031] (7) Recursive Filter (Infinite Impulse Response, IIR): Also known as an infinite impulse response digital filter, the IIR digital filter adopts a recursive structure, that is, the structure has a feedback loop. The IIR filter operation structure usually consists of basic operations such as delay, multiplication by coefficients, and addition. It can be combined into four structural forms: direct type, quasi-linear type, cascaded type, and parallel type, all of which have feedback loops.

[0032] (8) Gradient Descent: Gradient descent is an iterative method that can be used to solve least squares problems (both linear and nonlinear). It is one of the most commonly used methods for solving model parameters in machine learning algorithms, i.e., unconstrained optimization problems. When finding the minimum value of the loss function, gradient descent can be used to iterate step-by-step to obtain the minimized loss function and model parameter values. In machine learning, two gradient descent methods have been developed based on the basic gradient descent method: stochastic gradient descent and batch gradient descent.

[0033] (9) Least Mean Square (LMS): This is an adaptive filtering algorithm, an optimized extension of Wiener filtering theory using the rapid descent method. This algorithm does not require known statistical characteristics of the input and desired signals; the weights at the "current moment" are obtained by adding a proportional term of the negative mean square error gradient to the weights at the "previous moment." This algorithm is a special type of gradient descent algorithm that does not require repeated use of data or calculations on the correlation and cross-correlation matrices. It only needs to utilize the input vector and the desired response in each iteration. It has advantages such as simple principle, few parameters, fast convergence speed, and ease of implementation.

[0034] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions provided by the embodiments of this application will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0035] In some schemes for calculating the resonant frequency F0, the frequency domain current signal I(i) can be determined by FFT analysis using the following formula (1):

[0036]

[0037] Where N is the number of FFT points, used to characterize the number of current signals acquired.

[0038] Frequency domain voltage signal V(i):

[0039] V(i) = {V1, V2, ..., V} N} (2)

[0040] Based on the obtained current signal I(i) and voltage signal V(i).

[0041] Next, based on the obtained current signal I(i) and voltage signal V(i), the predicted voltage Vp(i) can be obtained by iterative calculation using the frequency domain LMS method. The error voltage value E at the k-th frequency is then calculated. k (i) can then be the V at the k-th frequency obtained from actual measurement. k (i) and the k-th predicted voltage value Vp k The difference between (i) is calculated as shown in the following formula (3):

[0042] E k (i)=V k (i)-Vp k (i) (3)

[0043] Based on the above error voltage value E k (i) The updated impedance Z can then be obtained. k (i+1):

[0044]

[0045] in, For conjugate impedance, Z k (i+1) is the updated impedance, E k (i) represents the error voltage value, μ k (i) represents the iteration step size.

[0046] It is understandable that by using the frequency domain method described above, the current signal value and voltage signal value are analyzed using FFT, and the updated impedance value is determined based on the current signal value and voltage signal value. Then, the corresponding impedance curve can be constructed based on the continuously updated impedance value, and the peak point of the impedance curve can be determined based on the slope method, thereby confirming the resonant frequency F0.

[0047] In this frequency domain method, a more accurate impedance curve is needed to obtain a more precise resonant frequency. The number of FFT points N in this method is a parameter affecting accuracy; a larger N results in higher calculation accuracy. To obtain a more accurate resonant frequency F0, the value of N will be very large. As shown in formula (1), this will result in a very large computational load, requiring significant electronic equipment resources and relying on high computational performance.

[0048] In other schemes for calculating the resonant frequency F0, an FIR filter transfer function model can be established. However, to perform iterative calculations of the impedance curve, an FIR filter requires a series of tap coefficients multiplied by a series of the latest n data samples. FIR filters often require a large number of tap coefficients to fit the impedance curve, such as hundreds. Each tap coefficient consumes multiplier-accumulator units, which are logic resources. Therefore, the iterative calculation of the impedance curve using an FIR filter involves a very large amount of computation on the tap coefficients, relying heavily on the computational performance of the electronic equipment.

[0049] In summary, existing schemes for calculating the resonant frequency F0 involve a large amount of computation, which requires establishing impedance curves through frequency domain methods or FIR filters. These schemes rely on high computing performance of electronic devices and consume a significant amount of the device's operating resources.

[0050] To address the aforementioned issues, this application proposes a method and apparatus for detecting the resonant frequency of a loudspeaker. The method employs a time-domain approach, using a first filter to fit and calculate a first correspondence between current and voltage values. Based on this first correspondence and the first current value, the corresponding voltage value (i.e., the predicted voltage value at the first moment) is determined. Then, according to a preset iterative method, updated filter coefficients are iterated backward from the predicted voltage value, and the target resonant frequency is obtained based on these filter coefficients. Therefore, based on the similarity between the impedance curves of the first filter and the loudspeaker, the resonant frequency of the loudspeaker can be directly determined from the updated first filter coefficients, effectively simplifying the iterative process, reducing computational load, and avoiding the consumption of significant electronic equipment operating resources.

[0051] Understandably, the preset filter needs to have a certain similarity to the speaker's impedance curve. Based on the preset filter, the numerical mapping relationship between current and voltage values ​​can be determined, i.e., the first correspondence. This allows the predicted voltage value to be inferred from the current current value combined with the first correspondence. Furthermore, the loss between the current and predicted voltage values ​​can be used to iterate the preset filter, enabling it to fit the speaker's impedance curve and thus facilitate the determination of the target resonant frequency.

[0052] It is understood that the above-mentioned preset filter can be any filter that has similarity to the impedance curve of the speaker.

[0053] It is understandable that the above-mentioned preset iteration method is not limited here, as long as it can achieve iterative update of the filter coefficients of the preset filter.

[0054] Figure 1 A schematic diagram of a loudspeaker impedance curve provided according to some embodiments of this application is shown.

[0055] Understandably, reference Figure 1Many filters have frequency response curves that are similar to the impedance curves of loudspeakers. The frequency response curve of a filter is determined by the center frequency fc, gain, and quality factor Q.

[0056] The embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0057] Understandably, reference Figure 1 The frequency response curve of a peak filter is similar to that of a loudspeaker. The frequency response curve of a peak filter is determined by the center frequency fc, gain, and quality factor Q.

[0058] To facilitate the determination of the loudspeaker's resonant frequency, Figure 2A A schematic diagram of the frame of a device 200 for detecting the resonant frequency of a loudspeaker is shown according to an embodiment of this application.

[0059] refer to Figure 2A The device 200 includes a data acquisition module 01 and a processor 02.

[0060] The acquisition module 01 is used to acquire the current current value and current voltage value of the speaker at a preset signal sampling rate, and transmit the acquired current current value and current voltage value of the speaker to the processor 02 for further data processing.

[0061] Processor 02 is used to execute program commands to determine the speaker resonant frequency f0 based on the acquired current and voltage values ​​of the speaker. The specific execution process of processor 02 will be explained in detail later and will not be repeated here.

[0062] It is understandable that the above program commands can be packaged in the form of software packages, toolkits, etc., so that users can use them in the corresponding application scenarios, such as applications that can be used to determine the resonant frequency f0 of a loudspeaker in real time.

[0063] Based on the above Figure 2A The structure of the device 200 shown is described below. The specific implementation process of the loudspeaker resonant frequency detection method proposed in this application will be described in detail below with reference to specific embodiments and related drawings.

[0064] Figure 2B An interactive flowchart of a loudspeaker resonant frequency detection method is shown according to an embodiment of this application. It can be understood that... Figure 2B The execution entity for each step of the process shown can be the aforementioned device 200 or other electronic equipment. The execution entity for a single step will not be described in detail.

[0065] like Figure 2B As shown, the interaction process includes the following steps:

[0066] 201: Acquire the current current and voltage values ​​of the speaker at a preset signal sampling rate.

[0067] For example, some electronic devices can be used to obtain the current current value and current voltage value of the speaker. For instance, an analog-to-digital converter (ADC) can be used to acquire the current current value and current voltage value of the speaker at a preset signal sampling rate.

[0068] It is understood that the aforementioned electronic devices include, but are not limited to, analog-to-digital converters, mobile terminals, computers, tablets, etc., and other electronic devices that acquire the current current and voltage values ​​of the speaker are also included and are not limited here.

[0069] In some embodiments, the speaker can be installed in a mobile phone, and the user can use the mobile phone to play a piece of white noise and collect the current current value and current voltage value of the speaker at a preset signal sampling rate.

[0070] In some embodiments, the preset signal sampling rate may include, but is not limited to, 16k, 32k or 48k, as long as it meets the user's sampling requirements, and is not limited here.

[0071] It is understandable that users can collect the current current and voltage values ​​of the speaker at a preset signal sampling rate. These users can be personnel with speaker management privileges, and no restrictions are imposed here.

[0072] 202: Determine the first correspondence between the current value and the voltage value based on the preset filter, and determine the predicted voltage value based on the first correspondence and the current current value.

[0073] Understandably, the preset filter needs to have a certain similarity to the speaker's impedance curve. Based on the preset filter, the numerical mapping relationship between current and voltage values ​​can be determined, i.e., the first correspondence. This allows the predicted voltage value to be inferred from the current current value combined with the first correspondence. Furthermore, the loss between the current and predicted voltage values ​​can be used to iterate the preset filter, enabling it to fit the speaker's impedance curve and thus facilitate the determination of the target resonant frequency.

[0074] It is understood that the above-mentioned preset filter can be any filter that has similarity to the impedance curve of the speaker.

[0075] In some embodiments, the preset filter can be a peak filter (PF). Using a peak filter to fit and calculate the updated filter coefficients of the speaker can effectively simplify the iteration process, reduce computational load, and avoid consuming a large amount of electronic device operating resources.

[0076] It is understandable that the parameters of the peak filter can be mapped one-to-one with the parameters of the speaker, as follows:

[0077] (1) The resonant frequency F0 of the loudspeaker is the center frequency Fc of the peak filter;

[0078] (2) The quality factor Qms of the loudspeaker is the same as the quality factor Q of the peak filter;

[0079] (3) The gain of the peak filter is 20*log10(Zmax / RDC) of the loudspeaker, where Zmax is the maximum impedance of the loudspeaker and RDC is the DC resistance of the loudspeaker.

[0080] Based on the above parameters, it can be seen that the frequency response curve of the peak filter is similar to the impedance curve of the loudspeaker. Therefore, the peak filter can be used as the initial model of the transfer function of the impedance curve.

[0081] Since the frequency response curve of the peak filter is similar to the impedance curve of the loudspeaker, the peak filter can be used to determine the first correspondence between the current value and the voltage value, and the predicted voltage value can be determined based on the first correspondence and the current value.

[0082] For example, since the impedance frequency response curve of a loudspeaker can be approximated as a peak filter, the relationship between the k-th voltage value v(k) and the current i(k) fed back across the loudspeaker can be represented by the difference equation (5) of the peak filter:

[0083]

[0084] Among them, a j (k) is the first coefficient of the peak filter, b j (k) is the second coefficient of the peak filter.

[0085] It is understood that the example in the above formula (5) is a peak filter with no limit on the order, which can be defined by M and N.

[0086] Furthermore, in some other embodiments, the peak filter is a second-order IIR filter, then M = N = 2. In this case, the difference equation (5) above can be normalized to express the following formula (5.1):

[0087] a0×v(k)=b0×i(k)+b1×i(k-1)+b2×i(k-2)-a1×y(k-1)-a2×y(k-2) (5.1)

[0088] Where a0 = 1.

[0089] 203: Determine the error voltage value based on the current voltage value and the predicted voltage value.

[0090] For example, the error voltage value can be determined based on a preset calculation method using the current voltage value and the predicted voltage value. For instance, the error voltage value can be determined by subtracting the predicted voltage value from the current voltage value. In some embodiments, the error voltage value can also be determined by subtracting the current voltage value from the predicted voltage value.

[0091] It is understood that the above-mentioned preset calculation methods include, but are not limited to, subtraction or weighted subtraction, and are not restricted here.

[0092] 204: Determine the updated filter coefficients based on the preset filter and error voltage value using a preset iteration method.

[0093] For example, the updated filter coefficients of a preset filter can be determined based on the error voltage value using a preset iteration method, wherein the updated filter coefficients include updated first coefficients and updated second coefficients.

[0094] For example, the aforementioned preset iteration methods include, but are not limited to, gradient descent iteration or least mean square (LMS) algorithm.

[0095] To determine the updated filter coefficients, the peak filter can be obtained by iterative calculation based on the error voltage value.

[0096] To better understand, Figure 3 An embodiment of this application illustrates a schematic diagram of the business logic for updating peak filter coefficients.

[0097] refer to Figure 3 The current I[k] acquired at time k is input into the peak filter 300 to obtain the predicted current voltage Vp[k] at time k. Then, the current voltage V[k] acquired at time k is obtained, and the current voltage V[k] and the predicted current voltage Vp[k] are calculated using the preset iteration method 302 to determine the current error voltage e[k].

[0098] It is understood that the aforementioned preset iteration method 302 includes, but is not limited to, gradient descent iteration or least mean square (LMS) algorithm. Using the aforementioned preset iteration method 302, the target weight coefficients, i.e., the updated peak filter coefficients, can be directly determined based on the current error voltage e[k].

[0099] The updated filter coefficients are calculated as follows:

[0100] Let the center frequency of the peak filter be fc, the gain be gain, the quality factor be Q, and the signal sampling rate be fs. Then, the following formulas (6), (7), and (8) can be used to calculate the first coefficients a0, a1, and a2 of the updated peak filter and the second coefficients b0, b1, and b2 of the updated peak filter:

[0101]

[0102]

[0103]

[0104] For the sake of formula simplicity, V0 is used as an intermediate variable to represent... It has no other meaning.

[0105] 205: Determine the second correspondence between the filter coefficients and the resonant frequency based on the preset filter, and determine the target resonant frequency according to the second correspondence and the updated filter coefficients.

[0106] For example, the preset filter described above can be a peak filter. In some embodiments, the second correspondence between the filter coefficients and the resonant frequency can be a data mapping relationship between the two. Then, the target resonant frequency can be directly determined based on the updated filter coefficients combined with the second correspondence.

[0107] In some embodiments, the target resonant frequency f0 can be obtained based on the first coefficients a0, a1, and a2 of the updated peak filter and the second coefficients b0, b1, and b2 of the updated peak filter, according to the following formulas (9) to (12):

[0108]

[0109]

[0110]

[0111]

[0112] For the sake of simplicity in the formula, wd is an intermediate variable, and a = -a2.

[0113] It is understandable that the parameters of the peak filter can be mapped one-to-one with the parameters of the speaker, as follows:

[0114] (1) The resonant frequency F0 of the loudspeaker is the center frequency Fc of the peak filter;

[0115] (2) The quality factor Qms of the loudspeaker is the same as the quality factor Q of the peak filter;

[0116] (3) The gain of the peak filter is 20*log10(Zmax / RDC) of the loudspeaker, where Zmax is the maximum impedance of the loudspeaker and RDC is the DC resistance of the loudspeaker.

[0117] Therefore, based on the correspondence between the peak filter parameters and the speaker parameters, the center frequency fc of the peak filter is the target resonant frequency f0 of the speaker, the bandwidth fb of the peak filter is the bandwidth of the speaker, and the quality factor Q of the peak filter is the quality factor Qms of the speaker. The real-time resonant frequency and quality factor of the speaker can be directly determined from the updated peak filter parameters, eliminating the need to determine the real-time resonant frequency f0 from the maximum impedance value in the updated peak filter waveform. This simplifies the iteration process, reduces computational load, enables real-time acquisition of the speaker status, and effectively improves the user experience.

[0118] It is understood that, through the above steps 201 to 205, the loudspeaker resonant frequency detection method disclosed in this application, by sampling the current current value and the current voltage value of the loudspeaker, determines the predicted voltage value by determining the first correspondence between the current value and the voltage value based on a preset filter, and iteratively calculates the difference between the current voltage value and the predicted voltage value, thereby continuously updating the coefficients corresponding to the peak filter, and then directly determining the quality factor and resonant frequency of the loudspeaker based on the updated peak filter coefficients. Compared with the method of using FFT or establishing the FIR filter transfer function, this method effectively simplifies the iteration process, reduces the amount of calculation, and can obtain the status of the loudspeaker in real time.

[0119] Based on the implementation process of step 205 above, the following is combined with Figure 4 The implementation process of step 205 above will be explained in detail.

[0120] Figure 4 A schematic diagram illustrating a specific implementation method for determining a target resonant frequency is shown in this application embodiment.

[0121] refer to Figure 4 The specific implementation process includes the following steps:

[0122] 205a: Determine the second correspondence between filter coefficients and resonant frequency based on a preset filter.

[0123] It is understandable that, since the current current and voltage values ​​are obtained based on a preset sampling frequency, the filter coefficients will be updated and iterated at the preset sampling frequency.

[0124] 205b: Calculate the updated filter coefficients based on the preset frequency and the second correspondence to determine the target resonant frequency.

[0125] For example, the updated filter coefficients are calculated based on a preset frequency according to a second correspondence, wherein the preset frequency is less than the preset sampling frequency, thereby reducing the occupation of electronic device operating resources, reducing the amount of computation, and improving the computing performance of processor 02.

[0126] It is understood that through the above steps 205a to 205b, this application shows an implementation method for determining the resonant frequency of a loudspeaker. By calculating the filter coefficients at a frequency lower than the preset sampling frequency, the computational load is further reduced, the occupation of electronic device operating resources is reduced, and the computational performance of processor 02 is further improved.

[0127] Figure 5 A schematic diagram of the structure of an electronic device 100 is shown according to an embodiment of this application. For example... Figure 5 As shown, the electronic device 100 includes one or more processors 101, system memory 102, non-volatile memory (NVM) 103, communication interface 104, input / output (I / O) devices 105, and system control logic 106 for coupling the processor 101, system memory 102, NVM 103, communication interface 104, and input / output (I / O) devices 105. Wherein:

[0128] Processor 101 may include one or more processing units, such as data processing units or processing circuits including central processing units (CPU), graphics processing units (GPUs), digital signal processors (DSPs), microprocessors (MCUs), artificial intelligence (AI) processors, field programmable gate arrays (FPGAs), neural network processing units (NPUs), etc., and may include one or more single-core or multi-core processors. In some embodiments, processor 101 may be used to execute instructions to implement the above-described loudspeaker resonant frequency detection method.

[0129] System memory 102 is volatile memory, such as random-access memory (RAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc. System memory is used for temporary storage of data and / or instructions. For example, in some embodiments, system memory 102 can be used to store instructions, as well as raw data objects and modified data objects.

[0130] The non-volatile memory 103 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory 103 may include any suitable non-volatile memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), compact disc (CD), digital versatile disc (DVD), solid-state drive (SSD), etc. In some embodiments, the non-volatile memory 103 may also be a removable storage medium, such as a secure digital (SD) memory card. In other embodiments, the non-volatile memory 103 may be used to store instructions, or to store original data objects and modified data objects.

[0131] Specifically, system memory 102 and non-volatile memory 103 may each include a temporary copy and a permanent copy of instruction 107. Instruction 107 may include, when executed by at least one of processors 101, causing electronic device 100 to implement the speaker resonant frequency detection method provided in the embodiments of this application.

[0132] The communication interface 104 may include a transceiver for providing a wired or wireless communication interface for the electronic device 100, thereby enabling communication with any other suitable device via one or more networks. In some embodiments, the communication interface 104 may be integrated into other components of the electronic device 100, for example, the communication interface 104 may be integrated into the processor 101. In some embodiments, the electronic device 100 may communicate with other devices through the communication interface 104. For example, the electronic device 100 may establish a communication connection with the electronic device 200 through the communication interface 104 to send data change requests, obtain original data objects, and send changed data objects to the electronic device 200 through the communication connection.

[0133] Input / output (I / O) device 105 may include input devices such as keyboards and mice, and output devices such as monitors. Users can interact with electronic devices 100 through input / output (I / O) device 105. For example, business personnel can input / select the content to be changed through input / output (I / O) device 105.

[0134] System control logic 106 may include any suitable interface controller to provide any suitable interface to other modules of electronic device 100. For example, in some embodiments, system control logic 106 may include one or more memory controllers to provide an interface to system memory 102 and non-volatile memory 103.

[0135] In some embodiments, at least one of the processors 101 may be packaged together with the logic of one or more controllers for system control logic 106 to form a system in package (SiP). In other embodiments, at least one of the processors 101 may also be integrated on the same chip with the logic of one or more controllers for system control logic 106 to form a system-on-chip (SoC).

[0136] Understandable. Figure 5 The structure of the electronic device 100 shown is merely an example. In other embodiments, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0137] This application also provides a program product for implementing the loudspeaker resonant frequency detection method provided in the above embodiments.

[0138] Various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or combinations of these implementation methods. Embodiments of this application can be implemented as computer modules or module code executing on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0139] Module code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0140] Module code can be implemented using a high-level modular language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used to implement module code when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0141] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0142] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0143] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0144] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0145] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0146] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0147] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0148] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0149] In this specification, the reference to "an embodiment" or "an embodiment" means that a specific feature, structure, or characteristic described in connection with the embodiment is included in at least one exemplary implementation or technology disclosed according to an embodiment of this application. The appearance of the phrase "in an embodiment" in various places in the specification does not necessarily refer to the same embodiment.

[0150] Furthermore, the language used in this specification has been primarily chosen for readability and instructional purposes and may not have been chosen to depict or limit the disclosed subject matter. Therefore, the embodiments disclosed herein are intended to illustrate, and not limit, the scope of the concepts discussed herein.

Claims

1. A method for detecting the resonant frequency of a loudspeaker, applied to a device including a processor, characterized in that, The method includes: The first current value and the first voltage value of the speaker are collected at multiple moments, wherein the first current value and the first voltage value are collected at the first moment; A first correspondence between current and voltage values ​​is determined based on a first filter, and a second voltage value is determined based on the first correspondence and the first current value, wherein the second voltage value is used to indicate the speaker voltage value predicted by the first filter at a first moment; The updated filter coefficients are determined using a preset iteration method based on the first voltage value and the second voltage value; Based on the first filter, a second correspondence is determined between the updated filter coefficients and the resonant frequency. Then, the target resonant frequency is determined based on the second correspondence and the updated filter coefficients. The step of determining the first correspondence between the current value and the voltage value based on the first filter includes: using a time-domain method, using the first filter to fit and calculate the first correspondence between the current value and the voltage value; The step of determining the updated filter coefficients based on the first voltage value and the second voltage value using a preset iteration method includes: continuously iterating the first filter using the loss between the first voltage value and the second voltage value, so that the first filter fits the impedance curve of the loudspeaker.

2. The method according to claim 1, characterized in that, Determining the target resonant frequency based on the second correspondence and the updated filter coefficients includes: The updated filter coefficients are calculated based on the second correspondence to determine the target resonant frequency. The calculation process of the updated filter coefficients does not include calculating the impedance curve of the loudspeaker and the curve corresponding to the first filter.

3. The method according to claim 2, characterized in that, The acquisition of the first current value and first voltage value of the speaker at multiple moments includes: The first current value and first voltage value of the speaker at multiple moments are collected at a preset signal sampling rate.

4. The method according to claim 3, characterized in that, The step of calculating the updated filter coefficients based on the second correspondence and determining the target resonant frequency includes: The updated filter coefficients are calculated based on the second correspondence at a preset frequency to determine the target resonant frequency, wherein the preset frequency is less than the preset signal sampling rate.

5. The method according to claim 1, characterized in that, The first filter includes a peak filter.

6. The method according to claim 1, characterized in that, The step of determining the updated filter coefficients based on the first voltage value and the second voltage value using a preset iteration method includes: The error voltage value is determined based on the first voltage value and the second voltage value; The updated filter coefficients are determined based on the error voltage value using a preset iterative method.

7. The method according to claim 6, characterized in that, The step of determining the error voltage value based on the first voltage value and the second voltage value includes: An error voltage value is determined based on the first voltage value and the second voltage value using a preset calculation method, wherein the preset calculation method includes any one of the following: The first voltage value minus the second voltage value; or The second voltage value minus the first voltage value; or The first voltage value is weighted and the second voltage value is subtracted; or The second voltage value is weighted and the first voltage value is subtracted.

8. The method according to claim 6, characterized in that, The step of determining the updated filter coefficients based on the error voltage value using a preset iterative method includes: The error voltage value is iteratively calculated using the gradient descent algorithm to determine the updated filter coefficients.

9. The method according to claim 6, characterized in that, The step of determining the updated filter coefficients based on the error voltage value using a preset iterative method includes: The error voltage value is calculated iteratively using the least mean square algorithm to determine the updated filter coefficients.

10. A loudspeaker resonant frequency detection device, characterized in that, The device includes a data acquisition module and at least one processor, wherein, The acquisition module is used to acquire the first current value and the first voltage value of the speaker at multiple moments, wherein the first current value and the first voltage value are acquired at the first moment; The processor is configured to determine a first correspondence between current and voltage values ​​based on a first filter, determine a second voltage value based on the first correspondence and the first current value, wherein the second voltage value indicates the speaker voltage value predicted by the first filter at a first moment, determine updated filter coefficients based on the first and second voltage values ​​using a preset iteration method, determine a second correspondence between filter coefficients and resonant frequency based on the first filter, and determine a target resonant frequency based on the second correspondence and the updated filter coefficients. The determination of the first correspondence between current and voltage values ​​based on the first filter includes: using a time-domain method to fit and calculate the first correspondence between current and voltage values ​​using the first filter; the determination of updated filter coefficients based on the first and second voltage values ​​using a preset iteration method includes: continuously iterating the first filter using the loss between the first and second voltage values, such that the first filter fits the impedance curve of the speaker.

11. A machine-readable medium, characterized in that, The machine-readable medium stores instructions that, when executed on the machine, cause the machine to perform the loudspeaker resonant frequency detection method according to any one of claims 1 to 9.

12. An electronic device for detecting the resonant frequency of a loudspeaker, comprising: Memory, used to store instructions executed by one or more processors of an electronic device, and The processor is one of the processors in an electronic device, used to execute the speaker resonant frequency detection method according to any one of claims 1 to 9.