Home > v_mfiles > v_mel2frq.m

# v_mel2frq

## PURPOSE

V_MEL2FRQ Convert Mel frequency scale to Hertz FRQ=(MEL)

## SYNOPSIS

function [frq,mr] = v_mel2frq(mel)

## DESCRIPTION

```V_MEL2FRQ  Convert Mel frequency scale to Hertz FRQ=(MEL)
frq = v_mel2frq(mel) converts a vector of Mel frequencies
to the corresponding real frequencies.
mr gives the corresponding gradients in Hz/mel.
The Mel scale corresponds to the perceived pitch of a tone```

## CROSS-REFERENCE INFORMATION

This function calls:
• v_xticksi V_XTIXKSI labels the x-axis of a plot using SI multipliers S=(AH)
• v_yticksi V_YTIXKSI labels the y-axis of a plot using SI multipliers S=(AH)
This function is called by:
• v_filtbankm V_FILTBANKM determine matrix for a linear/mel/erb/bark-spaced v_filterbank [X,IL,IH]=(P,N,FS,FL,FH,W)
• v_gammabank V_GAMMABANK gammatone filter bank [b,a,fx,bx,gd]=(n,fs,w,fc,bw,ph,k)
• v_melbankm V_MELBANKM determine matrix for a mel/erb/bark-spaced v_filterbank [X,MN,MX]=(P,N,FS,FL,FH,W)
• v_modspect V_MODSPECT Calculate the modulation spectrum of a signal C=(S,FS,W,NC,P,N,INC,FL,FH)
• v_spendred V_SPENDRED Speech Enhancement and Dereverberation by Doire
• v_spgrambw V_SPGRAMBW Draw spectrogram [T,F,B]=(s,fs,mode,bw,fmax,db,tinc,ann)

## SOURCE CODE

```0001 function [frq,mr] = v_mel2frq(mel)
0002 %V_MEL2FRQ  Convert Mel frequency scale to Hertz FRQ=(MEL)
0003 %    frq = v_mel2frq(mel) converts a vector of Mel frequencies
0004 %    to the corresponding real frequencies.
0005 %   mr gives the corresponding gradients in Hz/mel.
0006 %    The Mel scale corresponds to the perceived pitch of a tone
0007
0008 %    The relationship between mel and frq is given by [1]:
0009 %
0010 %    m = ln(1 + f/700) * 1000 / ln(1+1000/700)
0011 %
0012 %      This means that m(1000) = 1000
0013 %
0014 %    References:
0015 %
0016 %     [1] J. Makhoul and L. Cosell. "Lpcw: An lpc vocoder with
0017 %         linear predictive spectral warping", In Proc IEEE Intl
0018 %         Conf Acoustics, Speech and Signal Processing, volume 1,
0019 %         pages 466�469, 1976. doi: 10.1109/ICASSP.1976.1170013.
0020 %      [2] S. S. Stevens & J. Volkman "The relation of pitch to
0021 %          frequency", American J of Psychology, V 53, p329 1940
0022 %      [3] C. G. M. Fant, "Acoustic description & classification
0023 %          of phonetic units", Ericsson Tchnics, No 1 1959
0024 %          (reprinted in "Speech Sounds & Features", MIT Press 1973)
0025 %      [4] S. B. Davis & P. Mermelstein, "Comparison of parametric
0026 %          representations for monosyllabic word recognition in
0027 %          continuously spoken sentences", IEEE ASSP, V 28,
0028 %          pp 357-366 Aug 1980
0029 %      [5] J. R. Deller Jr, J. G. Proakis, J. H. L. Hansen,
0030 %          "Discrete-Time Processing of Speech Signals", p380,
0031 %          Macmillan 1993
0032
0033 %      Copyright (C) Mike Brookes 1998
0034 %      Version: \$Id: v_mel2frq.m 10865 2018-09-21 17:22:45Z dmb \$
0035 %
0036 %   VOICEBOX is a MATLAB toolbox for speech processing.
0038 %
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 %   This program is free software; you can redistribute it and/or modify
0042 %   the Free Software Foundation; either version 2 of the License, or
0043 %   (at your option) any later version.
0044 %
0045 %   This program is distributed in the hope that it will be useful,
0046 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0047 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0048 %   GNU General Public License for more details.
0049 %
0050 %   You can obtain a copy of the GNU General Public License from
0051 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0052 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0054 persistent k
0055 if isempty(k)
0056     k=1000/log(1+1000/700); % 1127.01048
0057 end
0058 frq=700*sign(mel).*(exp(abs(mel)/k)-1);
0059 mr=(700+abs(frq))/k;
0060 if ~nargout
0061     plot(mel,frq,'-x');
0062     xlabel(['Frequency (' v_xticksi 'Mel)']);
0063     ylabel(['Frequency (' v_yticksi 'Hz)']);
0064 end```