annotate trunk/src/Main/aimc.cc @ 320:c74acd46121b

- Added support for a very basic AIM-C file format
author tomwalters@google.com
date Thu, 27 May 2010 07:25:03 +0000
parents 30dde71d0230
children 0a8e7d0c70dc
rev   line source
tomwalters@278 1 // Copyright 2008-2010, Thomas Walters
tomwalters@268 2 //
tomwalters@268 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268 4 // http://www.acousticscale.org/AIMC
tomwalters@268 5 //
tomwalters@318 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@318 7 // you may not use this file except in compliance with the License.
tomwalters@318 8 // You may obtain a copy of the License at
tomwalters@268 9 //
tomwalters@318 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@268 11 //
tomwalters@318 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@318 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@318 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@318 15 // See the License for the specific language governing permissions and
tomwalters@318 16 // limitations under the License.
tomwalters@268 17
tomwalters@280 18 #include <stdlib.h>
tomwalters@280 19
tomwalters@278 20 #include <string>
tomwalters@278 21
tomwalters@278 22 #include "Modules/Input/ModuleFileInput.h"
tomwalters@278 23 #include "Modules/BMM/ModuleGammatone.h"
tomwalters@278 24 #include "Modules/BMM/ModulePZFC.h"
tomwalters@278 25 #include "Modules/NAP/ModuleHCL.h"
tomwalters@320 26 #include "Modules/Strobes/ModuleLocalMax.h"
tomwalters@278 27 #include "Modules/SAI/ModuleSAI.h"
tomwalters@288 28 #include "Modules/SSI/ModuleSSI.h"
tomwalters@288 29 #include "Modules/Profile/ModuleSlice.h"
tomwalters@292 30 #include "Modules/Profile/ModuleScaler.h"
tomwalters@278 31 #include "Modules/Features/ModuleGaussians.h"
tomwalters@278 32 #include "Modules/Output/FileOutputHTK.h"
tomwalters@320 33 #include "Modules/Output/FileOutputAIMC.h"
tomwalters@278 34
tomwalters@280 35 int main(int argc, char* argv[]) {
tomwalters@278 36 aimc::Parameters params;
tomwalters@292 37
tomwalters@292 38 int buffer_length = 480;
tomwalters@292 39 params.SetInt("input.buffersize", buffer_length);
tomwalters@292 40
tomwalters@278 41 aimc::ModuleFileInput input(&params);
tomwalters@288 42 aimc::ModuleGammatone bmm(&params);
tomwalters@278 43 aimc::ModuleHCL nap(&params);
tomwalters@320 44 aimc::ModuleLocalMax strobes(&params);
tomwalters@320 45 aimc::ModuleSAI sai(&params);
tomwalters@320 46 aimc::FileOutputAIMC output(&params);
tomwalters@278 47
tomwalters@278 48 std::string parameters_string = params.WriteString();
tomwalters@278 49 printf("%s", parameters_string.c_str());
tomwalters@278 50
tomwalters@278 51 input.AddTarget(&bmm);
tomwalters@278 52 bmm.AddTarget(&nap);
tomwalters@320 53 nap.AddTarget(&strobes);
tomwalters@320 54 strobes.AddTarget(&sai);
tomwalters@320 55 sai.AddTarget(&output);
tomwalters@278 56
tomwalters@320 57 output.OpenFile("test_output.aimc", params.GetFloat("sai.frame_period_ms"));
tomwalters@278 58 if (input.LoadFile("test.wav")) {
tomwalters@278 59 input.Process();
tomwalters@278 60 } else {
tomwalters@278 61 printf("LoadFile failed");
tomwalters@278 62 }
tomwalters@280 63 }