我正在制作一个简单的程序来收听我的麦克风,并使用Google的api将其转换为文本。 一切正常,但我的问题是,当我停止讲话时,该程序会继续监听,并且在我停止讲话后几秒钟便会停止。
我知道背景噪声可能是我的问题,尽管我有Blue Yeti麦克风,所以它不应该反弹,但是我仍然尝试调整噪声,但结果仍然相同。
Sub FilterSum()
On Error Resume Next
Dim MyRangeI As Range
Dim MyRangeO As Range
Dim cell As Range
Dim XNEWRANGE As Range
Dim wsI As Worksheet
Dim wsO As Worksheet
Set wsI = ThisWorkbook.Sheets("Sheet1")
Set wsO = ThisWorkbook.Sheets("Sheet2")
With wsI.UsedRange 'don't consider headers
Set MyRangeI = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 1, .Columns.Count - 1))
MyRangeI.Select
End With
With wsO.UsedRange 'don't consider headers
Set MyRangeO = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 1, .Columns.Count - 1))
MyRangeO.Select
End With
Application.ScreenUpdating = False
For Each cell In MyRangeI.Columns("A").Cells
MyRangeO.AutoFilter Field:=9, Criteria1:=">=" & MyRangeI.Cells(cell.Row, "O"), Operator:=xlAnd, Criteria2:="<=" & Now 'Field 9 is tha same of the Named Range "dates"
Set XNEWRANGE = MyRangeO.SpecialCells(xlCellTypeVisible)
MyRangeI.Cells(cell.Row, "K") = Application.SumIf(XNEWRANGE, MyRangeI.cell.Value, Range("aliquotes"))
Next cell
Application.ScreenUpdating = True
End Sub
正如预期的那样,即使我几秒钟不说话,该程序仍会继续监听,这确实使它变得缓慢而糟糕。 感谢您的帮助!
答案 0 :(得分:0)
您可以尝试调整pause_threshold
类的Recognizer
属性。
默认情况下,它设置为0.8
通过查看https://github.com/Uberi/speech_recognition/blob/350397d2fb5db318c877f29ee3dc6e6cbf4a393d/speech_recognition/init.py#L508
Recognizer
源代码来找到信息。
答案 1 :(得分:0)
如果所有代码都正确,请尝试将耳机连接到PC,然后在耳机设置为打开麦克风的情况下进行......这样程序就可以正常工作了,但有时麦克风是问题所在。这就是为什么程序不显示的原因任何错误..因为它尝试听但由于麦克风或信号源是问题而无法理解....