Code covered by the BSD License  

Highlights from
Triangular Filterbank

Be the first to rate this file! 39 Downloads (last 30 days) File Size: 2.59 KB File ID: #31755
image thumbnail

Triangular Filterbank

by

 

11 Jun 2011 (Updated )

Frequency domain triangular filterbank with uniform spacing on arbitrarily warped frequency scale.

| Watch this File

File Information
Description

Implements triangular filterbank given in [1]. Returns matrix of M triangular filters (one per row), each K coefficients long. The triangular filters are between limits given in R (Hz) and are uniformly spaced on a warped scale defined by forward (h2w) and backward (w2h) warping functions. For example, h2w and w2h can be hz2mel and mel2hz functions, respectively, in which case trifbank returns a mel filterbank, i.e., a filterbank of triangular filters uniformly spaced on the mel scale. Other forward and backward warping functions can be specified to arrive at arbitrary warped triangular filterbanks.

[1] Huang, X., Acero, A., Hon, H., 2001. Spoken Language Processing: A guide to theory, algorithm, and system development. Prentice Hall, Upper Saddle River, NJ, USA (pp. 314-315).

Acknowledgements

This file inspired Htk Mfcc Matlab.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
10 May 2013 ayoub bouziane

hello, thank you for the source code ... I did not understand why you used K = nfft/2+1; and f_max = 0.5*fs; ????

27 Apr 2012 Kamil Wojcicki

If all you want is a warping other than the mel scale, then the function is written to support that, i.e., no need to change trifbank.m. I would just pass different warping / unwarping functions to it:

- in MATLAB type in: help trifbank

- then try the example given there ( it will poduce a mel filterbank ), e.g.:

fs = 16000; % sampling frequency (Hz)
nfft = 2^12; % fft size (number of frequency bins)
K = nfft/2+1; % length of each filter
M = 23; % number of filters

hz2mel = @(hz)(1127*log(1+hz/700)); % Hertz to mel warping
mel2hz = @(mel)(700*exp(mel/1127)-700); % mel to Hertz warping

% Design mel filterbank of M filters each K coefficients long,
% filters are uniformly spaced on the mel scale between 0 and Fs/2
[ H1, freq ] = trifbank( M, K, [0 fs/2], fs, hz2mel, mel2hz );

hfig = figure('Position', [25 100 800 600], 'PaperPositionMode', ...
'auto', 'Visible', 'on', 'color', 'w'); hold on;

plot( freq, H1 );
xlabel( 'Frequency (Hz)' ); ylabel( 'Weight' ); set( gca, 'box', 'off');

- in the above code, the warping function are defined in following variables:

hz2mel = @(hz)(1127*log(1+hz/700)); % Hertz to mel warping
mel2hz = @(mel)(700*exp(mel/1127)-700); % mel to Hertz warping

- to use different warping functions you first have to define these, e.g., if you want uniformly spaced filters on Hz scale use:

hz2warp = @(hz)( hz );
warp2hz = @(warp)( warp );

- and make sure you then update the trifbank call with the new function handles:

[ H1, freq ] = trifbank( M, K, [0 fs/2], fs, hz2warp, warp2hz );

26 Apr 2012 Alexander Sepulveda

hi,
can you help me how to implement any arbitray warping function using trifbank?. I want to implement vocal tract length normalization.

thanks in advance,

Updates
13 Jun 2011

Trifbank now returns filter cutoff / center frequencies. In-file comments have been updated.

Contact us