端点检测

语音识别从声音进行电脑后,一般先进行端点检测,即将语音的部分与外界的噪音或是静音分割开来,以减少计算机的计算负担,从而更快进行识别

端点检测的算法比较多,一般就通过,过零率,能量值来进行判断;然后再对“符合条件“的声音转给识别程序

  Public Function Vad4(data16() As Int16) As List(Of Point)
        Dim j As Integer = 0
        Dim pow As Int64 = 0
        Dim tmp As Integer = 0
        Dim isStart As Boolean = False
        Dim StartPos As Integer = 0, EndPos As Integer = 0
        Dim WArray As New List(Of Point)


        For i = 0 To data16.Length - 1 '
            If j < 100 Then
                tmp = data16(i)
                pow = pow + Math.Pow(tmp, 2)


            Else
                Dim energy As Integer = 0
                energy = Math.Sqrt(pow) / 100
                Console.WriteLine(energy.ToString)
                If energy < 5 Then
                    If isStart = True Then  '已有开始点,此处能量低于阀值
                        isStart = False
                        EndPos = i

                        '*******过滤小于2000点的区域
                        If EndPos - StartPos > 1200 Then
                            WArray.Add(New Point(StartPos, EndPos))
                            'end 
                        End If

                    End If
                Else
                    If isStart = False Then
                        isStart = True
                        StartPos = i

                    End If

                End If
                pow = 0
                j = 0
            End If



            j = j + 1
        Next

        Return WArray
    End Function


你可能感兴趣的:(语音识别)