soundfile input and output. More...
#include "sms.h"
Defines | |
#define | MAX_SAMPLES 10000 |
Functions | |
int | sms_openSF (char *pChInputSoundFile, SMS_SndHeader *pSoundHeader) |
open a sound file and check its header | |
void | sms_closeSF () |
close a sound file that was open for reading | |
int | sms_getSound (SMS_SndHeader *pSoundHeader, long sizeSound, sfloat *pSound, long offset) |
get a chunk of sound from input file | |
int | sms_createSF (char *pChOutputSoundFile, int iSamplingRate, int iType) |
function to create an output sound file | |
void | sms_writeSound (sfloat *pFBuffer, int sizeBuffer) |
write to the sound file data | |
void | sms_writeSF () |
function to write the output sound file to disk | |
int | sms_createResSF (int iSamplingRate) |
function to create the residual sound file | |
int | sms_writeResSound (sfloat *pBuffer, int sizeBuffer) |
function to write to the residual sound file | |
void | sms_writeResSF () |
write the residual sound file to disk | |
void | sms_fillSoundBuffer (int sizeWaveform, sfloat *pWaveform, SMS_AnalParams *pAnalParams) |
fill the sound buffer | |
Variables | |
SNDFILE * | pSNDStream |
SNDFILE * | pOutputSNDStream |
SNDFILE * | pResidualSNDStream |
SF_INFO | sfSoundHeader |
SF_INFO | sfResidualHeader |
SF_INFO | sfOutputSoundHeader |
const char * | pChResidualFile = "residual.aiff" |
soundfile input and output.
#define MAX_SAMPLES 10000 |
Referenced by sms_getSound().
void sms_closeSF | ( | ) |
close a sound file that was open for reading
References pSNDStream.
int sms_createResSF | ( | int | iSamplingRate | ) |
function to create the residual sound file
iSamplingRate | samplerate of sound file |
References pChResidualFile, pResidualSNDStream, sfResidualHeader, and sms_error().
int sms_createSF | ( | char * | pChOutputSoundFile, | |
int | iSamplingRate, | |||
int | iType | |||
) |
function to create an output sound file
pChOutputSoundFile | name of output file | |
iSamplingRate | sampling rate of synthesis | |
iType | output file format (0 is wav, 1 is aiff, or other is libsndfile specific) |
References pOutputSNDStream, sfOutputSoundHeader, and sms_error().
void sms_fillSoundBuffer | ( | int | sizeWaveform, | |
sfloat * | pWaveform, | |||
SMS_AnalParams * | pAnalParams | |||
) |
fill the sound buffer
sizeWaveform | size of input data | |
pWaveform | input data | |
pAnalParams | pointer to structure of analysis parameters |
References SMS_AnalParams::iAnalysisDirection, SMS_SndBuffer::iFirstGood, SMS_SndBuffer::iMarker, MAX, SMS_SndBuffer::pFBuffer, sfloat, SMS_SndBuffer::sizeBuffer, SMS_DIR_REV, sms_preEmphasis(), and SMS_AnalParams::soundBuffer.
Referenced by sms_analyze().
int sms_getSound | ( | SMS_SndHeader * | pSoundHeader, | |
long | sizeSound, | |||
sfloat * | pSound, | |||
long | offset | |||
) |
get a chunk of sound from input file
This function will copy to samples from the channel specified by SMS_SndHeader->iReadChannel to an array, which is by default the first channel.
pSoundHeader | sound header information to hold extracted information | |
sizeSound | number of samples read | |
pSound | buffer for samples read | |
offset | which sound frame to start reading from |
References SMS_SndHeader::channelCount, SMS_SndHeader::iReadChannel, MAX_SAMPLES, pSNDStream, sfloat, sms_error(), and SMS_MALLOC.
int sms_openSF | ( | char * | pChInputSoundFile, | |
SMS_SndHeader * | pSoundHeader | |||
) |
open a sound file and check its header
Defualt channel to read is 1. If the user wishes to read from a different channel when calling sms_getSound, they need to set SMS_SndHeader->iReadChannel to the desired channel number.
pChInputSoundFile | name of soundfile | |
pSoundHeader | information of the sound |
References SMS_SndHeader::channelCount, SMS_SndHeader::iReadChannel, SMS_SndHeader::iSamplingRate, SMS_SndHeader::nSamples, pSNDStream, sfSoundHeader, SMS_SndHeader::sizeHeader, and sms_error().
void sms_writeResSF | ( | void | ) |
write the residual sound file to disk
References pOutputSNDStream.
int sms_writeResSound | ( | sfloat * | pBuffer, | |
int | sizeBuffer | |||
) |
function to write to the residual sound file
pBuffer | data to write to residual file | |
sizeBuffer | size of data buffer |
References pResidualSNDStream, sfloat, sms_deEmphasis(), SMS_MALLOC, and SMS_OK.
void sms_writeSF | ( | void | ) |
function to write the output sound file to disk
References pOutputSNDStream.
void sms_writeSound | ( | sfloat * | pFBuffer, | |
int | sizeBuffer | |||
) |
write to the sound file data
pFBuffer | data to write to file | |
sizeBuffer | size of data buffer |
References pOutputSNDStream.
const char* pChResidualFile = "residual.aiff" |
Referenced by sms_createResSF().
SNDFILE * pOutputSNDStream |
Referenced by sms_createSF(), sms_writeResSF(), sms_writeSF(), and sms_writeSound().
SNDFILE * pResidualSNDStream |
Referenced by sms_createResSF(), and sms_writeResSound().
SNDFILE* pSNDStream |
Referenced by sms_closeSF(), sms_getSound(), and sms_openSF().
SF_INFO sfOutputSoundHeader |
Referenced by sms_createSF().
SF_INFO sfResidualHeader |
Referenced by sms_createResSF().
SF_INFO sfSoundHeader |
Referenced by sms_openSF().