When i launch the javafx window and the sphinx application i got some bugs, if i run the sphinx first and then launch the window the program doesn't record any command, only if i close the window also if i launch the window first the sphinx record like usually but blocks the window.
My window:
public class Escolha extends Application{
private static final Image FOTOPROXY = new Image(Escolha.class.getResourceAsStream("/foto/proxy.png"));
private static final Font Corleone = Font.loadFont(Escolha.class.getResourceAsStream("/fontes/corleone.ttf"), 20);
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
public void init(final Stage primaryStage) {
//primaryStage.setScene(new Scene(addBorda()));
Group root = new Group();
primaryStage.setScene(new Scene(root));
HBox hboxImagem = new HBox();
hboxImagem.setPadding(new Insets(5, 5, 5, 25));
hboxImagem.setSpacing(10);
hboxImagem.setStyle("-fx-background-color: #b3ccff");
ImageView imagem = new ImageView(FOTOPROXY);
imagem.setFitHeight(200);
imagem.setFitWidth(550);
hboxImagem.getChildren().add(imagem);
HBox hboxTexto = new HBox();
hboxTexto.setPadding(new Insets(15, 5, 15, 15));
hboxTexto.setSpacing(10);
hboxTexto.setTranslateY(210);
hboxTexto.setStyle("-fx-border-style: solid;" + "-fx-border-width: 4;" +
"-fx-border-color: #99b3ff");
HBox hboxBotoes = new HBox();
hboxBotoes.setPadding(new Insets(35, 1, 1, -20));
hboxBotoes.setSpacing(10);
Text texto = new Text("Caso possua proxy é necessário configura-lo antes de executar a Olivia,\n" +
"você deseja configurar agora?");
texto.setFont(Corleone);
EventHandler<ActionEvent> vaiSim = new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
Configuracao.configurarProxy();
}
};
Button sim = new Button("Sim");
sim.setStyle("-fx-base: #b3ccff");
sim.setOnAction(vaiSim);
EventHandler<ActionEvent> vaiNao = new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
HelloWorld.RecDeVoz();
}
};
Button nao = new Button("Não");
nao.setStyle("-fx-base: #b3ccff");
nao.setOnAction(vaiNao);
hboxBotoes.getChildren().addAll(sim, nao);
hboxTexto.getChildren().addAll(texto, hboxBotoes);
root.getChildren().addAll(hboxImagem, hboxTexto);
}
Access to your microphone is limited to a single application. Yuor javafx is also accessing the microphone, as is implied by the line HelloWorld.RecDeVoz();
If you want to use Sphinx4 in your application, you'll most likely have to integrate it: build, link sphinx jar to app, and then start the recognition.
If you are trying offline recognition (from recorded audio files), you should change sphinx configuration to use the file source, not a microphone, as input.