Skip to content

Commit 50d667b

Browse files
singalsumarc-hb
authored andcommitted
Tools: Remove dependency to SOF from check_volume_levels.m
This patch adds local functions multitone() and level_dbfs() to script check_volume_levels.m to avoid need for SOF repository. The added functions are small and simple so the duplication is not an issue. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 6aa0829 commit 50d667b

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

tools/check_volume_levels.m

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ function check_volume_levels(cmd, fn1, fn2, fn3, do_plot)
2222
do_plot = 0;
2323
end
2424

25-
addpath('../../sof/tools/test/audio/std_utils');
26-
addpath('../../sof/tools/test/audio/test_utils');
27-
2825
if exist('OCTAVE_VERSION', 'builtin')
2926
pkg load signal
3027
end
@@ -282,3 +279,29 @@ function plot_levels(meas, tc, lm)
282279
y(:,j) = filter(b, a, x(:,j));
283280
end
284281
end
282+
283+
% This function is copy of
284+
% sof/tools/test/audio/test_utils/multitone.m
285+
function x = multitone(fs, f, amp, tlength)
286+
n = round(fs * tlength);
287+
t = (0 : n - 1) / fs;
288+
nf = length(f);
289+
if nf > 1
290+
ph = rand(nf, 1) * 2 * pi;
291+
else
292+
ph = 0;
293+
end
294+
295+
x = zeros(n, 1);
296+
for i = 1 : length(f)
297+
x = x + amp(i) * sin(2 * pi * f(i) * t + ph(i))';
298+
end
299+
end
300+
301+
% This function is copy of
302+
% sof/tools/test/audio/std_utils/level_dbfs.m
303+
function dbfs = level_dbfs(x)
304+
%% Reference AES 17 3.12.3
305+
level_ms = mean(x .^ 2);
306+
dbfs = 10 * log10(level_ms + 1e-20) + 20 * log10(sqrt(2));
307+
end

0 commit comments

Comments
 (0)