mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-22 17:42:39 +00:00
It provides better detection than mod_vmd but is a little more CPU intensive than mod_vmd. Perhaps someone would like to CUDAfy this code?
24 lines
433 B
C
24 lines
433 B
C
#ifndef __AMPLITUDE_H__
|
|
#include <math.h>
|
|
#include "amplitude.h"
|
|
#include "psi.h"
|
|
|
|
/*! \brief
|
|
* @author Eric des Courtis
|
|
* @param b A circular audio sample buffer
|
|
* @param i Position in the buffer
|
|
* @param f Frequency estimate
|
|
* @return The amplitude at position i
|
|
*/
|
|
extern double amplitude(circ_buffer_t *b, size_t i, double f)
|
|
{
|
|
double result;
|
|
|
|
result = sqrt(PSI(b, i) / sin(f * f));
|
|
|
|
return result;
|
|
}
|
|
|
|
#endif
|
|
|