27#define M_PI 3.14159265358979323846
41double MD_dot(
const double *a,
const double *b,
unsigned N);
50double MD_entropy(
const double *a,
unsigned N,
bool clip);
53double MD_energy(
const double *a,
unsigned N);
56double MD_power(
const double *a,
unsigned N);
70 double oldmin,
double oldmax,
71 double newmin,
double newmax);
75 double oldmin,
double oldmax,
76 double newmin,
double newmax);
84 double newmin,
double newmax);
91 unsigned N,
double dblevel);
314void MD_stft(
const double *signal,
unsigned signal_len,
315 unsigned N,
unsigned hop,
354void MD_sine_wave(
double *output,
unsigned N,
double amplitude,
355 double freq,
double sample_rate);
406void MD_impulse(
double *output,
unsigned N,
double amplitude,
unsigned position);
438 double f_start,
double f_end,
double sample_rate);
472void MD_chirp_log(
double *output,
unsigned N,
double amplitude,
473 double f_start,
double f_end,
double sample_rate);
507 double freq,
double sample_rate);
537 double freq,
double sample_rate);
579 unsigned margin,
int weightfunc,
594int MD_get_delay(
const double *siga,
const double *sigb,
unsigned N,
595 double *ent,
unsigned margin,
int weightfunc);
607void MD_gcc(
const double *siga,
const double *sigb,
unsigned N,
608 double *lagvals,
int weightfunc);
void MD_chirp_linear(double *output, unsigned N, double amplitude, double f_start, double f_end, double sample_rate)
Generate a linear chirp (swept sine with linearly increasing frequency).
double MD_power(const double *a, unsigned N)
Compute signal power: energy divided by the number of samples.
void MD_power_spectral_density(const double *signal, unsigned N, double *psd_out)
Compute the power spectral density (PSD) of a real-valued signal.
void MD_white_noise(double *output, unsigned N, double amplitude, unsigned seed)
Generate Gaussian white noise.
void MD_sine_wave(double *output, unsigned N, double amplitude, double freq, double sample_rate)
Generate a sine wave.
void MD_impulse(double *output, unsigned N, double amplitude, unsigned position)
Generate a discrete impulse (Kronecker delta).
void MD_scale_vec(double *in, double *out, unsigned N, double oldmin, double oldmax, double newmin, double newmax)
Map every element of a vector from one range to another.
void MD_phase_spectrum(const double *signal, unsigned N, double *phase_out)
Compute the one-sided phase spectrum of a real signal.
MD_GCC_WEIGHTING_TYPE
Weighting types for Generalized Cross-Correlation.
@ SIMP
Simple 1/N weighting (basic cross-correlation)
@ PHAT
Phase Transform weighting (sharper peaks, more robust to noise)
double MD_scale(double in, double oldmin, double oldmax, double newmin, double newmax)
Map a single value from one range to another.
void MD_Gen_Hann_Win(double *out, unsigned n)
Generate a Hanning window of length n.
double MD_energy(const double *a, unsigned N)
Compute signal energy: sum of squared samples.
void MD_stft(const double *signal, unsigned signal_len, unsigned N, unsigned hop, double *mag_out)
Compute the Short-Time Fourier Transform (STFT) of a real-valued signal.
double MD_entropy(const double *a, unsigned N, bool clip)
Compute the normalized entropy of a distribution.
void MD_shutdown(void)
Free all internally cached FFT plans and buffers.
double MD_power_db(const double *a, unsigned N)
Compute signal power in decibels: 10 * log10(power).
void MD_gcc(const double *siga, const double *sigb, unsigned N, double *lagvals, int weightfunc)
Compute the full generalized cross-correlation between two signals.
void MD_get_multiple_delays(const double **sigs, unsigned M, unsigned N, unsigned margin, int weightfunc, int *outdelays)
Estimate delays between a reference signal and M-1 other signals.
double MD_dot(const double *a, const double *b, unsigned N)
Compute the dot product of two vectors.
void MD_sawtooth_wave(double *output, unsigned N, double amplitude, double freq, double sample_rate)
Generate a sawtooth wave.
void MD_magnitude_spectrum(const double *signal, unsigned N, double *mag_out)
Compute the magnitude spectrum of a real-valued signal.
unsigned MD_stft_num_frames(unsigned signal_len, unsigned N, unsigned hop)
Compute the number of STFT frames for the given signal length and parameters.
void MD_fit_within_range(double *in, double *out, unsigned N, double newmin, double newmax)
Fit values within [newmin, newmax].
void MD_square_wave(double *output, unsigned N, double amplitude, double freq, double sample_rate)
Generate a square wave.
int MD_get_delay(const double *siga, const double *sigb, unsigned N, double *ent, unsigned margin, int weightfunc)
Estimate the delay between two signals.
void MD_adjust_dblevel(const double *in, double *out, unsigned N, double dblevel)
Automatic Gain Control: scale a signal so its power matches the requested dB level,...
void MD_chirp_log(double *output, unsigned N, double amplitude, double f_start, double f_end, double sample_rate)
Generate a logarithmic chirp (swept sine with exponentially increasing frequency).