/Users/richardeakin/projects/libsms/trunk/src/soundIO.c File Reference

soundfile input and output. More...

#include "sms.h"
Include dependency graph for soundIO.c:

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"

Detailed Description

soundfile input and output.


Define Documentation

#define MAX_SAMPLES   10000

Referenced by sms_getSound().


Function Documentation

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

Parameters:
iSamplingRate samplerate of sound file
Returns:
error code
See also:
SMS_SNDERR in SMS_ERRORS

References pChResidualFile, pResidualSNDStream, sfResidualHeader, and sms_error().

Here is the call graph for this function:

int sms_createSF ( char *  pChOutputSoundFile,
int  iSamplingRate,
int  iType 
)

function to create an output sound file

Parameters:
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)
Returns:
0 on success, -1 on failure

References pOutputSNDStream, sfOutputSoundHeader, and sms_error().

Here is the call graph for this function:

void sms_fillSoundBuffer ( int  sizeWaveform,
sfloat *  pWaveform,
SMS_AnalParams pAnalParams 
)

fill the sound buffer

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
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
Returns:
0 on success, -1 on failure

References SMS_SndHeader::channelCount, SMS_SndHeader::iReadChannel, MAX_SAMPLES, pSNDStream, sfloat, sms_error(), and SMS_MALLOC.

Here is the call graph for this function:

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.

Parameters:
pChInputSoundFile name of soundfile
pSoundHeader information of the sound
Returns:
0 on success, -1 on failure

References SMS_SndHeader::channelCount, SMS_SndHeader::iReadChannel, SMS_SndHeader::iSamplingRate, SMS_SndHeader::nSamples, pSNDStream, sfSoundHeader, SMS_SndHeader::sizeHeader, and sms_error().

Here is the call graph for this function:

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

Parameters:
pBuffer data to write to residual file
sizeBuffer size of data buffer
Returns:
error code
See also:
SMS_SNDERR in SMS_ERRORS

References pResidualSNDStream, sfloat, sms_deEmphasis(), SMS_MALLOC, and SMS_OK.

Here is the call graph for this function:

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

Parameters:
pFBuffer data to write to file
sizeBuffer size of data buffer

References pOutputSNDStream.


Variable Documentation

const char* pChResidualFile = "residual.aiff"

Referenced by sms_createResSF().

SNDFILE * pOutputSNDStream
SNDFILE * pResidualSNDStream
SNDFILE* pSNDStream

Referenced by sms_createSF().

Referenced by sms_createResSF().

SF_INFO sfSoundHeader

Referenced by sms_openSF().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Thu Oct 29 04:08:07 2009 for libsms by  doxygen 1.6.1