~ubuntu-branches/ubuntu/wily/octave-ltfat/wily

« back to all changes in this revision

Viewing changes to inst/fourier/warpedblfilter.m

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Rafael Laboissiere
  • Date: 2015-07-18 23:36:41 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20150718233641-jhuf3f551a3523qc
Tags: 2.1.0+dfsg-1
* Team upload.

[ Rafael Laboissiere ]
* Imported Upstream version 2.1.0+dfsg
* d/rules: Prevent unit testing on armhf and mips.
  This avoids FTBFS on theses architectures (see Bug#765545).
* Unit testing does not need X-window anymore
  + d/rules: Do not use xfvb-run to run the tests.
  + d/control: Drop xauth, xvfb, and gnuplot-nox from Build-Depends.
    Also, the versioned dependency on octave-pkg-dev is relaxed.
* Drop .jar file from upstream tarball, complying with the Debian Policy
  + d/copyright: Exclude file blockproc.jar
  + d/rules: Add get-orig-source target
  + d/watch: Mangle upstream version to cope with "+dfsg" tag
* Build blockproc.jar, which is deleted from the upstream tarball
  + d/rules: Add commands for building blockproc.jar
  + d/control: Build-depend on default-jdk
  + d/p/fix-path-of-included-makefile.patch: New patch
* Bump Standard-Versions to 3.9.6 (no changes needed)
* d/p/autoload-yes.patch: Remove patch (deprecated upstream)
* Bump Build-Depends on octave to >> 4.0.0~rc4-1 (for sndfile support)
* d/check.m: Avoid verbose output of unit tests
* d/watch: Add the repacksuffix option
* d/p/add-hardening-flags.patch: Drop patch (applied upstream)
* d/p/fix-path-of-included-makefile.patch: Drop patch (applied upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function gout=warpedblfilter(winname,fsupp,fc,fs,freqtoscale,scaletofreq,varargin)
2
 
%-*- texinfo -*-
3
 
%@deftypefn {Function} warpedblfilter
4
 
%@verbatim
5
 
%WARPEDBLFILTER  Construct a warped band-limited filter
6
 
%   Usage:  g=warpedblfilter(winname,fsupp,fc,fs,freqtoscale);
7
 
%           g=warpedblfilter(winname,fsupp,fc,...);
8
 
%
9
 
%   Input parameters:
10
 
%      winname     : Name of prototype.
11
 
%      fsupp       : Support length of the prototype (in scale units).
12
 
%      fc          : Centre frequency (in Hz).
13
 
%      fs          : Sampling rate
14
 
%      freqtoscale : Function handle to convert Hz to scale units
15
 
%      scaletofreq : Function to convert scale units into Hz.
16
 
%
17
 
%   Output parameters:
18
 
%      g           : Filter definition, see BLFILTER.
19
 
%
20
 
%   WARPEDBLFILTER(winname,fsupp) constructs a band-limited filter that is
21
 
%   warped on a given frequency scale. The parameter winname specifies the basic
22
 
%   shape of the frequency response. The name must be one of the shapes
23
 
%   accepted by FIRWIN. The support of the frequency response measured on
24
 
%   the selected frequency scale is specified by fsupp, the centre
25
 
%   frequency by fc and the scale by the function handle freqtoscale*
26
 
%   of a function that converts Hz into the choosen scale.
27
 
%
28
 
%   If one of the inputs is a vector, the output will be a cell array
29
 
%   with one entry in the cell array for each element in the vector. If
30
 
%   more input are vectors, they must have the same size and shape and the
31
 
%   the filters will be generated by stepping through the vectors. This
32
 
%   is a quick way to create filters for FILTERBANK and UFILTERBANK.
33
 
%
34
 
%   WARPEDBLFILTER accepts the following optional parameters:
35
 
%
36
 
%     'complex'   Make the filter complex valued if the centre frequency
37
 
%                 is non-zero.necessary. This is the default.
38
 
%
39
 
%     'real'      Make the filter real-valued if the centre frequency
40
 
%                 is non-zero.
41
 
%
42
 
%     'delay',d   Set the delay of the filter. Default value is zero.
43
 
%
44
 
%     'scal',s    Scale the filter by the constant s. This can be
45
 
%                 useful to equalize channels in a filterbank.
46
 
%
47
 
%   It is possible to normalize the transfer function of the filter by
48
 
%   passing any of the flags from the NORMALIZE function. The default
49
 
%   normalization is 'energy'.
50
 
%
51
 
%   The filter can be used in the PFILT routine to filter a signal, or
52
 
%   in can be placed in a cell-array for use with FILTERBANK or
53
 
%   UFILTERBANK.
54
 
%
55
 
%   The output format is the same as that of BLFILTER. 
56
 
%
57
 
%@end verbatim
58
 
%@strong{Url}: @url{http://ltfat.sourceforge.net/doc/fourier/warpedblfilter.php}
59
 
%@seealso{blfilter, firwin, pfilt, filterbank}
60
 
%@end deftypefn
61
 
 
62
 
% Copyright (C) 2005-2014 Peter L. Soendergaard <soender@users.sourceforge.net>.
63
 
% This file is part of LTFAT version 2.0.1
64
 
%
65
 
% This program is free software: you can redistribute it and/or modify
66
 
% it under the terms of the GNU General Public License as published by
67
 
% the Free Software Foundation, either version 3 of the License, or
68
 
% (at your option) any later version.
69
 
%
70
 
% This program is distributed in the hope that it will be useful,
71
 
% but WITHOUT ANY WARRANTY; without even the implied warranty of
72
 
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
73
 
% GNU General Public License for more details.
74
 
%
75
 
% You should have received a copy of the GNU General Public License
76
 
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
77
 
 
78
 
% Define initial value for flags and key/value pairs.
79
 
definput.import={'normalize'};
80
 
definput.importdefaults={'energy'};
81
 
definput.keyvals.delay=0;
82
 
definput.keyvals.scal=1;
83
 
definput.flags.real={'complex','real'};
84
 
 
85
 
[flags,kv]=ltfatarghelper({},definput,varargin);
86
 
 
87
 
[fsupp,fc,kv.delay,kv.scal]=scalardistribute(fsupp,fc,kv.delay,kv.scal);
88
 
 
89
 
Nfilt=numel(fsupp);
90
 
gout=cell(1,Nfilt);
91
 
 
92
 
for ii=1:Nfilt
93
 
    g=struct();
94
 
    
95
 
    
96
 
    if flags.do_1 || flags.do_area 
97
 
        g.H=@(L)    comp_warpedfreqresponse( winname,freqtoscale(fc(ii)), ...
98
 
                                             fsupp(ii),fs,L,freqtoscale, ...
99
 
                                             scaletofreq, flags.norm)*kv.scal(ii)*L;
100
 
    end;
101
 
    
102
 
    if  flags.do_2 || flags.do_energy
103
 
        g.H=@(L)    comp_warpedfreqresponse(winname,freqtoscale(fc(ii)), ...
104
 
                                            fsupp(ii),fs,L,freqtoscale,scaletofreq, ...
105
 
                                            flags.norm)*kv.scal(ii)*sqrt(L);
106
 
    end;
107
 
        
108
 
    if flags.do_inf || flags.do_peak
109
 
        g.H=@(L)    comp_warpedfreqresponse(winname,freqtoscale(fc(ii)), ...
110
 
                                            fsupp(ii),fs,L,freqtoscale,scaletofreq, ...
111
 
                                            flags.norm)*kv.scal(ii);
112
 
    end;
113
 
        
114
 
    g.foff=@(L) comp_warpedfoff(freqtoscale(fc(ii)),fsupp(ii),fs,L,scaletofreq);
115
 
    g.realonly=flags.do_real;
116
 
    g.delay=kv.delay(ii);
117
 
    g.fs=fs;
118
 
    gout{ii}=g;
119
 
end;
120
 
 
121
 
if Nfilt==1
122
 
    gout=g;
123
 
end;
124