Python 中用于语音转文本的语音处理库

问题描述 投票:0回答:3

嘿 我正在寻找用 python 构建一个代码,它将识别我通过麦克风所说的话并转换为语音, 你能给我一些有效的语音处理库来实现同样的目的吗?

python speech-recognition
3个回答

0
投票

蜻蜓示例代码在提供代码示例时遗漏了一个片段:https://pythonhosted.org/dragonfly/

from dragonfly.all import Grammar, CompoundRule

# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
    spec = "do something computer"                  # Spoken form of command.
    def _process_recognition(self, node, extras):   # Callback when command is spoken.
        print "Voice command spoken."

# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")                # Create a grammar to contain the        command rule.
grammar.add_rule(ExampleRule())                     # Add the command rule to the grammar.
grammar.load()                                      # Load the grammar.

后面应该是

import time
import pythoncom
while True:
    pythoncom.PumpWaitingMessages()
    time.sleep(.1)

正如这里提到的 - http://dragonfly.googlecode.com/svn-history/r46/trunk/dragonfly/examples/dragonfly-main.py


0
投票

我建议使用 Pyaudio,它可以有效地捕获语音,您还可以构建实时语音捕获,获取语音帧并转换然后 RMS,从中您可以保持一个阈值来捕获高于阈值的语音。

© www.soinside.com 2019 - 2024. All rights reserved.