Function: cqtfilters
CQTFILTERS   CQT-spaced filters
  Usage:  [g,a,fc]=cqtfilters(fs,fmin,fmax,bins,Ls,varargin);
          

  Input parameters:
     fs    : Sampling rate (in Hz).
     fmin  : Minimum frequency (in Hz)
     fmax  : Maximum frequency (in Hz)
     bins  : Vector consisting of the number of bins per octave.
     Ls    : Signal length.
  Output parameters:
     g     : Cell array of filters.
     a     : Downsampling rate for each channel.
     fc    : Center frequency of each channel.
     L     : Next admissible length suitable for the generated filters.

  [g,a,fc]=CQTFILTERS(fs,fmin,fmax,bins,Ls) constructs a set of
  band-limited filters g which cover the required frequency range
  fmin-fmax with bins filters per octave starting at fmin. All
  filters have (approximately) equal Q=f_c/f_b, hence constant-Q. The
  remaining frequency intervals not covered by these filters are captured
  by two additional filters (low-pass, high-pass). The signal length Ls*
  is mandatory, since we need to avoid too narrow frequency windows.

  By default, a Hann window on the frequency side is chosen, but the
  window can be changed by passing any of the window types from
  FIRWIN as an optional parameter.
  Run getfield(getfield(arg_firwin,'flags'),'wintype') to get a cell
  array of window types available.

  Because the downsampling rates of the channels must all divide the
  signal length, FILTERBANK will only work for multiples of the
  least common multiple of the downsampling rates. See the help of
  FILTERBANKLENGTH.

  [g,a]=CQTFILTERS(...,'regsampling') constructs a non-uniform
  filter bank. The downsampling rates are constant in the octaves but
  can differ among octaves. This approach was chosen in order to minimize
  the least common multiple of a, which determines a granularity of
  admissible input signal lengths.

  [g,a]=CQTFILTERS(...,'uniform') constructs a uniform filter bank
  where the downsampling rate is the same for all the channels. This
  results in most redundant representation, which produces nice plots.

  [g,a]=CQTFILTERS(...,'fractional') constructs a filter bank with
  fractional downsampling rates a. The rates are constructed such
  that the filter bank can handle signal lengths that are multiples of
  L, so the benefit of the fractional downsampling is that you get to
  choose the value returned by FILTERBANKLENGTH. This results in the
  least redundant system.

  [g,a]=CQTFILTERS(...,'fractionaluniform') constructs a filter bank with
  fractional downsampling rates a, which are uniform for all filters
  except the "filling" low-pass and high-pass filters can have different
  fractional downsampling rates. This is useful when uniform subsampling
  and low redundancy at the same time are desirable.

  The filters are intended to work with signals with a sampling rate of
  fs.

  CQTFILTERS accepts the following optional parameters:

    'Qvar',Qvar           Bandwidth variation factor. Multiplies the
                          calculated bandwidth. Default value is 1.
                          If the value is less than one, the
                          system may no longer be painless.

    'subprec'             Allow subsample window positions and
                          bandwidths to better approximate the constant-Q
                          property.

    'complex'             Construct a filter bank that covers the entire
                          frequency range. When missing, only positive
                          frequencies are covered.

    'min_win',min_win     Minimum admissible window length (in samples).
                          Default is 4. This restrict the windows not
                          to become too narrow when L is low. This
                          however brakes the constant-Q property for such
                          windows and creates rippling in the overall
                          frequency response.

    'redmul',redmul       Redundancy multiplier. Increasing the value of
                          this will make the system more redundant by
                          lowering the channel downsampling rates. Default
                          value is 1. If the value is less than one,
                          the system may no longer be painless.

  Examples:
  ---------

  In the first example, we construct a highly redundant uniform
  filter bank and visualize the result:

    [f,fs]=greasy;  % Get the test signal
    [g,a,fc]=cqtfilters(fs,100,fs,32,length(f),'uniform');
    c=filterbank(f,g,a);
    plotfilterbank(c,a,fc,fs,90,'audtick');

  In the second example, we construct a non-uniform filter bank with
  fractional sampling that works for this particular signal length, and
  test the reconstruction. The plot displays the response of the
  filter bank to verify that the filters are well-behaved both on a
  normal and an log scale. The second plot shows frequency responses of
  filters used for analysis (top) and synthesis (bottom). :

    [f,fs]=greasy;  % Get the test signal
    L=length(f);
    [g,a,fc]=cqtfilters(fs,100,fs,8,L,'fractional');
    c=filterbank(f,{'realdual',g},a);
    r=2*real(ifilterbank(c,g,a));
    norm(f-r)

    % Plot the response
    figure(1);
    subplot(2,1,1);
    R=filterbankresponse(g,a,L,fs,'real','plot');

    subplot(2,1,2);
    semiaudplot(linspace(0,fs/2,L/2+1),R(1:L/2+1));
    ylabel('Magnitude');

    % Plot frequency responses of individual filters
    gd=filterbankrealdual(g,a,L);
    figure(2);
    subplot(2,1,1);
    filterbankfreqz(gd,a,L,fs,'plot','linabs','posfreq');

    subplot(2,1,2);
    filterbankfreqz(g,a,L,fs,'plot','linabs','posfreq');


  References:
    N. Holighaus, M. Doerfler, G. A. Velasco, and T. Grill. A framework for
    invertible, real-time constant-Q transforms. IEEE Transactions on
    Audio, Speech and Language Processing, 21(4):775 --785, 2013.
    
    G. A. Velasco, N. Holighaus, M. Doerfler, and T. Grill. Constructing an
    invertible constant-Q transform with non-stationary Gabor frames.
    Proceedings of DAFX11, 2011.
    
    C. Schoerkhuber, A. Klapuri, N. Holighaus, and M. Doerfler. A Matlab
    Toolbox for Efficient Perfect Reconstruction Time-Frequency Transforms
    with Log-Frequency Resolution. In Audio Engineering Society Conference:
    53rd International Conference: Semantic Audio. Audio Engineering
    Society, 2014.
    

Url: http://ltfat.github.io/doc/filterbank/cqtfilters.html

See also: erbfilters, cqt, firwin, filterbank.

Package: ltfat