Earphone sound leakage detection method, device, equipment and storage medium
By acquiring the frequency domain signals of the headphone speaker and microphone, calculating the signal-to-noise ratio and transfer function, the accuracy problem of headphone sound leakage detection is solved, the adaptive adjustment of the active noise cancellation strategy is realized, the user's listening experience is improved, and the stability in complex scenarios is guaranteed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2026-03-17
AI Technical Summary
During use, differences in ear canal size and wearing method can lead to external noise interference and sound leakage, affecting the listening experience. Furthermore, current technology struggles to accurately detect sound leakage for effective active noise cancellation.
By acquiring the frequency domain signals of the speaker and microphone, calculating the signal-to-noise ratio, identifying the main sources of sound signals, and calculating the leakage characteristic value based on the transfer function, the sound leakage state of the headphones is characterized.
It achieves accurate detection of headphone sound leakage, supports adaptive adjustment of active noise cancellation strategy, improves user listening experience, and maintains stability in complex scenarios with low power hardware resources.
Smart Images

Figure CN116347286B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of audio data processing technology, and in particular to a method, apparatus, device, and storage medium for detecting sound leakage in headphones. Background Technology
[0002] Different users have different ear canal sizes and wearing methods. In addition, for the sake of wearing comfort, the earphone shell cannot fit the ear canal tightly. This causes users to be disturbed by external noise during use, and the output signal of the earphone also has a certain degree of leakage, which affects the listening experience.
[0003] With the development of headphone technology and smart technology, active noise cancellation has become the preferred choice for manufacturers due to its ability to provide a quiet and comfortable listening experience in many scenarios. However, when headphones implement active noise cancellation, they first need to understand the current sound leakage situation and then perform noise cancellation according to the corresponding calculation strategy. Therefore, accurate detection of headphone sound leakage is an important prerequisite for effective noise cancellation. Summary of the Invention
[0004] This disclosure aims to at least partially address one of the technical problems in the related art.
[0005] The first aspect of this disclosure provides a method for detecting sound leakage in headphones, including:
[0006] The system acquires a first frequency domain signal corresponding to the first audio signal from the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene, wherein the acquisition time of the second audio signal is the same as the acquisition time of the first audio signal.
[0007] Based on the first frequency domain signal and the second frequency domain signal, as well as the acquisition time, calculate the signal-to-noise ratio corresponding to the current scene;
[0008] Based on preset judgment conditions and the signal-to-noise ratio, determine the main sound signal source of the second microphone in the current earphone;
[0009] Based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, a leakage characteristic value corresponding to the acquisition time is calculated. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0010] A second aspect of this disclosure provides a sound leakage detection device for headphones, comprising:
[0011] The acquisition module is used to acquire the first frequency domain signal corresponding to the first audio of the headphone speaker and the second frequency domain signal corresponding to the second audio collected by the first microphone in the current scene, wherein the acquisition time of the second audio is the same as the time corresponding to the first audio.
[0012] The first calculation module is used to calculate the signal-to-noise ratio corresponding to the current scene based on the first frequency domain signal, the second frequency domain signal, and the acquisition time.
[0013] The determination module is used to determine the main sound signal source of the second microphone in the current earphone based on preset judgment conditions and the signal-to-noise ratio;
[0014] The second calculation module is used to calculate the leakage characteristic value corresponding to the acquisition time based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0015] A third aspect of this disclosure provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the sound leakage detection method for headphones as proposed in the first aspect of this disclosure.
[0016] The fourth aspect of this disclosure provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements the sound leakage detection method for headphones as proposed in the first aspect of this disclosure.
[0017] The headphone sound leakage detection method, apparatus, device, and storage medium disclosed herein have the following beneficial effects:
[0018] In this embodiment, firstly, a first frequency domain signal corresponding to the first audio signal of the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene can be acquired. Then, based on the first and second frequency domain signals and the acquisition time, the signal-to-noise ratio (SNR) corresponding to the current scene can be calculated. Next, based on preset judgment conditions and the SNR, the main sound signal source of the second microphone in the headphone is determined. Finally, based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, a leakage feature value corresponding to the acquisition time is calculated. The leakage feature value is used to characterize the sound leakage state of the headphone. Therefore, based on the first frequency domain signal corresponding to the first audio signal of the headphone speaker and the second frequency domain signal corresponding to the first microphone, the corresponding SNR can be determined, thereby identifying the main sound signal source of the second microphone. Then, based on the main sound signal source, the corresponding calculation frequency band and transfer function can be selected, so that the value of the transfer function can be used as the leakage feature value, thus helping to determine the current sound leakage state of the headphone. This facilitates the headphone in determining the corresponding calculation strategy based on the current sound leakage state to improve the user's auditory experience. This method is applicable to low-power hardware resources and ensures the stability of leakage detection in complex scenarios.
[0019] Additional aspects and advantages of this disclosure will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this disclosure. Attached Figure Description
[0020] The above and / or additional aspects and advantages of this disclosure will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, in which:
[0021] Figure 1 This is a schematic flowchart illustrating a sound leakage detection method for headphones provided in an embodiment of this disclosure;
[0022] Figure 2 This is a schematic flowchart illustrating a sound leakage detection method for headphones provided in an embodiment of this disclosure;
[0023] Figure 3 This is a schematic flowchart illustrating a sound leakage detection method for headphones provided in an embodiment of this disclosure;
[0024] Figure 4 This is a schematic diagram of the operation of an earphone provided in an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram illustrating a threshold adjustment for leakage levels provided in an embodiment of this disclosure;
[0026] Figure 6 This is a structural block diagram of a sound leakage detection device for headphones provided in an embodiment of the present disclosure;
[0027] Figure 7 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation
[0028] Embodiments of this disclosure are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure.
[0029] The following description, with reference to the accompanying drawings, outlines an embodiment of a sound leakage detection method, apparatus, computer device, and storage medium for headphones.
[0030] It should be noted that the execution subject of the headphone sound leakage detection method in this embodiment is the headphone sound leakage detection device, which can be implemented by software and / or hardware and can be configured in any electronic device. In the scenario proposed in this disclosure, the headphone can be used as the execution subject. The headphone sound leakage detection method proposed in this embodiment will be described below with "headphone" as the execution subject, and no limitation is made here.
[0031] More specifically, the sound leakage detection method for headphones provided in this disclosure can be applied to the use of TWS headphones (active noise-canceling headphones).
[0032] Figure 1 This is a schematic flowchart of a sound leakage detection method for headphones provided in an embodiment of this disclosure.
[0033] like Figure 1 As shown, the sound leakage detection method for this headset may include the following steps:
[0034] Step 101: Obtain the first frequency domain signal corresponding to the first audio signal of the headphone speaker, and the second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene. The acquisition time of the second audio signal is the same as the acquisition time of the first audio signal.
[0035] The second audio can be the audio captured by the first microphone during the acquisition time in the current scene.
[0036] The acquisition time can be 2s, 1s, or 1.5s.
[0037] The first audio signal can be the sound emitted by a speaker, and the time corresponding to the first audio signal is the same as the acquisition time of the second audio signal.
[0038] For example, if the speaker of the current headphones plays 10 seconds of audio, with the initial playback time being T1 and the end playback time being T2, that is, the duration of T1 and T2 is 10 seconds. If the second audio collected by the first microphone is from T1 to T3, with a duration of 2 seconds, then the audio from T1 to T3 with a duration of 2 seconds can be extracted as the first audio. Therefore, at this time, the start and reception times of the first audio and the second audio are the same, and the duration of both is 2 seconds.
[0039] The first microphone can be a feedforward microphone configured in the headphones, typically used to identify ambient noise.
[0040] The current scene can be the current location of the headphones, such as a classroom, a car, an office, a park, an amusement park, etc., without any restrictions.
[0041] The first frequency domain signal can be the frequency domain signal corresponding to the first audio signal.
[0042] The second frequency domain signal can be the frequency domain signal corresponding to the second audio frequency.
[0043] Optionally, the first audio signal from the speaker of the headphones and the second audio signal collected by the first microphone in the current scene can be sampled based on a preset sampling frequency to obtain a first time-domain signal and a second time-domain signal. Then, the first time-domain signal and the second time-domain signal can be processed by framing, windowing and Fourier transform to obtain a first frequency-domain signal corresponding to the first time-domain signal of each frame and a second frequency-domain signal corresponding to the second time-domain signal.
[0044] The first time-domain signal is the time-domain signal obtained by sampling the first audio signal at a preset sampling frequency. The second time-domain signal is the time-domain signal obtained by sampling the second audio signal at a preset sampling frequency.
[0045] The preset sampling frequency can be a predetermined sampling frequency for the audio signal, such as 48kHz, 44.1kHz, 24kHz, 16kHz, or 8kHz, and is not limited here. Optionally, in this disclosure, 16kHz can be selected as the preset sampling frequency, and is not limited here.
[0046] For example, let s(n) be the first time-domain signal acquired by the speaker, and f(n) be the second time-domain signal acquired by the first microphone. After obtaining the first time-domain signal s(n) and the second time-domain signal f(n), the first time-domain signal and the second time-domain signal can be framed according to preset framing parameters.
[0047] The preset framing parameters can include frame length and frame shift. The frame length can be 64ms, 32ms, 16ms, etc. Optionally, in this disclosure, 32ms can be selected as the frame length, and this is not limited. As an example, the frame shift can be half the frame length, i.e., 16ms, or it can be a quarter of the frame length, such as 8ms, and this is not limited.
[0048] Furthermore, when windowing the framed time-domain signal, it is necessary to window the time-domain signal of each frame. Specifically, the first and second time-domain signals after framing can be windowed using the following formula:
[0049] s(k,m)=s((k-1)×inc+m)*w(m) (1)
[0050] f(k,m)=f((k-1)×inc+m)*w(m) (2)
[0051] In formula (1), s(k,m) is the data after windowing the first time domain signal of the kth frame, f(k,m) in formula (2) is the data after windowing the second time domain signal of the kth frame, inc is the frame shift, m (1≤m≤L) is the intra-frame index, and L is the number of sampling points in the time domain signal of each frame.
[0052] Where w(m) is a window function, such as a Hanning window or a Hamming window, which is not limited here. In this disclosure, a Hanning window can be selected as an example.
[0053] Furthermore, after windowing the first time-domain signal and the second time-domain signal of each frame, a Fourier transform (FFT) operation can be performed on the data of each frame to obtain the first frequency domain signal S(k,m) corresponding to the first time-domain signal of each frame and the second frequency domain signal F(k,m) corresponding to the second time-domain signal of each frame.
[0054] It should be noted that the above example is only an illustrative example and is not intended to be limiting.
[0055] Step 102: Calculate the signal-to-noise ratio corresponding to the current scene based on the first frequency domain signal, the second frequency domain signal, and the acquisition time.
[0056] For example, if the current headphones need to detect sound leakage at time t1, the time period between t0 and t1 can be used as the second audio acquisition time. The corresponding time length can be preset, such as 2 seconds. That is to say, the time interval between t0 and t1 is 2 seconds, and the time 2 seconds before time t1 is used as the second audio acquisition time.
[0057] The signal-to-noise ratio (SNR) is the ratio of the strength of the received useful signal to the strength of the received interference signal.
[0058] It should be noted that different scenarios have different characteristics. For example, the level of external noise varies, and therefore the signal-to-noise ratio will also vary.
[0059] Specifically, when calculating the signal-to-noise ratio corresponding to the current scene, the energy corresponding to each frame can be calculated first based on the first and second frequency domain signals of each frame corresponding to the acquisition time. Through calculation, the first frequency domain signal S(k,m) and the second frequency domain signal F(k,m) of each frame can be converted into energy E. s (k,m) and E F (k,m), then E can be calculated. s (k,m) and E F The energy ratio λ(k,m) between (k,m) is:
[0060]
[0061] Furthermore, the energy ratio of each frame in decibels can be used as the signal-to-noise ratio ψ:
[0062]
[0063] Where K is the total number of frames in the calculation, which is related to the acquisition time.
[0064] It should be noted that, since the main energy of the audio signal is concentrated in the low frequency and in order to meet the power consumption requirements of active noise-canceling headphones, in this embodiment of the disclosure, only the energy of the 100-1000Hz frequency band can be calculated, that is, the value range of the corresponding intra-frame index m can be [3,32], which is not limited here.
[0065] Step 103: Determine the main sound signal source of the second microphone in the current earphone based on the preset judgment conditions and signal-to-noise ratio.
[0066] The second microphone can be the headphone's feedback microphone, which is usually located inside the ear when the user wears the headphones.
[0067] Among them, the preset judgment conditions can be pre-set conditions used to determine the main sound signal source of the second microphone based on the signal-to-noise ratio.
[0068] The main source of the sound signal can be external interference noise, or it can be the audio played by the speaker.
[0069] One possible approach is to determine the primary source of the audio signal from the second microphone in the current headset using the following method:
[0070] Optionally, if the signal-to-noise ratio is less than a preset threshold, the main source of the sound signal from the second microphone in the current earphone is determined to be external noise.
[0071] The preset threshold can be a preset signal-to-noise ratio (SNR) threshold. If the SNR is less than the preset threshold, the primary source of the sound signal from the second microphone in the current earphone is determined to be external noise.
[0072] Optionally, if the signal-to-noise ratio is greater than or equal to a preset threshold, the primary audio signal source of the second microphone is determined to be the sound played by the speaker.
[0073] like Figure 4 As shown, in Figure 4In the earphone, there is a chip (i.e., processor), speaker, feedforward microphone, and feedback microphone. The feedforward microphone can detect ambient noise, while the feedback microphone usually receives the sound near the speaker. The chip can generate corresponding anti-phase noise based on the current sound leakage to cancel the noise, so that the human ear receives the canceled noise.
[0074] Step 104: Based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, calculate the leakage characteristic value corresponding to the acquisition time. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0075] The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0076] It should be noted that when the main source of sound signal is external noise, the magnitude of the leakage characteristic value is directly proportional to the amount of sound leakage; when the main source of sound signal is sound emitted by a loudspeaker, the magnitude of the leakage characteristic value is inversely proportional to the amount of sound leakage.
[0077] It is understandable that sound leakage from headphones includes: ambient noise leaking into the ear canal, and audio played by the speaker leaking outwards.
[0078] The transfer function is a function with sound leakage as the dependent variable and the first and second frequency domain signals as independent variables. Different primary sound signal sources correspond to different transfer functions.
[0079] In this disclosure, the calculated value of the transfer function can be used as the leakage characteristic value.
[0080] The calculated frequency band can be the effective frequency range. It should be noted that the calculated frequency band can also be selected from different frequency ranges depending on the primary sound signal source of the second microphone.
[0081] As an example, if the main sound signal source of the second microphone in the current headphones is external noise, the corresponding calculated frequency band can be 1000-2000Hz. If the main sound signal source of the second microphone in the current headphones is sound played by a speaker, the corresponding calculated frequency band can be 100-600Hz. No limit is imposed here.
[0082] Specifically, if the primary audio signal source for the second microphone in the current headphones is the sound played from the speaker, then the corresponding transfer function can be:
[0083]
[0084] Wherein, the calculated result of η(k,m) is the leakage characteristic value. Let F(k,m) represent the conjugate of S(k,m), where S(k,m) is the signal in the first frequency domain and F(k,m) is the signal in the second frequency domain. It should be noted that the calculated frequency band corresponding to the sound emitted by the loudspeaker can be 100–600 Hz.
[0085] Optionally, the range of values for m corresponding to the calculation frequency band can be determined based on a preset mapping relationship; for example, m ∈ [3, 20] corresponds to 100–600 Hz. Further, η(k, m) can be calculated according to the above formula. It should be noted that since m ∈ [3, 20], k ∈ [1, K], and K is the total number of frames divided into the first or second frequency domain signal, the obtained leakage characteristic value is a numerical range.
[0086] Specifically, the average of this range can be used as the leakage characteristic value corresponding to the current acquisition time and the main sound signal source (the sound played by the speaker).
[0087] Similarly, if the primary source of the sound signal from the second microphone in the current headphones is external noise, then the corresponding transfer function can be:
[0088]
[0089] Wherein, the calculated result of η(k,m) is the leakage characteristic value. Let S(k,m) represent the conjugate of F(k,m), where S(k,m) is the first frequency domain signal and F(k,m) is the second frequency domain signal. It should be noted that the calculation frequency band corresponding to external noise can be 1000–2000 Hz.
[0090] Optionally, the range of values for m corresponding to the calculation frequency band can be determined based on a preset mapping relationship; for example, m∈[32,64] corresponds to 1000~2000Hz. Further, η(k,m) can be calculated according to the above formula. It should be noted that since m∈[32,64], k∈[1,K], and K is the total number of frames divided into the first or second frequency domain signal, the obtained leakage characteristic value is a numerical range.
[0091] Specifically, the average of this range can be used as the leakage characteristic value corresponding to the current acquisition time and the main source of sound signal (external noise).
[0092] It should be noted that, in this disclosure, the leakage characteristic value can be used to determine the corresponding leakage status of the headphones. For example, if the main sound signal source is the sound played by the speaker, the larger the leakage characteristic value, the less sound leakage the headphones currently have, and the smaller the sound leakage amount. Conversely, the smaller the leakage characteristic value, the more sound leakage the headphones currently have, and the larger the sound leakage amount.
[0093] If the main source of the sound signal is external noise, the larger the leakage characteristic value, the more sound leakage the headphones are experiencing and the greater the sound leakage amount. The smaller the leakage characteristic value, the less sound leakage the headphones are experiencing and the smaller the sound leakage amount.
[0094] In this embodiment, firstly, a first frequency domain signal corresponding to the first audio signal of the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene can be acquired. Then, based on the first and second frequency domain signals and the acquisition time, the signal-to-noise ratio (SNR) corresponding to the current scene can be calculated. Next, based on preset judgment conditions and the SNR, the main sound signal source of the second microphone in the headphone is determined. Finally, based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, a leakage feature value corresponding to the acquisition time is calculated. The leakage feature value is used to characterize the sound leakage state of the headphone. Therefore, based on the first frequency domain signal corresponding to the first audio signal of the headphone speaker and the second frequency domain signal corresponding to the first microphone, the corresponding SNR can be determined, thereby identifying the main sound signal source of the second microphone. Then, based on the main sound signal source, the corresponding calculation frequency band and transfer function can be selected, so that the value of the transfer function can be used as the leakage feature value, thus indicating the current sound leakage state of the headphone. This facilitates the headphone in determining the corresponding calculation strategy based on the current sound leakage state to improve the user's auditory experience. This method is applicable to low-power hardware resources and ensures the stability of leakage detection in complex scenarios.
[0095] Figure 2 This is a schematic flowchart of the sound leakage detection method for headphones provided in an embodiment of this disclosure.
[0096] like Figure 2 As shown, the sound leakage detection method for this headset may include the following steps:
[0097] Step 201: Obtain the first frequency domain signal corresponding to the first audio signal of the headphone speaker, and the second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene. The acquisition time of the second audio signal is the same as the acquisition time of the first audio signal.
[0098] It should be noted that the specific implementation of step 201 can be referred to the above embodiments, and will not be repeated here.
[0099] Step 202: Based on the acquisition time and preset framing parameters, calculate the total number of frames for the first frequency domain signal or the second frequency domain signal, wherein the total number of frames for the first frequency domain signal and the second frequency domain signal is the same.
[0100] The preset framing parameters can be frame length and frame shift. The frame length can be 64ms, 32ms, 16ms, etc. Optionally, in this disclosure, 32ms can be selected as the frame length, which is not limited here. As an example, the frame shift can be half the frame length, i.e., 16ms, or it can be a quarter of the frame length, such as 8ms, which is not limited here.
[0101] For example, if the time-domain signal acquired during the current audio acquisition time is 48ms, the frame length is 16ms, and the frame shift is 8ms, then the total number of frames currently divided can be calculated to be 5 frames.
[0102] That is, (48ms-16ms) / 8ms+1 frame = 5 frames.
[0103] It should be noted that since there is a one-to-one correspondence between the time domain signal and the frequency domain signal in each frame, the total number of frames for dividing the frequency domain signal is also 5 frames. This example is only for illustration and is not intended to be limiting.
[0104] Step 203: Calculate the first energy value corresponding to the first frequency domain signal and the second energy value corresponding to the second frequency domain signal for each frame.
[0105] The first energy value can be the energy value corresponding to the first frequency domain signal of each frame.
[0106] The second energy value can be the energy value corresponding to the second frequency domain signal of each frame.
[0107] Specifically, energy can be calculated using the following formula:
[0108] E s (k,m)=S r (k,m)×S r (k,m)+S i (k,m)×S i (k,m) (7)
[0109] E F (k,m)=F r (k,m)×F r (k,m)+F i (k,m)×F i (k,m) (8)
[0110] Among them, S r (k,m) represents the real part of the data corresponding to the first frequency domain signal of each frame, S i (k,m) represents the imaginary part of the data corresponding to the first frequency domain signal in each frame, E s (k,m) represents the corresponding first energy value.
[0111] Among them, Fr (k,m) represents the real part of the data corresponding to the second frequency domain signal in each frame, F i (k,m) represents the imaginary part of the data corresponding to the second frequency domain signal in each frame, E F (k,m) represents the corresponding second energy value.
[0112] Step 204: Determine the frame number corresponding to each first energy value and second energy value.
[0113] For example, if the first frequency domain signal is divided into 4 frames in chronological order, namely A1, A2, A3, and A4, and the second frequency domain signal is divided into 4 frames in chronological order, namely B1, B2, B3, and B4, where the first energy values corresponding to A1, A2, A3, and A4 are E1, E2, E3, and E4 respectively; and the second energy values corresponding to B1, B2, B3, and B4 are Y1, Y2, Y3, and Y4 respectively, then the frame numbers corresponding to E1, E2, E3, and E4 are 1, 2, 3, and 4 respectively, and the frame numbers corresponding to B1, B2, B3, and B4 are 1, 2, 3, and 4 respectively, without further restriction.
[0114] Step 205: Calculate the energy value ratio corresponding to each frame number, where the energy value ratio is the ratio between the first energy value and the second energy value corresponding to the same frame number.
[0115] For example, since E1, E2, E3, and E4 correspond to frame numbers 1, 2, 3, and 4 respectively, and B1, B2, B3, and B4 correspond to frame numbers 1, 2, 3, and 4 respectively, meaning that E1 and B1, E2 and B2, E3 and B3, and E4 and B4 have the same frame number, the ratio of E1 to B1 can be used as the energy value ratio corresponding to frame number "1", the ratio of E2 to B2 as the energy value ratio corresponding to frame number "2", the ratio of E3 to B3 as the energy value ratio corresponding to frame number "3", and the ratio of E4 to B4 as the energy value ratio corresponding to frame number "4". No further restrictions are imposed here.
[0116] Step 206: Calculate the signal-to-noise ratio corresponding to the current scene based on the total number of frames and the energy value ratio corresponding to each frame number.
[0117] Optionally, the average energy ratio corresponding to each frame number can be calculated first, and then the decibel value of the energy ratio can be determined as the signal-to-noise ratio corresponding to the current scene, as shown in the following formula:
[0118]
[0119] in, Let ψ be the average of the energy ratios corresponding to each frame number, K be the total number of frames, m be the intra-frame index (which can range from 3 to 32), and λ(k,m) be the energy ratio corresponding to the k-th frame.
[0120] Step 207: Determine the main sound signal source of the second microphone in the current earphone based on the preset judgment conditions and the signal-to-noise ratio.
[0121] Step 208: Based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, calculate the leakage characteristic value corresponding to the acquisition time. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0122] It should be noted that the specific implementation methods of steps 207 and 208 can refer to the above embodiments, and will not be repeated here.
[0123] In this embodiment, firstly, a first frequency domain signal corresponding to the first audio signal of the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene are acquired. Then, based on the acquisition time and preset framing parameters, the total number of frames divided for the first or second frequency domain signal is calculated. Where the total number of frames divided for the first and second frequency domain signals is the same, the first energy value corresponding to the first frequency domain signal and the second energy value corresponding to the second frequency domain signal are calculated for each frame. Then, the frame number corresponding to each first energy value and the second energy value is determined. Then, the energy value ratio corresponding to each frame number is calculated. Wherein, the energy value ratio is the ratio between the first energy value and the second energy value corresponding to the same frame number. Then, based on the total number of frames and the energy value ratio corresponding to each frame number, the signal-to-noise ratio corresponding to the current scene is calculated. Then, based on the preset judgment conditions and the signal-to-noise ratio, the main sound signal source of the second microphone in the headphone is determined. Then, based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, the leakage feature value corresponding to the acquisition time is calculated. The leakage feature value is used to characterize the sound leakage state of the headphone. Therefore, by comparing the signal energy of the speaker and the first microphone, the signal-to-noise ratio of the current scene can be determined, which is the main source of the signal received by the second microphone. Different calculation strategies can be adaptively switched by the "signal-to-noise ratio", so that the headphones can determine the corresponding calculation strategy according to the current sound leakage state to improve the user's listening experience. It can be applied to low-power hardware resources and ensure the stability of leakage detection in complex scenarios.
[0124] Figure 3 This is a schematic flowchart of the sound leakage detection method for headphones provided in an embodiment of this disclosure.
[0125] like Figure 3As shown, the sound leakage detection method for this headset may include the following steps:
[0126] Step 301: Obtain the first frequency domain signal corresponding to the first audio signal of the headphone speaker, and the second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene. The acquisition time of the second audio signal is the same as the acquisition time of the first audio signal.
[0127] Step 302: Calculate the signal-to-noise ratio corresponding to the current scene based on the first frequency domain signal, the second frequency domain signal, and the acquisition time.
[0128] Step 303: Determine the main sound signal source of the second microphone in the current earphone based on the preset judgment conditions and the signal-to-noise ratio.
[0129] Step 304: Based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, calculate the leakage characteristic value corresponding to the acquisition time. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0130] It should be noted that the specific implementation of steps 301-304 can be referred to the above embodiments, and will not be repeated here.
[0131] Step 305: Obtain the numerical distribution range of the leakage characteristic values within the target acquisition time period, as well as the main sound signal sources within the target acquisition time period.
[0132] The target acquisition time period can be the first acquisition period when leakage detection is performed after the current earphone moves to a new scene. For example, if scene A is moving to scene B, a period of sound acquisition is required first, and this period can be used as the target acquisition time period.
[0133] The target data collection time period can be a preset fixed value, and is not limited here.
[0134] It should be noted that when obtaining the leakage characteristic value within the target acquisition time period, it can be done in the manner described in the above embodiments, that is, by calculating the sound leakage amount obtained by calculating the transfer function and the corresponding calculation frequency band, as well as the main sound signal source corresponding to the target acquisition time period. It should also be noted that the leakage characteristic value corresponding to the target acquisition time period is a numerical distribution range.
[0135] Step 306: Based on preset rules, divide the numerical distribution range to determine the leakage level mapped to each leakage characteristic value.
[0136] It should be noted that when the primary sound signal source during the target acquisition period is sound emitted from a loudspeaker, a larger leakage characteristic value within the numerical distribution interval corresponds to a lower leakage level. Conversely, a smaller leakage characteristic value within the numerical distribution interval corresponds to a higher leakage level.
[0137] When the primary source of sound signal during the target acquisition period is external noise, the larger the leakage characteristic value within the numerical distribution interval, the higher the corresponding leakage level. Conversely, the smaller the leakage characteristic value within the numerical distribution interval, the lower the corresponding leakage level.
[0138] For example, if the currently determined numerical distribution range is a1-a2, where a1 is the lower limit of the leakage characteristic value within the target acquisition time period and a2 is the upper limit of the leakage characteristic value within the target acquisition time period, if the main sound signal source is sound emitted by a loudspeaker, then the leakage level corresponding to a1 is relatively high, and the leakage level corresponding to a2 is relatively low. If the main sound signal source is external noise, then the leakage level corresponding to a1 is relatively low, and the leakage level corresponding to a2 is relatively high; this is not a limitation here.
[0139] Step 307: Obtain the mapping table corresponding to the current main sound signal source.
[0140] It should be noted that the mapping tables for different primary sound signal sources are different.
[0141] The mapping table is a pre-stored mapping table between leakage characteristic values and leakage levels.
[0142] Step 308: Based on the mapping table, determine the leakage level corresponding to the leakage characteristic value.
[0143] It should be noted that, as one possible approach, the leakage level of the current headphones can be calculated directly based on the currently calculated leakage characteristic value.
[0144] For example, if the leakage characteristic value is divided into three intervals, namely D1, D2, and D3, the corresponding leakage levels are level 1, level 2, and level 3, respectively. If the leakage characteristic value is located in the range of D2, it means that the current leakage level of the headphones is level 2.
[0145] As another possible implementation, if the current leakage characteristic value belongs to leakage level N, and the headphones detect that the leakage characteristic value is gradually approaching the boundary threshold between leakage level N and leakage level N+1, the boundary threshold is increased by a preset adjustment amount, where N is a positive number.
[0146] Alternatively, if the current leakage characteristic value belongs to leakage level N+1, and the leakage characteristic value is detected to be gradually approaching the boundary threshold between leakage level N and leakage level N+1, the boundary threshold is reduced by a preset adjustment amount.
[0147] The threshold is the boundary value between leakage level N and leakage level N+1.
[0148] Among them, the preset adjustment amount (margin) n ) represents the preset threshold adjustment amount.
[0149] like Figure 5 As shown, Figure 5 It includes three leakage levels: n, n-1, and n+1, where the boundary between n and n+1 is defined as TH. n In actual detection scenarios, if the leakage level is n, and the leakage characteristic value gradually approaches TH... n At this point, the interval boundary (i.e., the threshold) can be adjusted to TH. n +margin n Conversely, if the leakage level is n+1, and the leakage characteristic value gradually approaches TH... n At this time, the threshold TH can be defined. n Adjusted to TH n -margin n Among them, margin n This refers to the preset adjustment amount mentioned above. This significantly increases the stability and robustness of the algorithm, thereby improving the user's listening experience and effectively ensuring the stability of leak detection in complex scenarios.
[0150] Step 309: Implement the noise reduction strategy corresponding to the leakage level.
[0151] The noise reduction strategy corresponds to the leakage level, with different leakage levels requiring different noise reduction strategies. The headphones can adaptively generate the inverse phase noise to be generated based on the noise reduction strategy corresponding to the leakage level, thereby compensating for leakage and ensuring a consistent listening experience for users in various scenarios.
[0152] In this embodiment, firstly, a first frequency domain signal corresponding to the first audio signal of the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene can be obtained. Then, based on the first and second frequency domain signals and the acquisition time, the signal-to-noise ratio corresponding to the current scene can be calculated. Then, based on preset judgment conditions and the signal-to-noise ratio, the main sound signal source of the second microphone in the headphone can be determined. Finally, based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, the leakage characteristic value within the acquisition time is calculated. Then, the numerical distribution interval corresponding to the leakage characteristic value within the target acquisition time period and the main sound signal source corresponding to the target acquisition time period are obtained. Based on preset rules, the numerical distribution interval is divided to determine the leakage level mapped by each leakage characteristic value. Then, the mapping relationship table corresponding to the current main sound signal source is obtained. Then, based on the mapping relationship table, the leakage level corresponding to the leakage characteristic value is determined. Finally, the noise reduction strategy corresponding to the leakage level is executed. Therefore, a mapping table corresponding to the main sound signal source can be determined in advance based on the numerical distribution range of the leakage characteristic value within the target acquisition time period. This makes it easier to directly determine the corresponding leakage level based on the leakage characteristic value, thereby ensuring that the headphones can execute accurate and reliable noise reduction strategies. This solves the problem that in real-world scenarios, the speaker volume may be low and the external noise may be high, leading to large errors in the detection and calculation strategies when the speaker is playing sound.
[0153] To achieve the above embodiments, this disclosure also proposes a sound leakage detection device for headphones.
[0154] Figure 6 This is a structural block diagram of the headphone sound leakage detection device provided in the fourth embodiment of this disclosure.
[0155] like Figure 6 As shown, the sound leakage detection device 600 for the headphones may include:
[0156] The acquisition module 610 is used to acquire the first frequency domain signal corresponding to the first audio of the headphone speaker and the second frequency domain signal corresponding to the second audio collected by the first microphone in the current scene, wherein the acquisition time of the second audio is the same as the time corresponding to the first audio.
[0157] The first calculation module 620 is used to calculate the signal-to-noise ratio corresponding to the current scene based on the first frequency domain signal, the second frequency domain signal, and the acquisition time.
[0158] The determining module 630 is used to determine the main sound signal source of the second microphone in the current earphone based on preset judgment conditions and the signal-to-noise ratio;
[0159] The second calculation module 640 is used to calculate the leakage characteristic value corresponding to the acquisition time based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band. The leakage characteristic value is used to characterize the sound leakage state of the headphones.
[0160] Optionally, the acquisition module is specifically used for:
[0161] Based on a preset sampling frequency, the first audio signal from the speaker of the headphones and the second audio signal collected by the first microphone in the current scene are sampled respectively to obtain a first time domain signal and a second time domain signal;
[0162] The first time-domain signal and the second time-domain signal are respectively processed by framing, windowing and Fourier transform to obtain the first frequency domain signal corresponding to the first time-domain signal in each frame and the second frequency domain signal corresponding to the second time-domain signal.
[0163] Optionally, the first calculation module is specifically used for:
[0164] The first calculation unit is used to calculate the total number of frames divided for the first frequency domain signal or the second frequency domain signal based on the acquisition time and preset framing parameters, wherein the total number of frames divided for the first frequency domain signal and the second frequency domain signal is the same;
[0165] The second calculation unit is used to calculate the first energy value corresponding to the first frequency domain signal and the second energy value corresponding to the second frequency domain signal in each frame, respectively.
[0166] The first determining unit is used to determine the frame number corresponding to each of the first energy value and the second energy value;
[0167] The third calculation unit is used to calculate the energy value ratio corresponding to each frame number, wherein the energy value ratio is the ratio between the first energy value and the second energy value corresponding to the same frame number;
[0168] The fourth calculation unit is used to calculate the signal-to-noise ratio corresponding to the current scene based on the total number of frames and the energy value ratio corresponding to each frame number.
[0169] Optionally, the four computing units are specifically used for:
[0170] Calculate the average of the energy value ratios corresponding to each of the frame numbers;
[0171] The decibel value of the energy value ratio is determined as the signal-to-noise ratio corresponding to the current scene.
[0172] Optional, determine the module, specifically used for
[0173] If the signal-to-noise ratio is less than a preset threshold, it is determined that the main source of the sound signal in the second microphone of the current earphone is external noise;
[0174] If the signal-to-noise ratio is greater than or equal to the preset threshold, the primary sound signal source of the second microphone is determined to be the sound played by the speaker.
[0175] Optionally, the second computing module further includes:
[0176] The acquisition unit is used to acquire the mapping table corresponding to the current main sound signal source;
[0177] The second determining unit is used to determine the leakage level corresponding to the leakage characteristic value based on the mapping relationship table;
[0178] An execution unit is used to execute a noise reduction strategy corresponding to the leakage level.
[0179] Optionally, the acquisition unit is further used for
[0180] Obtain the numerical distribution range of the leakage characteristic value within the target acquisition time period, and the main sound signal source corresponding to the target acquisition time period;
[0181] Based on preset rules, the numerical distribution range is divided to determine the leakage level mapped to each leakage characteristic value.
[0182] Optionally, the device may also include:
[0183] The first adjustment module is used to increase the threshold by a preset adjustment amount when the current leakage characteristic value belongs to the leakage level N and the leakage characteristic value is detected to be gradually approaching the threshold between the leakage level N and the leakage level N+1, where N is a positive number;
[0184] The second adjustment module is used to reduce the threshold by the preset adjustment amount when the current leakage characteristic value belongs to the leakage level N+1 and the leakage characteristic value is detected to be gradually approaching the boundary threshold between the leakage level N and the leakage level N+1.
[0185] In this embodiment, firstly, a first frequency domain signal corresponding to the first audio signal of the headphone speaker and a second frequency domain signal corresponding to the second audio signal collected by the first microphone in the current scene can be obtained. Then, based on the first and second frequency domain signals and the acquisition time, the signal-to-noise ratio (SNR) corresponding to the current scene can be calculated. Next, based on preset judgment conditions and the SNR, the main sound signal source of the second microphone in the headphone is determined. Finally, based on the transfer function corresponding to the main sound signal source and the corresponding calculation frequency band, a leakage feature value corresponding to the acquisition time is calculated. The leakage feature value is used to characterize the sound leakage state of the headphone. Therefore, based on the first frequency domain signal corresponding to the first audio signal of the headphone speaker and the second frequency domain signal corresponding to the first microphone, the corresponding SNR can be determined, thereby identifying the main sound signal source of the second microphone. Then, based on the main sound signal source, the corresponding calculation frequency band and transfer function can be selected, so that the value of the transfer function can be used as the leakage feature value, thereby confirming the current sound leakage state of the headphone. This facilitates the headphone in determining the corresponding calculation strategy based on the current sound leakage state to improve the user's auditory experience. This method is applicable to low-power hardware resources and ensures the stability of leakage detection in complex scenarios.
[0186] To implement the above embodiments, this disclosure also proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the headphone sound leakage detection method proposed in the foregoing embodiments of this disclosure.
[0187] To implement the above embodiments, this disclosure also proposes a non-transitory computer-readable storage medium storing a computer program, which, when executed by a processor, implements the headphone sound leakage detection method as proposed in the foregoing embodiments of this disclosure.
[0188] To implement the above embodiments, this disclosure also proposes a computer program product that, when the instruction processor in the computer program product is executed, performs the headphone sound leakage detection method as proposed in the foregoing embodiments of this disclosure.
[0189] Figure 7 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Figure 7 The computer device 12 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0190] like Figure 7As shown, the computer device 12 is represented in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and a bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0191] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0192] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0193] Memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 7 Not shown; usually referred to as a "hard drive"). Although Figure 7Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this disclosure.
[0194] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this disclosure.
[0195] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with computer device 12, and / or with any device that enables computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0196] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the foregoing embodiments.
[0197] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0198] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0199] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of this disclosure includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of this disclosure pertain.
[0200] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0201] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0202] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0203] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0204] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A method of sound leakage detection for a headphone, the method comprising: The method comprises: obtaining a first frequency domain signal corresponding to first audio of a loudspeaker of a headset, and a second frequency domain signal corresponding to second audio collected by a first microphone in a current scene, the collection time of the second audio being the same as the time corresponding to the first audio; calculating a signal-to-noise ratio corresponding to the current scene according to the first frequency domain signal and the second frequency domain signal, and the collection time; determining a main sound signal source of a second microphone in the current headset according to a preset judgment condition and the signal-to-noise ratio; calculating a leakage characteristic value corresponding to the collection time based on a transfer function corresponding to the main sound signal source and a corresponding calculation frequency band, the leakage characteristic value being used to represent a sound leakage state of the headset, wherein the transfer function is a function with sound leakage amount as the dependent variable and the first frequency domain signal and the second frequency domain signal as the independent variables.
2. The method of claim 1, wherein, The method comprises: sampling the first audio of the loudspeaker of the headset and the second audio collected by the first microphone in the current scene based on a preset sampling frequency to obtain a first time domain signal and a second time domain signal; performing frame division, windowing, and Fourier transform processing on the first time domain signal and the second time domain signal to obtain a first frequency domain signal corresponding to each frame of the first time domain signal and a second frequency domain signal corresponding to the second time domain signal.
3. The method of claim 2, wherein, The method comprises: calculating the total number of frames divided for the first frequency domain signal or the second frequency domain signal based on the collection time and a preset frame division parameter, wherein the total number of frames divided for the first frequency domain signal and the second frequency domain signal is the same; calculating a first energy value corresponding to each frame of the first frequency domain signal and a second energy value corresponding to the second frequency domain signal; determining a frame sequence number corresponding to each of the first energy value and the second energy value; calculating an energy value ratio corresponding to each frame sequence number, wherein the energy value ratio is the ratio between the first energy value and the second energy value corresponding to the same frame sequence number; calculating a signal-to-noise ratio corresponding to the current scene according to the total number of frames and the energy value ratio corresponding to each frame sequence number.
4. The method of claim 3, wherein, The method comprises: calculating the average of the energy value ratio corresponding to each frame sequence number; determining the decibel value of the energy value ratio as the signal-to-noise ratio corresponding to the current scene.
5. The method of claim 1, wherein, The method comprises: in the case where the signal-to-noise ratio is less than a preset threshold, determining that the main sound signal source of the second microphone in the current headset is external noise. In a case where the signal-to-noise ratio is greater than or equal to the preset threshold, it is determined that the main sound signal source of the second microphone is the sound played by the loudspeaker.
6. The method of claim 1, wherein, After the leakage characteristic value corresponding to the acquisition time is calculated, the method further includes: obtaining a mapping relationship table corresponding to the current main sound signal source; based on the mapping relationship table, determining a leakage level corresponding to the leakage characteristic value; executing a noise reduction strategy corresponding to the leakage level.
7. The method of claim 6, wherein, Before the mapping relationship table corresponding to the current main sound signal source is obtained, the method includes: obtaining a numerical distribution interval of the leakage characteristic value in a target acquisition time period, and the main sound signal source corresponding to the target acquisition time period; based on a preset rule, dividing the numerical distribution interval to determine the leakage level to which each leakage characteristic value is mapped.
8. The method of claim 1, wherein, Further comprising: in a case where the leakage level to which the current leakage characteristic value belongs is N, and it is detected that the leakage characteristic value gradually approaches a boundary threshold between the leakage level N and the leakage level N+1, the boundary threshold is increased by a preset adjustment amount, wherein N is a positive integer; or, in a case where the leakage level to which the current leakage characteristic value belongs is N+1, and it is detected that the leakage characteristic value gradually approaches a boundary threshold between the leakage level N and the leakage level N+1, the boundary threshold is decreased by the preset adjustment amount.
9. An apparatus for detecting sound leakage from an earphone, the apparatus comprising: including: an obtaining module, configured to obtain a first frequency domain signal corresponding to a first audio of a loudspeaker of a headset, and a second frequency domain signal corresponding to a second audio collected by a first microphone in a current scene, the collection time of the second audio being the same as the time corresponding to the first audio; a first calculating module, configured to calculate a signal-to-noise ratio corresponding to the current scene according to the first frequency domain signal and the second frequency domain signal, and the collection time; a determining module, configured to determine a main sound signal source of a second microphone in the headset according to a preset judgment condition and the signal-to-noise ratio; a second calculating module, configured to calculate a leakage characteristic value corresponding to the collection time based on a transfer function corresponding to the main sound signal source and a corresponding calculation frequency band, the leakage characteristic value being used to represent a sound leakage state of the headset; wherein the transfer function is a function with sound leakage amount as the dependent variable, and the first frequency domain signal and the second frequency domain signal as the independent variables.
10. An electronic device, comprising: The computer program is executed by the processor to implement the sound leakage detection method of the headset according to any one of claims 1-8.
11. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the sound leakage detection method of the headset according to any one of claims 1-8.
Citation Information
Patent Citations
Noise reduction control method and device, noise reduction earphone and storage medium
CN114786085A
Audio adjustment method and associated audio adjustment circuit for active noise cancellation
TW202041045A