BSAPI
first_step.cpp

First step in BSAPI. This example shows how work with an instance of an class. It calls BSAPICreateInstance() to request instance of speech recognizer, then a phoneme recognizer is initialized using a config file, speech form one file is transcribed to phonemes and at the end the instance is released.

#include <stdio.h>
#include <stdlib.h>
#include "bsapi.h"

main()
{
  
  SSpeechRecI *psrec = static_cast<SSpeechRecI *>(BSAPICreateInstance(SIID_SPEECHREC));
  if(!psrec)
  {
    fprintf(stderr, "ERROR: Memory allocation error\n");
    exit(1);
  }  

  if(psrec->Init("PHN_HU_SPDAT_LCRC_N1500/config"))
    exit(1);

  if(psrec->ProcessFile(SSpeechRecI::dfWaveform, SSpeechRecI::dfHypothesis, "inpt.raw", "output.lab")
    exit(1);

  psrec->Release();

  return 0;
}