如果波形格式如下,我该如何使用Goertzel算法: - 2个频道 - 32位 - 48 kHz
我已经搜索了Goertzel算法,但我在互联网上可以看到的是检测到DTMF,波形格式为2通道,16位和8 kHz。我不知道应该修改哪些代码以满足我的要求。
Private Function Goertzel(ByVal sample As Byte(), ByVal N As Long, _
ByVal freq As Double, ByVal sampr As Long) As Double
Dim Skn As Double = 0
Dim Skn1 As Double = 0
Dim Skn2 As Double
Dim c As Double
Dim c2 As Double
Dim i As Integer
c = 2 * Math.PI * freq / sampr
c2 = Math.Cos(c)
For i = 0 To (N - 1)
Skn2 = Skn1
Skn1 = Skn
Skn = 2 * c2 * Skn1 - Skn2 + sample(i)
Next
Return Skn - Math.Exp(-c) * Skn1
End Function
Private Function power(ByVal val As Double) As Double
Return 20 * Math.Log(Math.Abs(val)) / Math.Log(10)
End Function