Mercurial > hg > aimc
comparison src/Modules/Output/Graphics/Scale/ScaleLogScaled.h @ 116:47b009f2c936
- 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 | |
children | c5ac2f0c7fc5 |
comparison
equal
deleted
inserted
replaced
115:3801517c4e8f | 116:47b009f2c936 |
---|---|
1 /*! | |
2 * \file | |
3 * \brief Log frequency scale for generating filter banks and their frequencies. Based on the scaling of the ERB scale | |
4 * | |
5 * \author Tom Walters <tcw24@cam.ac.uk> | |
6 * \date created 2006/09/26 | |
7 * \version \$Id: ScaleLogScaled.h 459 2007-11-08 11:50:04Z tom $ | |
8 */ | |
9 /* (c) 2006, University of Cambridge, Medical Research Council | |
10 * http://www.pdn.cam.ac.uk/groups/cnbh/aimmanual | |
11 */ | |
12 #ifndef __MODULE_SCALE_LOGSCALED_H__ | |
13 #define __MODULE_SCALE_LOGSCALED_H__ | |
14 | |
15 #include <math.h> | |
16 | |
17 #include "Modules/Scale/Scale.h" | |
18 | |
19 /*! | |
20 * \class ScaleERB "Modules/Scale/ScaleERB.h" | |
21 * \brief ERB frequency scale for generating filter banks and their frequencies | |
22 * | |
23 * It is very advisable to use Scale::Create() to an instance of this scale. | |
24 * | |
25 * References: | |
26 * - J. Smith and J. Abel (1999), "Bark and ERB bilinear transforms" | |
27 * http://www-ccrma.stanford.edu/~jos/bbt/ | |
28 */ | |
29 class ScaleLogScaled : public Scale { | |
30 public: | |
31 ScaleLogScaled(unsigned int min, unsigned int max, float density) | |
32 : Scale(min, max, density) { m_iType = SCALE_ERB; m_sName = "logscaled"; }; | |
33 | |
34 float FromLinear(float fFreq) { | |
35 return 21.4f*log10(0.00437f*fFreq); | |
36 }; | |
37 | |
38 float ToLinear(float fFreq) { | |
39 return (pow(10, fFreq/21.4f))/0.00437f; | |
40 }; | |
41 }; | |
42 | |
43 #endif /* __MODULE_SCALE_ERB_H__ */ |