2015-01-21 247 views
-1

我在這裏得到了代碼: https://naudio.codeplex.com/discussions/270762我該如何實現Goertzel算法?

戈澤爾算法是這樣的:

public double goertzel(List<double> sngData, long N, float frequency, int samplerate) 
    { 
     double skn, skn1, skn2; 
     skn = skn1 = skn2 = 0; 
     samplerate = this.sampleRate; 
     frequency = this.freq; 

     double c = 2 * pi * frequency/samplerate; 
     double cosan = Math.Cos(c); 

     for (int i = 0; i < N; i++) 
     { 
      skn2 = skn1; 
      skn1 = skn; 
      skn = 2 * cosan * skn1 - skn2 + sngData[i]; 
     } 

     return skn - Math.Exp(-c) * skn1; 
    } 

我想通過使用算法(在上面的鏈接從波形文件閱讀器)來轉換的音頻數據。我怎樣才能做到這一點?謝謝

回答

0

如果您正在進行DTMF檢測,請嘗試「phoneToneDecoder」COM。它會從您的聲卡中檢測DTMF音調。 (我認爲它是專有的)