changeset 23:491b1b1d1dc5

-Added AIMCopy, a replacement for HTK's HCopy -Set "Id" keyword on all .cc, .h and .py files -Added FileList class to aupport AIMCopy -Added a first go at a Module factory class. It's not to be used at the moment, but it will serve as a reminder to implement a proper factory soon.
author tomwalters
date Tue, 23 Feb 2010 12:47:01 +0000
parents 645cfd371cff
children f7321fcaac7e
files SConstruct src/Main/AIMCopy.cc src/Modules/BMM/ModulePZFC.cc src/Modules/BMM/ModulePZFC.h src/Modules/Features/ModuleGaussians.cc src/Modules/Features/ModuleGaussians.h src/Modules/NAP/ModuleHCL.cc src/Modules/NAP/ModuleHCL.h src/Modules/SAI/ModuleSAI.cc src/Modules/SAI/ModuleSAI.h src/Modules/Strobes/ModuleParabola.cc src/Support/Common.h src/Support/ERBTools.h src/Support/FileList.cc src/Support/FileList.h src/Support/Module.cc src/Support/Module.h src/Support/ModuleFactory.cc src/Support/ModuleFactory.h src/Support/Parameters.cc src/Support/Parameters.h src/Support/SignalBank.h src/Support/StrobeList.h
diffstat 23 files changed, 464 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/SConstruct	Mon Feb 22 18:17:14 2010 +0000
+++ b/SConstruct	Tue Feb 23 12:47:01 2010 +0000
@@ -31,9 +31,11 @@
 
 # Sources common to every version
 common_sources = ['Support/Common.cc',
+                  'Support/FileList.cc',
                   'Support/SignalBank.cc',
                   'Support/Parameters.cc',
                   'Support/Module.cc',
+                  'Support/ModuleFactory.cc',
                   'Modules/Input/ModuleFileInput.cc',
                   'Modules/BMM/ModuleGammatone.cc',
                   'Modules/BMM/ModulePZFC.cc',
@@ -47,7 +49,7 @@
                   'Modules/Output/FileOutputHTK.cc']
 
 # File which contains main()
-sources = common_sources + ['Main/aimc.cc']
+sources = common_sources + ['Main/AIMCopy.cc']
 
 # Test sources
 test_sources = ['Modules/Profile/ModuleSlice_unittest.cc']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Main/AIMCopy.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -0,0 +1,203 @@
+// Copyright 2008-2010, Thomas Walters
+//
+// AIM-C: A C++ implementation of the Auditory Image Model
+// http://www.acousticscale.org/AIMC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+/*!
+ * \file AIMCopy.cpp
+ * \brief AIM-C replacement for HTK's HCopy
+ *
+ * The following subset of the command-line flags
+ * should be implemented from HCopy:
+ *  -A      Print command line arguments         off
+ *  -C cf   Set config file to cf                default 
+ * (should be able to take multiple config files)
+ *  -S f    Set script file to f                 none
+ *  //! \todo -T N    Set trace flags to N                 0
+ *  -V      Print version information            off
+ *  -D of   Write configuration data to of       none
+ *
+ * \author Thomas Walters <tom@acousticscale.org>
+ * \date created 2008/05/08
+ * \version \$Id$
+ */
+
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <stdlib.h>
+
+#include "Modules/Input/ModuleFileInput.h"
+#include "Modules/BMM/ModuleGammatone.h"
+#include "Modules/BMM/ModulePZFC.h"
+#include "Modules/NAP/ModuleHCL.h"
+#include "Modules/Strobes/ModuleParabola.h"
+#include "Modules/SAI/ModuleSAI.h"
+#include "Modules/SSI/ModuleSSI.h"
+#include "Modules/Profile/ModuleSlice.h"
+#include "Modules/Profile/ModuleScaler.h"
+#include "Modules/Features/ModuleGaussians.h"
+#include "Modules/Output/FileOutputHTK.h"
+#include "Support/Common.h"
+#include "Support/FileList.h"
+#include "Support/Parameters.h"
+
+using std::ofstream;
+using std::pair;
+using std::vector;
+using std::string;
+int main(int argc, char* argv[]) {
+  string sound_file;
+  string data_file;
+  string config_file;
+  string script_file;
+  bool write_data = false;
+  bool print_version = false;
+
+  string version_string(
+    " AIM-C AIMCopy\n"
+    "  (c) 2006-2010, Thomas Walters and Willem van Engen\n"
+    "  http://www.acoustiscale.org/AIMC/\n"
+    "\n");
+
+  if (argc < 2) {
+    printf("%s", version_string.c_str());
+    printf("AIMCopy is intended as a drop-in replacement for HTK's HCopy\n");
+    printf("command. It is used for making features from audio files for\n");
+    printf("use with HTK.\n");
+    printf("Usage: \n");
+    printf("  -A      Print command line arguments  off\n");
+    printf("  -C cf   Set config file to cf         none\n");
+    printf("  -S f    Set script file to f          none\n");
+    printf("  -V      Print version information     off\n");
+    printf("  -D g    Write configuration data to g none\n");
+    return -1;
+  }
+
+  // Parse command-line arguments
+  for (int i = 1; i < argc; i++) {
+    if (strcmp(argv[i],"-A") == 0) {
+      for (int j = 0; j < argc; j++)
+        printf("%s ",argv[j]);
+      printf("\n");
+      fflush(stdout);
+      continue;
+    }
+    if (strcmp(argv[i],"-C") == 0) {
+      if (++i >= argc) {
+        aimc::LOG_ERROR(_T("Configuration file name expected after -C"));
+        return(-1);
+      }
+      config_file = argv[i];
+      continue;
+    }
+    if (strcmp(argv[i],"-S") == 0) {
+      if (++i >= argc) {
+        aimc::LOG_ERROR(_T("Script file name expected after -S"));
+        return(-1);
+      }
+      script_file = argv[i];
+      continue;
+    }
+    if (strcmp(argv[i],"-D") == 0) {
+      if (++i >= argc) {
+        aimc::LOG_ERROR(_T("Data file name expected after -D"));
+        return(-1);
+      }
+      data_file = argv[i];
+      write_data = true;
+      continue;
+    }
+    if (strcmp(argv[i],"-V") == 0) {
+      print_version = true;
+      continue;
+    }
+    aimc::LOG_ERROR(_T("Unrecognized command-line argument: %s"), argv[i]);
+  }
+
+  if (print_version)
+    printf("%s", version_string.c_str());
+
+  aimc::Parameters params;
+
+  if (!params.Load(config_file.c_str())) {
+    aimc::LOG_ERROR(_T("Couldn't load parameters from file %s"),
+                    config_file.c_str());
+    return -1;
+  }
+
+  vector<pair<string, string> > file_list = aimc::FileList::Load(script_file);
+  if (file_list.size() == 0) {
+    aimc::LOG_ERROR("No data read from file %s", script_file.c_str());
+    return -1;
+  }
+
+  // Set up AIM-C processor here
+  aimc::ModuleFileInput input(&params);
+  aimc::ModuleGammatone bmm(&params);
+  aimc::ModuleHCL nap(&params);
+  aimc::ModuleSlice profile(&params);
+  aimc::ModuleScaler scaler(&params);
+  aimc::ModuleGaussians features(&params);
+  aimc::FileOutputHTK output(&params);
+
+  input.AddTarget(&bmm);
+  bmm.AddTarget(&nap);
+  nap.AddTarget(&profile);
+  profile.AddTarget(&scaler);
+  scaler.AddTarget(&features);
+  features.AddTarget(&output);
+
+  if (write_data) {
+    ofstream outfile(data_file.c_str());
+    if (outfile.fail()) {
+      aimc::LOG_ERROR("Couldn't open data file %s for writing",
+                      data_file.c_str());
+      return -1;
+    }
+    outfile << "# AIM-C AIMCopy\n";
+    outfile << "# Module versions:\n";
+    outfile << "# " << input.id() << " : " << input.version() << "\n";
+    outfile << "# " << bmm.id() << " : " << bmm.version() << "\n";
+    outfile << "# " << nap.id() << " : " << nap.version() << "\n";
+    outfile << "# " << profile.id() << " : " << profile.version() << "\n";
+    outfile << "# " << scaler.id() << " : " << scaler.version() << "\n";
+    outfile << "# " << features.id() << " : " << features.version() << "\n";
+    outfile << "# " << output.id() << " : " << output.version() << "\n";
+    outfile << "#\n";
+    outfile << "# Parameters:\n";
+    outfile << params.WriteString();
+    outfile.close();
+  }
+
+  for (unsigned int i = 0; i < file_list.size(); ++i) {
+    aimc::LOG_INFO(_T("In:  %s"), file_list[i].first.c_str());
+    aimc::LOG_INFO(_T("Out: %s"), file_list[i].second.c_str());
+
+    output.OpenFile(file_list[i].second.c_str(), 10.0f);
+    if (input.LoadFile(file_list[i].first.c_str())) {
+      input.Process();
+    } else {
+      printf("LoadFile failed for file %s\n", file_list[i].first.c_str());
+    }
+    input.Reset();
+  }
+
+  return 0;
+}
--- a/src/Modules/BMM/ModulePZFC.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/BMM/ModulePZFC.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
 
 /*! \author Thomas Walters <tom@acousticscale.org>
  *  \date created 2008/02/05
- *  \version \$Id: ModulePZFC.cc 4 2010-02-03 18:44:58Z tcw $
+ *  \version \$Id$
  */
 
 #include "Support/ERBTools.h"
@@ -35,7 +35,7 @@
   module_identifier_ = "pzfc";
   module_type_ = "bmm";
   module_description_ = "Pole-Zero Filter Cascade";
-  module_version_ = "$Id: ModulePZFC.cc 4 2010-02-03 18:44:58Z tcw $";
+  module_version_ = "$Id$";
 
   // Get parameter values, setting default values where necessary
   // Each parameter is set here only if it has not already been set elsewhere.
--- a/src/Modules/BMM/ModulePZFC.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/BMM/ModulePZFC.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
  *
  *  \author Thomas Walters <tom@acousticscale.org>
  *  \date created 2008/02/05
- * \version \$Id: ModulePZFC.h 2 2010-02-02 12:59:50Z tcw $
+ * \version \$Id$
  */
 
 #ifndef _AIMC_MODULES_BMM_PZFC_H_
--- a/src/Modules/Features/ModuleGaussians.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/Features/ModuleGaussians.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
 /*!
  * \author Thomas Walters <tom@acousticscale.org>
  * \date created 2008/06/23
- * \version \$Id: ModuleGaussians.cc 2 2010-02-02 12:59:50Z tcw $
+ * \version \$Id$
  */
 
 #include <math.h>
@@ -37,7 +37,7 @@
   module_description_ = "Gaussian Fitting to SSI profile";
   module_identifier_ = "gaussians";
   module_type_ = "features";
-  module_version_ = "$Id: ModuleGaussians.cc 2 2010-02-02 12:59:50Z tcw $";
+  module_version_ = "$Id$";
 
   m_iParamNComp = parameters_->DefaultInt("features.gaussians.ncomp", 4);
   m_fParamVar = parameters_->DefaultFloat("features.gaussians.var", 115.0);
--- a/src/Modules/Features/ModuleGaussians.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/Features/ModuleGaussians.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
 
 /*! \author Thomas Walters <tom@acousticscale.org>
  *  \date created 2008/06/23
- *  \version \$Id: ModuleGaussians.h 2 2010-02-02 12:59:50Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_MODULES_FEATURES_GAUSSIANS_H_
--- a/src/Modules/NAP/ModuleHCL.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/NAP/ModuleHCL.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
  *
  * \author Thomas Walters <tom@acousticscale.org>
  * \date created 2007/03/07
- * \version \$Id: ModuleHCL.cc 4 2010-02-03 18:44:58Z tcw $
+ * \version \$Id$
  */
 
 #include <cmath>
@@ -35,7 +35,7 @@
   module_type_ = "nap";
   module_description_ = "Halfwave rectification, compression "
                         "and lowpass filtering";
-  module_version_ = "$Id: ModuleHCL.cc 4 2010-02-03 18:44:58Z tcw $";
+  module_version_ = "$Id$";
 
   do_lowpass_ = parameters_->DefaultBool("nap.do_lowpass", true);
   do_log_ = parameters_->DefaultBool("nap.do_log_compression", false);
--- a/src/Modules/NAP/ModuleHCL.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/NAP/ModuleHCL.h	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
 
 /* \author Thomas Walters <tom@acousticscale.org>
  * \date created 2007/03/07
- * \version \$Id: ModuleHCL.h 4 2010-02-03 18:44:58Z tcw $
+ * \version \$Id$
  */
 
 #ifndef AIMC_MODULES_NAP_HCL_H_
--- a/src/Modules/SAI/ModuleSAI.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/SAI/ModuleSAI.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
 /*
  * \author Thomas Walters <tom@acousticscale.org>
  * \date created 2007/08/29
- * \version \$Id: ModuleSAI.cc 4 2010-02-03 18:44:58Z tcw $
+ * \version \$Id$
  */
 #include <cmath>
 
@@ -34,7 +34,7 @@
   module_identifier_ = "weighted_sai";
   module_type_ = "sai";
   module_description_ = "Stabilised auditory image";
-  module_version_ = "$Id: ModuleSAI.cc 4 2010-02-03 18:44:58Z tcw $";
+  module_version_ = "$Id$";
 
   min_delay_ms_ = parameters_->DefaultFloat("sai.min_delay_ms", 0.0f);
   max_delay_ms_ = parameters_->DefaultFloat("sai.max_delay_ms", 35.0f);
--- a/src/Modules/SAI/ModuleSAI.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/SAI/ModuleSAI.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
 
 /*! \author Thomas Walters <tom@acousticscale.org>
  *  \date created 2007/08/29
- *  \version \$Id: ModuleSAI.h 4 2010-02-03 18:44:58Z tcw $
+ *  \version \$Id$
  */
 #ifndef AIMC_MODULES_SAI_SAI_H_
 #define AIMC_MODULES_SAI_SAI_H_
--- a/src/Modules/Strobes/ModuleParabola.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Modules/Strobes/ModuleParabola.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
  *
  * \author Thomas Walters <tom@acousticscale.org>
  * \date created 2007/08/01
- * \version \$Id:$
+ * \version \$Id$
  */
 
 #include <limits.h>
--- a/src/Support/Common.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/Common.h	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
 /*! \author: Thomas Walters <tom@acousticscale.org>
  *  \author: Willem van Engen <cnbh@willem.engen.nl>
  *  \date 2010/01/30
- *  \version \$Id: Common.h 1 2010-02-02 11:04:50Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_COMMON_H_
--- a/src/Support/ERBTools.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/ERBTools.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
 
 /*! \author: Thomas Walters <tom@acousticscale.org>
  *  \date 2010/01/23
- *  \version \$Id: ERBTools.h 1 2010-02-02 11:04:50Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_ERBTOOLS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Support/FileList.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -0,0 +1,52 @@
+// Copyright 2010, Thomas Walters
+//
+// AIM-C: A C++ implementation of the Auditory Image Model
+// http://www.acousticscale.org/AIMC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+/*!
+ * \file 
+ * \brief Convert a file containing a list of pairs of tab-separated
+ * items, one per line, and convert it to a vector<pair<string, string> >
+ *
+ * \author Thomas Walters <tom@acousticscale.org>
+ * \date created 2010/02/23
+ * \version \$Id$
+ */
+
+#include "Support/FileList.h"
+
+namespace aimc {
+vector<pair<string, string> > FileList::Load(string filename) {
+  FILE* file_handle;
+  vector<pair<string, string> > file_list;
+  if ((file_handle = fopen(filename.c_str(), "r"))==NULL) {
+		LOG_ERROR(_T("Couldn't open file '%s' for reading."), filename.c_str());
+		return file_list;
+	}
+
+  string out_1;
+  string out_2;
+  char n1[PATH_MAX];
+  char n2[PATH_MAX];
+	while (fscanf(file_handle, "%s\t%s", n1, n2) != EOF) {
+    out_1 = n1;
+    out_2 = n2;
+    file_list.push_back(make_pair(out_1, out_2));
+	}
+  fclose(file_handle);
+  return file_list;
+}
+}  // namespace aimc
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Support/FileList.h	Tue Feb 23 12:47:01 2010 +0000
@@ -0,0 +1,43 @@
+// Copyright 2010, Thomas Walters
+//
+// AIM-C: A C++ implementation of the Auditory Image Model
+// http://www.acousticscale.org/AIMC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+/*!
+ * \file 
+ * \brief Convert a file containing a list of pairs of tab-separated
+ * items, one per line, and convert it to a vector<pair<string, string> >
+ *
+ * \author Thomas Walters <tom@acousticscale.org>
+ * \date created 2010/02/23
+ * \version \$Id$
+ */
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "Support/Common.h"
+
+namespace aimc {
+using std::vector;
+using std::pair;
+using std::string;
+class FileList {
+ public:
+  static vector<pair<string, string> > Load(string filename);
+};
+}  // namespace aimc
\ No newline at end of file
--- a/src/Support/Module.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/Module.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -45,7 +45,7 @@
 };
 
 bool Module::Initialize(const SignalBank &input) {
-  LOG_INFO_NN(_T("-> %s "), module_identifier_.c_str());
+  // LOG_INFO_NN(_T("-> %s "), module_identifier_.c_str());
   // Validate the input
   if (!input.Validate()) {
     LOG_ERROR(_T("Input SignalBank not valid"));
@@ -77,7 +77,7 @@
           return false;
     }
   } else {
-    LOG_INFO(_T("|"));
+    // LOG_INFO(_T("|"));
   }
   initialized_ = true;
   return true;
@@ -87,7 +87,7 @@
   if (!initialized_)
     return;
 
-  LOG_INFO("Resetting module %s", module_identifier_.c_str());
+  // LOG_INFO("Resetting module %s", module_identifier_.c_str());
   ResetInternal();
 
   // Iterate through all the targets of this module, resetting
--- a/src/Support/Module.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/Module.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
 
 /*! \author: Thomas Walters <tom@acousticscale.org>
  *  \date 2010/01/23
- *  \version \$Id: Module.h 4 2010-02-03 18:44:58Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_MODULE_H_
@@ -160,6 +160,22 @@
    */
   const SignalBank* GetOutputBank() const;
 
+  string version() const {
+    return module_version_;
+  }
+
+  string id() const {
+    return module_identifier_;
+  }
+
+  string description() const {
+    return module_description_;
+  }
+
+  string type() const {
+    return module_type_;
+  }
+
  protected:
   void PushOutput();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Support/ModuleFactory.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -0,0 +1,70 @@
+// Copyright 2008-2010, Thomas Walters
+//
+// AIM-C: A C++ implementation of the Auditory Image Model
+// http://www.acousticscale.org/AIMC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "Modules/Input/ModuleFileInput.h"
+#include "Modules/BMM/ModuleGammatone.h"
+#include "Modules/BMM/ModulePZFC.h"
+#include "Modules/NAP/ModuleHCL.h"
+#include "Modules/Strobes/ModuleParabola.h"
+#include "Modules/SAI/ModuleSAI.h"
+#include "Modules/SSI/ModuleSSI.h"
+#include "Modules/Profile/ModuleSlice.h"
+#include "Modules/Profile/ModuleScaler.h"
+#include "Modules/Features/ModuleGaussians.h"
+#include "Modules/Output/FileOutputHTK.h"
+
+#include "Support/ModuleFactory.h"
+
+namespace aimc {
+Module* ModuleFactory::Create(string module_name_, Parameters* params) {
+  if (module_name_.compare("gt") == 0)
+    return new ModuleGammatone(params);
+
+  if (module_name_.compare("pzfc") == 0)
+    return new ModulePZFC(params);
+
+  if (module_name_.compare("gaussians") == 0)
+    return new ModuleGaussians(params);
+
+  if (module_name_.compare("file_input") == 0)
+    return new ModuleFileInput(params);
+
+  if (module_name_.compare("hcl") == 0)
+    return new ModuleHCL(params);
+
+  if (module_name_.compare("htk_out") == 0)
+    return new FileOutputHTK(params);
+
+  if (module_name_.compare("scaler") == 0)
+    return new ModuleScaler(params);
+
+  if (module_name_.compare("slice") == 0)
+    return new ModuleSlice(params);
+
+  if (module_name_.compare("weighted_sai") == 0)
+    return new ModuleSAI(params);
+
+  if (module_name_.compare("ssi") == 0)
+    return new ModuleSSI(params);
+
+  if (module_name_.compare("parabola") == 0)
+    return new ModuleParabola(params);
+
+  return NULL;
+}
+}  // namespace aimc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Support/ModuleFactory.h	Tue Feb 23 12:47:01 2010 +0000
@@ -0,0 +1,54 @@
+// Copyright 2008-2010, Thomas Walters
+//
+// AIM-C: A C++ implementation of the Auditory Image Model
+// http://www.acousticscale.org/AIMC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+/*! \file
+ *  \brief Factory class for AIM-C modules.
+ */
+
+/*! \author: Thomas Walters <tom@acousticscale.org>
+ *  \date 2010/02/23
+ *  \version \$Id$
+ */
+
+#ifndef AIMC_SUPPORT_MODULE_FACTORY_H_
+#define AIMC_SUPPORT_MODULE_FACTORY_H_
+
+#include <string>
+
+#include "Support/Module.h"
+#include "Support/Parameters.h"
+
+namespace aimc {
+/*! \brief Factory class for AIM-C modules.
+ *
+ * This class is the basis for a more complete module registration scheme to
+ * be implemented in future. For now, all modules which are created have to
+ * be added to this class individually. The goal is to eventally replace this
+ * with a REGISTER_MODULE macro which can be added to the header file for 
+ * every module.
+ */
+
+class ModuleFactory {
+ public:
+  static Module* Create(string module_name_, Parameters *params);
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ModuleFactory);
+};
+}
+
+#endif  // AIMC_SUPPORT_MODULE_FACTORY_H_
\ No newline at end of file
--- a/src/Support/Parameters.cc	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/Parameters.cc	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
  *
  * \author Willem van Engen <cnbh@willem.engen.nl>
  * \date created 2006/09/21
- * \version \$Id: Parameters.cc 4 2010-02-03 18:44:58Z tcw $
+ * \version \$Id$
  */
 
 #include <stdio.h>
--- a/src/Support/Parameters.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/Parameters.h	Tue Feb 23 12:47:01 2010 +0000
@@ -23,7 +23,7 @@
  *  \author Willem van Engen <cnbh@willem.engen.nl>
  *  \author Thomas Walters <tom@acousticscale.org>
  *  \date created 2006/09/21
- *  \version \$Id: Parameters.h 4 2010-02-03 18:44:58Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_PARAMETERS_H_
--- a/src/Support/SignalBank.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/SignalBank.h	Tue Feb 23 12:47:01 2010 +0000
@@ -29,7 +29,7 @@
 
 /*! \author: Thomas Walters <tom@acousticscale.org>
  *  \date 2010/01/23
- *  \version \$Id: SignalBank.h 4 2010-02-03 18:44:58Z tcw $
+ *  \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_SIGNALBANK_H_
--- a/src/Support/StrobeList.h	Mon Feb 22 18:17:14 2010 +0000
+++ b/src/Support/StrobeList.h	Tue Feb 23 12:47:01 2010 +0000
@@ -22,7 +22,7 @@
  *
  * \author Tom Walters <tom@acousticscale.org>
  * \date created 2007/08/22
- * \version \$Id: StrobeList.h 1 2010-02-02 11:04:50Z tcw $
+ * \version \$Id$
  */
 
 #ifndef AIMC_SUPPORT_STROBELIST_H_