The J.A.R.V.I.S. Speech API is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer. While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.
To change this template use File | Settings | File Templates.
*/
public class DoItAll extends JFrame {
JButton stop = new JButton("Stop");
JButton run = new JButton("Run");
JButton process = new JButton("Process");
Microphone microphone = new Microphone(AudioFileFormat.Type.WAVE);
Recognizer recognizer = new Recognizer();
String audioFile = "c:/temp/toto.wav";
public DoItAll(){
stop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
microphone.close();
}
});
run.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
public static void main(String[] args) {
new DoItAll();
}
}
It show a JFrame, you click "Run", you talk in the micro, you stop talking, you click "Stop" and then click "Process". And then a JOptionPane shows the google response.
Easy.
But I get this rawResponse from Google:
{"status":5,"id":"5ea8848cad8489a332c589dcfaa14af4-1","hypotheses":[]}
and my code ends with an exception.
Did I miss something?
Or did Google change something that breaks java-speech-api ?
I wrote this simple code to test your lib:
package net.datao.stt;
import com.darkprograms.speech.microphone.Microphone; import com.darkprograms.speech.recognizer.Recognizer;
import javax.sound.sampled.AudioFileFormat; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
/**
To change this template use File | Settings | File Templates. */ public class DoItAll extends JFrame { JButton stop = new JButton("Stop"); JButton run = new JButton("Run"); JButton process = new JButton("Process"); Microphone microphone = new Microphone(AudioFileFormat.Type.WAVE); Recognizer recognizer = new Recognizer(); String audioFile = "c:/temp/toto.wav";
public DoItAll(){ stop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { microphone.close(); } }); run.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try {
}
public static void main(String[] args) { new DoItAll(); }
}
It show a JFrame, you click "Run", you talk in the micro, you stop talking, you click "Stop" and then click "Process". And then a JOptionPane shows the google response. Easy. But I get this rawResponse from Google: {"status":5,"id":"5ea8848cad8489a332c589dcfaa14af4-1","hypotheses":[]} and my code ends with an exception.
Did I miss something? Or did Google change something that breaks java-speech-api ?