K-Weighting Filter Response

K-Weighting Filter Response

ソースコード(Scilab 6.0.2)

clear;
clf(0);

//第1段フィルタ
h1 = poly( [1.53512485958697 -2.6916918940638 1.19839281085285], "p", "coeff" ) / poly( [1 -1.69065929318241 0.73248077421585], "p", "coeff" );
[xm1, fr1] = frmag(h1, 2048);

//第2段フィルタ
h2 = poly( [1.0 -2.0 1.0], "p", "coeff" ) / poly( [1 -1.99004745483398 0.99007225036621], "p", "coeff" );
[xm2, fr2] = frmag(h2, 2048);

f = gcf();
f.figure_size = [2000,1500];

a = gca();
a.margins = [0.05,0.05,0.1,0.1];
a.grid = [1,1,0];

a.title.text = "K-Weighting Filter Response";
a.title.font_size=5;
a.title.font_style=6;

a.x_label.text = "Frequency (Hz)";
a.x_label.font_size=3;
a.x_label.font_style=6;

a.y_label.text = "Relative level (dB)";
a.y_label.font_size=3;
a.y_label.font_style=6;

plot(fr2*48000,20*log10(xm1)+20*log10(xm2),"-r","thickness",2);

a.data_bounds = [20,-20;24000,5];
a.log_flags = "ln";

a.x_ticks =  tlist(["ticks", "locations", "labels"], [10;100;1000;10000], ["10";"100";"1k";"10k"]);
a.y_ticks =  tlist(["ticks", "locations", "labels"], [-25;-20;-15;-10;-5;0;5;], ["-25";"-20";"-15";"-10";"-5";"0";"5"]);
a.sub_ticks = [8,5];

xs2png(f,'./K-weighting_Filter.png');

参考文献

ITU-R BS.1770-4:Algorithms to measure audio programme loudness and true-peak audio level
https://www.itu.int/rec/R-REC-BS.1770-4-201510-I/en

MATLAB:Frequency-weighted filter
https://jp.mathworks.com/help/audio/ref/weightingfilter-system-object.html