libsent/src/anlz/wrwav.c File Reference

Write waveform data to WAV file. More...

#include <sent/stddefs.h>
#include <sent/speech.h>

Go to the source code of this file.

Defines

#define MYWRITE(A, B, C, D)   if (!mywrite(A, B, C, D)) {jlog("Error: wrwav: failed to write wave data\n"); fclose_writefile(fp); return NULL;}
 Function macro to mywrite() with error handling.

Functions

static boolean mywrite (void *buf, size_t unitbyte, int unitnum, FILE *fp)
 Write speech data in little endian.
FILE * wrwav_open (char *filename, int sfreq)
 Open/create a WAVE file and write header.
boolean wrwav_data (FILE *fp, SP16 *buf, int len)
 Write speech samples.
boolean wrwav_close (FILE *fp)
 Close the file.

Variables

static int totallen
 Total number of samples written to the file.


Detailed Description

Write waveform data to WAV file.

Author:
Akinobu LEE
Date:
Tue Feb 15 01:02:18 2005
Revision
1.1.1.1

Definition in file wrwav.c.


Function Documentation

static boolean mywrite ( void *  buf,
size_t  unitbyte,
int  unitnum,
FILE *  fp 
) [static]

Write speech data in little endian.

Parameters:
buf [in] speech data
unitbyte [in] unit size in bytes
unitnum [in] number of units to be written
fp [in] file pointer
Returns:
TRUE on success (specified number of data has been written), FALSE on failure.

Definition at line 41 of file wrwav.c.

Referenced by CMN_save_to_file(), wrwav_close(), and wrwav_data().

FILE* wrwav_open ( char *  filename,
int  sfreq 
)

Open/create a WAVE file and write header.

Open or creat a new WAV file and prepare for later data writing. The frame length written here is dummy, and will be overwritten when closed by wrwav_close().

Parameters:
filename [in] file name
sfreq [in] sampling frequency of the data you are going to write
Returns:
the file pointer.

Definition at line 74 of file wrwav.c.

Referenced by record_sample_open().

boolean wrwav_data ( FILE *  fp,
SP16 buf,
int  len 
)

Write speech samples.

Parameters:
fp [in] file descriptor
buf [in] speech data to be written
len [in] length of above
Returns:
actual number of written samples.

Definition at line 127 of file wrwav.c.

Referenced by record_sample_write().

boolean wrwav_close ( FILE *  fp  ) 

Close the file.

The frame length in the header part is overwritten by the actual value before file close.

Parameters:
fp [in] file pointer to close, previously opened by wrwav_open().
Returns:
TRUE on success, FALSE on failure.

Definition at line 147 of file wrwav.c.

Referenced by record_sample_close().


Generated on Tue Dec 18 16:01:38 2007 for Julius by  doxygen 1.5.4