/
correlation.h
68 lines (58 loc) · 1.6 KB
/
correlation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "pitchutils.h"
#include "FFT.h"
#ifndef CORRELATION_H_
#define CORRELATION_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Standard Correlation */
typedef enum correlation_type{
AUTO,
AMDF,
ASDF,
YIN,
FAST_AUTO,
FAST_ASDF,
FAST_YIN
} CORR;
typedef struct
{
CORR correlationType;
REAL* correlation;
int length;
int searchStart;
int searchEnd;
int sampleRate;
SIGNAL threshold;
FFT* fft_x1;
FFT* fft_x2;
FFT* ifft;
SIGNAL* x2;
REAL* buffer; // General purpose buffer for efficiency;
} Correlation;
Correlation* NewCorrelation( CORR correlationType,
int length,
int searchStart,
int searchEnd,
int sampleRate,
REAL threshold );
Correlation* NewFastCorrelation( CORR correlationType,
int length,
int searchStart,
int searchEnd,
int sampleRate,
REAL threshold );
void FreeCorrelation( Correlation* c );
REAL firstMinima( Correlation* c );
REAL firstMaxima( Correlation* c );
void autocorrelation(SIGNAL* input, Correlation* c);
void amdf(SIGNAL* input, Correlation* c);
void asdf(SIGNAL* input, Correlation* c);
void yin(SIGNAL* input, Correlation* c);
void fast_autocorrelation(SIGNAL* input, Correlation* c);
void fast_asdf(SIGNAL*, Correlation* c);
void fast_yin(SIGNAL*, Correlation* c);
#ifdef __cplusplus
}
#endif
#endif