Telecommunications & Signal Processing Laboratory


libtsp TSP Signal Processing Library

The libtsp package is a library of routines for signal processing. It also includes a number of general purpose routines useful for program development. Examples of programs using this library for filtering, LPC analysis/synthesis and resampling are available as part of the AFsp package.

The libtsp library routines are divided into a number of categories, with the first two letters of the routine name keyed to the category. Examples of the functions available are listed for each category.

AF - Audio file routines

FI - Filtering routines

FL - File routines

FN - Functions

MA - Matrix routines

MS - Miscellaneous routines

SP - Signal processing routines

ST - String routines

UT - Utility routines

VR - Vector routines

Audio file routines

AFclose - Close an audio file
AFdReadData - Read data from an audio file (return double values)
AFdWriteData - Write data to an audio file (double input values)
AFfReadData - Read data from an audio file (return float values)
AFfWriteData - Write data to an audio file (float input values)
AFopnRead - Open an audio file for reading
AFopnWrite - Open an audio file for writing
AFsetFileType - Set the input audio file type
AFsetInfo - Set the audio file information string
AFsetNHpar - Set defaults for input headerless audio files from a string specification
AFsetSpeaker - Set defaults for loudspeaker spacial positions

Filtering routines

FIdBiquad - Filter a signal using a biquadratic IIR filter
FIdConvSI - Filter a signal with an FIR filter (sample rate change)
FIdConvol - Filter a signal with an FIR filter
FIdFiltAP - Filter a signal with an all-pole IIR filter
FIdFiltIIR - Filter a signal using a cascade of biquadratic IIR filters
FIdKaiserLPF - Generate a Kaiser windowed lowpass filter
FIdReadFilt - Read a filter coefficient file
FIdWinHamm - Generate a generalized Hamming window
FIdWinKaiser - Generate a Kaiser window
FIfBiquad - Filter a signal using a biquadratic IIR filter
FIfConvSI - Filter a signal with an FIR filter (sample rate change)
FIfConvol - Filter a signal with an FIR filter
FIfDeem - Deemphasize a signal using a first order recursive filter
FIfFiltAP - Filter a signal with an all-pole IIR filter
FIfFiltIIR - Filter a signal using a cascade of biquadratic IIR filters
FIfKaiserLPF - Generate a Kaiser windowed lowpass filter
FIfPreem - Preemphasize a signal using a first difference filter
FIfReadFilt - Read a filter coefficient file
FIfWinHCos - Generate a Hamming/cosine window
FIfWinHamm - Generate a generalized Hamming window
FIfWinKaiser - Generate a Kaiser window
FIfWinRCos - Generate a raised-cosine window
FIgdelFIR - Calculate the group delay for an FIR filter
FIgdelIIR - Calculate the group delay for a cascade IIR filter

File routines

FLbackup - Rename an existing file
FLbaseName - Return the last component of a file path
FLdReadData - Read numeric data in text form from a file
FLdWriteData - Write a double array in text form to a file
FLdate - Find the last modification time for a file (by name)
FLdefName - Fill in file name components from a default string
FLdirName - Return all but the last component of a file path
FLexpHome - Expand the home directory specification for a file
FLextName - Return the extension component of a file name
FLfReadData - Read numeric data in text form from a file
FLfWriteData - Write a float array in text form to a file
FLfileDate - Find the last modification time for an open file
FLfullName - Expand a file name path
FLgetLine - Read a line of text from a file
FLgetRec - Read and assemble a text record from an input stream
FLhomeDir - Get the home directory for a user
FLpathList - Fill in a directory for a file name from a list of paths
FLpreName - Return the last component of a file name stripped of its extension
FLprompt - Print a prompt
FLreadLine - Print a prompt and read a line of text

Functions

FNbessI0 - Evaluate the zeroth-order modified Bessel function of first kind
FNevChebP - Evaluate a series expansion in Chebyshev polynomials
FNgcd - Find the greatest common divisor of two integer values
FNiLog2 - Find the integer greater than or equal to log (base 2) of a given value
FNsinc - Evaluate the sin(pi*x)/(pi*x) function

Matrix routines

MAdAllocMat - Allocate a matrix of double values
MAdFreeMat - Free an allocated double matrix
MAdPrint - Print a double matrix along with a header text
MAfAllocMat - Allocate a matrix of float values
MAfChSolve - Solve a positive definite set of equations
MAfFreeMat - Free an allocated float matrix
MAfPrint - Print a float matrix along with a header text
MAfSubMat - Set up pointers to a submatrix of a matrix of float values
MAfSyBilin - Calculate a bilinear form for a symmetric matrix
MAfSyQuad - Calculate a quadratic form for a symmetric matrix
MAfTpQuad - Calculate a quadratic form for a symmetric Toeplitz matrix
MAfTpSolve - Solve a Toeplitz set of equations
MAiPrint - Print an integer matrix along with a header text
MAlPrint - Print a long integer matrix along with a header text

Miscellaneous routines

MSdConvCof - Convolve the coefficients of two vectors
MSdDeconvCof - Polyomial divide (deconvolve the coefficients of two vectors)
MSdIntLin - Interpolate a table of values using a piecewise linear interpolant
MSdIntMC - Interpolate a table of values using a piecewise monotonic cubic interpolant
MSdLocate - Binary search in a table
MSdNint - Nearest integer function
MSdPolyInt - Polynomial interpolation given a set of points
MSfConvCof - Convolve the coefficients of two vectors
MSfGaussRand - Generate a Gaussian pseudo-random value
MSfIntLin - Interpolate a table of values using a piecewise linear interpolant
MSfIntMC - Interpolate a table of values using a piecewise monotonic cubic interpolant
MSfUnifRand - Generate a uniformly distributed pseudo-random value
MSiCeil - Ceiling function for the ratio of two integers
MSiFloor - Floor function for the ratio of two integers
MSiPower - Integer raised to an integer power
MSlCeil - Ceiling function for the ratio of two long ints
MSlFloor - Floor function for the ratio of two long ints
MSratio - Find a ratio of integers approximation to a floating point value

Signal processing routines

SPautoc - Calculate the autocorrelation for a data sequence
SPcepXpc - Convert cepstral coefficients to predictor coefficients
SPcorBWexp - Bandwidth expand a set of correlation values
SPcorFilt - Find filter coefficients to minimize the mean-square error
SPcorFmse - Calculate the mean-square filtering error
SPcorPmse - Calculate the mean-square prediction error
SPcorXpc - Find predictor coefficients from autocorrelation values
SPcovCXpc - Find predictor coefficients using the covariance lattice method (Cumani)
SPcovFilt - Find filter coefficients using the covariance approach
SPcovFmse - Find the mean-square error for a filter (covariance specified)
SPcovLXpc - Find predictor coefficients using the covariance lattice method
SPcovMXpc - Find predictor coefficients using the modified covariance method
SPcovPmse - Calculate the mean-square prediction error (covariance specified)
SPcovXpc - Find predictor coefficients using the covariance method
SPcovar - Calculate a correlation (covariance) matrix for a data sequence
SPdCFFT - Fast Fourier transform (complex data)
SPdQuantL - Binary search for a bounding interval
SPdRFFT - Fast Fourier transform of a real sequence
SPecXpc - Convert prediction error filter coefficients to predictor coefficients
SPfCFFT - Fast Fourier transform (complex data)
SPfDCT - Calculate the discrete cosine transform
SPfQuantL - Binary search for a bounding interval
SPfQuantU - Binary search for a bounding interval
SPfRFFT - Fast Fourier transform of a real sequence
SPlpcISdist - Calculate the Itakura-Saito LPC spectral distance measure
SPlpcLSdist - Calculate the RMS log LPC spectral distance measure
SPlsfXpc - Convert LSF's to predictor coefficients
SPpcBWexp - Bandwidth expand a set of predictor coefficients
SPpcXcep - Convert predictor coefficients to cepstral coefficients
SPpcXcor - Convert predictor coefficients to correlation values
SPpcXec - Convert predictor coefficients to prediction error filter coefficients
SPpcXlsf - Convert predictor coefficients to line spectral frequencies
SPpcXrc - Convert predictor coefficients to reflection coefficients
SPrcXpc - Convert reflection coefficients to predictor coefficients

String routines

STcatMax - Append characters to a string (maximum length specified)
STcopyMax - Copy at most Maxchar characters to a string
STcopyNMax - Copy N characters characters to a string
STdec1double - Decode a double value
STdec1float - Decode a float value
STdec1int - Decode an integer value
STdec1long - Decode a long integer value
STdecDfrac - Decode a ratio specification of two double values
STdecIfrac - Decode a ratio specification of two integer values
STdecIrange - Decode a range specification for integer values
STdecLrange - Decode a range specification for long integer values
STdecNdouble - Decode double values (variable number)
STdecNfloat - Decode float values (variable number)
STdecNint - Decode integer values (variable number)
STdecNlong - Decode long integer values (variable number)
STfindToken - Find the first token string in a string
STkeyMatch - Match a string to keyword strings
STkeyXpar - Decode keywords and return parameter values
STstrLC - Copy a string, changing uppercase characters to lowercase
STtrim - Copy a string, trimming leading and trailing white-space
STunQuote - Copy a string, removing outer quote characters

Utility routines

UTdate - Return a date/time string for the current time
UTerror - Print user and system error messages, stop with error status set
UTfree - Deallocate a block of memory
UTgetOption - Decode command line options and arguments
UThalt - Print an error message, stop with error status set
UTmalloc - Allocate a block of memory
UTrealloc - Reallocate a block of memory
UTsetProg - Set the program name for messages
UTsysMsg - Print user and system warning messages
UTuserName - Get the user name and host name
UTwarn - Print a warning message

Vector routines

VRdAdd - Element-by-element sum of two double arrays
VRdCopy - Copy an array of doubles
VRdCorSym - Find the correlation coefficient for a vector and its reversal
VRdDotProd - Dot product of two double arrays
VRdLinInc - Generate a linearly spaced array of values
VRdMult - Element-by-element product of two double arrays
VRdPrint - Print a double array along with a header text
VRdRFFTMSq - Calculate the magnitude squared spectrum for the DFT of a real sequence
VRdScale - Multiply each element of a double array by a scalar value
VRdSet - Set each element in an array of doubles to a given value
VRdShift - Shift the elements of an array of doubles
VRdSymPart - Find the symmetric or anti-symmetric part of a vector
VRdZero - Zero an array of doubles
VRfAdd - Element-by-element sum of two float arrays
VRfAmpldB - Convert each value in an array of amplitudes to a decibel value
VRfCopy - Copy an array of floats
VRfCorSym - Find the correlation coefficient for a vector and its reversal
VRfDiff - Element-by-element difference of two float arrays
VRfDiffSq - Find the sum of squares of the differences for two float arrays
VRfDotProd - Dot product of two float arrays (double result)
VRfLog10 - Find the logarithm (base 10) of each element of an array
VRfMax - Return the maximum value in a float array
VRfMin - Return the minimum value in a float array
VRfMult - Element-by-element product of two float arrays
VRfPow10 - Find 10 raised to the power of each element of an array
VRfPrint - Print a float array along with a header text
VRfRev - Reverse the order of the elements of an array
VRfScale - Multiply each element of a float array by a scalar value
VRfSet - Set each element in an array of floats to a given value
VRfShift - Shift the elements of an array of floats
VRfSum - Calculate the sum of elements in an array of floats
VRfZero - Zero an array of floats
VRiPrint - Print an integer array along with a header text
VRiZero - Zero an array of ints
VRlPrint - Print a long integer array along with a header text

Author / revision

P. Kabal - kabal@ECE.McGill.CA
Telecommunications & Signal Processing Laboratory
Department of Electrical & Computer Engineering
McGill University
Montreal, Canada H3A 2A7

2005/03/15