Python Speech Compare

人盡茶涼 提交于 2019-12-23 09:57:02

问题


I have two .wav files that I need to compare and decide if they contain the same words (same order too).

I have been searching for the best method for a while now. I can't figure out how to have pyspeech use a file as input. I've tried getting the CMU sphinx project working but I cant seem to get GStreamer to work with Python 27 let alone their project. I've messed around with DragonFly as well with no luck.

I am using Win7 64bit with Python27. Does anyone have any ideas?

Any help is greatly appreciated.


回答1:


You could try PySpeech. For some more info see pyspeech (python) - Transcribe mp3 files?. I have never used this, but I believe it leverages the built in speech recognition engine of Windows. This will let you convert the Wav files to text and then you can do a text compare.

To use the Windows speech engine and use a wav file for input there are two requirements.

  1. Use an inproc recognizer (SpeechRecognitionEngine). Shared recognizers cannot use Wav files as input.
  2. On the recognizer object call SetInputToWaveFile to specify your input wav file.

You may have to resample the wav files because the speech recognition engines only support certain sample rates.

  • 8 bits per sample
  • single channel mono
  • 22,050 samples per second
  • PCM encoding

works well on Windows. See https://stackoverflow.com/a/6203533/90236 for some more info.

For some more background on the windows speech engines, you might take a look at SAPI and Windows 7 Problem and What is the difference between System.Speech.Recognition and Microsoft.Speech.Recognition?



来源:https://stackoverflow.com/questions/9404099/python-speech-compare

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!