DeepSpeech Speech recognition
This is a non UI component with which it is possible to get speech recognition (text to speech) in Vaadin!
Mozilla DeepSpeech with Vaadin
How it works:
This component is based on Mozilla DeepSpeech. More specifically on their web_microphone_websocket example. This implementation asks for microphone access and if granted, it records voice, sends it to a node.js server, which again sends the recognized text back. This text can then be processed in your Java code.
How to use:
- Get the Node.js server up and running. Here are the installation instructions.
- Grab yourself a copy of the downsampling_worker.js file. Place this file in the
projectRoot/src/main/webapp/
folder. (Or wherever the file will become available under yourdomain.com/downsampling_worker.js) - Go to your projects root directory and run
npm add socket.io
- Add the maven dependency to your pom.xml
- Use the component in your Vaadin application (see the code samples).
More information:
For more Information about this project see the GitHub repository.
Sample code
SpeechRecognizer speechRecognizer = new SpeechRecognizer(); add(speechRecognizer); // To start the recognition: // Note: the first time this gets executed, it will ask for microphone permission. If the user blocks it, you are not able to ask for permission again. speechRecognizer.startRecognition() // To stop the recognition: speechRecognizer.stopRecognition()
speechRecognizer.addSpeechRecognitionListener(Notification::show /* your event handling here*/ );
SpeechRecognizer speechRecognizer = new SpeechRecognizer(); speechRecognizer.addSpeechRecognitionListener(result -> { // event handling; result is the recognized String Notification.show(result); }); add(speechRecognizer); VerticalLayout vL = new VerticalLayout(); vL.add(new Button("Start Recording", buttonClickEvent -> speechRecognizer.startRecognition())); vL.add(new Button("Stop Recording", buttonClickEvent -> speechRecognizer.stopRecognition())); add(vL);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Minor fixes.
- Released
- 2020-05-07
- Maturity
- EXPERIMENTAL
- License
- MIT License
Compatibility
- Framework
- Vaadin 10+
- Browser
- Firefox
- Opera
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Windows Phone
- Microsoft Edge
DeepSpeech Speech recognition - Vaadin Add-on Directory
This is a non UI component with which it is possible to get speech recognition (text to speech) in Vaadin!# Mozilla DeepSpeech with Vaadin #
## How it works: ##
This component is based on [Mozilla DeepSpeech](https://github.com/mozilla/DeepSpeech). More specifically on their [web_microphone_websocket example](). This implementation asks for microphone access and if granted, it records voice, sends it to a node.js server, which again sends the recognized text back. This text can then be processed in your Java code.
## How to use: ##
1. Get the Node.js server up and running. [Here](https://github.com/Schlomon/Vaadin-MozillaDeepSpeech/tree/nodeJsServerOnly) are the installation instructions.
2. Grab yourself a copy of the [downsampling_worker.js](https://github.com/Schlomon/Vaadin-MozillaDeepSpeech/tree/master/VaadinProject/src/main/webapp) file. Place this file in the ```projectRoot/src/main/webapp/``` folder. (Or wherever the file will become available under yourdomain.com/downsampling_worker.js)
3. Go to your projects root directory and run ```npm add socket.io```
4. Add the maven dependency to your pom.xml
5. Use the component in your Vaadin application (see the code samples).
### More information:
For more Information about this project see the [GitHub repository](https://github.com/Schlomon/Vaadin-MozillaDeepSpeech).