Virang Patel - 2019-04-07

I am trying to create a program that can recognize Human Speech and also distinguist between multiple speakers. I have viewed both the SpeakerID and VoiceDetection demos and want to try to use both of them.

        System.out.format("Microphone Activated. Start speaking please \n");
        LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration);

        recognizer.startRecognition(true);  

        SpeechResult result  = recognizer.getResult();

        // Program does not work when this line below is added
         ArrayList<SpeakerCluster> clusters = sd.cluster(recognizer.microphone.getStream());  

              while (result != null || result.getHypothesis() == "stop") {

            //stats.collect(result);

            if(result.getHypothesis().isEmpty() == false && result.getHypothesis().length() > 3){
                System.out.format("Voice Detected: \n");
                System.out.format("Approximate Transcription: %s\n", result.getHypothesis());
            }
            else{
                System.out.format("Voice Not Detected! \n");
            }

            result  = recognizer.getResult();
        }

        recognizer.stopRecognition();
        }

So I set the microphone in the LiveSpeechRecognizer's class to public to get access to the InputStream to follow how the SpeakerID demo, but when I try to run my code, it does not detect my voice. I was wondering how can I incorporate the SpeakerID API with my code?

 

Last edit: Virang Patel 2019-04-07