annotate src/Main/aimc.cc @ 16:2a5354042241

-Updated the Slaney IIR gammatone to use a cascase of four second-order filters as per the implementtion in Slaney's auditory toolbox. This is more numerically stable at high sample rates and low centre frequencies.
author tomwalters
date Sat, 20 Feb 2010 17:56:40 +0000
parents fcbf85ce59fb
children f4e712d41321
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@8 19 #include <stdlib.h>
tomwalters@8 20
tomwalters@6 21 #include <string>
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@16 29 #include "Modules/SSI/ModuleSSI.h"
tomwalters@16 30 #include "Modules/Profile/ModuleSlice.h"
tomwalters@6 31 #include "Modules/Features/ModuleGaussians.h"
tomwalters@6 32 #include "Modules/Output/FileOutputHTK.h"
tomwalters@6 33
tomwalters@8 34 int main(int argc, char* argv[]) {
tomwalters@6 35 aimc::Parameters params;
tomwalters@6 36 aimc::ModuleFileInput input(&params);
tomwalters@16 37 aimc::ModuleGammatone bmm(&params);
tomwalters@16 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@16 42 aimc::ModuleSSI ssi(&params);
tomwalters@16 43 aimc::ModuleSlice 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@16 54 sai.AddTarget(&ssi);
tomwalters@16 55 ssi.AddTarget(&profile);
tomwalters@16 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@8 65 }