Pitch Perfector
A real-time pitch-shifting microphone project at the University of Glasgow
 All Classes Functions
vocoder.h
1 #include <fftw3.h>
2 #include "fft.h"
3 #pragma once
4 
5 class Vocoder {
6  public:
7  float baseFreq;
8  int baseSample;
9  int samplerate;
10  int bufferSize;
11  float frequencyResolution;
12  const double* scaleFrequencies;
13  float newFreq;
14  float difference;
15  int binDifference;
16  fftw_complex fourierSpectrum[257];
17  double peakFrequency;
18  double closestNoteFrequency;
19  char currentNote[4];
20  double* peakFrequencyPointer;
21 
22  Vocoder(int sampleRate, int bufferSize, const double* scaleFrequencies);
23  float binary_search(const float* NotesInKey, float* note, int highest_index, int lowest_index);
24  float noteFinder(const float* NotesInKey, float* note);
25  float SampleToFreq(int sample);
26  void pitchShift_setup(fftw_complex* fft_spectrum);
27  void pitchShift();
28  void findPeak();
29  double getClosest(double val1, double val2, double target);
30  double findClosestNote(const double notes[], int n, double target);
31  int FrequencyToIndex(double frequency);
32  void setFourierSpectrum(fftw_complex* fftSpectrum);
33  const char* frequencyToNote(double freq);
34  char* getNote();
35 
36 };
Definition: vocoder.h:5