tomwalters@278: // Copyright 2008-2010, Thomas Walters tomwalters@268: // tomwalters@268: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@268: // http://www.acousticscale.org/AIMC tomwalters@268: // tomwalters@268: // This program is free software: you can redistribute it and/or modify tomwalters@268: // it under the terms of the GNU General Public License as published by tomwalters@268: // the Free Software Foundation, either version 3 of the License, or tomwalters@268: // (at your option) any later version. tomwalters@268: // tomwalters@268: // This program is distributed in the hope that it will be useful, tomwalters@268: // but WITHOUT ANY WARRANTY; without even the implied warranty of tomwalters@268: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tomwalters@268: // GNU General Public License for more details. tomwalters@268: // tomwalters@268: // You should have received a copy of the GNU General Public License tomwalters@268: // along with this program. If not, see . tomwalters@268: tomwalters@280: #include tomwalters@280: tomwalters@278: #include tomwalters@278: tomwalters@278: #include "Modules/Input/ModuleFileInput.h" tomwalters@278: #include "Modules/BMM/ModuleGammatone.h" tomwalters@278: #include "Modules/BMM/ModulePZFC.h" tomwalters@278: #include "Modules/NAP/ModuleHCL.h" tomwalters@278: #include "Modules/Strobes/ModuleParabola.h" tomwalters@278: #include "Modules/SAI/ModuleSAI.h" tomwalters@288: #include "Modules/SSI/ModuleSSI.h" tomwalters@288: #include "Modules/Profile/ModuleSlice.h" tomwalters@292: #include "Modules/Profile/ModuleScaler.h" tomwalters@278: #include "Modules/Features/ModuleGaussians.h" tomwalters@278: #include "Modules/Output/FileOutputHTK.h" tomwalters@278: tomwalters@280: int main(int argc, char* argv[]) { tomwalters@278: aimc::Parameters params; tomwalters@292: tomwalters@292: int buffer_length = 480; tomwalters@292: params.SetInt("input.buffersize", buffer_length); tomwalters@292: params.SetBool("slice.normalize", true); tomwalters@292: params.SetFloat("nap.lowpass_cutoff", 100.0f); tomwalters@292: tomwalters@278: aimc::ModuleFileInput input(¶ms); tomwalters@288: aimc::ModuleGammatone bmm(¶ms); tomwalters@289: // aimc::ModulePZFC bmm(¶ms); tomwalters@278: aimc::ModuleHCL nap(¶ms); tomwalters@292: // aimc::ModuleParabola strobes(¶ms); tomwalters@292: // aimc::ModuleSAI sai(¶ms); tomwalters@292: // aimc::ModuleSSI ssi(¶ms); tomwalters@288: aimc::ModuleSlice profile(¶ms); tomwalters@292: aimc::ModuleScaler scaler(¶ms); tomwalters@278: aimc::ModuleGaussians features(¶ms); tomwalters@278: aimc::FileOutputHTK output(¶ms); tomwalters@278: tomwalters@278: std::string parameters_string = params.WriteString(); tomwalters@278: printf("%s", parameters_string.c_str()); tomwalters@278: tomwalters@278: input.AddTarget(&bmm); tomwalters@278: bmm.AddTarget(&nap); tomwalters@292: nap.AddTarget(&profile); tomwalters@292: //strobes.AddTarget(&sai); tomwalters@292: //sai.AddTarget(&ssi); tomwalters@292: //ssi.AddTarget(&profile); tomwalters@292: profile.AddTarget(&scaler); tomwalters@292: scaler.AddTarget(&features); tomwalters@278: features.AddTarget(&output); tomwalters@278: tomwalters@292: float frame_period_ms = 1000.0f * buffer_length tomwalters@292: / input.GetOutputBank()->sample_rate(); tomwalters@292: tomwalters@292: output.OpenFile("test_output.htk", frame_period_ms); tomwalters@292: if (input.LoadFile("test.wav")) { tomwalters@292: input.Process(); tomwalters@292: } else { tomwalters@292: printf("LoadFile failed"); tomwalters@292: } tomwalters@292: tomwalters@292: input.Reset(); tomwalters@292: output.OpenFile("test_output_2.htk", frame_period_ms); tomwalters@278: if (input.LoadFile("test.wav")) { tomwalters@278: input.Process(); tomwalters@278: } else { tomwalters@278: printf("LoadFile failed"); tomwalters@278: } tomwalters@280: }