Skip to content

Commit

Permalink
more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
garygru committed Nov 15, 2012
1 parent 45f63f9 commit a96cdaa
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 14 deletions.
Binary file not shown.
56 changes: 48 additions & 8 deletions sources/YapHash/src/Stft.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,67 @@ class Stft{

public:

// Convenience constructor
Stft(const Audio& audio, int windowSize, int feedRate);
int calcStft(const Audio &audio, int windowSize, int feedRate); // calc stft from audio file
/**
* Convenience constructor
* @param audio the audio object
* @param windowSize the size of the frames/windows in samples
* @param feedRate the step size of the frames in samples
*/
Stft(const Audio& audio, int windowSize, int feedRate);

/**
* calc stft from audio file
* @param audio the audio object
* @param windowSize the size of the frames/windows in samples
* @param feedRate the step size of the frames in samples
* @return error
*/
int calcStft(const Audio &audio, int windowSize, int feedRate);

// destructor
~Stft();
~Stft();

Fw32f **spectrogramm; // Short time fourier transformation
int fftLen;
int NoOfWindows;
int NoOfWindows;

private:
//IppStatus status;
};


/**
* Applies a Hamming window of given length, inplace operation!
* @param data input overwritten by output data
* @param length of window
*/
void WinHamming_I(double* data, int length);

/**
* combine some functions for convenience and speedup
* @param inAudio audio samples as 32 bit float to be multriplied with hamming window
* @param windowedAudio windowed audio samples
* @param fftLen length of fft (next power of 2)
* @param windowSize size of window
*/
void CopyWithHamming(float *inAudio, double* windowedAudio, int fftLen, int windowSize);

/**
* combine some functions for convenience and speedup
* @param inAudio
* @param windowedAudio
* @param hamming
* @param fftLen
* @param windowSize
*/
void CopyConvertAndMultiply(float *inAudio, double* windowedAudio, double* hamming, int fftLen, int windowSize);

/**
* calculate power spectrum from spectrum
* @param power_spectrum
* @param spectrum
* @param N size of full spectrum
*/
void PowerSpectrum(Fw32f* power_spectrum, fftw_complex* spectrum, int N);


#endif

53 changes: 47 additions & 6 deletions sources/YapHash/src/VAD.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,63 @@

#include "fwSignal.h"

// energy with windowsize parameter
void EnergyInWindows(float *energy,
float *data,
unsigned int dataLen,
int windowSize,
/**
* calculate energy of each frame and writes energy vector to first arg
* @param energy calculated energy in windows
* @param data input audio data
* @param dataLen number of audio samples
* @param windowSize size of windows in samples
* @param stepSize size of steps in samples
*/
void EnergyInWindows(float *energy,
float *data,
unsigned int dataLen,
int windowSize,
int stepSize);

//void Windows(short *data, short windowSize, short stepSize);
/**
* calc energy with fixed window size
* @param data input audio data
* @param dataLen number of audio samples
* @param energy calculated energy in windows
*/
void Energy(double *data, unsigned int dataLen, float *energy);

/**
* Voice activity detection
* @param data input audio data
* @param dataLen number of audio samples
* @param threshold energy threshold of audio
* @return index of first window to use for processing
*/
int Vad(double *data, unsigned int dataLen, int threshold);

/**
* Voice activity detection, in place operation. writes result to
* input buffer and returns new length
* @param data input audio data
* @param dataLen number of audio samples
* @param threshold energy threshold of audio
* @return zero if no error
*/
int cutVad_I(double *data, int *dataLen, int threshold);

/**
* Voice activity detection based on autocorrelation, inplace operation
* @param data input audio data
* @param dataLen number of audio samples
* @param threshold energy threshold of audio
* @return zero if no error
*/
int cutACFVad_I(Fw32f *data, int *dataLen, int threshold);

/**
* Voice activity detection based on autocorrelation
* @param data input audio data
* @param dataLen number of audio samples
* @param threshold energy threshold of audio
* @return index of first window to use for processing
*/
int AutocorrelationVad(Fw32f *data, int dataLen, int threshold);


Expand Down

0 comments on commit a96cdaa

Please sign in to comment.