annotate src/Main/aimc.cc @ 6:8c859ef1fb75

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