mathematical operations and values needed for functions within this library More...
Defines | |
#define | PI 3.141592653589793238462643 |
#define | TWO_PI 6.28318530717958647692 |
#define | INV_TWO_PI (1 / TWO_PI) |
#define | PI_2 1.57079632679489661923 |
#define | LOG2 0.69314718055994529 |
#define | LOG10 2.3025850929940459 |
#define | EXP 2.7182818284590451 |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
returns the maximum of a and b | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
returns the minimum of a and b | |
Functions | |
sfloat | sms_magToDB (sfloat x) |
convert from magnitude to decibel | |
sfloat | sms_dBToMag (sfloat x) |
convert from decibel to magnitude | |
void | sms_arrayMagToDB (int sizeArray, sfloat *pArray) |
convert an array from magnitude to decibel | |
void | sms_arrayDBToMag (int sizeArray, sfloat *pArray) |
convert and array from decibel (0-100) to magnitude (0-1) | |
void | sms_setMagThresh (sfloat x) |
set the linear magnitude threshold | |
sfloat | sms_rms (int sizeArray, sfloat *pArray) |
Root Mean Squared of an array. | |
sfloat | sms_sine (sfloat fTheta) |
table-lookup sine method | |
sfloat | sms_sinc (sfloat fTheta) |
global sinc table-lookup method | |
sfloat | sms_random (void) |
random number genorator | |
int | sms_power2 (int n) |
make sure a number is a power of 2 | |
sfloat | sms_scalarTempered (float x) |
void | sms_arrayScalarTempered (int sizeArray, sfloat *pArray) |
scale an array of linear frequencies to the well-tempered scale |
mathematical operations and values needed for functions within this library
#define EXP 2.7182818284590451 |
Eurler's number
Referenced by sms_dCepstrumEnvelope().
#define INV_TWO_PI (1 / TWO_PI) |
1 / ( pi * 2)
Referenced by SineSynthIFFT(), sms_deterministic(), and sms_sine().
#define LOG10 2.3025850929940459 |
natural logarithm of 10
#define LOG2 0.69314718055994529 |
natural logarithm of 2
Referenced by InitializeHybrid().
#define MAX | ( | a, | |||
b | ) | ((a) > (b) ? (a) : (b)) |
returns the maximum of a and b
Referenced by MultiplySpectra(), sms_analyze(), sms_detectPeaks(), sms_fillSoundBuffer(), sms_initAnalParams(), and sms_spectralApprox().
#define MIN | ( | a, | |||
b | ) | ((a) < (b) ? (a) : (b)) |
returns the minimum of a and b
Referenced by FillGap(), sms_analyze(), sms_copyFrame(), sms_detectPeaks(), and sms_spectralApprox().
#define PI 3.141592653589793238462643 |
pi
Referenced by GetPhaseVal(), Hanning(), and sms_dCepstrum().
#define PI_2 1.57079632679489661923 |
pi / 2
Referenced by SinePhaSynth(), SineSynthIFFT(), sms_dCepstrum(), and sms_deterministic().
#define TWO_PI 6.28318530717958647692 |
pi * 2
Referenced by BlackmanHarris62(), BlackmanHarris70(), BlackmanHarris74(), BlackmanHarris92(), FillGap(), GetPhaseVal(), Hamming(), IFFTwindow(), SinePhaSynth(), SineSynth(), SineSynthIFFT(), sms_deterministic(), sms_prepSinc(), sms_prepSine(), sms_sine(), sms_sineSynthFrame(), sms_stochastic(), and StocSynthApprox().
void sms_arrayDBToMag | ( | int | sizeArray, | |
sfloat * | pArray | |||
) |
convert and array from decibel (0-100) to magnitude (0-1)
depends on the magnitude threshold
sizeArray | size of array | |
pArray | pointer to array |
References sms_dBToMag().
Referenced by sms_analyze().
void sms_arrayMagToDB | ( | int | sizeArray, | |
sfloat * | pArray | |||
) |
convert an array from magnitude to decibel
Depends on a linear threshold that indicates the bottom end of the dB scale (magnutdes at this value will convert to zero).
sizeArray | size of array | |
pArray | pointer to array |
References sms_magToDB().
Referenced by sms_analyzeFrame().
void sms_arrayScalarTempered | ( | int | sizeArray, | |
sfloat * | pArray | |||
) |
scale an array of linear frequencies to the well-tempered scale
sizeArray | size of the array | |
pArray | pointer to array of frequencies |
References sms_scalarTempered().
sfloat sms_dBToMag | ( | sfloat | x | ) |
convert from decibel to magnitude
x | decibel (0-100) |
References mag_thresh.
Referenced by SinePhaSynth(), SineSynth(), sms_arrayDBToMag(), and sms_scaleDet().
sfloat sms_magToDB | ( | sfloat | x | ) |
convert from magnitude to decibel
x | magnitude (0:1) |
References inv_mag_thresh, mag_thresh, and TWENTY_OVER_LOG10.
Referenced by sms_arrayMagToDB(), and sms_scaleDet().
int sms_power2 | ( | int | n | ) |
make sure a number is a power of 2
Referenced by sms_analyze(), sms_analyzeFrame(), sms_dCepstrumEnvelope(), sms_initAnalysis(), sms_initSynth(), sms_invSpectrum(), sms_spectrum(), sms_spectrumMag(), and sms_stocAnalysis().
sfloat sms_random | ( | void | ) |
random number genorator
References genrand_real1(), INV_HALF_MAX, and sfloat.
Referenced by SineSynth(), SineSynthIFFT(), sms_deterministic(), sms_stochastic(), and StocSynthApprox().
sfloat sms_rms | ( | int | sizeArray, | |
sfloat * | pArray | |||
) |
sfloat sms_scalarTempered | ( | float | x | ) |
void sms_setMagThresh | ( | sfloat | x | ) |
set the linear magnitude threshold
magnitudes below this will go to zero when converted to db. it is limited to 0.00001 (-100db)
x | threshold value |
References inv_mag_thresh, and mag_thresh.
sfloat sms_sinc | ( | sfloat | fTheta | ) |
global sinc table-lookup method
fTheta has to be from 0 to 8
fTheta | angle in radians |
References fSincScale, and sms_tab_sinc.
Referenced by SineSynthIFFT(), and sms_deterministic().
sfloat sms_sine | ( | sfloat | fTheta | ) |
table-lookup sine method
fTheta | angle in radians |
References fSineIncr, INV_TWO_PI, sms_tab_sine, and TWO_PI.
Referenced by SineSynth(), SineSynthIFFT(), sms_dCepstrum(), and sms_deterministic().