Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 2cc0d1f

Browse files
committed
SOFT: Improve audio test synchronization code
The audio tests signals contain a start and end marker to extract the test output to analyze from in-between the markers. This patch fixes a fail in SRC tests that was caused by incorrect synchronization to output data. The chirp upper frequency is limited to 0.99 x Nyquist frequency since the Nyquist frequency in the end aliased and caused a visible artefact to spectral plot and it triggered a resampler filter impulse response that had some correlation with start/end marker chirps. The cosine chirp initialization to start from 90 degrees (zero PCM code instead of max.) also cleaned the start impulse and improved the look of spectrogram plot. The syncronization was limited to seek from one measured channel only. The sync finder also didn't handle properly multi-channel input. The output file start marker scan length was reduced to be idle+marker length. And the scan time for end was reduced to be 2xidle+marker length Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 9aa6193 commit 2cc0d1f

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

test/test_utils/chirp_test_analyze.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
end
3939

4040
%% Find sync
41-
[d, nt, nt_use, nt_skip] = find_test_signal(x, test);
41+
[d, nt, nt_use, nt_skip] = find_test_signal(x(:,test.ch(1)), test);
4242

4343
%% Trim sample
4444
i1 = d+nt_skip;

test/test_utils/chirp_test_input.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
test.a_db = -0.1; % Near full scale
7878
test.a = 10^(test.a_db/20);
7979
test.f_min = 20;
80-
test.f_max = test.fs/2;
80+
test.f_max = 0.99*test.fs/2;
8181
test.cl = 2.0;
8282

8383

test/test_utils/find_test_signal.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
fprintf('Finding test start marker...\n');
3535
s = sync_chirp(test.fs, 'up');
3636
nx = length(x);
37-
n_half = round(nx/2);
38-
n = min(round(test.fs*test.sm), n_half);
37+
n_seek = round(test.fs*(test.idle_t + test.mark_t));
38+
n = min(round(test.fs*test.sm), n_seek);
3939
y = x(1:n);
4040
[r, lags] = xcorr(y, s);
4141
[r_max, idx] = max(r);
@@ -44,7 +44,8 @@
4444
%% Find end marker
4545
fprintf('Finding test end marker...\n');
4646
s = sync_chirp(test.fs, 'down');
47-
n = min(round(test.fs*test.em),n_half);
47+
n_seek = round(test.fs*(2*test.idle_t + test.mark_t));
48+
n = min(round(test.fs*test.em),n_seek);
4849
y = x(end-n+1:end);
4950
[r, lags] = xcorr(y, s);
5051
[r_max, idx] = max(r);

test/test_utils/mix_chirp.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
test.ts = mark_start.t;
4444

4545
%% Idle time to start and end
46-
t_idle0 = 0.5;
47-
n_idle = round(test.fs*t_idle0);
46+
test.idle_t = 0.5;
47+
n_idle = round(test.fs*test.idle_t);
4848
t_idle = n_idle/test.fs;
4949
x = zeros(test.nt + mark_start.n + mark_end.n +2*n_idle, test.nch, 'int32');
5050

@@ -65,7 +65,7 @@
6565
i2 = i1+test.nt-1;
6666
fprintf('Mixing %.1f dBFS chirp ...\n', test.a_db);
6767
tc = ((1:round(test.cl*test.fs))-1)/test.fs;
68-
s = test.a * chirp(tc, test.f_min, test.tl, test.f_max, 'linear');
68+
s = test.a * chirp(tc, test.f_min, test.tl, test.f_max, 'linear', 90);
6969
sign = 1;
7070
for ch=test.ch
7171
x(i1:i2, ch) = dither_and_quantize(sign * s, test.bits_in);

test/test_utils/mix_sweep.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
test.ts = mark_start.t;
4646

4747
%% Idle time to start and end
48-
t_idle0 = 0.5;
49-
n_idle = round(test.fs*t_idle0);
48+
test.idle_t = 0.5;
49+
n_idle = round(test.fs*test.idle_t);
5050
t_idle = n_idle/test.fs;
5151
x = zeros(test.nf*test.na*test.nt +mark_start.n +mark_end.n +2*n_idle, ...
5252
test.nch, 'int32');

0 commit comments

Comments
 (0)