Ear canal sound quality compensation method and device, electronic equipment and storage medium
By performing spectrum analysis and compensation on the audio signal in the ear canal, the problem that existing technology fails to effectively consider the unique acoustic characteristics of the ear canal is solved, and a better audio experience is achieved.
Patent Information
- Application Number
- CN202411543711.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-24
AI Technical Summary
Existing audio processing technology fails to effectively consider the unique acoustic characteristics of the ear canals of different users, resulting in poor user audio experience.
By analyzing the audio signal in the ear canal, comparing and standard audio signals, determine the distortion band, and make targeted sound compensation for it.
Effective compensation of ear canal audio signals is achieved, improving the user's hearing experience.
Smart Images

Figure CN119364258A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of signal processing technology, and more specifically, relates to an ear canal sound quality compensation method and device, electronic equipment, and storage medium. Background Art
[0002] With the continuous development of audio technology, people have higher and higher requirements for audio quality. In various audio application scenarios such as music appreciation, voice calls, audio recording, etc., people hope to obtain clear, natural and realistic audio effects. The environment inside the ear canal has extremely special audio characteristics. Due to its shape and acoustic characteristics, it causes distortion and degradation during sound collection. Existing audio processing technologies usually use general processing methods without considering the unique acoustic characteristics of the ear canals of different users, resulting in a poor audio experience for users. Summary of the invention
[0003] The purpose of the present disclosure is to provide an ear canal sound quality compensation method and device, an electronic device, and a storage medium to improve the user's audio experience.
[0004] A first aspect of an embodiment of the present disclosure provides an ear canal sound quality compensation method, comprising: Performing spectrum analysis on the first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal; comparing the frequency spectrum of the first audio signal with the frequency spectrum of a standard audio signal to determine a distorted frequency band of the first audio signal; Sound quality compensation is performed on the distorted frequency band of the first audio signal to obtain a second audio signal.
[0005] A second aspect of the embodiments of the present disclosure provides an ear canal sound quality compensation device, comprising: A first processing module, configured to perform spectrum analysis on the first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal; a second processing module, configured to compare the frequency spectrum of the first audio signal with the frequency spectrum of a standard audio signal to determine a distorted frequency band of the first audio signal; The sound quality compensation module is used to perform sound quality compensation on the distorted frequency band of the first audio signal to obtain a second audio signal.
[0006] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned ear canal sound quality compensation method when executing the computer program.
[0007] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned ear canal sound quality compensation method are implemented.
[0008] The ear canal sound quality compensation method and device, electronic device, and storage medium provided by the embodiments of the present disclosure have the following beneficial effects: The disclosed embodiment performs spectrum analysis on the first audio signal in the ear canal and compares it with a standard audio signal to obtain a distorted frequency band of the first audio signal, and then performs targeted compensation for the distorted frequency band. The obtained second audio signal can bring a better auditory experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A schematic diagram of a flow chart of an ear canal sound quality compensation method provided by an embodiment of the present disclosure; Figure 2 A structural block diagram of an ear canal sound quality compensation device provided by an embodiment of the present disclosure; Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0011] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0012] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, specific embodiments will be described below in conjunction with the accompanying drawings.
[0013] Please refer to Figure 1 , Figure 1 A schematic diagram of a flow chart of an ear canal sound quality compensation method provided by an embodiment of the present disclosure, the method comprising: S101: Performing spectrum analysis on a first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal.
[0014] In this embodiment, a sound pickup device such as a miniature microphone can be set in the ear canal to collect the audio signal in the ear canal to obtain the first audio signal. Specifically, the sound quality compensation method of this embodiment can be applied to hearing devices such as wireless headphones and hearing aids, and the first audio signal can be collected by setting a miniature microphone in the above-mentioned devices.
[0015] The first audio signal can be converted into a frequency domain representation by a method such as Fast Fourier Transform (FFT) to obtain a spectrum diagram of the first audio signal, thereby clearly showing the energy distribution of the signal at different frequencies.
[0016] S102: Compare the frequency spectrum of the first audio signal with the frequency spectrum of the standard audio signal to determine a distortion frequency band of the first audio signal.
[0017] In this embodiment, the standard audio signal is an audio signal recorded under ideal conditions and has an accurate frequency response and a low distortion level.
[0018] By comparing the spectrum of the first audio signal with the spectrum of the standard audio signal, the difference between the two audio signals at each frequency can be intuitively obtained, and then the frequency band with excessive noise, distortion or insufficient energy in the first audio signal, i.e., the distorted frequency band, can be determined. For example, if the energy of a certain frequency band in the first audio signal is significantly higher or lower than that of the standard audio signal, or an abnormal frequency component appears, the frequency band can be determined to be a distorted frequency band.
[0019] S103: Perform sound quality compensation on the distorted frequency band of the first audio signal to obtain a second audio signal.
[0020] In this embodiment, based on the obtained distortion frequency band, sound quality compensation can be carried out in a targeted manner. The compensation method can be determined according to the specific distortion situation. For example, if the energy of a certain frequency band is too low, the frequency band can be enhanced; if there is too much noise or distortion in a certain frequency band, the frequency band can be attenuated.
[0021] From the above, it can be concluded that the embodiment of the present disclosure can obtain the distorted frequency band of the first audio signal by performing spectral analysis on the first audio signal in the ear canal and comparing it with the standard audio signal, and then perform targeted compensation for the distorted frequency band, and the obtained second audio signal can bring a better auditory experience.
[0022] In one embodiment of the present disclosure, performing sound quality compensation on a distorted frequency band of a first audio signal includes: If the first difference value corresponding to the distorted frequency band is less than the first distortion threshold value, and the amplitude change value of the first audio signal is less than or equal to the first change threshold value, determine the first gain value based on the negative correlation between the amplitude change value and the first gain value, and perform signal enhancement on the distorted frequency band based on the first gain value; the first difference value is the difference between the first audio signal and the standard audio signal; If the first difference corresponding to the distorted frequency band is less than the first distortion threshold and the amplitude change value of the first audio signal is greater than the first change threshold, a first frequency response curve is determined based on the first change threshold, a second gain value is determined based on a negative correlation between the amplitude change value and the second gain value, and signal enhancement is performed on the distorted frequency band based on the first frequency response curve and the second gain value.
[0023] In this embodiment, the first distortion threshold is a preset negative number. If, in a certain distortion frequency band, the amplitude difference between the first audio signal and the standard audio signal (i.e., the first difference) is less than the first distortion threshold, it indicates that the energy of the distortion frequency band is too low, and the sound quality compensation can be performed by signal enhancement method.
[0024] A common method for signal enhancement is to amplify the first audio signal based on a first gain value. This embodiment takes into account that if the amplitude variation value of the first audio signal is large, that is, the volume variation range is large, when the first gain value is used to amplify the first audio signal, it is easy to cause the high volume part to exceed the processing capability range of the audio device, thereby causing the high volume part to be distorted.
[0025] To avoid the above problem, this embodiment sets a first change threshold. When the amplitude change value of the first audio signal is less than or equal to the first change threshold, it indicates that the volume change range of the first audio signal is small. At this time, the first audio signal can be amplified based on the first gain value.
[0026] The magnitude of the first gain value is inversely proportional to the amplitude change value of the first audio signal, that is, when the amplitude change value of the first audio signal is small, it indicates that the first audio signal is relatively stable as a whole, and a larger first gain value can be set; when the amplitude change value of the first audio signal is large, it indicates that the volume change range of the first audio signal is large, and the first gain value needs to be reduced to avoid distortion of the high volume part.
[0027] Specifically, when calculating the first gain value, a reference gain G10 may be pre-set, and at the same time, when the amplitude change value D of the first audio signal is compared with the first change threshold value X, the first gain value G1 corresponding to each decrease of 1 dB is set to increase by a, thereby obtaining a calculation formula for the first gain value: G1= G10 + a(X - D).
[0028] When the amplitude change value of the first audio signal is greater than the first change threshold, it indicates that the volume change range of the first audio signal is large. If the first audio signal is amplified based on the first gain value, it is easy to cause distortion of the high volume part. Therefore, at this time, the frequency response curve can be switched based on the first change threshold, and the signal of the distorted frequency band can be enhanced based on the switched first frequency response curve.
[0029] Different frequency response curves correspond to different frequency band enhancement or attenuation characteristics. By dynamically adjusting the frequency response curve, the enhancement amplitude of each frequency band can be accurately controlled. Multiple groups of different frequency response curves can be pre-set, corresponding to different amplitude change values. When the amplitude change value of the first audio signal is small, the curve enhancement amplitude of the low-energy frequency band in the corresponding frequency response curve is large; when the amplitude change value of the first audio signal is large, the corresponding frequency response curve is relatively flat, and the enhancement amplitude of the low-energy frequency band is small. By enhancing the signal of the distorted frequency band according to the frequency response curve and the second gain value, it is possible to avoid the low-energy frequency band from being over-amplified when the volume is large, thereby reducing the possibility of distortion.
[0030] Specifically, when calculating the second gain value, a reference gain G20 may be pre-set, and at the same time, when the amplitude change value D of the first audio signal is compared with the first change threshold value X, the second gain value G2 corresponding to each increase of 1 dB is set to decrease by b, thereby obtaining a calculation formula for the second gain value: G2 = G20 - b(DX).
[0031] It can be concluded from the above that, in this embodiment, when the amplitude change value of the first audio signal is small, the signal can be simply and effectively enhanced based on the first gain value; when the amplitude change value of the first audio signal is large, the dynamic change of the first audio signal can be better adapted to improve the accuracy of compensation by switching the frequency response curve.
[0032] In one embodiment of the present disclosure, the switching process of the first frequency response curve includes: In a set second time window, the parameters of the second frequency response curve are switched to the first frequency response curve; the second frequency response curve is the frequency response curve used previously.
[0033] In this embodiment, when switching the frequency response curve, a second time window may be set, and within the second time window, the parameters of the second frequency response curve previously used are gradually switched to the parameters of the first frequency response curve. For example, various parameters of the frequency response curve, such as gain, amplitude of frequency points, etc., may be gradually adjusted at certain time intervals, thereby ensuring that the first audio signal does not undergo sudden changes during the switching process, and maintaining the continuity and stability of the first audio signal.
[0034] In one embodiment of the present disclosure, the ear canal sound quality compensation method further includes: If the first audio signal belongs to a first type of audio signal, the second time window is determined to be a first time length; the first type of audio signal is a speech signal; If the first audio signal belongs to the second category audio signal or the third category audio signal, the second time window is determined to be the second duration; the second category audio signal is a pop music signal, and the third category audio signal is a specified audio signal; The first duration is less than the second duration.
[0035] In this embodiment, the first type of audio signal is a voice signal, which is mainly used to clearly convey language information. To ensure that listeners can clearly hear the content in different environments, the second time window can be set to a smaller first duration, so that the switching time is as short as possible, and the low-frequency signal is enhanced in time to ensure call quality. The second type of audio signal is a pop music signal, and the third type of audio signal is classical music, movie special effects music, etc. When the first type of audio signal belongs to the second type of audio signal or the third type of audio signal, the second time window can be set to a larger second duration to ensure a natural transition and ensure the overall coherence and immersion of the audio.
[0036] It can be concluded from the above that this embodiment sets different second time windows as the switching time of the first frequency response curve according to application scenarios of different audio signals, which can meet the actual needs of specific scenarios.
[0037] In one embodiment of the present disclosure, the ear canal sound quality compensation method further includes: If the first audio signal belongs to a first type of audio signal, the first change threshold is determined to be a first value; the first type of audio signal is a speech signal; If the first audio signal belongs to the second type of audio signal, the first change threshold is determined to be a second value; the second type of audio signal is a pop music signal; If the first audio signal belongs to the third category of audio signals, the first change threshold is determined to be a third value; the third category of audio signals is a designated audio signal; The first value, the second value, and the third value increase in sequence.
[0038] In this embodiment, the first type of audio signal is a voice signal, which includes audio signals of radio programs, audio signals generated by voice calls, or audio signals of audio books, etc. The voice signal is mainly used to clearly convey language information to ensure that the audience can clearly hear the content in different environments, and the volume is relatively stable. The third type of audio signal is a designated audio signal, which may include classical music, movie special effects music, etc. The third type of audio signal usually contains rich instrumental performances, and the volume variation range is large to show the delicacy and layering of the music. The second type of audio signal is a pop music signal. Pop music focuses on the rhythm and melody, but in order to adapt to various playback devices and environments, its volume variation range should not be too large, otherwise the volume may be unstable when played on some devices. Therefore, the volume variation range of pop music is between the first type of audio signal and the third type of audio signal.
[0039] Therefore, in order to adapt to different audio signal playback needs, the first change threshold corresponding to the first type of audio signal is set to a smaller first value, and the signal enhancement method is adjusted when the amplitude change value of the audio signal is small to avoid distortion of the high volume part. The first change threshold corresponding to the third type of audio signal is set to a larger third value to adapt to a larger volume change range.
[0040] Among them, it can be determined according to different process information whether the first audio signal specifically belongs to the first category of audio signals, the second category of audio signals, or the third category of audio signals. For example, if the first audio signal comes from a voice call software, the first audio signal belongs to the first category of audio signals; if the first category of audio signals comes from a music player software, the first audio signal belongs to the second category of audio signals or the third category of audio signals. Furthermore, the audio file corresponding to the first category of audio signals usually contains file tags such as "popular", "classical", and "movie", based on which it can be determined whether the first audio signal belongs to the second category of audio signals or the third category of audio signals.
[0041] It can be concluded from the above that, in this embodiment, different first change thresholds are set for different types of audio signals, so that more accurate sound quality compensation can be achieved.
[0042] In one embodiment of the present disclosure, performing sound quality compensation on a distorted frequency band of a first audio signal includes: If the first difference corresponding to the distorted frequency band is greater than the second distortion threshold, the signal of the distorted frequency band is attenuated based on the adaptive filtering method.
[0043] In this embodiment, the second distortion threshold is a positive number, and the second distortion threshold is greater than the first distortion threshold. If the amplitude difference (i.e., the first difference) between the first audio signal and the standard audio signal in a certain distortion frequency band is greater than the first distortion threshold, it indicates that there is too much noise in the distortion frequency band, and the sound quality compensation can be performed by signal attenuation.
[0044] Specifically, an adaptive filtering method may be used to attenuate the signal in the distorted frequency band. Adaptive filtering may automatically adjust the filter coefficient according to the signal characteristics of the distorted frequency band to attenuate the signal in the frequency band, so that the first audio signal gradually approaches the standard audio signal.
[0045] It can be concluded from the above that this embodiment uses an adaptive filtering method to attenuate the signal of the distorted frequency band with more noise, which can achieve accurate compensation for the distorted frequency band and improve the audio quality.
[0046] In one embodiment of the present disclosure, the ear canal sound quality compensation method further includes: Acquire a maximum amplitude value and a minimum amplitude value of the first audio signal based on a set first time window; The difference between the maximum amplitude value and the minimum amplitude value is determined as the amplitude variation value of the first audio signal.
[0047] In this embodiment, a first time window may be set, within which the real-time sampling point values of the first audio signal are analyzed to obtain a maximum amplitude value and a minimum amplitude value of the first audio signal, and then the difference between the maximum amplitude value and the minimum amplitude value is determined as an amplitude change value of the first audio signal, and the amplitude change value may characterize an amplitude fluctuation range of the first audio signal.
[0048] It can be concluded from the above that this embodiment can accurately measure the dynamic range of the first audio signal by obtaining the maximum amplitude value and the minimum amplitude value within a specific time window, and then perform corresponding sound quality compensation according to its dynamic range.
[0049] In one embodiment of the present disclosure, the ear canal sound quality compensation method further includes: Determining a proportion of high frequency components in the first audio signal; The length of the first time window is determined based on the proportion of the high-frequency components; wherein the proportion of the high-frequency components is negatively correlated with the length of the first time window.
[0050] In this embodiment, the length setting of the first time window may affect the accuracy of obtaining the amplitude change value of the first audio signal. If the first time window is set too long, it may not respond to the dynamic changes of the first audio signal in a timely manner. If the first time window is set too short, it may not accurately reflect the overall amplitude change trend of the first audio signal.
[0051] Considering that high-frequency signals usually change quickly, a shorter first time window can be used to accurately capture their amplitude changes; while low-frequency signals change relatively slowly, a longer first time window can be used to capture the overall amplitude change trend of the first audio signal.
[0052] On this basis, the proportion of high-frequency components in the first audio signal can be obtained by performing spectrum analysis on the first audio signal, and then the length of the first time window can be determined based on the negative correlation between the proportion of high-frequency components and the length of the first time window. That is, when there are more high-frequency components in the first audio signal, a shorter first time window can be set; when there are fewer high-frequency components, a shorter first time window can be set.
[0053] Specifically, a reference value P0 of the high-frequency component ratio and a reference value L0 of the first time window length may be pre-set, and then a first proportional coefficient k=P0 / P may be calculated based on the high-frequency component ratio P of the first audio signal and the reference value P0 of the high-frequency component ratio, and then the first proportional coefficient k may be multiplied by the reference value L0 of the first time window length to obtain a length L=L0×P0 / P of the first time window.
[0054] It can be concluded from the above that, in this embodiment, the length of the first time window is adjusted according to the proportion of high-frequency components of the first audio signal, so that the amplitude change value of the audio signal can be analyzed more accurately.
[0055] In one embodiment of the present disclosure, before performing spectrum analysis on the first audio signal collected in the ear canal, the ear canal sound quality compensation method further includes: If the first audio signal is a multi-channel audio signal, phase calibration is performed on the first audio signal.
[0056] In this embodiment, the multi-channel audio signal generally includes multiple channels, such as common stereo audio has two left and right channels, and a surround sound system may have more channels. Whether the first audio signal is a multi-channel audio signal can be determined by reading the format, metadata or specific identification of the first audio signal.
[0057] If the first audio signal is determined to be a multi-channel audio signal based on the format, metadata or specific identifier of the first audio signal, considering that in multi-channel audio, the phase relationship of signals of different channels is crucial to the spatial sense and positioning accuracy of the audio. If the phases of signals of different channels are inconsistent, the stereoscopic sense and spatial sense of the audio will be deteriorated, and even problems such as sound fuzziness and phase cancellation may occur; at the same time, when the phases of signals of various channels are inconsistent, mutual interference may occur, resulting in increased noise.
[0058] Therefore, before performing distortion frequency band compensation on the first audio signal in the ear canal, phase calibration can be performed first to coordinate the signals of each channel, reduce interference and noise, provide better conditions for distortion frequency band compensation, make the compensation process smoother, and reduce compensation errors caused by interference and noise. At the same time, the accurate phase relationship provides a more stable audio basis for distortion frequency band compensation. If distortion frequency band compensation is performed under inconsistent phase conditions, the compensation effect may be inaccurate due to interference between different channels. After phase calibration in this embodiment, the signals of each channel are coordinated in time and phase, so that the compensation of the distortion frequency band can be more accurately adjusted according to the actual situation of each channel, thereby improving the positioning accuracy and spatial sense of the audio.
[0059] Corresponding to the ear canal sound quality compensation method of the above embodiment, Figure 2 This is a structural block diagram of an ear canal sound quality compensation device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 2 The ear canal sound quality compensation device 20 includes: a first processing module 21, a second processing module 22 and a sound quality compensation module 23. The first processing module 21 is used to perform spectrum analysis on the first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal; A second processing module 22, configured to compare the spectrum of the first audio signal with the spectrum of the standard audio signal to determine a distorted frequency band of the first audio signal; The sound quality compensation module 23 is used to perform sound quality compensation on the distorted frequency band of the first audio signal to obtain a second audio signal.
[0060] In one embodiment of the present disclosure, the sound quality compensation module 23 is specifically used to: If the first difference value corresponding to the distorted frequency band is less than the first distortion threshold value, and the amplitude change value of the first audio signal is less than or equal to the first change threshold value, determine the first gain value based on the negative correlation between the amplitude change value and the first gain value, and perform signal enhancement on the distorted frequency band based on the first gain value; the first difference value is the difference between the first audio signal and the standard audio signal; If the first difference corresponding to the distorted frequency band is less than the first distortion threshold and the amplitude change value of the first audio signal is greater than the first change threshold, a first frequency response curve is determined based on the first change threshold, a second gain value is determined based on a negative correlation between the amplitude change value and the second gain value, and signal enhancement is performed on the distorted frequency band based on the first frequency response curve and the second gain value.
[0061] In one embodiment of the present disclosure, the sound quality compensation module 23 is further used to: If the first audio signal belongs to a first type of audio signal, the first change threshold is determined to be a first value; the first type of audio signal is a speech signal; If the first audio signal belongs to the second type of audio signal, the first change threshold is determined to be a second value; the second type of audio signal is a pop music signal; If the first audio signal belongs to the third category of audio signals, the first change threshold is determined to be a third value; the third category of audio signals is a designated audio signal; The first value, the second value, and the third value increase in sequence.
[0062] In one embodiment of the present disclosure, the sound quality compensation module 23 is specifically used to: If the first difference corresponding to the distorted frequency band is greater than the second distortion threshold, the signal of the distorted frequency band is attenuated based on the adaptive filtering method.
[0063] In one embodiment of the present disclosure, the sound quality compensation module 23 is specifically used to: Acquire a maximum amplitude value and a minimum amplitude value of the first audio signal based on a set first time window; The difference between the maximum amplitude value and the minimum amplitude value is determined as the amplitude variation value of the first audio signal.
[0064] In one embodiment of the present disclosure, the sound quality compensation module 23 is further used to: Determining a proportion of high frequency components in the first audio signal; The length of the first time window is determined based on the proportion of the high-frequency components; wherein the proportion of the high-frequency components is negatively correlated with the length of the first time window.
[0065] In one embodiment of the present disclosure, the first processing module 21 is specifically used for: Before performing spectrum analysis on the first audio signal collected in the ear canal, if the first audio signal is a multi-channel audio signal, phase calibration is performed on the first audio signal.
[0066] See also Figure 3 , Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. Figure 3The electronic device 300 in the embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303 and one or more memories 304. The processors 301, input devices 302, output devices 303 and memories 304 communicate with each other via a communication bus 305. The memory 304 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. The processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above-mentioned device embodiments, such as Figure 2 The functions of modules 21 to 23 are shown.
[0067] It should be understood that in the embodiment of the present disclosure, the processor 301 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0068] The input device 302 may include a touch panel, a fingerprint collection sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.
[0069] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A portion of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.
[0070] In a specific implementation, the processor 301, input device 302, and output device 303 described in the embodiments of the present disclosure can execute the implementation methods described in the first and second embodiments of the ear canal sound quality compensation method provided in the embodiments of the present disclosure, and can also execute the implementation methods of the electronic device described in the embodiments of the present disclosure, which will not be repeated here.
[0071] In another embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by the processor, all or part of the processes in the above-mentioned embodiment method are implemented, and the computer program can also be completed by instructing the relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0072] The computer-readable storage medium may be an internal storage unit of the electronic device of any of the aforementioned embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0074] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0075] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces or units, or it can be an electrical, mechanical or other form of connection.
[0076] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure.
[0077] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0078] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for compensating ear canal sound quality, characterized in that: include: Performing spectrum analysis on the first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal; comparing the frequency spectrum of the first audio signal with the frequency spectrum of a standard audio signal to determine a distorted frequency band of the first audio signal; Sound quality compensation is performed on the distorted frequency band of the first audio signal to obtain a second audio signal.
2. The ear canal sound quality compensation method according to claim 1, characterized in that: The performing sound quality compensation on the distorted frequency band of the first audio signal comprises: If the first difference value corresponding to the distorted frequency band is less than the first distortion threshold value, and the amplitude change value of the first audio signal is less than or equal to the first change threshold value, the first gain value is determined based on the negative correlation between the amplitude change value and the first gain value, and the signal of the distorted frequency band is enhanced based on the first gain value; the first difference value is the difference between the first audio signal and the standard audio signal; If the first difference corresponding to the distorted frequency band is less than the first distortion threshold and the amplitude change value of the first audio signal is greater than the first change threshold, a first frequency response curve is determined based on the first change threshold, the second gain value is determined based on the negative correlation between the amplitude change value and the second gain value, and signal enhancement is performed on the distorted frequency band based on the first frequency response curve and the second gain value.
3. The ear canal sound quality compensation method according to claim 2, characterized in that: Also includes: If the first audio signal belongs to a first type of audio signal, the first change threshold is determined to be a first value; the first type of audio signal is a speech signal; If the first audio signal belongs to a second type of audio signal, the first change threshold is determined to be a second value; and the second type of audio signal is a pop music signal; If the first audio signal belongs to a third category of audio signals, the first change threshold is determined to be a third value; the third category of audio signals is a designated audio signal; The first value, the second value and the third value increase sequentially.
4. The ear canal sound quality compensation method according to claim 1, characterized in that: The performing sound quality compensation on the distorted frequency band of the first audio signal comprises: If the first difference corresponding to the distorted frequency band is greater than the second distortion threshold, the signal of the distorted frequency band is attenuated based on an adaptive filtering method.
5. The ear canal sound quality compensation method according to claim 2, characterized in that: Also includes: Acquire a maximum amplitude value and a minimum amplitude value of the first audio signal based on a set first time window; The difference between the maximum amplitude value and the minimum amplitude value is determined as the amplitude variation value of the first audio signal.
6. The ear canal sound quality compensation method according to claim 5, characterized in that: Also includes: Determining a proportion of high frequency components in the first audio signal; The length of the first time window is determined based on the proportion of the high-frequency component; wherein the proportion of the high-frequency component is negatively correlated with the length of the first time window.
7. The ear canal sound quality compensation method according to claim 1, characterized in that: Before performing spectrum analysis on the first audio signal collected in the ear canal, the ear canal sound quality compensation method further includes: If the first audio signal is a multi-channel audio signal, phase calibration is performed on the first audio signal.
8. An ear canal sound quality compensation device, characterized in that: include: A first processing module, configured to perform spectrum analysis on the first audio signal collected in the ear canal to obtain a spectrum diagram of the first audio signal; a second processing module, configured to compare the frequency spectrum of the first audio signal with the frequency spectrum of a standard audio signal to determine a distorted frequency band of the first audio signal; The sound quality compensation module is used to perform sound quality compensation on the distorted frequency band of the first audio signal to obtain a second audio signal.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.