2

This question may well go unanswered, but I would dearly like some help on the matter. I found a snippet of code for dealing with Microsoft's Speech API in Python, and then went and learned about W3C's "Speech Recognition Grammar Specification Version 1.0".

I boiled it down to this:

>>> import win32com.client
>>> listener = win32com.client.Dispatch("SAPI.SpSharedRecognizer")
>>> context = listener.CreateRecoContext()
>>> grammar = context.CreateGrammar()
>>> grammar.DictationSetState(0)
>>> grammar.CmdLoadFromFile("C:\\grammar.grxml")
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    grammar.CmdLoadFromFile("C:\\grammar.grxml")
  File "C:\Python26\lib\site-packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", line 2372, in CmdLoadFromFile
    , LoadOption)
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147201021), None)

From what I've been able to uncover, the above error code corresponds to "SPERR_NO_DRIVER", which has something to do with "There is no wave driver installed."

I am now stuck. I have no idea what, in this context, a wave driver is, nor where to find it or how to debug it etc... Any thoughts?

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
skeggse
  • 6,103
  • 11
  • 57
  • 81

1 Answers1

0

.wav data is the most basic sort of sound data - raw sampling of a wave-form, "how loud is the sound" 8000 to 44000 times per second.

A wave driver lets your computer get this raw data from a microphone or send it to a speaker.

If your computer has a sound card, it should already have this installed. Are you developing on a computer without sound hardware?

Edit: after looking at the documentation some more, I think you have wrongly identified the error; -2147201021 is 0x80045003 which is SPERR_UNSUPPORTED_FORMAT (see http://msdn.microsoft.com/en-us/library/ms717306%28VS.85%29.aspx)

Are you sure that your version of the Speech API supports grxml files? Looking at http://msdn.microsoft.com/en-us/library/ee125091%28v=VS.85%29.aspx it may demand either .xml or .cfg - try changing the extension from .grxml to just .xml?

Hugh Bothwell
  • 55,315
  • 8
  • 84
  • 99
  • No, I'm not...and I don't see how a wave drive should affect the ability to load a grammar file... – skeggse Dec 20 '10 at 03:30
  • My apologies for taking so long in responding, I tried changing the extension to .xml, but continue to get the same error. – skeggse Jan 02 '11 at 22:43
  • Is it possible that I need Visual Studio installed for this to work? – skeggse Jan 02 '11 at 22:49