The following functions are provided by the Prosody WAV BFILE API:
API call | W | Description |
---|---|---|
sm_replay_wav_bf_start() | Play a WAV file | |
sm_replay_wav_bf_close() | Close a WAV file opened by sm_replay_wav_bf_start | |
sm_record_wav_bf_start() | Record into a WAV file | |
sm_record_wav_bf_close() | Close a WAV file created by sm_record_wav_bf_start | |
sm_record_wav_bf_trim_close() | Trim and close a WAV file created by sm_record_wav_bf_start | |
sm_replay_wav_bf_get_type() | Determine the type of data in a WAV file |
This document is also available as separate pages for each function.
int sm_replay_wav_bf_start(char *filename, SM_BFILE_REPLAY_PARMS *file_parms)
Opens and parses header of WAV file, sets up fd, replay_parms.type, and replay_parms.data_length, in structure pointed at by file_parms and then invokes sm_replay_bfile_start.
The other elements of the replay_parms structure must be set up as for sm_replay_bfile_start(). Note that the offset is assumed to be relative to the first octet of speech data following the WAV header. If offset, and replay_parms.data_length, are both set to zero then file_parms will be set up to replay all the speech data in the WAV file.
Note: It is the responsibility of the application to operate the replay as described in Prosody high level BFILE play/record documentation and to close the file following replay completion or abort (using sm_replay_wav_bf_close()).
0 if call completed successfully, otherwise a standard error such as:
int sm_replay_wav_bf_close(SM_BFILE_REPLAY_PARMS *file_parms)
Following completion of WAV file replay this function may be called to close the replay file and release the associated file descriptor.
0 if call completed successfully, otherwise a standard error such as:
int sm_record_wav_bf_start(char *filename, SM_BFILE_RECORD_PARMS *file_parms)
Creates file with given name, allocates space in file by writing blank WAV file header, sets up fd in structure pointed at by file_parms and then invokes sm_record_bfile_start.
The other elements of the record_parms. structure must be set up as for sm_record_bfile_start. The setting of the record_parms.type, parameter will determine type of WAV file created.
Note it is the responsibility of the application to close the file following record completion or abort using sm_record_wav_bf_close().
0 if call completed successfully, otherwise a standard error such as:
int sm_record_wav_bf_close(SM_BFILE_RECORD_PARMS *file_parms)
Following completion of a recording into a WAV file this function must be called to write the correct WAV header in space previously reserved by sm_record_wav_bf_start() then closes the file.
Note that the sampling_rate of the record_parms structure must be set to the recorded sample rate,as returned by sm_record_status(). This is done automatically except when sm_record_bfile_progress_istatus() has been used.
0 if call completed successfully, otherwise a standard error such as:
int sm_record_wav_bf_trim_close(SM_BFILE_RECORD_PARMS *file_parms, tSM_UT32 trimLength)
trimLength octets of data are subtracted from the WAV file length recorded in the WAV header and hence this amount of data will be omitted from the end of a replay of this WAV file. Then a sm_record_wav_bf_close() is performed.
Note that the sampling_rate of the record_parms structure must be set to the recorded sample rate,as returned by sm_record_status(). This is done automatically except when sm_record_bfile_progress_istatus() has been used.
0 if call completed successfully, otherwise a standard error such as:
int sm_replay_wav_bf_get_type(char *filename, int *replay_type)
Given name of existing WAV file, returns in replay_type Prosody API data format type id that would be used by sm_replay_start.
0 if call completed successfully, otherwise a standard error such as:
These functions constitute the Prosody WAV BFILE API.