⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sphere.doc

📁 speech signal process tools
💻 DOC
📖 第 1 页 / 共 5 页
字号:
See Also:    sp_set_data_mode(), sp_read_data(), sp_open(), sp_close()II.C.5 sp_seek()Description:       Perform a 'seek' operation to a specific sample of opened SPHEREwaveform which has been opened for read.Syntax:    int sp_seek(SP_FILE *sp_file, int offset, int origin)Arguments:    Move the SPHERE file pointer 'sp_file' to the sample defined by'offset' and 'origin'.  The SPHERE waveform file must be opened forread.Remarks:    Sp_seek() takes the opened-for-read SPHERE file and moves the filepointer to the sample defined by the 'offset' and 'origin' arguments.    The 'offset' and 'origin' arguments specify the sample position atwhich the next read will occur.  Offset must be an integer (which maybe negative) and origin must be one of the following:      0    The new access position will be offset samples from  the          start of the file.      1    The new access position will be offset samples from  the          current  access  position;  a negative offset moves the          access position backwards in the file.      2    The new access position will be offset samples from  the          end  of  the file.  A negative offset places the access          position before the end-of-file, and a positive  offset          is illegal.    For multi-channel interleaved data, the file pointer is moved tothe nth sample of all channels.    If the opened SPHERE file is a pipe, then the seek can only goforward in the file.  In this case, the seek is performed viasequential reads to the appropriate location.    When sp_seek() is called, checksum computation and verificationare disabled unless the file is seek'd to sample 0 in which casethe sample checksum computations are reset.Return Value:    If an error occurs, 1 is return.  Otherwise 0 is returned.See Also:    sp_set_data_mode(), sp_read_data(), sp_open(), sp_close()II.C.6 sp_tell()Description:       Return the waveform sample position at which the next read orwrite to a SPHERE file will occur.Syntax:    int sp_tell(SP_FILE *sp_file)Arguments:    Return the sample position in 'sp_file' at which the next read orwrite will occur.Remarks:    Sp_tell() works for SPHERE files opened for read or write accessonly.    For multi-channel interleaved data, the value returned isthe nth sample of all channels.Return Value:    If an error occurs, -1 is return.  Otherwise the sample number isreturned.See Also:    sp_read_data(), sp_write_data(), sp_open(), sp_close()II.C.6 sp_compute_checksum()Description:       Compute and return the checksum for a SPHERE file opened for read.Syntax:    int sp_compute_checksum(SP_FILE *sp_file, SP_CHECKSUM *checksum)Arguments:    Compute a checksum for the SPHERE file 'sp_file' which has beenopened for read and return the checksum in the pointer '*checksum'.Remarks:    Sp_compute_checksum() first calls sp_tell() to save the currentsample pointed to by the SP_FILE pointer.  Then an sp_seek() to the0th sample of the SPHERE file is performed and the entire waveform isread in to compute the checksum.  After the checksum is calculated,another sp_seek() is performed to return the SP_FILE to it's originalsample position.Return Value:    Successful execution returns a 0, otherwise a number greater than 100 is returned.See Also:    sp_tell(), sp_seek(), sp_open(), sp_close()II.D   Status FunctionsII.D.1 sp_eof()Description:    Returns the End-of-File (EOF) status of an opened SPHERE file.Syntax:    int sp_eof(SP_FILE *sp_file)	Arguments:    sp_eof takes as it's argument a SPHERE file pointer, 'sp_file',and returns the EOF status of that file.Return Value:    sp_eof returns a non-zero value if the end-of-file has beenreached during the last file read.  Otherwise, it returns a zero.See Also:    sp_read_data(), sp_error()II.D.2 sp_error()Description:    Returns the error status of an opened SPHERE file.Syntax:    int sp_error(SP_FILE *sp_file)	Arguments:    sp_error takes as it's argument a SPHERE file pointer, 'sp_file',and returns the error status of that file.Return Value:    sp_error returns a zero if no errors occurred during the last fileI/O operation, a 100 if a checksum verification error occurred, or greaterthan 100 if a fatal file I/O error occurred.See Also:    sp_read_data(), sp_write_data(), sp_eof()II.D.3 sp_print_return_status()Description:    Prints the return status of the last SPHERE function call.Syntax:    int sp_print_return_status(FILE *fp)Arguments:        sp_return_status takes as it's argument an opened file pointer,'fp', and prints a message indicating the success or failure andlibrary version number of the last SPHERE function called to 'fp'.Remarks:    sp_return_status prints the following report for the lastfunction called:    Procedure: <function-name> V2.4        Status code: <integer-value>        Status type: <Success|Warning|Error>        Message: <message-string>Failures of child functions are recorded in the Message string.Note: This is currently only defined for the SPHERE 2.0 C-languageProgrammer Interface Library functions.Return Value:        sp_return_status a zero on success and a 100 or greater on error.II.D.4 sp_return_status()Description:    Returns the return status of the last SPHERE function call.Syntax:    int sp_return_status()Return Value:        sp_return_status returns the status of the last SPHERE functioncall.  The SPHERE 2.0 C-Language Programmers Interface Library functionsfollow the conventions below for indicating Success, Warnings, orErrors:     	Return Condition	Possible Range of Values	---------------- 	------------------------	   Success		           0	   Warning                        1-99	   Fatal Error	             100 or greaterNote: This is currently only defined for the SPHERE 2.0 C-languageProgrammer Interface Library functions.II.D.5  sp_get_version()Description:    Returns a pointer to a character string that identifies the SPHERElibrary version.Syntax:    char *sp_get_version(void)Return Value:        sp_get_version returns a pointer to a character string thatdefines the SPHERE Library version.  An example of the string wouldbe: "SPHERE Lib V2.4".Note: The character string should NOT by "free()'d" by the programmer.II.E   Data (Waveform) Buffer Allocation/Deallocation FunctionsII.E.1 sp_data_alloc()Description:    Return a pointer to memory allocated for N samples of all datachannels for an opened SP_FILE.Syntax:    void *sp_data_alloc(SP_FILE *sp, int nsamp)	Arguments:sp_data_alloc takes as it's argument a SP_FILE pointer, 'sp', and thenumber of samples 'nsamp' and returns an allocated buffer large enoughto hold 'nsamp' samples times the number of channels.  If the SP_FILEpointer is opened for read and 'nsamp' is -1, the returned buffer willbe size of the entire file.  If the SP_FILE is opened for write, and'nsamp' is -1, an error will occur.Remarks:   The returned buffer can be either a linear array of interleavedchannel samples, or a 2-dimensional array of non-interleaved channelsamples, with each channel contained in a separate array.  The form ofthe data structure is determined by the mode string passed to the'sp_set_data_mode' function.If 'nsamp' is greater than 0, and if a linear array(interleaved channels) is specified in the mode string, the bufferbyte size is computed as follows:	sample_n_bytes * channel_count * nsamp	The sample_n_bytes and channel_count values are obtained from	the SP_FILE's header.    If 'nsamp' is greater than zero and a 2-dimensional array is specifiedin the mode string, then the memory structure below is created andreturned.  The SP_FILE's sample_n_bytes and channel_count fields areused to create a structure large enough to hold the data.The structure consists of an array of double pointers for eachchannel, and each double pointer points to an array of 'nsamp'samples.                	 <--- 'nsamp' samples --->    		___      _________________________     	^	| |  ->  |  |  |  |  |  |  |  |  |        |	| |	 -------------------------     	|	|-|      _________________________     channel	| |  ->  |  |  |  |  |  |  |  |  |      count	| |	 -------------------------	|	|-|      _________________________	|	| |  ->  |  |  |  |  |  |  |  |  |	|	| |	 -------------------------	v	---The programmer must 'cast' the returned pointer to a double pointer ofthe expected type.  The programmer has a choice to access the data intwo ways: 	1. as a 2-dimensional array where the first subscript is the	   channel (zero for the first channel), and the second	   subscript is the sample number, e.g. arr[0][40].	2. as a pointer to each channel's data, e.g. arr[0], arr[1] ...If the defaults are not to be used, sp_set_data_mode must be calledbefore sp_data_alloc.  Further calls to sp_set_data_mode after thestructure is created can result in unknown spurious errors.Return Value:    sp_data_alloc() returns a pointer to memory allocated for waveformdata.  The returned value must be 'cast' to the programmer's expecteddata type.  If an error occurs, a NULL is returned.See Also:    sp_read_data(), sp_write_data(), sp_set_data_mode(), sp_data_free()I.E.2 sp_data_free()Description:    Frees a memory structure created by a call to sp_data_alloc().Syntax:    int sp_data_free(SP_FILE *sp, void *buffer)	Arguments:    sp_data_free takes as it's argument a SPHERE file pointer, 'sp',and a pointer to a memory buffer created by a call to sp_data_alloc()and "frees" the memory associated with the buffer.Remarks:   The buffer can be either a linear array of interleaved channelsamples, or a 2-dimensional array of non-interleaved channel samples,with each channel contained in a separate array.  The form of the datastructure is determined by the mode string passed to the'sp_set_data_mode' function.Return Value:    sp_data_free() returns a zero on success, and 100 or greateron error.See Also:    sp_read_data(), sp_write_data(), sp_set_data_mode(), sp_data_alloc()III.  File Format DefinitionSPHERE files contain a strictly defined header portion followed bythe file body (waveform).  Any waveform encoding may be used, but theencoding must be sufficiently described in the header.The header is an object-oriented, 1024-byte blocked, ASCII structurewhich is prepended to the waveform data.  The header is composed of afixed-format portion followed by an object-oriented variable portion.The fixed portion is as follows:NIST_1A<new-line>   1024<new-line>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -