annotate trunk/src/Main/aimc.cc @ 278:5b8b9ea1218a

- Added a basic main function to test that all the can be fitted together - Fixed an initialisation bug in ModuleFileInput that left the buffer size at zero - Added proper description strings to the input and output modules - Fixed an out-by-a-factor-of-1000 bug in the SAI memory allocation (oops) - Added LOG_INFO_NN fucnction to log without a newline. Useful for the ASCII art module chain in aimc.cc.
author tomwalters
date Thu, 18 Feb 2010 19:35:07 +0000
parents c26222c51fb7
children e55d0c225a57
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@278 19 #include <string>
tomwalters@278 20
tomwalters@278 21 #include <stdlib.h>
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@278 29 //#include "Modules/SSI/ModuleSSI.h"
tomwalters@278 30 //#include "Modules/Profile/ModuleProfile.h"
tomwalters@278 31 #include "Modules/Features/ModuleGaussians.h"
tomwalters@278 32 #include "Modules/Output/FileOutputHTK.h"
tomwalters@278 33
tomwalters@278 34 int main (int argc, char* argv[]) {
tomwalters@278 35 aimc::Parameters params;
tomwalters@278 36 aimc::ModuleFileInput input(&params);
tomwalters@278 37 //aimc::ModuleGammatone bmm(&params);
tomwalters@278 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@278 42 //aimc::ModuleSSI ssi(&params);
tomwalters@278 43 //aimc::ModuleProfile 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@278 54 sai.AddTarget(&features);
tomwalters@278 55 //ssi.AddTarget(&profile);
tomwalters@278 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@268 65 }