ReSpeaker DSP V02

Dependencies:   mbed MbedJSONValue

Matlab_Script/AmplCalc.txt

Committer:
Arkadi
Date:
2019-06-20
Revision:
14:8a4699aa69b5
Parent:
1:574b54755983

File content as of revision 14:8a4699aa69b5:

function [Amp, Diff] = AmplCalc(L) % L - length of vector
%Value of Playback and Avisoft should be taken from calibration

% Frequency Vector - KHz
%         [30     35     40     45    50    55     60     65     70    75      80    85      90     95     100   105    110   115    120    125   130  Fd12/2];
% Playback (dB)
Plb =   [-23.12 -19.87 -20.77 -26.72 -25   -30.42 -24   -23.25 -22.57 -21.31 -24.32 -24.71 -27.67 -30.61 -33.26 -33.05 -31.94 -35    -37.5  -41.78 -49.73];
%Recorded by Avisoft
Avs =   [-35.7  -33.9  -33.7 -35.35 -32.84 -35.11 -32.56 -33.19 -34.7 -30.73 -32.43 -32    -30.7  -32.6  -30.45 -29.24 -29.9  -29.28 -29.27 -32.77 -32.7];

% dB = 10*log10(Amp^2)
% Amp = sqrt(10^(dB/10))

D1 = Plb(length(Plb));
Plb(length(Plb)+1 : length(Avs)) = D1;

Diff = Avs - Plb;
% Shift to average value
Diff = Diff - mean(Diff);
% Complete  for high path filter
%      0 5 10 15 20  25  30 ...      KHz
Amp = [0 0  0  0  0 0.1 sqrt(10.^(Diff/10))];
A1 = Amp(length(Amp));
Amp(length(Amp)+1 : L) = A1;