#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SEGRec.h"
#include "segStdLib.h"
#include "segV3Compat.h"
Defines | |
#define | isSWAP 1 |
Read feature data will be byte-swapped if 1. | |
Functions | |
int | segCheckMasterList (SEG_UTT_LIST *uL, int detail) |
Display details of the utterance list for debugging. | |
int | segTime2FrameNum (SEG_UTT_LIST *uL, int winSize, int numVecs) |
Convert annotation times. | |
int | segFreeBreakPoints (int uttVecs, int **breakPt) |
Free memory allocated to break points. | |
int | segFreeMasterList (int totLabs, SEG_UTT_LIST *masterList) |
Free memory space allocated to the master utterance list. | |
int | segReadSpData (double ***spData, FILE *curSpFile, int numVecs, int vecSize) |
Read in the acoustic feature vectors. | |
int | segFreeSpData (int numVecs, double ***spData) |
Free memory space allocated to the current speech data. | |
int | segCheckSpData (int sT, int eT, int vecSize, double **spData) |
Display the speech vectors for debugging. | |
int | segCountLabels (FILE *labFile, int numVecs, int winSize) |
Count the number of labels in an annotation file. | |
int | segJoinLabels (int *startT, int *endT, char ***labList, FILE *curLabFile, int nLabs) |
Extract overall start and end times of the utterance and loads label names. | |
int | segGetBreakPoints (int **breakPt, int startT, int endT, FILE *curLabFile, int emb, int winSize, int nLabs, int verbose) |
Identify the frames that correspond to the start of a new utterance. | |
int | segWriteMLFData (SEG_ANN_DATA *recOp, int nLabs, int winSize, FILE *mlfFile, char *labFileName) |
Generate and write new annotations from the classification/recognition output. |
int segCheckMasterList | ( | SEG_UTT_LIST * | uL, | |
int | detail | |||
) |
Display details of the utterance list for debugging.
The index of the utterance, its start time, end time and the number of labels in the utterance are displayed on the screen.
[in] | uL | Utterance list |
[in] | detail | Level of debugging |
NO_ERROR | Successful execution |
int segCheckSpData | ( | int | sT, | |
int | eT, | |||
int | vecSize, | |||
double ** | spData | |||
) |
Display the speech vectors for debugging.
[in] | sT | Start time of the utterance |
[in] | eT | End time of the utterance |
[in] | vecSize | Length of acoustic feature vector in bytes |
[in] | spData | Acoustic feature vectors of speech |
NO_ERROR | Successful execution |
int segCountLabels | ( | FILE * | labFile, | |
int | numVecs, | |||
int | winSize | |||
) |
Count the number of labels in an annotation file.
This function goes through the file for the first time to count the number of labels.
[in] | labFile | File pointer to the annotation file |
[in] | numVecs | Number of frames |
[in] | winSize | Frame shift size |
int segFreeBreakPoints | ( | int | uttVecs, | |
int ** | breakPt | |||
) |
Free memory allocated to break points.
[in] | uttVecs | Number of utterances |
[in] | breakPt | Pointer to the break point array |
NO_ERROR | Successful execution |
int segFreeMasterList | ( | int | totLabs, | |
SEG_UTT_LIST * | masterList | |||
) |
Free memory space allocated to the master utterance list.
[in] | totLabs | Number of labels in the utterance |
[in] | masterList | Master utterance list |
NO_ERROR | Successful execution |
int segFreeSpData | ( | int | numVecs, | |
double *** | spData | |||
) |
Free memory space allocated to the current speech data.
The memory allocated to the speech data is freed for all frames.
[in] | numVecs | Number of frames in the utterance |
[in] | spData | Pointer to memory storing speech data |
NO_ERROR |
int segGetBreakPoints | ( | int ** | breakPt, | |
int | startT, | |||
int | endT, | |||
FILE * | curLabFile, | |||
int | emb, | |||
int | winSize, | |||
int | nLabs, | |||
int | verbose | |||
) |
Identify the frames that correspond to the start of a new utterance.
This function is used to create an array of break points for all frames in the utterance.
[in,out] | breakPt | Array for the break points |
[in] | startT | Start time of the utterance |
[in] | endT | End time of the utterance |
[in] | curLabFile | File pointer to the current label file |
[in] | emb | Training type (supervised/embedded) |
[in] | winSize | Frame shift size |
[in] | nLabs | Number of labels int the utterance |
[in] | verbose | Level of reporting during execution |
RTN_ERROR | Memory allocation error / File read error | |
otherwise | Number of elements in the break point array |
int segJoinLabels | ( | int * | startT, | |
int * | endT, | |||
char *** | labList, | |||
FILE * | curLabFile, | |||
int | nLabs | |||
) |
Extract overall start and end times of the utterance and loads label names.
This function goes through the label file for the second time and process the labels.
[in,out] | startT | Start time of the utterance |
[in,out] | endT | End time of the utterance |
[in,out] | labList | Pointer to the label name list |
[in] | curLabFile | File pointer to the current label file |
[in] | nLabs | Number of labels in the utterance |
RTN_ERROR | Memory allocation error / File read error | |
otherwise | Index of the last label in the file |
int segReadSpData | ( | double *** | spData, | |
FILE * | curSpFile, | |||
int | numVecs, | |||
int | vecSize | |||
) |
Read in the acoustic feature vectors.
[in,out] | spData | Pointer to a 2D array used to store the vectors |
[in,out] | curSpFile | File pointer to the speech file |
[in] | numVecs | Number of frames in the utterance |
[in] | vecSize | Sample size |
RTN_ERROR | Memory allocation error | |
totRead | Total number of items in the speech file that are read |
int segTime2FrameNum | ( | SEG_UTT_LIST * | uL, | |
int | winSize, | |||
int | numVecs | |||
) |
Convert annotation times.
Convert the start and end times in nano seconds to appropriate frame indices.
[in,out] | uL | Utterance list |
[in] | winSize | Size of window (ms) used in processing speech data |
[in] | numVecs | Number of frames in the utterance |
NO_ERROR | Successful execution |
int segWriteMLFData | ( | SEG_ANN_DATA * | recOp, | |
int | nLabs, | |||
int | winSize, | |||
FILE * | mlfFile, | |||
char * | labFileName | |||
) |
Generate and write new annotations from the classification/recognition output.
[in] | recOp | Array of struct annData variables |
[in] | nLabs | Number of labels in the utterance |
[in] | winSize | Size of the window (ms) used in processing speech data |
[in] | mlfFile | File pointer to a MLF file |
[in] | labFileName | Name of the label file |
RTN_ERROR | File write error | |
NO_ERROR | Successful execution |