主要内容

weightingFilter

Frequency-weighted过滤器

描述

weightingFilter系统对象™在每个输入通道上独立地执行频率加权滤波。

进行频率加权滤波:

  1. 创建weightingFilter对象并设置其属性。

  2. 使用参数调用对象,就像调用函数一样。

有关系统对象如何工作的详细信息,请参见什么是系统对象?

创建

描述

weightFilt= weightingFilter创建一个System对象,weightFilt,它在每个输入通道上独立地执行频率加权滤波。

weightFilt= weightingFilter (weightType设置方法财产weightType

weightFilt= weightingFilter (weightTypeFs设置SampleRate财产Fs

weightFilt = weightingFilter(___名称,值设置每个属性的名字到指定的价值.未指定的属性有默认值。

例子:weightFilt = weightingFilter('C-weighting','SampleRate',96000)创建一个采样率为96,000 Hz的c加权滤波器。

属性

全部展开

除非另有说明,属性为nontunable,这意味着在调用对象后不能更改它们的值。对象在调用时锁定,而释放功能解锁它们。

如果属性为可调,您可以随时更改其值。

有关更改属性值的详细信息,请参见使用系统对象的MATLAB系统设计

加权类型,指定为“权重”“C-weighting”,或“K-weighting”.看到算法获取更多信息。

可调:没有

数据类型:字符|字符串

输入采样率(以Hz为单位),指定为正标量。

可调:是的

数据类型:|

使用

描述

例子

audioOut= weightFilt (audioIn对输入信号进行频率加权滤波,audioIn,并返回过滤后的信号,audioOut.类的算法和属性指定过滤类型weightingFilter系统对象,weightFilt

输入参数

全部展开

音频输入到加权滤波器,指定为矩阵。矩阵的列被视为独立的音频通道。

数据类型:|

输出参数

全部展开

音频从加权滤波器输出,返回为大小相同的矩阵audioIn

数据类型:|

对象的功能

要使用对象函数,请将System对象指定为第一个输入参数。例如,释放system对象的系统资源obj,使用这种语法:

发行版(obj)

全部展开

可视化 可视化并验证过滤器响应
getFilter 返回设置了设计参数的双方过滤器对象
createAudioPluginClass 创建音频插件类,实现的功能系统对象
isStandardCompliant 验证滤波器设计符合IEC 61672-1:2002
克隆 创建重复的系统对象
isLocked 确定系统对象正在使用中
释放 释放资源并允许更改系统对象属性值和输入特征
重置 重置的内部状态系统对象
一步 运行系统对象算法

请注意

weightingFilter金宝app支持额外的过滤分析功能。看到比较和分析权重类型获取详细信息。

例子

全部折叠

检查过滤器设计的符合性状态并将其可视化。

创建一个采样率为22.5 kHz的a加权滤波器。验证过滤器符合标准,并可视化过滤器设计。

aWeight = weightingFilter(“权重”“SampleRate”, 22500);compliancestry atus = isStandardCompliant(aWeight,“1级”
complianceStatus =逻辑0
可视化(aWeight“1级”

更改您的a加权滤波器采样率为44.1 kHz。验证过滤器符合标准,并可视化过滤器设计。

aWeight。SampleRate = 44100;

compliancestry atus = isStandardCompliant(aWeight,“1级”
complianceStatus =逻辑1

使用weightingFilter系统对象™设计一个a加权滤波器,然后使用您的频率加权滤波器设计处理音频信号。

创建一个dsp。AudioFileReader系统对象。

samplesPerFrame = 1024;Reader = dsp。AudioFileReader (“文件名”...“rockguitar - 16 - 44 - p1 -立体声- 72 secs.wav”...“SamplesPerFrame”samplesPerFrame,...“PlayCount”、正);

创建一个weightingFilter系统对象。将读取器的采样率作为加权滤波器的采样率。

Fs = reader.SampleRate;weightFilt = weightingFilter(“权重”Fs);

创建一个频谱分析仪来可视化原始音频信号和经过频率加权滤波后的音频信号。

Scope = dsp。简介(...“SampleRate”Fs,...“PlotAsTwoSidedSpectrum”假的,...“FrequencyScale”“日志”...“FrequencyResolutionMethod”“WindowLength”...“WindowLength”samplesPerFrame,...“标题”“加权滤波”...“ShowLegend”,真的,...“ChannelNames”, {原始信号的“过滤信号”});

在音频流循环中处理音频信号。将过滤后的音频和原始音频可视化。作为最佳实践,在完成时释放System对象。

抽搐Toc < 20 x = reader();y = weightFilt(x);范围([x (: 1), y (: 1)))结束release(weightFilt) release(reader) release(scope)

图频谱分析仪包含一个axis对象和其他类型为uiflowcontainer、uimenu、uitoolbar的对象。标题为A-Weighted Filtering的axes对象包含2个类型为line的对象。这些对象分别代表原始信号、滤波信号。

比较引擎声音的a加权、c加权和k加权滤波。

创建一个a权重过滤器,一个c权重过滤器和一个k权重过滤器。比较和分析所使用的过滤器FVTool

wF{1} = weightingFilter;wF{2} = weightingFilter(“C-weighting”);wF{3} = weightingFilter(“K-weighting”);wF fvtool (wF {1}, {2}, wF {3},“FrequencyScale”“日志”“Fs”传说,wF {1} .SampleRate) (“权重”“C-weighting”“K-weighting”“位置”“最佳”

图形过滤可视化工具-幅度响应(dB)包含一个轴对象和其他类型的uitoolbar, uimenu对象。标题为Magnitude Response (dB)的axis对象包含3个类型为line的对象。这些对象表示a权重,c权重,k权重。

weightingFilter对象支持多种筛金宝app选器分析方法。有关更多信息,请使用帮助在命令行:

帮助weightingFilter.helpFilterAnalysis
以下分析方法可用于离散时间过滤器系统对象:fvtool -滤波器可视化工具info -滤波器信息freqz -频响相位-相位响应零相位-零相位响应grpdelay -群延迟响应相位-相位延迟响应impz -脉冲响应impzlength -脉冲响应长度stepz -阶跃响应zplane -极点/零图成本-实现滤波器的成本估计系统对象测量-频响顺序的测量特征-滤波器顺序系数-滤波器系数一个structure firtype - Determine the type (1-4) of a linear phase FIR filter System object tf - Convert to transfer function zpk - Convert to zero-pole-gain ss - Convert to state space representation isallpass - Verify if filter System object is allpass isfir - Verify if filter System object is FIR islinphase - Verify if filter System object is linear phase ismaxphase - Verify if filter System object is maximum phase isminphase - Verify if filter System object is minimum phase isreal - Verify if filter System object is minimum real issos - Verify if filter System object is in second-order sections form isstable - Verify if filter System object is stable realizemdl - Filter realization (Simulink diagram) specifyall - Fully specify fixed-point filter System object settings cascade - Create a FilterCascade System object Second-order sections: scale - Scale second-order sections of BiquadFilter System object scalecheck - Check scaling of BiquadFilter System object reorder - Reorder second-order sections of BiquadFilter System object cumsec - Cumulative second-order section of BiquadFilter System object scaleopts - Create an options object for second-order section scaling sos - Convert to second-order-sections (for IIRFilter System objects only) Fixed-Point (Fixed-Point Designer Required): freqrespest - Frequency response estimate via filtering freqrespopts - Create an options object for frequency response estimate noisepsd - Power spectral density of filter output due to roundoff noise noisepsdopts - Create an options object for output noise PSD computation Multirate Analysis: polyphase - Polyphase decomposition of multirate filter System object gain (CIC decimator) - Gain of CIC decimator filter System object gain (CIC interpolator) - Gain of CIC interpolator filter System object For decimator, interpolator, or rate change filter System objects the analysis tools perform computations relative to the rate at which the filter is running. If a sampling frequency is specified, it is assumed that the filter is running at that rate. Help for weightingFilter.helpFilterAnalysis is inherited from superclass dsp.internal.FilterAnalysis

创建一个dsp。AudioFileReader并指定一个声音文件。创建一个audioDeviceWriter使用默认属性。在音频流循环中,播放白噪声,然后依次听经过a加权、c加权和k加权滤波器过滤的白噪声。

fileReader = dsp。AudioFileReader (“Engine-16-44p1-stereo-20sec.wav”);deviceWriter = audioDeviceWriter(“SampleRate”, fileReader.SampleRate);流(“没有过滤……”
没有过滤…
i = 1:400 x = fileReader();如果I ==100 index =1;流(“加权滤波…”elseifI ==200 index =2;流(“C-weighted过滤…”elseifI ==300 index =3;流(“K-weighted过滤…\ n”结束如果i>99 y = wF{index}(x);其他的Y = x;结束deviceWriter (y);结束
加权滤波……
C-weighted过滤…
K-weighted过滤…

作为最佳实践,一旦完成就释放对象。

发布(deviceWriter)发布(fileReader)

weightingFilter对象使用二阶分段(SOS)进行过滤。提取加权滤波器的设计,使用getFilter返回dsp。BiquadFilter对象的SOSMatrix而且ScaleValues属性集。

使用weightingFilter创建c加权和a加权过滤对象。使用getFilter返回相应的dsp。BiquadFilter对象。

cFilt = weightingFilter(“C-weighting”);aFilt =加权过滤器(“权重”);cSOSFilter = getFilter(cFilt);aSOSFilter = getFilter(aFilt);

为音频输入/输出创建一个音频文件阅读器和音频设备写入器。使用读者的抽样率作为作者的抽样率。

fileReader = dsp。AudioFileReader (“JetAirplane-16-11p025-mono-16secs.wav”);deviceWriter = audioDeviceWriter(“SampleRate”, fileReader.SampleRate);

在音频流循环中,播放未经过滤的信号。释放文件读取器,以便下次调用它时,它从文件的开头读取。

抽搐toc<8 x = fileReader();deviceWriter (x);结束发行版(fileReader)

播放信号经过a加权滤波器处理。然后播放经过c加权滤波器处理的信号。缓存每一帧原始和滤波信号的功率以供分析。作为最佳实践,一旦完成,就释放文件读取器和设备写入器。

Y = [];Count = 1;抽搐~isDone(fileReader) x = fileReader();过滤= aSOSFilter(x);cFiltered = cSOSFilter(x);如果toc > 8 deviceWriter (cFiltered);其他的deviceWriter (aFiltered);结束xPower(count) = var(x);aPower(count) = var(过滤);cPower(count) = var(cFiltered);Y = [Y;x];Count = Count +1;结束发布(fileReader)发布(deviceWriter)

绘制原始信号、a加权信号和c加权信号随时间变化的功率。

次要情节(2,1,1)谱图(y, 512256、4096、fileReader。SampleRate,“桠溪”)标题(原始信号的) subplot(2,1,2) t = linspace(0,16.3468,count-1);情节(t, xPower“r”t一“b”t cPower‘g’)传说(原始信号的“加权”“C-Weighted”)包含(“时间(s)”) ylabel (“权力”

图中包含2个轴对象。标题为Original Signal的Axes对象1包含一个图像类型的对象。坐标轴对象2包含3个line类型的对象。这些对象表示原始信号,a加权,c加权。

算法

全部展开

参考文献

美国声学学会。声学测量加权网络的设计响应.ANSI s1.42 - 2001。纽约州纽约:美国国家标准协会,2001年。

[2]国际电工委员会。电声声级计第1部分:规范.第一版。IEC 61672 - 1。2002 - 2005。

[3]国际电信联盟。测量音频节目响度和真峰值音频水平的算法.ITU-R BS.1770-4。2015.

[4]曼斯布里奇,斯图尔特,西尔莎·芬恩和约书亚·d·赖斯。自主多轨迹推子控制的实现与评估。在第132届音频工程学会大会上发表的论文,布达佩斯,匈牙利,2012。

扩展功能

在R2016b中引入