SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
API_LowLvl::lib::data
+ Collaboration diagram for API_LowLvl::lib::data:

Data Structures

struct  SprCorSegOD
 
struct  SprCorpusEntry
 
struct  SprCorpusInfo
 
struct  SprSegEntry
 A single segment. More...
 
struct  SprSegmentation
 A segmentation, i.e. a list of segments. More...
 

Macros

#define spr_bss_round(x)
 returns the rounded value of x More...
 

Enumerations

enum  {
  SPR_BSS_KEY, SPR_BSS_AUDLAB, SPR_BSS_RAW, SPR_BSS_NOHEADER,
  SPR_BSS_EHEADER, SPR_BSS_SAMorKEY, SPR_BSS_SUNAU, SPR_BSS_HPAU,
  SPR_BSS_OLDKEY, SPR_BSS_SPHERE, SPR_BSS_NEWKEY, SPR_BSS_GZIPKEY,
  SPR_BSS_NFILEFORMAT
}
 file formats. More...
 
enum  SPR_PARAMTYPE {
  SPR_PARAMTYPE_SPECTRUM, SPR_PARAMTYPE_VQ_CODEBOOK, SPR_PARAMTYPE_HMM, SPR_PARAMTYPE_MVGAUSS,
  SPR_PARAMTYPE_SELECT, SPR_PARAMTYPE_NPARAMTYPE
}
 parameter types More...
 
enum  SPR_TRACKTYPE {
  SPR_TRACKTYPE_SAMPLE, SPR_TRACKTYPE_SPECTRUM, SPR_TRACKTYPE_AUT, SPR_TRACKTYPE_LPC,
  SPR_TRACKTYPE_RC, SPR_TRACKTYPE_CEPSTRUM, SPR_TRACKTYPE_LABEL, SPR_TRACKTYPE_RMS,
  SPR_TRACKTYPE_NTRACKTYPE
}
 track types More...
 
enum  { SPR_BSS_CONTINUOUS, SPR_BSS_DISCRETE }
 
enum  {
  SPR_BSS_ENDIAN_10, SPR_BSS_ENDIAN_01, SPR_BSS_ENDIAN_MSK, SPR_BSS_RAW_MODE,
  SPR_BSS_ASCII_MODE, SPR_BSS_SPHERE_MODE, SPR_BSS_MSK_MODE, SPR_BSS_NRMODE
}
 

Functions

int spr_int_max (int a, int b)
 
long spr_long_max (long a, long b)
 
ssize_t spr_ssize_max (ssize_t a, ssize_t b)
 
unsigned int spr_uint_max (unsigned int a, unsigned int b)
 
unsigned long spr_ulong_max (unsigned long a, unsigned long b)
 
size_t spr_size_max (size_t a, size_t b)
 
float spr_float_max (float a, float b)
 
double spr_double_max (double a, double b)
 
int spr_int_min (int a, int b)
 
long spr_long_min (long a, long b)
 
ssize_t spr_ssize_min (ssize_t a, ssize_t b)
 
unsigned int spr_uint_min (unsigned int a, unsigned int b)
 
unsigned long spr_ulong_min (unsigned long a, unsigned long b)
 
size_t spr_size_min (size_t a, size_t b)
 
float spr_float_min (float a, float b)
 
double spr_double_min (double a, double b)
 
void spr_corpus_ctb_to_dtb (double btime, double etime, int totalnfr, double fshift, int *skip, int *nfr)
 Convert continuous time base to discrete time base. More...
 
void * spr_corpus_close (SprCorpusInfo *info)
 
SprCorpusInfospr_corpus_open (const char *fname)
 
SprCorpusEntryspr_corpus_entry_read (SprCorpusInfo *info)
 
int spr_corpus_range_adjust (SprCorpusInfo *info, const char *rangestr)
 
void * spr_seg_free (SprSegmentation *seg)
 
SprSegEntryspr_seg_new_entry (SprSegmentation *seg, const char *phon)
 
SprSegmentationspr_seg_alloc (const char *name, int nseg)
 
int spr_seg_write (SprStream *dest, const SprSegmentation *seg, int timebase, double fshift)
 
SprSegmentationspr_seg_read (SprCorpusInfo *info)
 
int spr_seg_range_adjust (SprCorpusInfo *info, const char *rangestr)
 

Variables

const char *const spr_bss_str_tracktype [SPR_TRACKTYPE_NTRACKTYPE+1]
 
const SprOptDesc spr_cor_seg_od []
 

Detailed Description

Macro Definition Documentation

#define spr_bss_round (   x)

returns the rounded value of x

Enumeration Type Documentation

anonymous enum

file formats.

Enumerator
SPR_BSS_KEY 

interal binary and/or ASCII file header

SPR_BSS_AUDLAB 

(for backward compatibility only)

SPR_BSS_RAW 

no KEY header, both for reading and writing

SPR_BSS_NOHEADER 

optional external KEY header for reading, no HEADER for writing

SPR_BSS_EHEADER 

external KEY header, both for reading and writing

SPR_BSS_SAMorKEY 

only for reading

SPR_BSS_SUNAU 

SUN audio file format.

SPR_BSS_HPAU 

HP audio file format.

SPR_BSS_OLDKEY 

the old fashioned KEY format (interal binary and/or ASCII file header)

SPR_BSS_SPHERE 

the National Institute of Standards and Technology SPeech HEader REsources file format

SPR_BSS_NEWKEY 

explicitely the new KEY format

SPR_BSS_GZIPKEY 
SPR_BSS_NFILEFORMAT 

parameter types

Enumerator
SPR_PARAMTYPE_SPECTRUM 
SPR_PARAMTYPE_VQ_CODEBOOK 
SPR_PARAMTYPE_HMM 
SPR_PARAMTYPE_MVGAUSS 
SPR_PARAMTYPE_SELECT 
SPR_PARAMTYPE_NPARAMTYPE 

track types

Enumerator
SPR_TRACKTYPE_SAMPLE 
SPR_TRACKTYPE_SPECTRUM 
SPR_TRACKTYPE_AUT 
SPR_TRACKTYPE_LPC 
SPR_TRACKTYPE_RC 
SPR_TRACKTYPE_CEPSTRUM 
SPR_TRACKTYPE_LABEL 
SPR_TRACKTYPE_RMS 
SPR_TRACKTYPE_NTRACKTYPE 
anonymous enum
Enumerator
SPR_BSS_CONTINUOUS 
SPR_BSS_DISCRETE 
anonymous enum
Enumerator
SPR_BSS_ENDIAN_10 
SPR_BSS_ENDIAN_01 
SPR_BSS_ENDIAN_MSK 
SPR_BSS_RAW_MODE 
SPR_BSS_ASCII_MODE 
SPR_BSS_SPHERE_MODE 
SPR_BSS_MSK_MODE 
SPR_BSS_NRMODE 

Function Documentation

int spr_int_max ( int  a,
int  b 
)
Returns
max(a,b)
long spr_long_max ( long  a,
long  b 
)
Returns
max(a,b)
ssize_t spr_ssize_max ( ssize_t  a,
ssize_t  b 
)
Returns
max(a,b)
unsigned int spr_uint_max ( unsigned int  a,
unsigned int  b 
)
Returns
max(a,b)
unsigned long spr_ulong_max ( unsigned long  a,
unsigned long  b 
)
Returns
max(a,b)
size_t spr_size_max ( size_t  a,
size_t  b 
)
Returns
max(a,b)
float spr_float_max ( float  a,
float  b 
)
Returns
max(a,b)
double spr_double_max ( double  a,
double  b 
)
Returns
max(a,b)
int spr_int_min ( int  a,
int  b 
)
Returns
min(a,b)
long spr_long_min ( long  a,
long  b 
)
Returns
min(a,b)
ssize_t spr_ssize_min ( ssize_t  a,
ssize_t  b 
)
Returns
min(a,b)
unsigned int spr_uint_min ( unsigned int  a,
unsigned int  b 
)
Returns
min(a,b)
unsigned long spr_ulong_min ( unsigned long  a,
unsigned long  b 
)
Returns
min(a,b)
size_t spr_size_min ( size_t  a,
size_t  b 
)
Returns
min(a,b)
float spr_float_min ( float  a,
float  b 
)
Returns
min(a,b)
double spr_double_min ( double  a,
double  b 
)
Returns
min(a,b)
void spr_corpus_ctb_to_dtb ( double  btime,
double  etime,
int  totalnfr,
double  fshift,
int *  skip,
int *  nfr 
)

Convert continuous time base to discrete time base.

The begin and end times are converted to a number of frames to skip and a number of frames to process. During the conversion, the begin and end times are changed to fall on the nearest frame border.

Continuous timebase:
  |______|______|______|______|______|______|
    ^                                     ^
Discrete timebase:
  |______|______|______|______|______|______|
  ^                                         ^
Parameters
btimebegin time
etimeend time
totalnfrtotal number of frames in file
fshiftframe shift
skipframes to skip
nfrframes to process
void* spr_corpus_close ( SprCorpusInfo info)

Close a corpus file and release the resources. Do not use the corpus struct after this function has been called. Does nothing if info equals NULL.

Returns
NULL
Parameters
infoa corpus struct describing an open corpus file
SprCorpusInfo* spr_corpus_open ( const char *  fname)

Open a corpus or segmentation file for reading. Allocate the resources for a SprCorpusInfo object, and reads and processes the corpus/segmentation file header.

Returns
A structure holding info for the opened corpus/segmentation file or NULL on failure (out-of-memory, file does not exist, invalid header, ...).
Parameters
fnamefile name of a corpus or segmentation file to be opened for reading
SprCorpusEntry* spr_corpus_entry_read ( SprCorpusInfo info)

Read the next entry from an open corpus or segmentation file. Segmentation files are treaded as corpus files, and hence only a single segment (line) is read per call.

Returns
A corpus entry struct holding the entry info or NULL on error or if the EOF is reached or if all entries available (as indicated in the header) are read.
Note
The distinction between an EOF and an error condition can be detected by comparing info->idim1 and info->dim1. In the case of an EOF (and only then), these two will be equal.
Parameters
infoCorpus file to read from.
int spr_corpus_range_adjust ( SprCorpusInfo info,
const char *  rangestr 
)

Adjust the stream read pointer and the number of entries in info according to the sub-range specified in rangestr. The sub-range specifier rangestr has the format

<start>:<stop>

which indicates that only the entries in the range [<start>,<stop>[ must be handled, i.e. all entries X : <start> <= X < <stop>. Counting starts at 0.

Returns
0 on success and -1 on failure.
void* spr_seg_free ( SprSegmentation seg)

Free the given segmentation. Does nothing when seg is NULL.

Returns
NULL
Parameters
segSegmentation to free.
SprSegEntry* spr_seg_new_entry ( SprSegmentation seg,
const char *  phon 
)

Add a new segment to the list of segments in the given segmentation seg. The new element is initialized to a zero-length segment starting at time 0. The symbol name phon may be NULL.

Returns
A pointer to the newly added segment or NULL on failure.
Parameters
segSegmentation that must be extended.
phonSymbol name (typically a phone) for the new segment.
SprSegmentation* spr_seg_alloc ( const char *  name,
int  nseg 
)

Allocate and initialize a segmentation structure. The nseg segmentation elements are initialized to zero-length segments starting at time 0 with a NULL symbol name.

Returns
A pointer to the allocated segmentation or NULL on failure.
Parameters
nameName of the segmentation (e.g. file name).
nsegNumber of segments to allocate.
int spr_seg_write ( SprStream dest,
const SprSegmentation seg,
int  timebase,
double  fshift 
)

Write the segmentation seg to the stream dest in the desired format. Parameter timebase can be SPR_BSS_CONTINUOUS or SPR_BSS_DISCRETE. Parameter fshift is ignored when using a continuous timebase.

Returns
The number of segments that were written or -1 on error.
Parameters
destDestination stream.
segThe segmentation to be serialized.
timebaseUse discrete or continuous timebase.
fshiftFrame shift for discrete timebase.
SprSegmentation* spr_seg_read ( SprCorpusInfo info)

Read the next segmentation from the stream info. All reads must be sequential. This function cannot be intermixed with any other operation on the same stream (e.g. seeking, or reading a corpus entry).

Returns
The segmentation read or NULL on error or if the EOF is reached or if all entries available (as indicated in the header) are read. The flag info->err will be set if an error occurred.
Note
The distinction between an EOF and an error condition can be detected by comparing info->idim2 and info->dim2. In the case of an EOF (and only then), these two will be equal.
Only the continuous time indices The distinction between an EOF and an error condition can be detected by comparing info->idim2 and info->dim2. In the case of an EOF (and only then), these two will be equal.
Parameters
infoSegmentation file to read from.
int spr_seg_range_adjust ( SprCorpusInfo info,
const char *  rangestr 
)

Identical to spr_corpus_range_adjust() but when reading segmentations (spr_seg_read()) instead of single (corpus) entries (spr_corpus_entry_read()).

Returns
0 on success and -1 on failure.

Variable Documentation

const char* const spr_bss_str_tracktype[SPR_TRACKTYPE_NTRACKTYPE+1]
const SprOptDesc spr_cor_seg_od[]

Description of all program arguments related to working with data described by a corpus or segementation file.