Edinburgh Speech Tools  2.1-release
EST_wave_utils.cc File Reference
#include <cstdio>
#include <cstdlib>
#include "EST_unix.h"
#include <cstring>
#include <cmath>
#include "EST_wave_utils.h"
#include "EST_wave_aux.h"
#include "EST_error.h"
Include dependency graph for EST_wave_utils.cc:

Go to the source code of this file.

Macros

#define st_alaw_to_short(a)   (a2s[(unsigned char)a])
 
#define ZEROTRAP   /* turn on the trap as per the MIL-STD */
 
#define BIAS   0x84 /* define the add-in bias for 16 bit samples */
 
#define CLIP   32635
 
#define HUGE_VAL   HUGE
 
#define FloatToUnsigned(f)   ((unsigned long)(((long)(f - 2147483648.0)) + 2147483647L) + 1)
 
#define UnsignedToFloat(u)   (((double)((long)(u - 2147483647L - 1))) + 2147483648.0)
 

Functions

void ulaw_to_short (const unsigned char *ulaw, short *data, int length)
 
void alaw_to_short (const unsigned char *alaw, short *data, int length)
 
void shorten_to_short (unsigned char *ulaw, short *data, int length)
 
void uchar_to_short (const unsigned char *chars, short *data, int length)
 
void schar_to_short (const unsigned char *chars, short *data, int length)
 
void short_to_uchar (const short *data, unsigned char *chars, int length)
 
void short_to_schar (const short *data, unsigned char *chars, int length)
 
void short_to_ulaw (const short *data, unsigned char *ulaw, int length)
 
void short_to_alaw (const short *data, unsigned char *alaw, int length)
 
short * convert_raw_data (unsigned char *file_data, int data_length, enum EST_sample_type_t sample_type, int bo)
 
enum EST_write_status save_raw_data (FILE *fp, const short *data, int offset, int num_samples, int num_channels, enum EST_sample_type_t sample_type, int bo)
 
int get_word_size (enum EST_sample_type_t sample_type)
 
enum EST_sample_type_t str_to_sample_type (const char *type)
 
const char * sample_type_to_str (enum EST_sample_type_t type)
 
void ConvertToIeeeExtended (double num, unsigned char *bytes)
 
double ConvertFromIeeeExtended (unsigned char *bytes)
 

Macro Definition Documentation

#define st_alaw_to_short (   a)    (a2s[(unsigned char)a])

Definition at line 101 of file EST_wave_utils.cc.

#define ZEROTRAP   /* turn on the trap as per the MIL-STD */

Definition at line 483 of file EST_wave_utils.cc.

#define BIAS   0x84 /* define the add-in bias for 16 bit samples */

Definition at line 484 of file EST_wave_utils.cc.

#define CLIP   32635

Definition at line 485 of file EST_wave_utils.cc.

#define HUGE_VAL   HUGE

Definition at line 664 of file EST_wave_utils.cc.

#define FloatToUnsigned (   f)    ((unsigned long)(((long)(f - 2147483648.0)) + 2147483647L) + 1)

Definition at line 667 of file EST_wave_utils.cc.

#define UnsignedToFloat (   u)    (((double)((long)(u - 2147483647L - 1))) + 2147483648.0)

Definition at line 760 of file EST_wave_utils.cc.

Function Documentation

void ulaw_to_short ( const unsigned char *  ulaw,
short *  data,
int  length 
)

Definition at line 103 of file EST_wave_utils.cc.

void alaw_to_short ( const unsigned char *  alaw,
short *  data,
int  length 
)

Definition at line 113 of file EST_wave_utils.cc.

void shorten_to_short ( unsigned char *  ulaw,
short *  data,
int  length 
)

Definition at line 124 of file EST_wave_utils.cc.

void uchar_to_short ( const unsigned char *  chars,
short *  data,
int  length 
)

Definition at line 133 of file EST_wave_utils.cc.

void schar_to_short ( const unsigned char *  chars,
short *  data,
int  length 
)

Definition at line 145 of file EST_wave_utils.cc.

void short_to_uchar ( const short *  data,
unsigned char *  chars,
int  length 
)

Definition at line 155 of file EST_wave_utils.cc.

void short_to_schar ( const short *  data,
unsigned char *  chars,
int  length 
)

Definition at line 165 of file EST_wave_utils.cc.

void short_to_ulaw ( const short *  data,
unsigned char *  ulaw,
int  length 
)

Definition at line 196 of file EST_wave_utils.cc.

void short_to_alaw ( const short *  data,
unsigned char *  alaw,
int  length 
)

Definition at line 206 of file EST_wave_utils.cc.

short* convert_raw_data ( unsigned char *  file_data,
int  data_length,
enum EST_sample_type_t  sample_type,
int  bo 
)

Definition at line 216 of file EST_wave_utils.cc.

enum EST_write_status save_raw_data ( FILE *  fp,
const short *  data,
int  offset,
int  num_samples,
int  num_channels,
enum EST_sample_type_t  sample_type,
int  bo 
)

Definition at line 275 of file EST_wave_utils.cc.

int get_word_size ( enum EST_sample_type_t  sample_type)

Definition at line 365 of file EST_wave_utils.cc.

enum EST_sample_type_t str_to_sample_type ( const char *  type)

Definition at line 400 of file EST_wave_utils.cc.

const char* sample_type_to_str ( enum EST_sample_type_t  type)

Definition at line 438 of file EST_wave_utils.cc.

void ConvertToIeeeExtended ( double  num,
unsigned char *  bytes 
)

Definition at line 669 of file EST_wave_utils.cc.

double ConvertFromIeeeExtended ( unsigned char *  bytes)

Definition at line 766 of file EST_wave_utils.cc.