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