CN115379354A - Filter coefficient setting method and device and electronic equipment - Google Patents
Filter coefficient setting method and device and electronic equipment Download PDFInfo
- Publication number
- CN115379354A CN115379354A CN202211128571.4A CN202211128571A CN115379354A CN 115379354 A CN115379354 A CN 115379354A CN 202211128571 A CN202211128571 A CN 202211128571A CN 115379354 A CN115379354 A CN 115379354A
- Authority
- CN
- China
- Prior art keywords
- filter
- transfer function
- sub
- function
- coefficients
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R3/00—Circuits for transducers, loudspeakers or microphones
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R2420/00—Details of connection covered by H04R, not provided for in its groups
- H04R2420/03—Connection circuits to selectively connect loudspeakers or headphones to amplifiers
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Acoustics & Sound (AREA)
- Signal Processing (AREA)
- Filters That Use Time-Delay Elements (AREA)
Abstract
Description
技术领域technical field
本申请实施例涉及信号处理技术领域,尤其涉及一种滤波器系数设置方法、装置及电子设备。The embodiments of the present application relate to the technical field of signal processing, and in particular to a filter coefficient setting method, device, and electronic equipment.
背景技术Background technique
用户可以使用具有透传功能的耳机,获取和没有佩戴耳机时类似的外界环境声。可以在耳机中设置透传滤波器,使耳机具有透传功能。Users can use earphones with pass-through function to obtain ambient sounds similar to those without earphones. A pass-through filter can be set in the headset so that the headset has a pass-through function.
为了使佩戴耳机时用户听到的外界环境声尽可能和没有佩戴耳机时的外界环境声一致,需要调节透传滤波器的系数。在相关技术中,可以通过如下方式调节透传滤波器系数:手动调节每个子滤波器的参数,确定调节后透传滤波器的频率响应。当透传滤波器的频率响应接近理想透传滤波器的频率响应,调节完成。根据调节完成后每个子滤波器的参数,确定透传滤波器的参数。在上述过程中,由于需要人工手动调节每个子滤波器的参数,从而得到透传滤波器的系数,导致设置滤波器系数的准确性较低。In order to make the external ambient sound heard by the user when wearing the earphone be as consistent as possible with the external ambient sound when not wearing the earphone, it is necessary to adjust the coefficient of the transparent transmission filter. In related technologies, the coefficients of the transparent transmission filter may be adjusted in the following manner: manually adjusting the parameters of each sub-filter to determine the frequency response of the adjusted transparent transmission filter. When the frequency response of the transparent filter is close to the frequency response of the ideal transparent filter, the adjustment is completed. According to the parameters of each sub-filter after the adjustment is completed, the parameters of the transparent transmission filter are determined. In the above process, since it is necessary to manually adjust the parameters of each sub-filter to obtain the coefficients of the pass-through filter, the accuracy of setting the filter coefficients is low.
发明内容Contents of the invention
本申请实施例提供一种滤波器系数设置方法、装置及电子设备,用以解决设置滤波器系数的准确性较低的问题。Embodiments of the present application provide a filter coefficient setting method, device, and electronic equipment to solve the problem of low accuracy in setting filter coefficients.
第一方面,本申请实施例提供一种滤波器系数设置方法,包括:In the first aspect, the embodiment of the present application provides a filter coefficient setting method, including:
获取声源与麦克风之间的第一传递函数、声源与佩戴耳机的所述麦克风之间的第二传递函数、和扬声器与所述麦克风之间的第三传递函数,所述麦克风设置在人工耳中,所述扬声器设置在所述耳机中;Obtaining a first transfer function between a sound source and a microphone, a second transfer function between a sound source and the microphone wearing an earphone, and a third transfer function between a loudspeaker and the microphone, the microphone being set in an artificial In the ear, the loudspeaker is arranged in the earphone;
确定透传滤波器中各子滤波器的滤波器传递函数,所述透传滤波器设置在所述耳机中;Determining the filter transfer function of each sub-filter in the transparent filter, the transparent filter is set in the earphone;
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和各子滤波器的滤波器传递函数,确定所述透传滤波器的系数。Determine coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function and the filter transfer functions of the sub-filters.
在一种可能的实施方式中,根据所述第一传递函数、所述第二传递函数、所述第三传递函数和各子滤波器的滤波器传递函数,确定所述透传滤波器的系数,包括:In a possible implementation manner, the coefficients of the transparent transmission filter are determined according to the first transfer function, the second transfer function, the third transfer function and the filter transfer functions of each sub-filter ,include:
将各子滤波器的滤波器传递函数的乘积确定为第四传递函数;determining the product of the filter transfer functions of the respective sub-filters as a fourth transfer function;
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定所述透传滤波器的系数。Determine coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function.
在一种可能的实施方式中,根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定所述透传滤波器的系数,包括:In a possible implementation manner, determining coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function includes:
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定灵敏度函数;determining a sensitivity function based on the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function;
根据所述灵敏度函数,确定所述透传滤波器的系数。According to the sensitivity function, the coefficients of the transparent transmission filter are determined.
在一种可能的实施方式中,根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定灵敏度函数,包括:In a possible implementation manner, determining a sensitivity function according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function includes:
获取所述第三传递函数和所述第四传递函数的乘积函数;obtaining a product function of the third transfer function and the fourth transfer function;
将所述第一传递函数减去所述第二传递函数和所述乘积函数的差值,确定为误差信号;Determining the difference between the first transfer function minus the second transfer function and the product function as an error signal;
将所述误差信号与所述第一传递函数的比值,确定为所述灵敏度函数。A ratio of the error signal to the first transfer function is determined as the sensitivity function.
在一种可能的实施方式中,根据所述灵敏度函数,确定所述透传滤波器的系数,包括:In a possible implementation manner, determining the coefficients of the transparent transmission filter according to the sensitivity function includes:
确定所述灵敏度函数对应的目标函数;determining an objective function corresponding to the sensitivity function;
调整所述各子滤波器的滤波器参数的取值,直至得到所述目标函数的最小值;Adjusting the values of the filter parameters of the sub-filters until the minimum value of the objective function is obtained;
根据所述目标函数取所述最小值时各子滤波器的滤波器参数的取值,确定为所述透传滤波器的系数。According to the value of the filter parameter of each sub-filter when the objective function takes the minimum value, it is determined as the coefficient of the transparent transmission filter.
在一种可能的实施方式中,根据所述目标函数取所述最小值时各子滤波器的滤波器参数的取值,确定为所述透传滤波器的系数,包括:In a possible implementation manner, according to the value of the filter parameter of each sub-filter when the objective function takes the minimum value, it is determined as the coefficient of the transparent transmission filter, including:
将所述各子滤波器参数的取值确定为各子滤波器的系数;Determining the value of each sub-filter parameter as a coefficient of each sub-filter;
对所述子滤波器的系数进行级联处理,得到所述透传滤波器的系数。The coefficients of the sub-filters are cascaded to obtain the coefficients of the transparent transmission filter.
在一种可能的实施方式中,所述子滤波器为双二阶滤波器。In a possible implementation manner, the sub-filter is a biquad filter.
第二方面,本申请实施例提供一种滤波器系数设置装置,所述装置包括:In a second aspect, an embodiment of the present application provides a device for setting filter coefficients, the device comprising:
获取模块,用于获取声源与麦克风之间的第一传递函数、声源与佩戴耳机的所述麦克风之间的第二传递函数、和扬声器与所述麦克风之间的第三传递函数,所述麦克风设置在人工耳中,所述扬声器设置在所述耳机中;An acquisition module, configured to acquire a first transfer function between a sound source and a microphone, a second transfer function between a sound source and the microphone wearing an earphone, and a third transfer function between a speaker and the microphone, the The microphone is set in the artificial ear, and the speaker is set in the earphone;
第一确定模块,用于确定透传滤波器中各子滤波器的滤波器传递函数,所述透传滤波器设置在所述耳机中;The first determining module is used to determine the filter transfer function of each sub-filter in the transparent filter, and the transparent filter is set in the earphone;
第二确定模块,用于根据所述第一传递函数、所述第二传递函数、所述第三传递函数和各子滤波器的滤波器传递函数,确定所述透传滤波器的系数。The second determining module is configured to determine the coefficients of the transparent filter according to the first transfer function, the second transfer function, the third transfer function and the filter transfer functions of the sub-filters.
在一种可能的实施方式中,所述第二确定模块具体用于:In a possible implementation manner, the second determining module is specifically configured to:
将各子滤波器的滤波器传递函数的乘积确定为第四传递函数;determining the product of the filter transfer functions of the respective sub-filters as a fourth transfer function;
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定所述透传滤波器的系数。Determine coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function.
在一种可能的实施方式中,所述第二确定模块具体用于:In a possible implementation manner, the second determining module is specifically configured to:
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定灵敏度函数;determining a sensitivity function based on the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function;
根据所述灵敏度函数,确定所述透传滤波器的系数。According to the sensitivity function, the coefficients of the transparent transmission filter are determined.
在一种可能的实施方式中,所述第二确定模块具体用于:In a possible implementation manner, the second determining module is specifically configured to:
获取所述第三传递函数和所述第四传递函数的乘积函数;obtaining a product function of the third transfer function and the fourth transfer function;
将所述第一传递函数减去所述第二传递函数和所述乘积函数的差值,确定为误差信号;Determining the difference between the first transfer function minus the second transfer function and the product function as an error signal;
将所述误差信号与所述第一传递函数的比值,确定为所述灵敏度函数。A ratio of the error signal to the first transfer function is determined as the sensitivity function.
在一种可能的实施方式中,所述第二确定模块具体用于:In a possible implementation manner, the second determining module is specifically configured to:
确定所述灵敏度函数对应的目标函数;determining an objective function corresponding to the sensitivity function;
调整所述各子滤波器的滤波器参数的取值,直至得到所述目标函数的最小值;Adjusting the values of the filter parameters of the sub-filters until the minimum value of the objective function is obtained;
根据所述目标函数取所述最小值时各子滤波器的滤波器参数的取值,确定为所述透传滤波器的系数。According to the value of the filter parameter of each sub-filter when the objective function takes the minimum value, it is determined as the coefficient of the transparent transmission filter.
在一种可能的实施方式中,所述第二确定模块具体用于:In a possible implementation manner, the second determining module is specifically configured to:
将所述各子滤波器参数的取值确定为各子滤波器的系数;Determining the value of each sub-filter parameter as a coefficient of each sub-filter;
对所述子滤波器的系数进行级联处理,得到所述透传滤波器的系数。The coefficients of the sub-filters are cascaded to obtain the coefficients of the transparent transmission filter.
在一种可能的实施方式中,所述子滤波器为双二阶滤波器。In a possible implementation manner, the sub-filter is a biquad filter.
第三方面,本申请提供一种芯片,所述芯片上存储有计算机程序,所述计算机程序被所述芯片执行时,实现如第一方面任一项所述的方法。In a third aspect, the present application provides a chip, on which a computer program is stored, and when the computer program is executed by the chip, the method according to any one of the first aspect is realized.
第四方面,本申请提供一种芯片模组,所述芯片模组上存储有计算机程序,所述计算机程序被所述芯片模组执行时,实现如第一方面任一项所述的方法。In a fourth aspect, the present application provides a chip module, where a computer program is stored on the chip module, and when the computer program is executed by the chip module, the method according to any one of the first aspect is realized.
第五方面,本申请实施例提供一种电子设备,包括:In a fifth aspect, the embodiment of the present application provides an electronic device, including:
至少一个处理器;以及at least one processor; and
与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行第一方面任一项所述的方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method according to any one of the first aspect.
第六方面,本申请实施例提供一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行根据第一方面中任一项所述的方法。In a sixth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method according to any one of the first aspect.
第七方面,本申请实施例提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现根据第一方面中任一项所述的方法。In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method according to any one of the first aspect when the computer program is executed by a processor.
本申请实施例提供的滤波器系数设置方法、装置及电子设备,可以获取声源在不同条件下的传递函数,确定透传滤波器中各子滤波器的滤波器传递函数。根据声源在不同条件下的传递函数以及各个子滤波器的传递函数,自动确定透传滤波器的系数。无需人为手动调节,提高了设置滤波器系数的准确性。The filter coefficient setting method, device and electronic equipment provided in the embodiments of the present application can obtain transfer functions of sound sources under different conditions, and determine the filter transfer functions of each sub-filter in the transparent transmission filter. According to the transfer function of the sound source under different conditions and the transfer function of each sub-filter, the coefficients of the transparent filter are automatically determined. There is no need for manual adjustment, which improves the accuracy of setting filter coefficients.
附图说明Description of drawings
图1为本申请实施例提供的应用场景的示意图;FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
图2为本申请实施例提供的一种滤波器系数设置方法的流程示意图;FIG. 2 is a schematic flowchart of a method for setting filter coefficients provided in an embodiment of the present application;
图3A为本申请实施例提供的一种获取传递函数的过程的示意图;FIG. 3A is a schematic diagram of a process of obtaining a transfer function provided by an embodiment of the present application;
图3B为本申请实施例提供的另一种获取传递函数的过程的示意图;FIG. 3B is a schematic diagram of another process of obtaining a transfer function provided by the embodiment of the present application;
图4为本申请实施例提供的另一种滤波器系数设置方法的流程示意图;FIG. 4 is a schematic flowchart of another method for setting filter coefficients provided in an embodiment of the present application;
图5为本申请实施例提供的确定fk的过程的示意图;Fig. 5 is a schematic diagram of the process of determining f k provided by the embodiment of the present application;
图6为本申请实施例提供的透传滤波器的设计原理图;FIG. 6 is a schematic diagram of the design of the transparent transmission filter provided by the embodiment of the present application;
图7为本申请实施例提供的滤波器系数设置装置的结构示意图;FIG. 7 is a schematic structural diagram of a filter coefficient setting device provided in an embodiment of the present application;
图8为本申请实施例提供的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present application as recited in the appended claims.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
图1为本申请实施例提供的应用场景的示意图。请参见图1,耳机中设置有透传滤波器101。在用户佩戴耳机的过程中,当用户需要听到外界环境声时,耳机可以通过透传滤波器101对外界环境声进行透传处理,使得用户在佩戴耳机的情况下听到的外界环境声,与用户未佩戴耳机的情况下听到的外界环境声尽可能的接近。FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application. Referring to FIG. 1 , a transparent filter 101 is set in the earphone. When the user wears the earphone, when the user needs to hear the external ambient sound, the earphone can transparently transmit the external environmental sound through the transparent transmission filter 101, so that the external environmental sound heard by the user while wearing the earphone is It is as close as possible to the external ambient sound heard by the user without headphones.
在相关技术中,由于需要人工手动调节透传滤波器的系数,导致设置滤波器系数的准确性较低。In the related art, since it is necessary to manually adjust the coefficients of the transparent transmission filter, the accuracy of setting the filter coefficients is low.
本申请实施例中,可以获取声源在不同条件下的传递函数,确定透传滤波器中各子滤波器的滤波器传递函数。根据声源在不同条件下的传递函数以及各个子滤波器的传递函数,自动确定透传滤波器的系数。无需人为手动调节,提高了设置滤波器系数的准确性。In the embodiment of the present application, the transfer function of the sound source under different conditions can be obtained, and the filter transfer function of each sub-filter in the transparent filter can be determined. According to the transfer function of the sound source under different conditions and the transfer function of each sub-filter, the coefficients of the transparent filter are automatically determined. There is no need for manual adjustment, which improves the accuracy of setting filter coefficients.
下面,通过具体实施例对本申请所示的方法进行说明。需要说明的是,下面几个实施例可以单独存在,也可以互相结合,对于相同或相似的内容,在不同的实施例中不再重复说明。In the following, the method shown in this application will be described through specific examples. It should be noted that the following embodiments may exist independently or be combined with each other, and the same or similar content will not be repeatedly described in different embodiments.
图2为本申请实施例提供的一种滤波器系数设置方法的流程示意图。请参见图2,该方法可以包括:FIG. 2 is a schematic flowchart of a method for setting filter coefficients provided in an embodiment of the present application. See Figure 2, the method can include:
S201、获取声源与麦克风之间的第一传递函数、声源与佩戴耳机的麦克风之间的第二传递函数、和扬声器与麦克风之间的第三传递函数。S201. Acquire a first transfer function between a sound source and a microphone, a second transfer function between a sound source and a microphone wearing an earphone, and a third transfer function between a speaker and the microphone.
本申请实施例的执行主体可以为电子设备,也可以为设置在电子设备中的芯片、芯片模组或滤波器系数设置装置等。滤波器系数设置装置可以通过软件实现,也可以通过软件和硬件的结合实现。电子设备可以为计算机。The executor of the embodiment of the present application may be an electronic device, or may be a chip, a chip module, or a filter coefficient setting device installed in the electronic device. The device for setting filter coefficients can be implemented by software, or by a combination of software and hardware. The electronic device may be a computer.
麦克风设置在人工耳中,扬声器设置在耳机中。The microphone is set in the artificial ear, and the speaker is set in the earphone.
可以通过实验测试,获取第一传递函数,第二传递函数以及第三传递函数。The first transfer function, the second transfer function and the third transfer function can be obtained through experimental testing.
下面,结合图3A-图3B,对获取第一传递函数,第二传递函数以及第三传递函数的过程进行说明。Next, the process of obtaining the first transfer function, the second transfer function and the third transfer function will be described with reference to FIGS. 3A-3B .
图3A为本申请实施例提供的一种获取传递函数的过程的示意图。请参见图3A,包括播放设备301以及模型302。播放设备301可以为高保真音箱,模型302上设置有人工耳,人工耳中设置有麦克风(图中未示意出麦克风)。播放设备301用于播放扫频信号,模型302中的麦克风用于收集播放设备301播放的扫频信号。此过程用以模拟人耳在未佩戴耳机时,听到的外界环境声音。扫频信号可以为20Hz线性递增到20kHz的正弦波信号。FIG. 3A is a schematic diagram of a process of obtaining a transfer function provided by an embodiment of the present application. Please refer to FIG. 3A , which includes a playback device 301 and a model 302 . The playback device 301 may be a high-fidelity speaker, and the model 302 is provided with an artificial ear, and a microphone is provided in the artificial ear (the microphone is not shown in the figure). The playback device 301 is used to play the frequency sweep signal, and the microphone in the model 302 is used to collect the frequency sweep signal played by the playback device 301 . This process is used to simulate the external ambient sound heard by the human ear when the earphone is not worn. The frequency sweep signal can be a sine wave signal with a linear increase from 20Hz to 20kHz.
可以通过如下方式获取第一传递函数:模型302在播放设备301播放扫频信号时,利用模型302的麦克风收集播放设备301播放的扫频信号。对播放设备302播放的扫频信号以及模型302收集的扫频信号进行傅里叶变换,将时域信号变为频域信号。根据频域信号的幅频和相频变化,确定播放设备301播放的声源与麦克风之间的第一传递函数。The first transfer function may be obtained in the following manner: when the model 302 plays the frequency sweep signal on the playback device 301 , the microphone of the model 302 collects the frequency sweep signal played by the playback device 301 . Fourier transform is performed on the frequency sweep signal played by the playback device 302 and the frequency sweep signal collected by the model 302 to change the time domain signal into a frequency domain signal. According to changes in the amplitude frequency and phase frequency of the frequency domain signal, a first transfer function between the sound source played by the playback device 301 and the microphone is determined.
图3B为本申请实施例提供的另一种获取传递函数的过程的示意图。请参见图3B,包括播放设备301,模型302以及耳机303。播放设备301可以为高保真音箱,模型302上设置有人工耳(图中未示意出人工耳),人工耳中设置有麦克风,模型302的人工耳上佩戴有耳机303。FIG. 3B is a schematic diagram of another process of obtaining a transfer function provided by the embodiment of the present application. Please refer to FIG. 3B , which includes a playback device 301 , a model 302 and earphones 303 . The playback device 301 can be a high-fidelity speaker, the model 302 is provided with an artificial ear (artificial ear is not shown in the figure), a microphone is provided in the artificial ear, and an earphone 303 is worn on the artificial ear of the model 302 .
播放设备301用于播放扫频信号,模型302中的麦克风用于收集佩戴耳机303时,播放设备301播放的扫频信号。此过程用以模拟人耳在佩戴耳机时,听到的外界环境声音。The playback device 301 is used to play the frequency sweep signal, and the microphone in the model 302 is used to collect the frequency sweep signal played by the playback device 301 when the earphone 303 is worn. This process is used to simulate the external environment sound heard by the human ear when wearing earphones.
可以通过如下方式获取第二传递函数:播放设备301播放扫频信号时,模型302在佩戴耳机303的情况下,模型302的人工耳麦克风收集播放设备301播放的扫频信号。对播放设备302播放的扫频信号以及模型302收集的扫频信号进行傅里叶变换,将时域信号变为频域信号。根据频域信号的幅频和相频变化,确定声源与佩戴耳机的麦克风之间的第二传递函数。The second transfer function can be acquired in the following manner: when the playback device 301 plays the frequency sweep signal, and the model 302 wears the earphone 303 , the artificial ear microphone of the model 302 collects the frequency sweep signal played by the playback device 301 . Fourier transform is performed on the frequency sweep signal played by the playback device 302 and the frequency sweep signal collected by the model 302 to change the time domain signal into a frequency domain signal. A second transfer function between the sound source and the microphone wearing the earphone is determined according to the amplitude-frequency and phase-frequency changes of the frequency domain signal.
模型302在佩戴耳机303时,用耳机303直接播放扫频信号,用以模拟人使用耳机时听到耳机播放的声源。When the model 302 is wearing the earphone 303, the earphone 303 is used to directly play the sweeping signal, so as to simulate the sound source played by the earphone when a person uses the earphone.
可以通过如下方式获取第三传递函数:模型302佩戴耳机303时,耳机303的扬声器播放扫频信号,模型302的人工耳麦克风收集播放耳机303的扬声器播放的扫频信号。对耳机303的扬声器播放的扫频信号以及模型302收集的扫频信号进行傅里叶变换,将时域信号变为频域信号。根据频域信号的幅频和相频变化,确定扬声器与麦克风之间的第三传递函数。The third transfer function can be obtained in the following manner: when the model 302 wears the earphone 303 , the speaker of the earphone 303 plays a frequency sweep signal, and the artificial ear microphone of the model 302 collects and plays the frequency sweep signal played by the speaker of the earphone 303 . Fourier transform is performed on the frequency sweep signal played by the speaker of the earphone 303 and the frequency sweep signal collected by the model 302, and the time domain signal is changed into a frequency domain signal. A third transfer function between the loudspeaker and the microphone is determined according to the amplitude-frequency and phase-frequency changes of the frequency domain signal.
S202、确定透传滤波器中各子滤波器的滤波器传递函数。S202. Determine the filter transfer function of each sub-filter in the pass-through filter.
透传滤波器设置在耳机中。一个透传滤波器可以包括一个或多个子滤波器。其中,多个子滤波器级联组成透传滤波器。子滤波器可以为双二阶滤波器。可以根据子滤波器的类型,确定子滤波器的滤波器传递函数。The pass-through filter is set in the earphone. A pass-through filter can include one or more sub-filters. Wherein, multiple sub-filters are cascaded to form a pass-through filter. The sub-filters may be biquad filters. The filter transfer function of the sub-filter may be determined according to the type of the sub-filter.
例如,透传滤波器包括一个峰值滤波器,则该透传滤波器中子滤波器为峰值滤波器。峰值滤波器的滤波器传递函数可以如公式1所示:For example, if the transparent filter includes a peak filter, then the sub-filter in the transparent filter is a peak filter. The filter transfer function of the peak filter can be shown in Equation 1:
其中,H0(z)为峰值滤波器的滤波器传递函数。公式1中的参数可以通过公式2、公式3、公式4确定。Wherein, H 0 (z) is the filter transfer function of the peak filter. The parameters in
公式2:A=10g/40 Formula 2: A = 10 g/40
公式3: Formula 3:
公式4: Formula 4:
其中,g为单节增益;f为中心频率;fs为采样频率;Q为品质因数。Among them, g is the single-section gain; f is the center frequency; f s is the sampling frequency; Q is the quality factor.
S203、根据第一传递函数、第二传递函数、第三传递函数和各子滤波器的滤波器传递函数,确定透传滤波器的系数。S203. Determine coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function, and the filter transfer functions of the sub-filters.
可以通过如下方式,确定透传滤波器的系数:将各子滤波器的滤波器传递函数的乘积确定为第四传递函数;根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定透传滤波器的系数。The coefficients of the transparent filter can be determined in the following manner: the product of the filter transfer functions of each sub-filter is determined as the fourth transfer function; according to the first transfer function, the second transfer function, the third transfer function and the fourth Transfer function, which determines the coefficients of the pass-through filter.
例如,透传滤波器包括两个子滤波器,分别为子滤波器1以及子滤波器2。其中子滤波器1的滤波器传递函数为H0(z),子滤波器2的滤波器传递函数为H1(z)。则可以确定第四传递函数为H0(z)×H1(z)。For example, the transparent transmission filter includes two sub-filters, which are sub-filter 1 and
根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定灵敏度函数。根据灵敏度函数,确定透传滤波器的系数。A sensitivity function is determined based on the first transfer function, the second transfer function, the third transfer function and the fourth transfer function. According to the sensitivity function, the coefficients of the pass-through filter are determined.
为了使佩戴耳机时用户听到的外界环境声尽可能和没有佩戴耳机时的外界环境声一致,需要使灵敏度函数趋近于0。当灵敏度函数趋近于0时,透传滤波器的频率响应接近理想透传滤波器的频率响应。此时透传滤波器的系数,为设置在耳机中的透传滤波器的系数。In order to make the external ambient sound heard by the user when wearing the earphone be as consistent as possible with the external ambient sound when not wearing the earphone, it is necessary to make the sensitivity function close to 0. When the sensitivity function is close to 0, the frequency response of the transparent filter is close to the frequency response of the ideal transparent filter. At this time, the coefficient of the transparent filter is the coefficient of the transparent filter set in the earphone.
本申请实施例提供的滤波器系数设置方法,获取声源与麦克风之间的第一传递函数、声源与佩戴耳机的麦克风之间的第二传递函数、和扬声器与麦克风之间的第三传递函数;确定透传滤波器中各子滤波器的滤波器传递函数;根据第一传递函数、第二传递函数、第三传递函数和各子滤波器的滤波器传递函数,确定透传滤波器的系数。在上述过程中,由于是根据第一传递函数、第二传递函数、第三传递函数和各子滤波器的滤波器传递函数,而不是人为手动调节,确定透传滤波器的系数。提高了设置滤波器系数的准确性。The filter coefficient setting method provided in the embodiment of the present application obtains the first transfer function between the sound source and the microphone, the second transfer function between the sound source and the microphone wearing the earphone, and the third transfer function between the speaker and the microphone function; determine the filter transfer function of each sub-filter in the transparent filter; determine the filter transfer function of the transparent filter according to the first transfer function, the second transfer function, the third transfer function and the filter transfer function of each sub-filter coefficient. In the above process, the coefficients of the transparent filter are determined according to the first transfer function, the second transfer function, the third transfer function and the filter transfer functions of each sub-filter instead of manual adjustment. Improved accuracy of setting filter coefficients.
图4为本申请实施例提供的另一种滤波器系数设置方法的流程示意图。FIG. 4 is a schematic flowchart of another method for setting filter coefficients provided in an embodiment of the present application.
请参见图4,该方法可以包括:See Figure 4, the method can include:
S401、获取第一传递函数,第二传递函数和第三传递函数。S401. Acquire a first transfer function, a second transfer function, and a third transfer function.
需要说明的是,S401的执行过程参见S201,此处不再赘述。It should be noted that, for the execution process of S401, refer to S201, which will not be repeated here.
S402、确定透传滤波器中各子滤波器的滤波器传递函数。S402. Determine the filter transfer function of each sub-filter in the pass-through filter.
透传滤波器设置在耳机中。一种类型子滤波器对应同一形式的传递函数。The pass-through filter is set in the earphone. A type of sub-filter corresponds to a transfer function of the same form.
例如,假设子滤波器为搁架滤波器,其传递函数可以如公式5所示:For example, assuming the sub-filter is a shelving filter, its transfer function can be shown in Equation 5:
其中,H1(z)为架滤波器的滤波器传递函数。其他参数的解释见上文。公式5中的参数可以通过公式2、公式3、公式4确定。Wherein, H 1 (z) is the filter transfer function of the shelf filter. See above for explanation of other parameters. The parameters in Formula 5 can be determined by
S403、将各子滤波器的滤波器传递函数的乘积确定为第四传递函数。S403. Determine the product of the filter transfer functions of the sub-filters as a fourth transfer function.
例如,一个透传滤波器包括3个子滤波器,分别为子滤波器1,子滤波器2以及子滤波器3。其中子滤波器1的滤波器传递函数为H0(z),子滤波器2的滤波器传递函数为H1(z),子滤波器2的滤波器传递函数为H2(z)。则可以确定第四传递函数为H0(z)×H1(z)×H2(z)。For example, a pass-through filter includes three sub-filters, namely sub-filter 1,
S404、根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定灵敏度函数。S404. Determine a sensitivity function according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function.
可以通过如下方式确定灵敏度函数:获取第三传递函数和第四传递函数的乘积函数;将第一传递函数减去第二传递函数和乘积函数的差值,确定为误差信号;将差值函数与第一传递函数的比值,确定为灵敏度函数。The sensitivity function can be determined in the following manner: obtain the product function of the third transfer function and the fourth transfer function; subtract the difference between the first transfer function and the second transfer function and the product function, and determine it as an error signal; combine the difference function with The ratio of the first transfer function is determined as the sensitivity function.
可以通过如下公式5,确定灵敏度函数:The sensitivity function can be determined by the following formula 5:
其中,E(z)为误差信号的z变换;T(z)为第一传递函数;P(z)为第二传递函数;S(z)为第三传递函数;A(z)为第四传递函数。Among them, E(z) is the z transformation of the error signal; T(z) is the first transfer function; P(z) is the second transfer function; S(z) is the third transfer function; A(z) is the fourth Transfer Function.
误差信号为未佩戴耳机时获取的环境声源信号与佩戴耳机时获取的环境声源信号的差值信号。The error signal is a difference signal between the ambient sound source signal acquired when the earphone is not worn and the ambient sound source signal acquired when the earphone is worn.
例如,未佩戴耳机时获取的环境声源信号为r(n),佩戴耳机时获取的环境声源信号的差值信号为d(n)。则误差信号为e(n)=r(n)-d(n)。For example, r(n) is the ambient sound source signal acquired when the earphone is not worn, and d(n) is the difference signal of the ambient sound source signal acquired when the earphone is worn. Then the error signal is e(n)=r(n)-d(n).
S405、确定灵敏度函数对应的目标函数。S405. Determine an objective function corresponding to the sensitivity function.
目标函数可以通过如下公式6确定:The objective function can be determined by the following formula 6:
其中,Eobj为灵敏度函数对应的目标函数;fk为透传滤波器作用的频段范围内任意一个频率点;fstop为透传滤波器的截止频率;w(fk)为拟合频率的权重系数。其他相关参数解释见上文。Among them, E obj is the objective function corresponding to the sensitivity function; f k is any frequency point within the frequency range of the transparent filter; f stop is the cut-off frequency of the transparent filter; w(f k ) is the fitting frequency weight factor. Other related parameters are explained above.
带上耳机后,能听到外界环境声音时对应的频率范围,确定为透传滤波器的频段。例如,透传滤波器作用的的频段为20Hz~4000Hz。则fk的取值可以在20Hz~4000Hz内任意一个频率。After putting on the earphones, the corresponding frequency range when the external environment sound can be heard is determined as the frequency band of the transparent transmission filter. For example, the frequency band of the transparent transmission filter is 20Hz-4000Hz. Then the value of f k can be any frequency within 20Hz-4000Hz.
在确定fk的取值时,可以根据预设关系,确定每个取样点k值。根据k值,确定每个k值对应的fk。下面,结合图5,对确定fk的过程进行说明。When determining the value of f k , the value of k at each sampling point can be determined according to a preset relationship. According to the k value, f k corresponding to each k value is determined. Next, with reference to FIG. 5 , the process of determining f k will be described.
图5为本申请实施例提供的确定fk的过程的示意图。请参见图5,包括两个过程。请参见过程1,过程1中的曲线为取样点和k值的关系曲线。其中,取样点=1,2,3,……n。根据取样点和k值的关系曲线,确定每个取样点对应的k值。请参见过程2,过程2中的曲线为k和fk的关系曲线。根据k和fk的关系曲线,确定每个k值对应的fk。根据过程1中取样点对应的k值,确定每个取样点对应的fk。每个取样点对应的fk具体可以如表1所示:FIG. 5 is a schematic diagram of a process of determining f k provided by an embodiment of the present application. See Figure 5, including two processes. Please refer to
表1Table 1
需要注意的是,若fk大于fstop时,停止取样。It should be noted that if f k is greater than f stop , the sampling is stopped.
可以根据透传滤波器作用的频段,调整拟合频率的权重系数w(fk)。The weight coefficient w(f k ) of the fitting frequency can be adjusted according to the frequency band on which the transparent transmission filter acts.
在确定透传滤波器系数时,可以通过预设算法调整各子滤波器的滤波器参数的取值,以使目标函数Eobj的取值最小。目标函数Eobj的取值越小,可以使佩戴耳机时用户听到的外界环境声尽可能和没有佩戴耳机时的外界环境声一致。初始时,各子滤波器的滤波器参数的取值可以随机选取。When determining the coefficients of the transparent transmission filter, the value of the filter parameter of each sub-filter may be adjusted through a preset algorithm, so as to minimize the value of the objective function E obj . The smaller the value of the objective function E obj , the better the external ambient sound heard by the user when wearing the earphone is as consistent as possible with the external ambient sound when not wearing the earphone. Initially, the values of the filter parameters of each sub-filter can be randomly selected.
预设算法可以为全局优化算法。例如,预设算法可以为遗传算法,粒子群算法以及差分进化算法。The preset algorithm may be a global optimization algorithm. For example, the preset algorithm may be a genetic algorithm, a particle swarm algorithm, and a differential evolution algorithm.
可以通过如下方式确定目标函数的取值:确定各子滤波器的滤波器参数的取值;根据各子滤波器的参数的取值,确定各子滤波器的传递函数;根据调整后各子滤波器的传递函数的乘积,确定该条件下对应的第四传递函数;根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定误差信号;根据误差信号和第一传递函数,确定灵敏度函数;根据灵敏度函数,确定该条件下目标函数的取值。The value of the objective function can be determined in the following manner: determine the value of the filter parameters of each sub-filter; determine the transfer function of each sub-filter according to the value of the parameter of each sub-filter; The product of the transfer function of the device, determine the corresponding fourth transfer function under this condition; determine the error signal according to the first transfer function, the second transfer function, the third transfer function and the fourth transfer function; according to the error signal and the first transfer function function to determine the sensitivity function; according to the sensitivity function, determine the value of the objective function under this condition.
例如,一个透传滤波器包括2个子滤波器。在确定目标函数的取值时,根据预设算法,确定2个子滤波器的滤波器参数的取值。子滤波器1的滤波器参数的取值为f1,Q1,g1,子滤波器2的滤波器参数的取值为f2,Q2,g2。根据子滤波器1的参数的取值f1,Q1,g1,确定子滤波器1的传递函数为H1(z)。根据子滤波器2的滤波器参数的取值f2,Q2,g2,确定子滤波器2的传递函数为H2(z)。此时,可以确定该条件下对应的第四传递函数为H1(z)×H2(z)。根据第一传递函数、第二传递函数、第三传递函数和该条件下对应的第四传递函数,确定误差信号为E1(z)。根据误差信号E1(z)和第一传递函数,确定灵敏度函数。根据灵敏度函数,确定该条件下目标函数的取值为 For example, a pass-through filter includes 2 sub-filters. When determining the value of the objective function, the values of the filter parameters of the two sub-filters are determined according to a preset algorithm. The values of the filter parameters of the
S406、判断目标函数是否为取到最小值。S406. Determine whether the objective function is to obtain a minimum value.
若是,执行S408。If yes, execute S408.
若否,执行S407。If not, execute S407.
S407、调整各子滤波器的滤波器参数的取值,以更新各子滤波器的传递函数。S407. Adjust the value of the filter parameter of each sub-filter, so as to update the transfer function of each sub-filter.
子滤波器的参数包括:单节增益g,中心频率f以及品质因数Q。The parameters of the sub-filter include: single section gain g, center frequency f and quality factor Q.
例如,一个透传滤波器包括2个子滤波器。其中,子滤波器1对应的中心频率为f1,品质因数为Q1,单节增益为g1。子滤波器2对应的中心频率为f2,品质因数为Q2,单节增益为g2。则可以确定子滤波器1的滤波器参数的取值为f1,Q1,g1。确定子滤波器2的滤波器参数的取值为f2,Q2,g2。For example, a pass-through filter includes 2 sub-filters. Wherein, the center frequency corresponding to the
可以通过如下方式更新各子滤波器的传递函数:将调整各子滤波器的滤波器参数的取值确定为调整后各子滤波器的系数;根据调整后各子滤波器的系数,更新各子滤波器的传递函数。The transfer function of each sub-filter can be updated in the following manner: the value of the filter parameter of each sub-filter is determined as the adjusted coefficient of each sub-filter; according to the adjusted coefficient of each sub-filter, each sub-filter is updated. The transfer function of the filter.
例如,一个透传滤波器包括2个子滤波器。其中,子滤波器1的系数x1=[f1,Q1,g1],子滤波器2的系数x2=[f2,Q2,g2]。根据子滤波器1的系数x1,确定子滤波器1的传递函数为H1(z)。根据子滤波器2的滤波器的系数x2,确定子滤波器2的传递函数为H2(z)。在最小化灵敏度函数对应的目标函数时,得到灵敏度函数对应的目标函数为此时,若确定并不是灵敏度函数对应的目标函数的最小值。则调整2个子滤波器的滤波器参数的取值。调整后子滤波器1的系数x1′=[f1′,Q1′,g1′],子滤波器2的系数x2’=[f2′,Q2′,g2′]。根据调整后子滤波器1的系数,更新子滤波器1的传递函数为H1′(z)。根据调整后子滤波器2的系数,更新子滤波器2的传递函数为H2′(z)。For example, a pass-through filter includes 2 sub-filters. Wherein, the coefficient x 1 of the
在S407之后,执行S403。After S407, execute S403.
S408、根据各子滤波器的滤波器参数的取值,确定透传滤波器的系数。S408. Determine coefficients of the transparent transmission filter according to values of filter parameters of each sub-filter.
可以通过如下方式确定透传滤波器的系数:将各子滤波器参数的取值确定为各子滤波器的系数;对子滤波器的系数进行级联处理,得到透传滤波器的系数。The coefficients of the transparent filter can be determined in the following manner: determining the value of each sub-filter parameter as the coefficient of each sub-filter; cascading the coefficients of the sub-filters to obtain the coefficients of the transparent filter.
例如,假设一个透传滤波器可以由一个峰值滤波器和一个搁架滤波器组成。其中,峰值滤波器对应的中心频率为f1,品质因数为Q1,单节增益为g1。架滤波器对应的中心频率为f2,品质因数为Q2,单节增益为g2。则可以确定峰值滤波器的系数x1=[f1,Q1,g1]。确定搁架滤波器的系数x2=[f2,Q2,g2]。对两个子滤波器的系数进行级联处理,得到透传滤波器的系数X=[x1,x2,G]。其中,G为全局增益。For example, suppose a pass-through filter can be composed of a peak filter and a shelving filter. Wherein, the center frequency corresponding to the peak filter is f 1 , the quality factor is Q 1 , and the single-section gain is g 1 . The center frequency corresponding to the shelf filter is f 2 , the quality factor is Q 2 , and the single-section gain is g 2 . Then the coefficient x 1 =[f 1 , Q 1 , g 1 ] of the peak filter can be determined. The coefficients x 2 =[f 2 , Q 2 , g 2 ] of the shelving filter are determined. The coefficients of the two sub-filters are cascaded to obtain the coefficients X=[x 1 , x 2 , G] of the transparent filter. Among them, G is the global gain.
本申请实施例提供的滤波器参数设置方法,获取第一传递函数,第二传递函数和第三传递函数;确定第四传递函数;根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定灵敏度函数;通过预设算法最小化灵敏度函数对应的目标函数,调整各子滤波器的滤波器参数的取值。根据各子滤波器的滤波器参数的取值,确定透传滤波器的系数。在上述过程中,由于是通过预设算法最小化灵敏度函数对应的目标函数,从而调整各子滤波器的滤波器参数。根据各子滤波器的滤波器参数,确定透传滤波器的系数。而不是人为手动调节,提高了设置滤波器系数的准确性。The filter parameter setting method provided by the embodiment of the present application obtains the first transfer function, the second transfer function and the third transfer function; determines the fourth transfer function; according to the first transfer function, the second transfer function, the third transfer function and The fourth transfer function is to determine the sensitivity function; the objective function corresponding to the sensitivity function is minimized through a preset algorithm, and the value of the filter parameter of each sub-filter is adjusted. According to the value of the filter parameter of each sub-filter, the coefficient of the transparent transmission filter is determined. In the above process, since the objective function corresponding to the sensitivity function is minimized through a preset algorithm, the filter parameters of each sub-filter are adjusted. According to the filter parameters of each sub-filter, the coefficients of the transparent transmission filter are determined. Instead of manual adjustment, the accuracy of setting filter coefficients is improved.
在上述任意一个实施例基础上,下面,结合图6,对设置滤波器参数的过程进行举例说明。图6为本申请实施例提供的透传滤波器的设计原理图。请参见图6,T(z)为第一传递函数;P(z)为第二传递函数;S(z)为第三传递函数;A(z)为第四传递函数。输入信号x(n)后,x(n)经过第一传递函数T(z)变为r(n),x(n)经过第二传递函数P(z)变为d(n),x(n)经过第四传递函数A(z)变为y(n)。经过第三传递函数S(z)变为y′(n)。e(n)为误差信号,e(n)经过z变换后为E(z)。On the basis of any one of the above embodiments, the process of setting filter parameters will be illustrated below with reference to FIG. 6 . FIG. 6 is a design schematic diagram of a transparent transmission filter provided by an embodiment of the present application. Please refer to FIG. 6 , T(z) is the first transfer function; P(z) is the second transfer function; S(z) is the third transfer function; A(z) is the fourth transfer function. After the input signal x(n), x(n) becomes r(n) through the first transfer function T(z), x(n) becomes d(n) through the second transfer function P(z), and x( n) becomes y(n) through the fourth transfer function A(z). S(z) becomes y'(n) through the third transfer function. e(n) is an error signal, and e(n) is E(z) after z transformation.
假设透传滤波器包括2个子滤波器。初始时,子滤波器1的系数x1=[f1,Q1,g1],子滤波器2的系数x2=[f2,Q2,g2]。根据子滤波器1的系数x1,确定子滤波器1的传递函数为H1(z)。根据子滤波器2的系数x2,确定子滤波器2的传递函数为H2(z)。此时,第四传递函数A1(z)=H1(z)×H2(z)。输入信号x1(n)后得到的误差信号e1(n),经过z变换后得到E1(z)。It is assumed that the transparent transmission filter includes 2 sub-filters. Initially, the coefficient x 1 of the
可以通过公式5,确定灵敏度函数1:
根据公式6,确定灵敏度函数1对应的目标函数。According to formula 6, the objective function corresponding to the
根据预设算法,判断是否为最小值。若是,则对每个子滤波器的系数进行级联处理,得到透传滤波器的系数X=[x1,x2,G]。其中,G为全局增益。According to the preset algorithm, the judgment Is it the minimum value. If yes, the coefficients of each sub-filter are cascaded to obtain the coefficient X=[x 1 , x 2 , G] of the transparent filter. Among them, G is the global gain.
若否,则调整各子滤波器的滤波器参数的取值。调整后子滤波器1的系数x1′=[f1′,Q1′,g1′],子滤波器2的系数x2′=[f2′,Q2′,g2′]。根据调整后子滤波器1的系数,确定调整后子滤波器1的传递函数为H1′(z)。根据调整后子滤波器2的系数,确定调整后子滤波器2的传递函数为H2′(z)。则可以确定调整后的第四传递函数为A2(z)=H1′(z)×H2′(z)。此时,输入信号x2(n)后得到的误差信号e2(n),经过z变换后得到E2(z)。If not, the values of the filter parameters of each sub-filter are adjusted. After adjustment, the coefficient x 1 ′ of the
可以通过公式5,确定灵敏度函数2:
根据公式6,确定灵敏度函数2对应的目标函数。According to formula 6, the objective function corresponding to the
根据预设算法,判断是否为最小值。若是,则对每个子滤波器的系数进行级联处理,得到透传滤波器的系数X=[x1′,x2′,G]。According to the preset algorithm, the judgment Is it the minimum value. If yes, the coefficients of each sub-filter are cascaded to obtain the coefficients X=[x 1 ′, x 2 ′, G] of the transparent filter.
若否,则调整各子滤波器的滤波器参数的取值,重复上述步骤,直至灵敏度函数对应的目标函数Eobj为最小值。此时,对每个子滤波器的系数进行级联处理,得到透传滤波器的系数。If not, adjust the values of the filter parameters of each sub-filter, and repeat the above steps until the objective function E obj corresponding to the sensitivity function is the minimum value. At this time, cascade processing is performed on the coefficients of each sub-filter to obtain the coefficients of the transparent transmission filter.
将得到的透传滤波器的系数设置在该透传滤波器之后,将该透传滤波器配入耳机中。此时,耳机具有透传功能。The coefficients of the obtained transparent filter are set after the transparent filter, and the transparent filter is configured into the earphone. At this time, the headset has the transparent transmission function.
本申请实施例提供的设置滤波器参数的过程的举例说明,获取第一传递函数,第二传递函数和第三传递函数;根据各个子滤波器的滤波器参数的取值,确定第四传递函数;根据第一传递函数、第二传递函数、第三传递函数和第四传递函数,确定灵敏度函数;通过预设算法最小化灵敏度函数对应的目标函数,调整各子滤波器的滤波器参数的取值。各子滤波器的滤波器参数的取值,确定个各子滤波器的系数。根据各子滤波器的系数,确定透传滤波器的系数。在上述过程中,由于是通过预设算法最小化灵敏度函数对应的目标函数,从而调整各子滤波器的系数。根据各子滤波器的系数,确定透传滤波器的系数。而不是人为手动调节,提高了设置滤波器系数的准确性。The example of the process of setting filter parameters provided by the embodiment of the present application obtains the first transfer function, the second transfer function and the third transfer function; according to the values of the filter parameters of each sub-filter, determine the fourth transfer function ; Determine the sensitivity function according to the first transfer function, the second transfer function, the third transfer function and the fourth transfer function; minimize the target function corresponding to the sensitivity function through a preset algorithm, and adjust the filter parameters of each sub-filter value. The values of the filter parameters of each sub-filter determine the coefficients of each sub-filter. According to the coefficients of each sub-filter, the coefficients of the transparent transmission filter are determined. In the above process, since the objective function corresponding to the sensitivity function is minimized through a preset algorithm, the coefficients of each sub-filter are adjusted. According to the coefficients of each sub-filter, the coefficients of the transparent transmission filter are determined. Instead of manual adjustment, the accuracy of setting filter coefficients is improved.
图7为本申请实施例提供的滤波器系数设置装置的结构示意图。滤波器系数设置装置可以为芯片或芯片模组。请参见图7,该滤波器系数设置装置10可以包括:FIG. 7 is a schematic structural diagram of an apparatus for setting filter coefficients provided by an embodiment of the present application. The filter coefficient setting device can be a chip or a chip module. Referring to Fig. 7, the filter coefficient setting device 10 may include:
获取模块11,用于获取声源与麦克风之间的第一传递函数、声源与佩戴耳机的所述麦克风之间的第二传递函数、和扬声器与所述麦克风之间的第三传递函数,所述麦克风设置在人工耳中,所述扬声器设置在所述耳机中;An
第一确定模块12,用于确定透传滤波器中各子滤波器的滤波器传递函数,所述透传滤波器设置在所述耳机中;The
第二确定模块13,用于根据所述第一传递函数、所述第二传递函数、所述第三传递函数和各子滤波器的滤波器传递函数,确定所述透传滤波器的系数。The
本申请实施例提供的滤波器系数设置装置可以执行上述方法实施例所示的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The device for setting filter coefficients provided in the embodiments of the present application can implement the technical solutions shown in the above method embodiments, and its implementation principles and beneficial effects are similar, and will not be repeated here.
在一种可能的实施方式中,所述第二确定模块13具体用于:In a possible implementation manner, the
将各子滤波器的滤波器传递函数的乘积确定为第四传递函数;determining the product of the filter transfer functions of the respective sub-filters as a fourth transfer function;
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定所述透传滤波器的系数。Determine coefficients of the transparent transmission filter according to the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function.
在一种可能的实施方式中,所述第二确定模块13具体用于:In a possible implementation manner, the
根据所述第一传递函数、所述第二传递函数、所述第三传递函数和所述第四传递函数,确定灵敏度函数;determining a sensitivity function based on the first transfer function, the second transfer function, the third transfer function, and the fourth transfer function;
根据所述灵敏度函数,确定所述透传滤波器的系数。According to the sensitivity function, the coefficients of the transparent transmission filter are determined.
在一种可能的实施方式中,所述第二确定模块13具体用于:In a possible implementation manner, the second determining
获取所述第三传递函数和所述第四传递函数的乘积函数;obtaining a product function of the third transfer function and the fourth transfer function;
将所述第一传递函数减去所述第二传递函数和所述乘积函数的差值,确定为误差信号;Determining the difference between the first transfer function minus the second transfer function and the product function as an error signal;
将所述误差信号与所述第一传递函数的比值,确定为所述灵敏度函数。A ratio of the error signal to the first transfer function is determined as the sensitivity function.
在一种可能的实施方式中,所述第二确定模块13具体用于:In a possible implementation manner, the second determining
确定所述灵敏度函数对应的目标函数;determining an objective function corresponding to the sensitivity function;
调整所述各子滤波器的滤波器参数的取值,直至得到所述目标函数的最小值;Adjusting the values of the filter parameters of the sub-filters until the minimum value of the objective function is obtained;
根据所述目标函数取所述最小值时各子滤波器的滤波器参数的取值,确定为所述透传滤波器的系数。According to the value of the filter parameter of each sub-filter when the objective function takes the minimum value, it is determined as the coefficient of the transparent transmission filter.
在一种可能的实施方式中,所述第二确定模块13具体用于:In a possible implementation manner, the
将所述各子滤波器参数的取值确定为各子滤波器的系数;Determining the value of each sub-filter parameter as a coefficient of each sub-filter;
对所述子滤波器的系数进行级联处理,得到所述透传滤波器的系数。The coefficients of the sub-filters are cascaded to obtain the coefficients of the transparent transmission filter.
在一种可能的实施方式中,所述子滤波器为双二阶滤波器。In a possible implementation manner, the sub-filter is a biquad filter.
本申请实施例提供的滤波器系数设置装置可以执行上述方法实施例所示的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The device for setting filter coefficients provided in the embodiments of the present application can implement the technical solutions shown in the above method embodiments, and its implementation principles and beneficial effects are similar, and will not be repeated here.
图8为本申请实施例提供的电子设备的结构示意图。请参见图8,该电子设备20可以包括:存储器21、处理器22。示例性地,存储器21、处理器22,各部分之间通过总线23相互连接。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Referring to FIG. 8 , the electronic device 20 may include: a
存储器21用于存储程序指令;The
处理器22用于执行该存储器所存储的程序指令,用以使得电子设备20执行上述方法实施例所示的方法。The
本申请实施例提供的电子设备可以执行上述方法实施例所示的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The electronic device provided by the embodiment of the present application can implement the technical solutions shown in the above method embodiments, and its implementation principles and beneficial effects are similar, and will not be repeated here.
本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现上述方法。An embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to implement the foregoing method when executed by a processor.
本申请实施例还可提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时,可实现上述方法。The embodiment of the present application may further provide a computer program product, including a computer program, and when the computer program is executed by a processor, the foregoing method may be implemented.
实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一可读取存储器中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储器(存储介质)包括:只读存储器(英文:read-only memory,缩写:ROM)、随机存取存储器(英文:Random Access Memor,缩写:RAM)、快闪存储器、硬盘、固态硬盘、磁带(英文:magnetic tape)、软盘(英文:floppy disk)、光盘(英文:optical disc)及其任意组合。All or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a readable memory. When the program is executed, it executes the steps comprising the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviated: ROM), random access memory (English: Random Access Memor, abbreviation: RAM), flash memory, hard disk, solid state disk, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), optical disc (English: optical disc) and any combination thereof.
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理单元以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理单元执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processing unit of other programmable data processing equipment to produce a machine such that the instructions executed by the processing unit of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Apparently, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. In this way, if the modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and equivalent technologies, the present application also intends to include these modifications and variations.
在本申请中,术语“包括”及其变形可以指非限制性的包括;术语“或”及其变形可以指“和/或”。本申请中术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。本申请中,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In this application, the term "include" and its variants may mean non-limiting inclusion; the term "or" and its variants may mean "and/or". The terms "first", "second", etc. in this application are used to distinguish similar objects, and not necessarily used to describe a specific order or sequence. In the present application, "plurality" means two or more. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. The character "/" generally indicates that the contextual objects are an "or" relationship.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211128571.4A CN115379354A (en) | 2022-09-16 | 2022-09-16 | Filter coefficient setting method and device and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211128571.4A CN115379354A (en) | 2022-09-16 | 2022-09-16 | Filter coefficient setting method and device and electronic equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115379354A true CN115379354A (en) | 2022-11-22 |
Family
ID=84071202
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211128571.4A Pending CN115379354A (en) | 2022-09-16 | 2022-09-16 | Filter coefficient setting method and device and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115379354A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119342381A (en) * | 2024-10-15 | 2025-01-21 | 太原理工大学 | Method, device, medium, equipment and earphone for determining transparent adaptive filter |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001049066A2 (en) * | 1999-12-24 | 2001-07-05 | Koninklijke Philips Electronics N.V. | Headphones with integrated microphones |
| US20090086988A1 (en) * | 2007-09-28 | 2009-04-02 | Foxconn Technology Co., Ltd. | Noise reduction headsets and method for providing the same |
| CN108769857A (en) * | 2018-06-26 | 2018-11-06 | 会听声学科技(北京)有限公司 | sound compensation method, system and earphone |
| CN213186476U (en) * | 2020-09-16 | 2021-05-11 | 深圳市中科蓝讯科技股份有限公司 | Debugging system |
-
2022
- 2022-09-16 CN CN202211128571.4A patent/CN115379354A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001049066A2 (en) * | 1999-12-24 | 2001-07-05 | Koninklijke Philips Electronics N.V. | Headphones with integrated microphones |
| US20090086988A1 (en) * | 2007-09-28 | 2009-04-02 | Foxconn Technology Co., Ltd. | Noise reduction headsets and method for providing the same |
| CN108769857A (en) * | 2018-06-26 | 2018-11-06 | 会听声学科技(北京)有限公司 | sound compensation method, system and earphone |
| CN213186476U (en) * | 2020-09-16 | 2021-05-11 | 深圳市中科蓝讯科技股份有限公司 | Debugging system |
Non-Patent Citations (1)
| Title |
|---|
| 吴礼福、胡秋岑、陈晶晶: "自校正滤波有源噪声控制算法", 南京大学学报(自然科学), vol. 58, no. 2, 30 March 2022 (2022-03-30) * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119342381A (en) * | 2024-10-15 | 2025-01-21 | 太原理工大学 | Method, device, medium, equipment and earphone for determining transparent adaptive filter |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102378085B (en) | Equal-loudness contour-based loudness compensation method and device, and audio processing system | |
| CN102947685B (en) | Method and apparatus for reducing the effect of environmental noise on listeners | |
| US10104459B2 (en) | Audio system with conceal detection or calibration | |
| US11405723B2 (en) | Method and apparatus for processing an audio signal based on equalization filter | |
| WO2020142320A1 (en) | Compensation for microphone roll-off variation in acoustic devices | |
| US10056876B2 (en) | Narrowing audio filter transition band | |
| CN114787911A (en) | Noise elimination system and signal processing method of ear-wearing type playing device | |
| US20190132676A1 (en) | Phase Inversion Filter for Correcting Low Frequency Phase Distortion in a Loudspeaker System | |
| CN110956973A (en) | An echo cancellation method, device and intelligent terminal | |
| CN115379354A (en) | Filter coefficient setting method and device and electronic equipment | |
| TWI843240B (en) | Method for generating active noise reduction filter, storage medium and earphone | |
| CN115499747A (en) | Feedback filter coefficient determination method and device and electronic equipment | |
| CN115442712A (en) | Filter coefficient setting method and device and electronic equipment | |
| CN112640485B (en) | Automatic calibration of active noise control system | |
| CN113613123A (en) | Audio data processing method and device, earphone and storage medium | |
| EP4005240A1 (en) | Partial hrtf compensation or prediction for in-ear microphone arrays | |
| CN115361634A (en) | Method, device and electronic equipment for determining feedforward filter coefficients | |
| CN110312198B (en) | Virtual sound source repositioning method and device for digital cinema | |
| US12192711B2 (en) | Speaker calibration method, apparatus and program | |
| CN115002600B (en) | Headphone noise reduction method, device, electronic device and computer-readable storage medium | |
| JP5333085B2 (en) | Equalizer device and electroacoustic transducer | |
| CN115175046B (en) | Headphone noise reduction method, device, electronic device and computer-readable storage medium | |
| TWI837867B (en) | Sound compensation method and head-mounted apparatus | |
| Zotter et al. | Higher-order ambisonic microphones and the wave equation (linear, lossless) | |
| CN108495237A (en) | A kind of amplitude gain control method of loudspeaker tonequality equilibrium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |