annotate trunk/src/Main/aimc.cc @ 288:34993448961f

-Updated the Slaney IIR gammatone to use a cascase of four second-order filters as per the implementtion in Slaney's auditory toolbox. This is more numerically stable at high sample rates and low centre frequencies.
author tomwalters
date Sat, 20 Feb 2010 17:56:40 +0000
parents e55d0c225a57
children 6cf55200a199
rev   line source
tomwalters@278 1 // Copyright 2008-2010, Thomas Walters
tomwalters@268 2 //
tomwalters@268 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268 4 // http://www.acousticscale.org/AIMC
tomwalters@268 5 //
tomwalters@268 6 // This program is free software: you can redistribute it and/or modify
tomwalters@268 7 // it under the terms of the GNU General Public License as published by
tomwalters@268 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@268 9 // (at your option) any later version.
tomwalters@268 10 //
tomwalters@268 11 // This program is distributed in the hope that it will be useful,
tomwalters@268 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268 14 // GNU General Public License for more details.
tomwalters@268 15 //
tomwalters@268 16 // You should have received a copy of the GNU General Public License
tomwalters@268 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@268 18
tomwalters@280 19 #include <stdlib.h>
tomwalters@280 20
tomwalters@278 21 #include <string>
tomwalters@278 22
tomwalters@278 23 #include "Modules/Input/ModuleFileInput.h"
tomwalters@278 24 #include "Modules/BMM/ModuleGammatone.h"
tomwalters@278 25 #include "Modules/BMM/ModulePZFC.h"
tomwalters@278 26 #include "Modules/NAP/ModuleHCL.h"
tomwalters@278 27 #include "Modules/Strobes/ModuleParabola.h"
tomwalters@278 28 #include "Modules/SAI/ModuleSAI.h"
tomwalters@288 29 #include "Modules/SSI/ModuleSSI.h"
tomwalters@288 30 #include "Modules/Profile/ModuleSlice.h"
tomwalters@278 31 #include "Modules/Features/ModuleGaussians.h"
tomwalters@278 32 #include "Modules/Output/FileOutputHTK.h"
tomwalters@278 33
tomwalters@280 34 int main(int argc, char* argv[]) {
tomwalters@278 35 aimc::Parameters params;
tomwalters@278 36 aimc::ModuleFileInput input(&params);
tomwalters@288 37 aimc::ModuleGammatone bmm(&params);
tomwalters@288 38 //aimc::ModulePZFC bmm(&params);
tomwalters@278 39 aimc::ModuleHCL nap(&params);
tomwalters@278 40 aimc::ModuleParabola strobes(&params);
tomwalters@278 41 aimc::ModuleSAI sai(&params);
tomwalters@288 42 aimc::ModuleSSI ssi(&params);
tomwalters@288 43 aimc::ModuleSlice profile(&params);
tomwalters@278 44 aimc::ModuleGaussians features(&params);
tomwalters@278 45 aimc::FileOutputHTK output(&params);
tomwalters@278 46
tomwalters@278 47 std::string parameters_string = params.WriteString();
tomwalters@278 48 printf("%s", parameters_string.c_str());
tomwalters@278 49
tomwalters@278 50 input.AddTarget(&bmm);
tomwalters@278 51 bmm.AddTarget(&nap);
tomwalters@278 52 nap.AddTarget(&strobes);
tomwalters@278 53 strobes.AddTarget(&sai);
tomwalters@288 54 sai.AddTarget(&ssi);
tomwalters@288 55 ssi.AddTarget(&profile);
tomwalters@288 56 profile.AddTarget(&features);
tomwalters@278 57 features.AddTarget(&output);
tomwalters@278 58
tomwalters@278 59 output.OpenFile("test_output.htk", params.GetFloat("sai.frame_period_ms"));
tomwalters@278 60 if (input.LoadFile("test.wav")) {
tomwalters@278 61 input.Process();
tomwalters@278 62 } else {
tomwalters@278 63 printf("LoadFile failed");
tomwalters@278 64 }
tomwalters@280 65 }