FRQ2ERB Convert Hertz to Cents frequency scale [C,CR]=(FRQ) [c,cr] = frq2mel(frq) converts a vector of frequencies (in Hz) to the corresponding values on the logarithmic cents scale. 100 cents corresponds to one semitone and 440Hz corresponds to 5700 cents. The optional cr output gives the gradient in Hz/cent. The relationship between cents and frq is given by: c = 1200 * log2(f/(440*(2^((3/12)-5))) Reference: [1] Ellis, A. On the Musical Scales of Various Nations Journal of the Society of Arts, 1885, 485-527

- xticksi XTIXKSI labels the x-axis of a plot using SI multipliers S=(AH)
- yticksi YTIXKSI labels the y-axis of a plot using SI multipliers S=(AH)

0001 function [c,cr] = frq2cent(frq) 0002 %FRQ2ERB Convert Hertz to Cents frequency scale [C,CR]=(FRQ) 0003 % [c,cr] = frq2mel(frq) converts a vector of frequencies (in Hz) 0004 % to the corresponding values on the logarithmic cents scale. 0005 % 100 cents corresponds to one semitone and 440Hz corresponds to 5700 0006 % cents. 0007 % The optional cr output gives the gradient in Hz/cent. 0008 % 0009 % The relationship between cents and frq is given by: 0010 % 0011 % c = 1200 * log2(f/(440*(2^((3/12)-5))) 0012 % 0013 % Reference: 0014 % 0015 % [1] Ellis, A. 0016 % On the Musical Scales of Various Nations 0017 % Journal of the Society of Arts, 1885, 485-527 0018 0019 % Copyright (C) Mike Brookes 1998 0020 % Version: $Id: frq2cent.m 3122 2013-06-19 19:02:47Z dmb $ 0021 % 0022 % VOICEBOX is a MATLAB toolbox for speech processing. 0023 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 % This program is free software; you can redistribute it and/or modify 0027 % it under the terms of the GNU General Public License as published by 0028 % the Free Software Foundation; either version 2 of the License, or 0029 % (at your option) any later version. 0030 % 0031 % This program is distributed in the hope that it will be useful, 0032 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0033 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0034 % GNU General Public License for more details. 0035 % 0036 % You can obtain a copy of the GNU General Public License from 0037 % http://www.gnu.org/copyleft/gpl.html or by writing to 0038 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 persistent p q 0041 if isempty(p) 0042 p=1200/log(2); 0043 q=5700-p*log(440); 0044 end 0045 af=abs(frq); 0046 % c = 1200*sign(frq).*log2(frq/(440*2^((3/12)-5))); 0047 c=sign(frq).*(p*log(af)+q); 0048 cr=af/p; 0049 if ~nargout 0050 plot(frq,c,'-x'); 0051 xlabel(['Frequency (' xticksi 'Hz)']); 0052 ylabel(['Frequency (' yticksi 'Cents)']); 0053 end

Generated on Tue 19-Sep-2017 12:07:31 by