-
Notifications
You must be signed in to change notification settings - Fork 18
/
pitch_shifter.h
37 lines (26 loc) · 1.11 KB
/
pitch_shifter.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
#ifndef TALENTENEDHACK_PITCH_SHIFTER_H
#define TALENTENEDHACK_PITCH_SHIFTER_H
#define PI (float)3.14159265358979323846
#include <stdlib.h>
#include <math.h>
#include "pitch_detector.h"
#include "circular_buffer.h"
typedef struct {
// VARIABLES FOR PITCH SHIFTER
float phprdd; // default (unvoiced) phase period
double inphinc; // input phase increment
double outphinc; // input phase increment
double phincfact; // factor determining output phase increment
double phasein;
double phaseout;
float* frag; // windowed fragment of speech
unsigned long fragsize; // size of fragment in samples
float* hannwindow; // length-N hann
float* cbo; // circular output buffer
unsigned long cbord; //read index for circular buffer;
} PitchShifter;
void PitchShifterInit(PitchShifter * pshifter, unsigned long SampleRate, unsigned long cbsize);
void ComputePitchShifterVariables(PitchShifter * pshifter, float inpperiod, float outpperiod, float fs);
float ShiftPitch(PitchShifter * pshifter, CircularBuffer * buffer, long int N);
void Interpolate(PitchShifter * pshifter, long int bounds, long int N);
#endif