Gamma  0.9.5
Generic Synthesis Library
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
/Users/ljp/code/gamma/trunk/Gamma/FormantData.h
00001 #ifndef GAMMA_FORMANTDATA_H_INC
00002 #define GAMMA_FORMANTDATA_H_INC
00003 
00004 /*  Gamma - Generic processing library
00005     See COPYRIGHT file for authors and license information
00006 
00007     File Description: 
00008     Frequency/amplitude data of formants.
00009 */
00010 
00011 #include <math.h>
00012 
00013 namespace gam{
00014 
00016 
00019 class Vowel{
00020 public:
00021 
00023     enum Voice{
00024         MAN=0,      
00025         WOMAN=1,    
00026         CHILD=2,    
00027         NUM_VOICES
00028     };
00029 
00031     enum Phoneme{
00032         HEED=0,     
00033         HID=1,      
00034         HEAD=2,     
00035         HAD=3,      
00036         HOD=4,      
00037         HAWED=5,    
00038         HOOD=6,     
00039         WHOD=7,     
00040         HUD=8,      
00041         HEARD=9,    
00042         NUM_PHONEMES
00043     };
00044 
00046     static float amp(Voice v, Phoneme p, int i){
00047         return ::pow(10., dB(v,p,i)/20.);
00048     }
00049 
00051     static float dB(Voice v, Phoneme p, int i){
00052         static const float voweldB[NUM_PHONEMES][3] = {
00053             {-4, -24, -28},
00054             {-3, -23, -27},
00055             {-2, -17, -24},
00056             {-1, -12, -22},
00057             {-1, - 5, -28},
00058             { 0, - 7, -34},
00059             {-1, -12, -34},
00060             {-3, -19, -43},
00061             {-1, -10, -27},
00062             {-5, -15, -20}
00063         };
00064         return voweldB[p][i];
00065     }
00066 
00068     static float freq(Voice v, Phoneme p, int i){
00069         static const float vowelHz[NUM_VOICES][NUM_PHONEMES][3] = {
00070             {   {270, 2290, 3010},
00071                 {390, 1990, 2550},
00072                 {530, 1840, 2480},
00073                 {660, 1720, 2410},
00074                 {730, 1090, 2440},
00075                 {570,  840, 2410},
00076                 {440, 1020, 2240},
00077                 {300,  870, 2240},
00078                 {640, 1190, 2390},
00079                 {490, 1350, 1690}
00080             },
00081             {   {310, 2790, 3310},
00082                 {430, 2480, 3070},
00083                 {610, 2330, 2990},
00084                 {860, 2050, 2850},
00085                 {850, 1220, 2810},
00086                 {590,  920, 2710},
00087                 {470, 1160, 2680},
00088                 {370,  950, 2670},
00089                 {760, 1400, 2780},
00090                 {500, 1640, 1960}
00091             },
00092             {   {370, 3200, 3730},
00093                 {530, 2730, 3600},
00094                 {690, 2610, 3570},
00095                 {1010,2320, 3320},
00096                 {1030,1370, 3170},
00097                 {680, 1060, 3180},
00098                 {560, 1410, 3310},
00099                 {430, 1170, 3260},
00100                 {850, 1590, 3360},
00101                 {560, 1820, 2160}
00102             },
00103         };
00104         return vowelHz[v][p][i];
00105     }
00106 
00108     static float pitch(Voice v, Phoneme p, int i){
00109         static const float vowelFund[NUM_VOICES][NUM_PHONEMES] = {
00110             {136, 135, 130, 127, 124, 129, 137, 141, 130, 133},
00111             {235, 232, 223, 210, 212, 216, 232, 231, 221, 218},
00112             {272, 269, 260, 251, 256, 263, 276, 274, 261, 261},
00113         };
00114         return vowelFund[v][p];
00115     }
00116 
00117 };
00118 
00119 } // gam::
00120 
00121 #endif