lkuza2 / java-speech-api

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.
GNU General Public License v3.0
531 stars 304 forks source link

Ability to Stop GSpeechDublex UpStream and code improvements #101

Closed goxr3plus closed 6 years ago

goxr3plus commented 6 years ago

The programmer hadn't the ability to stop The UpStream Thread on GSpeechDublexclass and even if you called Microphone.close(); method nothing happened .

The below method fixes this problem by stopping AudioSystem.write(ais, FLACFileWriter.FLAC, out);

/**
     * Force HttpsPostConnection Thread to Stop , Closes this audio input stream and releases any system resources associated with the stream.
     */
public void stopSpeechRecognition() {
        try {
            ais.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

Further more code improvements .