LpFB_GPSM_v2.m 1.75 KB
Newer Older
dualberger's avatar
dualberger committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function out = LpFB_GPSM_v2(in,freq,fs)
% LpFB_GPSM.m Lowpass-Filterbank applied to power features per auditory
% channel. Temporal-integrated power features are used to normalize short-time envelope power feature.
% (make them independent from the short-time intensity of the carrier)

% INPUT
%   in:         envelope of the corresponding auditory channel
% freq:         vector that gives the modulation frequencies [1,2,4,...,256 Hz]
%   fs:         sampling frequency

% OUTPUT
%   out:        matrix containing dc-values;
%               different window length (depending on the modulation filter center frequency)
%               are used for computing dc-values,
%
% Usage: out = LpFB_GPSM_v2(in,freq,fs)
% author: thomas.biberger@uni-oldenburg
% date:   2013-07-22
% modified: 2018-10-12

out=zeros(length(in),length(freq)); % preallocation

factor=1.5;  % 1.4
count =0;

if freq(1)==0;
    start=2;
elseif freq>0;
    start=1;
end

for ii=start:length(freq);
    if freq(ii)==0       
    else
        if freq(ii)<=8;
            
            N=round(fs/(freq(ii)/factor));
            % average window
            b=ones(1,N)/N;  % numerator of the rectangular moving average window
%             out(:,ii) = dlfconvComp(b,in);
            out(:,ii)=moving_average(N,in);
            
        elseif freq(ii)>8 && count==0;
            factor=round(freq(ii)/8);
            count=count+1;
            
            N=round(fs/(freq(ii)/factor));
             % average window
            b=ones(1,N)/N;  % numerator of the rectangular moving average window
%             out(:,ii) = dlfconvComp(b,in);
            out(:,ii)=moving_average(N,in);
                        
        else freq(ii)>8 && count>=1;
            out(:,ii)=out(:,ii-1);
        end
        
    end
end