Jump to content

Skyrim Voice Command Engine: Seeking one committed partner.


irswat

Recommended Posts

if anything and regardless of which speech library you use, trying to dictate into notepad and use that as input for your program doesn't really seem like a robust solution. i'd think that you'd want whatever you're working on to accept voice commands as input just as your basic starting point. you don't need to learn a new language, because there's a library for c++ that has a whole 8 functions that would work fine. http://voce.sourceforge.net/

mad props to you for this!

Link to comment
Share on other sites

The method you are proposing is highly inefficient and prone to many problems. This is better done as an SKSE plugin instead of an external program without any need to save to text files and such.

 

You can register event handlers so that events from an SKSE plugin can call directly into Papyrus code. Take a look at the SKSE source code for how OnKeyDown is performed for example:

 

https://github.com/xanderdunn/skaar/blob/b20ff15c9bf9a5cdcfecdfd5bf9b70db5e7e56ab/skaar_skse_plugin/skse/PapyrusEvents.cpp#L180

 

You should be able to use the Windows Speech API to pass the strings produced from the speech-to-text directly to Papyrus using this method in a much simpler and efficient manner and you don't have to worry about complex threading issues as everything is event based.

 

Sorry to say I can't help you with your project, but it will make a big difference if you take some time understanding the SKSE code in order to develop an event based plugin to do what you require.

thank you so much for sharing this. I am making good progress toward getting voice recognition in skyrim!

 

 

 

#include "SKSE_SpeechRecPlugin.h"
#include "voce.h"
#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <fstream>

namespace SpeechRecNamespace {
	BSFixedString GetTextFromSpeech(StaticFunctionTag *base, UInt32 Listening) {
		//const std::string vocePath = "C:\\Users\Anonymous\Desktop\SKSE_SpeechRecPlugin\SpeechRecPlugin\lib\";
		voce::init("C:\\Users\Anonymous\Desktop\SKSE_SpeechRecPlugin\SpeechRecPlugin\lib", false, true, "./grammar", "digits");
		const char* c_GetSpeech = "";
		
		while (Listening == 1)
		{
			voce::setRecognizerEnabled(true);
			if (voce::isRecognizerEnabled() == true)
			{
				while (voce::getRecognizerQueueSize() > 0)
				{
					std::string s_TextFromSpeech = voce::popRecognizedString();
					const char* c_GetSpeech = s_TextFromSpeech.c_str();

					std::fstream myfile("C:\Games\SteamApps\common\Skyrim\Data\SVE_PI.txt", std::fstream::in | std::fstream::out | std::fstream::app);
					if (myfile.is_open())
					{
						myfile << c_GetSpeech << "/n";
						myfile.close();
					}

				}
				voce::setRecognizerEnabled(false);
			}

		}
			
		return BSFixedString(c_GetSpeech);
	}
		

	bool RegisterFuncs(VMClassRegistry* registry) {
		registry->RegisterFunction(
			new NativeFunction1 <StaticFunctionTag, BSFixedString, bool>("GetTextFromSpeech", "SKSE_SpeechRecPlugin", SpeechRecNamespace::GetTextFromSpeech, registry));

		return true;
	}
}

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...