-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfdlpenv.m
executable file
·43 lines (34 loc) · 1.15 KB
/
fdlpenv.m
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
function env = fdlpenv(p,npts)
%*****************************************************************
% FDLPENV Calculate fdlp envelopes from FDLP poles
% Usage : env = fdlpenv(p,npts)
% input is one dimensional cell array in p
% npts is the number of points required in the envelope
% env is the output LP envelope
% Computed from LP polynomial coefficients and finding the inverse spectrum.
%*****************************************************************
% Sriram Ganapathy
% Center of Language and Speech Processing
% Johns Hopkins University
%*****************************************************************
% 25-Jan-2012
% See the file COPYING for the licence associated with this software.
%*****************************************************************
if nargin < 2
npts = 1000;
end
% Find the size of the input signal
[na,nf] = size(p{1});
% How many fft points to calculate
nfft = 2*(max(npts,na)-1);
% Calculate the LP frequency response
h = fft(p{1},nfft);
% Use the positive half of the spectrum
h = h(1:(nfft/2)+1,:);
% Get the inverse spectrum
h = 1./h;
% Power spectrum
h = (h.*conj(h));
% Correcting energy factor
env = 2*h;