Comments (4)
Hi, if you're not using voice commands you don't need the redirectRecognizedTextOutput
function.
You can retrieve the recognized text from the dictation object in the onResult
callback. Note that you have already set some event listeners to the buttons (start and stop) with jQuery, therefore isn't necessary to add new actions in the onclick attribute of the buttons.
The following code is the same as yours but simplified (and working):
<!-- Buttons to start the dictation object -->
<input class="buttonRoundVoiceToTextWhite" type="button" value="Recognize text" />
<input class="buttonRoundVoiceToTextBlue hidden" type="button" value="stop recognition" />
<!-- In this input the recognized text will appear -->
<input id="artyom-redirect-output" type="text" name="lastname">
<script>
// Configure artyom
var UserDictation = artyom.newDictation({
continuous: true, // Don't stop never because i have https connection
onResult: function (text) {
/**
* Set the recognized text as value of the text input
**/
$("#artyom-redirect-output").val(text);
},
onStart: function () {
console.log("Dictation started by the user");
},
onEnd: function () {
alert("Dictation stopped by the user");
}
});
var btnAnimWhite = $(".buttonRoundVoiceToAnimWhite");
var btnAnimBlue = $(".buttonRoundVoiceToAnimBlue");
var btnVoiceTextWhite = $(".buttonRoundVoiceToTextWhite");
var btnVoiceTextBlue = $(".buttonRoundVoiceToTextBlue");
btnAnimWhite.click(function () {
btnAnimBlue.show();
btnAnimWhite.hide();
});
btnAnimBlue.click(function () {
btnAnimWhite.show();
btnAnimBlue.hide();
});
// Start recognition with the Recognize text button
btnVoiceTextWhite.click(function () {
// Start recognition
UserDictation.start();
btnVoiceTextBlue.show();
btnVoiceTextWhite.hide();
});
// Stop recognition with the Stop recognition button
btnVoiceTextBlue.click(function () {
// Stop recognition
UserDictation.stop();
btnVoiceTextWhite.show();
btnVoiceTextBlue.hide();
});
</script>
The language of the dictation object will be the same as the one providen with the initialization.
As the problem isn't related to the library, this issue can be closed.
from artyom.js.
THANK YOU so much Carlos!!!! Just tested it it works perfectly YAAYYYY it's like magic:))))
from artyom.js.
Hi there carlos I was able to use this and it worked very well. I have a question related to switching languages in the browser, similar to how you used it in this application
https://sdkcarlos.github.io/demo-sites/artyom/artyom_sticky_notes.html
Basically I am wondering if it's possible to have a command that will tell artyom to switch the language that it is recognizing. For example I am bilingual in English and Portuguese. Is there a way to have a command that will switch the language after it has been initialized.
If I say for example "Switch to Portuguese", and vice-versa, once the browser recognizes speech in Portuguese, I create a command that will tell it to go back to English. I see how you have the drop-down menu for several languages in the example above. It worked but it was not done via a speech command.
I am not sure if 1. It can be done via command as opposed to clicking on browser button and 2. If not, how can I create a simple switch function that would allow me to move between 2 separate languages (and display the text like I did using the example above I used in the past?
Thank you. I am not sure if I should post this as a separate question or continue here.
from artyom.js.
Hi @popbijoux , sorry for the late reply. Indeed, starting from scratch and doing it with the new version of Artyom could be tricky, therefore I wrote a detailed article with examples of how to switch from one language to other (multiple languages) using a single instance of Artyom or multiple. You can find the article here.
from artyom.js.
Related Issues (20)
- Webview with artyom
- Basic Usage with TS HOT 1
- Remove command Callbacks (TEXT_RECOGNIZED).
- Allow adding custom JSGF
- Speech adaptation
- artyom.say doesn't speak after some time HOT 2
- problem installing node.js HOT 2
- newPrompt returns before receiving a spoken response
- React native HOT 1
- Raspberry artyom HOT 1
- Capturing values with Regex expressions
- .say() and continuos recognition creates a loop
- Voice command
- Very handy tool, looking for progress
- Artyom does not recognize the command HOT 1
- Contentious restarting for no reason.
- Additional languages
- Is there a way for it to only recognise the defined commands?
- Speech Recognition Doesn't work on Safari standalone app on IOS<17
- Regex with wildcard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artyom.js.