Skip to content

Commit e7816e9

Browse files
singalsukv2019i
authored andcommitted
Tools: Tune: dcblock: Fixes for Matlab compatibility
The script can be run in both Matlab and Octave with these changes. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 884bad4 commit e7816e9

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

tools/tune/dcblock/dcblock_build_blob.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
function blob8 = dcblock_build_blob(R_coeffs, endian, ipc_ver)
22

33
%% Settings
4-
bits_R = 32; %Q2.30
54
qy_R = 30;
65

76
if nargin < 2
8-
endian = 'little'
9-
endif
7+
endian = 'little';
8+
end
109

1110
if nargin < 3
1211
ipc_ver = 3;
13-
endif
12+
end
1413

1514
%% Shift values for little/big endian
1615
switch lower(endian)
@@ -44,7 +43,7 @@
4443
j=j+4;
4544
end
4645

47-
endfunction
46+
end
4847

4948
function bytes = word2byte(word, sh)
5049
bytes = uint8(zeros(1,4));

tools/tune/dcblock/dcblock_plot_stepfn.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function dcblock_plot_stepfn(R, fs);
1+
function dcblock_plot_stepfn(R, fs)
22
% Plot the step response of a DC Blocking Filter
33
% For a DC Blocking filter: H(z) = (1-1/z)/(1 - R/z)
44
% Therefore the coefficients are b = [1 -1], a = [1 -R]
@@ -13,4 +13,4 @@
1313
tstr = sprintf("DC Blocking Filter Step Response, R = %i", R);
1414
title(tstr);
1515

16-
endfunction
16+
end

tools/tune/dcblock/dcblock_plot_transferfn.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function dcblock_plot_transferfn(R, fs);
1+
function dcblock_plot_transferfn(R, fs)
22
% Plot the transfer function.
33
% For a DC Blocking filter: H(z) = (1-1/z)/(1 - R/z)
44
% Therefore the coefficients are b = [1 -1], a = [1 -R]
@@ -14,4 +14,4 @@
1414
tstr = sprintf("DC Blocking Filter Frequency Response, R = %i", R);
1515
title(tstr);
1616

17-
endfunction
17+
end

tools/tune/dcblock/example_dcblock.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
function example_dcblock();
1+
function example_dcblock()
22

33
% Set the parameters here
4-
tplg1_fn = "../../topology/topology1/m4/dcblock_coef_default.m4" % Control Bytes File
5-
tplg2_fn = "../../topology/topology2/include/components/dcblock/default.conf"
4+
tplg1_fn = "../../topology/topology1/m4/dcblock_coef_default.m4"; % Control Bytes File
5+
tplg2_fn = "../../topology/topology2/include/components/dcblock/default.conf";
66
% Use those files with sof-ctl to update the component's configuration
7-
blob3_fn = "../../ctl/ipc3/dcblock_coef.blob" % Blob binary file
8-
alsa3_fn = "../../ctl/ipc3/dcblock_coef.txt" % ALSA CSV format file
9-
blob4_fn = "../../ctl/ipc4/dcblock_coef.blob" % Blob binary file
10-
alsa4_fn = "../../ctl/ipc4/dcblock_coef.txt" % ALSA CSV format file
7+
blob3_fn = "../../ctl/ipc3/dcblock_coef.blob"; % Blob binary file
8+
alsa3_fn = "../../ctl/ipc3/dcblock_coef.txt"; % ALSA CSV format file
9+
blob4_fn = "../../ctl/ipc4/dcblock_coef.blob"; % Blob binary file
10+
alsa4_fn = "../../ctl/ipc4/dcblock_coef.txt"; % ALSA CSV format file
1111

1212
endian = "little";
1313
R_coeffs = [0.98, 0.98, 0.98, 0.98, 0.98, 0.98, 0.98, 0.98];
@@ -28,11 +28,11 @@
2828

2929
% Plot Filter's Transfer Function and Step Response
3030
% As an example, plot the graphs of the first coefficient
31-
fs = 48e3
31+
fs = 48e3;
3232
dcblock_plot_transferfn(R_coeffs(1), fs);
3333
figure
3434
dcblock_plot_stepfn(R_coeffs(1), fs);
3535

3636
rmpath ./../common
3737

38-
endfunction
38+
end

0 commit comments

Comments
 (0)