Permalink
Browse files

Got goertzel function into mainstream

  • Loading branch information...
1 parent d36a2fc commit 0c9c8cee4039fed8ad4e45887ba83e847c4a4509 @arjo129 committed Sep 29, 2012
Showing with 6 additions and 6 deletions.
  1. +5 −5 formant.cpp
  2. +1 −1 uspeech.h
View
@@ -48,16 +48,16 @@ void signal::debugPrintFilter(){
Serial.println("-----");
}
-/*int signal::goertzel(int freq){
-int freq = freq/100000;
+int signal::goertzel(int freq){
+freq = freq/100000;
int s_prev = 0 ;
int s_prev2 = 0 ;
int coeff = 2 * cos(2 * 3.14 * freq) ;
-for(int i = 2; i < 6; i++){
- s = x[i] + coeff *s_prev - s_prev2 ;
+for(int i = 2; i < 32; i++){
+ int s = arr[i] + coeff *s_prev - s_prev2 ;
s_prev2 = s_prev ;
s_prev = s ;
}
return s_prev2 * s_prev2 + s_prev * s_prev - coeff * s_prev * s_prev2 ;
-}*/
+}
View
@@ -28,7 +28,7 @@ class signal{
char getPhoneme();
void debugPrintFilter();
void voiceFormants();
- //int goertzel(int freq)
+ int goertzel(int freq);
private:
int pin;
int mil;

0 comments on commit 0c9c8ce

Please sign in to comment.