Speech Recognition DLL using Windows Speech API

Posted By: PadMalcom

Speech Recognition DLL using Windows Speech API - 04/10/09 17:17

There were several requests on the forum for a Speech Recognition DLL. Today I finished it and it is working properly. Download can be found on my site:

http://www.jofre.de/?p=197

The dialog box at the beginning will be removed soon.
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/11/09 01:39

Oh thats i did request it, let see what can be done smile
Thanks man!
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/11/09 14:53

hey @Padmalcom,
the variable is_listening(var) when i start the program, its 1. After speeaking something it changes to 1 then 0. but its not noticed because its already one, so you just see it go zero. (this is the problem)

And each time then i speak it goes 1 ( if something is heard) and then changes to zero... i guess there is a problem there, on the initial variable value os is_listening(var)...

As its seems, when i speek is_listening(var) is 1 , when the word is said, after that variable returns to 0.

So i think you should make the initial value of is_listening(var) to zero on the dll? because nothing was said yet?


But sometimes the variable just goes 1 , if you something weird, that is not understood. hum..
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/11/09 21:14

Well i solved the problem..

The thing is that you call cpy mysentence everyframe, so is i compare the sentente and do a command, it will loop the command.. So i had to make a way to compare the sentence with a previouse one, and its equal, then do nothing, if its new, overwrite the last sentence and do something corresponding to that sentense.


Did you thought about implementing the add word, for a stricted grammar and not the full dictionary to improve the recognition results?

cheers
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 08:35

Hey I don't really understand how a limited grammar should improve the speech recognition... I had a look at the "create own grammar"-interface and creating an own one will result in a lot of work!

What you can do is to practise with your speech recognition api... that is a standard windows program that can be found in the system control.
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 09:21

hello padmalcom. but when you did your win 32 appl, you had tha function add word. and the program would select from the list only, the most likely to be the word you said. or you were working with the full dictionary grammar?

It improves alot! i tell you why: istead of having

that
the
this

if the engine contains only the word this.. when you say that or the, it will output only this, because its the most likely word comparing the the grammar it contains.. So it will only recognize words you added.

So with t he current grammar, if i say give me that, it can output alot of variations, like:
did that, did me that, eve me at .. and this wont result in any useful command, so by restricting the grammar to the words give, me, that, and other, i can say that command and it will be 100% a match

On the api, there is a section, where you can load no grammar, and then add word , i think its add sequence pr something..

hum.. but if you think its too difficult.

But anyway , the win32 demo you had on your webpage, is full dictionary or the grammar are just the commands on the list? i seem to be restricted grammar to me..
cheers


Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 09:25

Apart from that great work.
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 10:46

Ah thats cool, didn't know that! smile Well maybe next week when I find a free time slot I'll have another look at the functionality.

In my Win32-app I use the full grammar! Hence the recognition is not good at all if the programm isn't trained wink
Posted By: firelord

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 12:48

Is there a english version?
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/12/09 19:16

Firelord, this is a English version.. i wonder though if its possible to implement other languages. :X but i guess that has to do with the SDk that is englisgh.

@PadmalcomWell anyway your win32 worked very very well then! thats why i though it was a restricted grammar..

usually grammar is loaded via XML, but, i think, 5.1 has already the option to add a specifc word.. restricting the recognition dictionary, and thus, low variation..

But well thats like you said, when you got time. if you plan give de source code, maybe i could learn from it? since its something i ever wondered, the only think i could do is the engine SPEAK text to voice. using that SDK, the voice part i tried but i fail. :P


Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 04/26/09 15:45

Originally Posted By: PadMalcom


The dialog box at the beginning will be removed soon.


is it removed already?
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 05/13/09 16:32

So.. you said you would remove the dialog box.. and ?

Also does the speech starts in listening mode or i need to click listen to what i say?
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 05/14/09 09:15

Has been updated, you'll find the download here: http://www.jofre.de/?p=197
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 05/16/09 14:14

hi.. i see, but you did not added any notice then i could now heh.

Is there anyway to make it start automaticly in hearing mode? because i have to click, listen on the Speech microsoft UI Vista , to make it start listening?
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 05/16/09 16:47

When you call the initialisation function it starts listening. When you destroy it, it stops wink
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 05/18/09 16:05

.. ok i didn't explain right.

I mean, when i start the program, it starts in sleeping mode..
It listens, but i need to say "start listening" and then it will start recieving...

And overthere i think is the same, it starts in sleeping mode.. ( of course when you first start the Speech panel..)
Posted By: shiznitIII

Re: Speech Recognition DLL using Windows Speech API - 07/23/09 04:40

Hi! I'm using your speech dll for my projects for education. I'm having a problem because the engine is very sensitive to noise thus giving a wrong word. Is there a way to control when the engine receives a sound or listens after executing init_speech()? I tried calling free_speech but it doesn't work. I just want to control when the engine receives sound. Can you help me?
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 07/27/09 23:14

i got some ways, you can make listining =0 or 1 i dont remember...
there is somewhere a if condition, so if you add next to that condition a && mute==1..
then you can control that.
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 07/31/09 09:08

Hi, I added 2 functions to pause and resume listening. I will upload it this evening.

P.S. Hope it works properly could not really test it since I'm currently in a lecture wink

EDIT: Uploaded, can be found here: http://www.jofre.de/?p=197
Posted By: Clemens

Re: Speech Recognition DLL using Windows Speech API - 02/09/11 15:33

Really cool project, thanks for sharing it! (hom many lines source code has the dll?)

I had better result with that code:
Code:
while(gamerunning) {
	wait(1);	
	if (key_space) {
		str_cpy((status_text.pstring)[0],"listening");
		while (key_space) {
			wait(1);
		}
		wait(-1);
		get_last_sentence(mysentence);
		str_cpy((dummy_text.pstring)[0],mysentence);
	}
	str_cpy((status_text.pstring)[0],"ready");
	str_cpy((dummy_text.pstring)[0],mysentence);
}


...because otherwise the "listening" is too late... hmm well, not sure in general how it works in detail ... but the result was better wink

What I would really prefer is a command like get_last_word so it doesn't try to make any grammatical interpretation which results in absolut wrong sentences.

And what about a german language support?

Are these realistic features for the future?
Regards, Clemens
Posted By: Dark_samurai

Re: Speech Recognition DLL using Windows Speech API - 02/09/11 18:02

If you have no microphone plugged in, the .dll crashes.

But it also doesn't work with a plugged in microphone for me. I press the start listening button [2] and talk something. Then I press the stop listening button [1] but I no recognised sentences appears on the screen?!

I'm using Win 7.
Posted By: Clemens

Re: Speech Recognition DLL using Windows Speech API - 02/09/11 18:37

No, I guess these buttons are for activate and deactivate the whole process.

His script example recognize with is_listening at its own if you're speaking. I had problem with that -> recogniziting it too late.
So you can try my code, maybe you've more luck then wink
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 02/10/11 13:15

Hey, Clemens, thanks for your update. I'm happy that someone uses the DLL.

I think I don't have the code anymore but I'll have a look at it when I'm home. Since the dll uses the WindowsXP Speech Recognition API I am pretty sure that there exists no compatibility with Windows 7. German will be supported if the Windows Speech API supports German language wink

If I do not respond in this topic please remind me via PM at the weekend.
Posted By: Clemens

Re: Speech Recognition DLL using Windows Speech API - 02/10/11 16:35

Oh, hopelly you didn't lost the source code. Hoy much time did you invest..?
The supported operating systems depends on the version number, so probably it's not a big thing to upgrade. Also german and more languages are integrated since version 5. ( wiki / wikiger )

okay, will remind you if required wink
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/04/11 23:56

can someone assist me in converting this to A6 c-script please? i need it for a small game i am working on for my students that are having problems decoding words and reading. can someone please help or point me in the right direction to converting it?
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/06/11 16:53

Is there no one that can point me in the right direction for converting this to A6 c-script, and how to implement this? i would appreciate whatever assistance i can get. thanks in advance.
Posted By: MMike

Re: Speech Recognition DLL using Windows Speech API - 07/06/11 18:13

Why not use lite-c? Its the same thing almost like wdl.

try to download and then test the included files..

run the .c file!
Posted By: Xarthor

Re: Speech Recognition DLL using Windows Speech API - 07/06/11 19:37

@MMike: Why don't you try to read his posts more carefully? He already said that he is using A6, which does not support lite-C. Furthermore I guess he has his reasons to not use A8 (which has a free-edition I might add).
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/06/11 20:54

Icant mix code, the project is in c-script, and i dont really know lite-c to start all over. i just want to know how to revert the code to c-script so i can use it. its really not too many lines of code, but i dont know what the proper code structure is to use in c-script.
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/12/11 20:27

ok, i tried to convert it to c-script and i am a bit stuck. i dont really understand how to write functions for these empty/nonexistent functions.

function init_speech();

Has to be called to init the Ole Object.

---

function free_speech();

Frees the Ole Object after using it. Should be called on engine shutdown.

---

function stop_listening();

Pauses the listening process. If the dll is listening at the moment it will
finish the current sentence and THEN stop listening.

---

function start_listening();

Resumes listening after the process has been paused.

---

function is_listening(var* myres);

Writes the current state of the dll to the var "myres".
0 = waiting for input
1 = receiving input

---

function get_last_sentence(STRING* sentence);

Puts the received sentence in the string "sentence".

can someone help me create functions here in c-script?

i re-wrote the entire code from lite-c to c-script, but i get errors on these functions that dont exist.
Posted By: lostclimate

Re: Speech Recognition DLL using Windows Speech API - 07/12/11 21:44

"you guys are helping a7 wreak a nice beach" grin
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/12/11 23:28

What does that mean, lostc?
Posted By: lostclimate

Re: Speech Recognition DLL using Windows Speech API - 07/13/11 03:44

lol its a reference to an old tshirt back in the ninties when apple was working on speech recognition. they said "I helped apple wreck a nice beach" you have to say it right to get what it means grin
Posted By: MrGuest

Re: Speech Recognition DLL using Windows Speech API - 07/13/11 10:38

Originally Posted By: lostclimate
"I helped apple wreck a nice beach"
lol, love it
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/13/11 13:12

That is funny, actually,lol.
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/13/11 21:41

all that aside, no help on this issue from anyone? i got it to work running it in lite-c, so i know it works.i just need some help with the 4 functions to convert it to c-script.
Posted By: lostclimate

Re: Speech Recognition DLL using Windows Speech API - 07/14/11 00:28

sorry, wish i could, never used the dll, and havent needed speech recognition..
Posted By: Blink

Re: Speech Recognition DLL using Windows Speech API - 07/15/11 13:19

Thanks anyway. i may have to redo the project in lite-c.
Posted By: PadMalcom

Re: Speech Recognition DLL using Windows Speech API - 07/22/11 09:18

Sorry, was on holiday. I sent you a PM!
© 2024 lite-C Forums