|
@@ -34,7 +34,7 @@ function [R Fs] = sphear_af_power(measurements, fmin, fmax, N, Npre)
|
|
|
pkg load signal;
|
|
pkg load signal;
|
|
|
|
|
|
|
|
%% read in reference microphone, select samples to process
|
|
%% read in reference microphone, select samples to process
|
|
|
- [ref, Fs] = wavread('../cal/2016.04.20/export/reference-001-1.wav');
|
|
|
|
|
|
|
+ [ref, Fs] = wavread('../data/2016.08.03/ref/reference-001-1.wav');
|
|
|
[peaks, locs] = findpeaks(abs(ref));
|
|
[peaks, locs] = findpeaks(abs(ref));
|
|
|
[~, index] = max(peaks);
|
|
[~, index] = max(peaks);
|
|
|
start = locs(index) - Npre;
|
|
start = locs(index) - Npre;
|
|
@@ -57,11 +57,12 @@ function [R Fs] = sphear_af_power(measurements, fmin, fmax, N, Npre)
|
|
|
%% this is only valid for the frequency range covered by the test speaker,
|
|
%% this is only valid for the frequency range covered by the test speaker,
|
|
|
%% anything outside is undefined
|
|
%% anything outside is undefined
|
|
|
%%
|
|
%%
|
|
|
- capsule = wavread(["../cal/2016.04.20/export/a-format-0" sprintf("%02.0f", m) "-" char(capnames(c)) ".wav"]);
|
|
|
|
|
|
|
+ capsule = wavread(["../data/2016.08.03/af/a-format-0" sprintf("%02.0f", m) "-" char(capnames(c)) ".wav"]);
|
|
|
equalized = fft(capsule(range), N) ./ ref_fft;
|
|
equalized = fft(capsule(range), N) ./ ref_fft;
|
|
|
|
|
|
|
|
%% return total power of signal in frequency range
|
|
%% return total power of signal in frequency range
|
|
|
R(i, c) = sqrt(sum(equalized(imin:imax).*conj(equalized(imin:imax)))/size(equalized(imin:imax),1));
|
|
R(i, c) = sqrt(sum(equalized(imin:imax).*conj(equalized(imin:imax)))/size(equalized(imin:imax),1));
|
|
|
|
|
+
|
|
|
end
|
|
end
|
|
|
i = i + 1;
|
|
i = i + 1;
|
|
|
end
|
|
end
|