Mercurial > hg > aimc
annotate src/Modules/Output/Graphics/Scale/ScaleLogScaled.h @ 227:73c6d61440ad
- First add of a lot of graphics code from the old version. Not working yet, not even compiling yet.
author | tomwalters |
---|---|
date | Fri, 15 Oct 2010 05:40:53 +0000 |
parents | 9d880fb93c39 |
children | 82e0dc3dfd16 |
rev | line source |
---|---|
tomwalters@116 | 1 /*! |
tomwalters@116 | 2 * \file |
tomwalters@116 | 3 * \brief Log frequency scale for generating filter banks and their frequencies. Based on the scaling of the ERB scale |
tomwalters@116 | 4 * |
tomwalters@116 | 5 * \author Tom Walters <tcw24@cam.ac.uk> |
tomwalters@116 | 6 * \date created 2006/09/26 |
tomwalters@116 | 7 * \version \$Id: ScaleLogScaled.h 459 2007-11-08 11:50:04Z tom $ |
tomwalters@116 | 8 */ |
tomwalters@116 | 9 /* (c) 2006, University of Cambridge, Medical Research Council |
tomwalters@116 | 10 * http://www.pdn.cam.ac.uk/groups/cnbh/aimmanual |
tomwalters@116 | 11 */ |
tomwalters@116 | 12 #ifndef __MODULE_SCALE_LOGSCALED_H__ |
tomwalters@116 | 13 #define __MODULE_SCALE_LOGSCALED_H__ |
tomwalters@116 | 14 |
tomwalters@116 | 15 #include <math.h> |
tomwalters@116 | 16 |
tomwalters@227 | 17 #include "Modules/Scale/Scale.h" |
tomwalters@116 | 18 |
tomwalters@116 | 19 /*! |
tomwalters@116 | 20 * \class ScaleERB "Modules/Scale/ScaleERB.h" |
tomwalters@116 | 21 * \brief ERB frequency scale for generating filter banks and their frequencies |
tomwalters@116 | 22 * |
tomwalters@116 | 23 * It is very advisable to use Scale::Create() to an instance of this scale. |
tomwalters@116 | 24 * |
tomwalters@116 | 25 * References: |
tomwalters@116 | 26 * - J. Smith and J. Abel (1999), "Bark and ERB bilinear transforms" |
tomwalters@116 | 27 * http://www-ccrma.stanford.edu/~jos/bbt/ |
tomwalters@116 | 28 */ |
tomwalters@116 | 29 class ScaleLogScaled : public Scale { |
tomwalters@116 | 30 public: |
tomwalters@227 | 31 ScaleLogScaled(unsigned int min, unsigned int max, float density) |
tomwalters@227 | 32 : Scale(min, max, density) { m_iType = SCALE_ERB; m_sName = "logscaled"; }; |
tomwalters@116 | 33 |
tomwalters@227 | 34 float FromLinear(float fFreq) { |
tomwalters@227 | 35 return 21.4f*log10(0.00437f*fFreq); |
tomwalters@227 | 36 }; |
tomwalters@116 | 37 |
tomwalters@227 | 38 float ToLinear(float fFreq) { |
tomwalters@227 | 39 return (pow(10, fFreq/21.4f))/0.00437f; |
tomwalters@227 | 40 }; |
tomwalters@116 | 41 }; |
tomwalters@227 | 42 |
tomwalters@116 | 43 #endif /* __MODULE_SCALE_ERB_H__ */ |