speechRecognition - Forum

Forum Navigation
You need to log in to create posts and topics.

speechRecognition

Estoy usando la API speechRecognition y en principio funciona con todas las funciones dentro de los comandos BeginJS-EndJS.

Pero cuando deseo ejecutar funciones por separado en diferentes comandos BeginJS-EndJS para usar por ejemplo un botón donde se le asigne la función sr.start() entonces no funciona. ¿Hay alguna forma de poder usar las funcione  de esta API por separado para poder usarlas con código VisualNeo?

 

@rrey

I am using speechRecognition API and in principle it works with all functions inside BeginJS-EndJS commands.

But when I want to execute functions separately on different BeginJS-EndJS commands to use for example a button where the sr.start () function is assigned then it doesn't work. Is there any way I can use the functions of this API separately so I can use them with VisualNeo code?

it could be because the (javascript) commands that initiate the request, also contain (embedded) callback functions.

Can you provide a reference (link) to the (javascript) library for the the API that you are referring to ?

Hola @gaev,

Te adjunto el código en una captura de imagen ya que si lo inserto aquí me da error al publica el post.

 

Uploaded files:
  • You need to login to have access to uploads.

@rrey

Thank you for the script.

1) I tried to do a Google search for webkitSpeechRecognition ; looks like there are two libraries (one from Google and another from Mozilla) and neither of them had the same events as the ones in your script. Perhaps you can provide a link to the library you are using.

2) Basically, there are 3 parts to the code ...

a) the sr (object) definition of properties (lang, continuous, interimResults)
b) the specification of what function to invoke for various events (result, audioend, audiostart)
c) the request to start listening / translating

I am not sure what happens to objects created in Button event code ; not sure if they are global in nature; at the least you may have to define them in the $ App space.

The events can point to VisualNEOWeb Subroutines (of the Javascript kind). The result event can receive an array of objects (ie result).

The request to start listening / translating ie start  can then be part of the click event of another button ... but invoked after the object is defined.

The key issue is making the sr object global and in the NeoScript variable space.

If you can provide a link to the library you are using, perhaps I can do some more investigating.

Finally, what is the reason you do not want all the code in one place?

 

 

 

Hola @gaev,

En chrome se usa el prefijo  webkit  junto  con SpeechRecognition para Chrome. Este es el soporte de navegadores.

Y esta la API.

Creo que la claves es como tú dices  hacer que el objeto  sr  global.  Lo he probado y funciona: He declarado las funciones como:

$App.sr = new webkitSpeechRecognition();

Y después llamo a la función star en un botón:

BeginJS
$App.sr.start();
EndJS

Es importante que las funciones puedan  ejecutarse como llamadas independientes para poder integrarlas con Neoscript.

También se podría crear un pluguin donde las funciones básicas funcionaran independientemente.

Muchas gracias por tu ayuda,

Roger Rey

@rrey

Thank you for your response.

Although I had not thought through the exact details, I had the same concept in mind regarding the placement of the sr object in the global $App variable space.

I see from the API documentation that there are any number of event-hooks that you can exploit. As well, a number of methods that you can deploy to force termination of a recording of the speech.

A plugin would extend the reach of VisualNEOWeb to yet another frontier; is there anything VisualNEOWeb can't do ? :-))

In the mean time, for those who can't wait for the plugin, you might want to post your code associated with the different parts.