-
Notifications
You must be signed in to change notification settings - Fork 18
/
pitch_detector.h
36 lines (27 loc) · 1.07 KB
/
pitch_detector.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
#ifndef TALENTENEDHACK_PITCH_DETECTOR_H
#define TALENTENEDHACK_PITCH_DETECTOR_H
#include <math.h>
#include "circular_buffer.h"
#include "fft.h"
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#ifdef DEBUGPLOT
#include <SDL/SDL.h>
#endif
#define PI (float)3.14159265358979323846
typedef struct {
float pperiod;
float confidence;
unsigned long corrsize; // Size of the autocorrelation buffers
float* cbwindow; //cosine window;
float* acwinv; // inverse of autocorrelation of window
float* p_pmax; // Maximum allowable pitch (Hz)
float* p_pmin; // Minimum allowable pitch (Hz)
float* p_vthresh; // The voiced confidence (unbiased peak) threshold level
float* p_ppickthresh; // MPM's "k" constant
} PitchDetector;
const float * obtain_autocovariance(PitchDetector * pdetector,fft_vars* fftvars, CircularBuffer* buffer, long int N);
float get_pitch_period(PitchDetector * pdetector, const float* autocorr, unsigned long Nf, float fs);
void InstantiatePitchDetector(PitchDetector * pdetector, fft_vars* fftvars, unsigned long corrsize, double samplerate );
#endif