name: FrontEnd : public FrontEndBase
synopsis:

>     g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_sp.a

>     #include <FrontEnd.h>

>     FrontEnd();
>     FrontEnd(const FrontEnd& arg);
>     boolean eq(const FrontEndBase* arg) const;
>     boolean setType(TYPES type_a);
>     long getNumChannels() const;
>     boolean setNumChannels(long arg);
>     boolean setCoeffName(const String& name);

quick start:

>     // configure the FrontEnd
>     //
>     FrontEnd fe;
>     fe.setType(AUDIO);

>     // run the file
>     //
>     String raw_file(L"diagnose_AD.raw");
>     String output_mfcc(L".diagnose_mfcc_output.sof");
>     fe.run(output_mfcc, raw_file);

description:
This class, coupled with FrontEndBase, defines a methodology for implementing generic front ends - systems that convert a signal (e.g., audio, video) to a feature stream. The user specifies what processing should take place by creating a Recipe of general Algorithm objects, referred to as Components. Tools such as isip_transform process this recipe and produce feature files that contain the desired parameters. Currently, the only existing implementation for this class is AudioFrontEnd which handles audio signal processing. The interface should be general enough to handle other types of data, such as video.
The class has two levels of interface. The first is the getVector() method, which allows a higher-level program (such as a speech recognizer) to obtain feature vectors on a frame-by-frame basis. The second is the run interface, which is used by the isip_transform driver program to produce an output file for each input file.
dependencies:

- FrontEndBase
- FrontEndUndefined
- MemoryManager

public constants:

- define the class name:

      static const String CLASS_NAME = L"FrontEnd";

- enumerate data mode:

      enum TYPES { AUDIO = 0, VIDEO, DEF_TYPE = AUDIO };

- define static NameMap objects:

      static const NameMap TYPES_MAP(L"AudioFrontEnd, VideoFrontEnd");

- define i/o related constants:

      static const String PARAM_TYPE = L"name";

error codes:

- general class errors:

      static const long ERR = 80200;

protected data:

- pointer to the base class object:

      FrontEndBase* virtual_fe_d;

- an empty object used for uninitialized things:

      static const FrontEndUndefined NO_FRONTEND;

- static memory manager:

      static MemoryManager mgr_d;

required public methods:

- static methods:

      static const String& name();

      static boolean diagnose(Integral::DEBUG debug_level);

- debug methods: the setDebug method is inherited from the base class

      boolean debug(const unichar* message) const;

- destructor/constructor(s):

      ~FrontEnd();

      FrontEnd();

      FrontEnd(const FrontEnd& arg);

- assign methods:

      boolean assign(const FrontEnd& arg);

- i/o methods:

      long sofSize() const;

      boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);

      boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;

      boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;

- equality methods:

      boolean eq(const FrontEnd& arg) const;

- memory management methods:

      static void* operator new(size_t size);

      static void* operator new[](size_t size);

      static void operator delete(void* ptr);

      static void operator delete[](void* ptr);

      static boolean setGrowSize(long grow_size);

      boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);

class-specific public methods:

- set methods:

      boolean setType(TYPES type);

      boolean setVerbosity(Integral::DEBUG verbosity);

      boolean setOutputDirectory(String& directory);

      boolean setOutputBasename(String& basename);

      boolean setOutputExtension(String& extension);

      boolean setOutputPreserve(long new_preserve_level);

      boolean setOutputSuffix(String& suffix);

      boolean setOutputType(File::TYPE type);

      boolean setNumChannels(long arg);

      boolean setCoefName(const String& name);

- get methods:

      TYPES getType() const;

      Integral::DEBUG getVerbosity() const;

      const boolean getOutputBasename(String& basename) const;

      const boolean getOutputExtension(String& extension) const;

      const boolean getOutputSuffix(String& suffix) const;

      const File::TYPE& getOutputType() const;

      boolean getVector(VectorFloat& coeffs, long channel, long frame_index);

      long getNumFeatures() const;

      long getNumChannels() const;

      long getNumFrames() const;

      float getFrameDuration() const;

      const String& getID() const;

      boolean isNameInput(const String& name) const;

      boolean getInputFlag() const;

- core interface contract methods:

      boolean eq(const FrontEndBase& arg) const;

      boolean assign(const FrontEndBase& arg);

      const String& className() const;

      boolean load(const Filename& input);

      boolean open(const Filename& input);

      boolean close();

      boolean init(float start_time, float stop_time, int channel)

      boolean run(const Filename& output, const Filename& input);

- additional parameter file processing methods:

      boolean load(const Filename& input);

    boolean eq(const FrontEndBase& arg) const;

private methods:

- reset methods:

      boolean reset();

examples:

- This example shows how to set up the front end:

      // configure the FrontEnd by reading from a parameter file
      //
      FrontEnd fe;
      Sof sof;
      sof.open(L"params.sof");
      fe.read(sof, 0);
      sof.close();

      // run the file
      //
      String raw_file(L"diagnose_AD.raw");
      String output_mfcc(L".diagnose_mfcc_output.sof");
      fe.run(output_mfcc, raw_file);

notes:

- When making significant modifications to the header files in this directory (e.g., FrontEndBase), be sure to execute make depend before compiling. This will install the modified header files in the system include directory, and guarantee all code will be compiled with the modified header files.