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@318: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@318: // you may not use this file except in compliance with the License. tomwalters@318: // You may obtain a copy of the License at tomwalters@268: // tomwalters@318: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@268: // tomwalters@318: // Unless required by applicable law or agreed to in writing, software tomwalters@318: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@318: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@318: // See the License for the specific language governing permissions and tomwalters@318: // limitations under the License. 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: }