annotate aux/autoaligntest.m @ 3:1f7b986dab05
Added autoalign.m: aligns audio by zero-padding before the signal to align the peak of the crosscorrelation function
author |
Brecht De Man <b.deman@qmul.ac.uk> |
date |
Mon, 17 Nov 2014 23:01:09 +0000 |
parents |
|
children |
|
rev |
line source |
b@3
|
1 % autoalign test
|
b@3
|
2 % generate files to test autoalign.m
|
b@3
|
3
|
b@3
|
4 [fragment,fs] = audioread('../../AUDIO/SR1/pro.wav', [10*96000, 20*96000]); % from 0:10 to 0:20
|
b@3
|
5
|
b@3
|
6 % files with increasing leading zeros - end result should be all same file
|
b@3
|
7 N = 5;
|
b@3
|
8 spacing = 45678; % samples
|
b@3
|
9
|
b@3
|
10 for i = 1:N
|
b@3
|
11 audiowrite(['autoaligntest' num2str(i) '.wav'], ... % file name
|
b@3
|
12 [zeros(i*spacing, size(fragment, 2)); fragment], ... % audio
|
b@3
|
13 fs, 'BitsPerSample', 24); % format
|
b@3
|
14 end |