sphinx4 icon indicating copy to clipboard operation
sphinx4 copied to clipboard

Speaker Identification runs forever

Open themoonraker13 opened this issue 9 years ago • 6 comments

I've developed a Java program that consumes sphinx to perform speaker-clustering using SpeakerIdentification. The program/algorithm works fine giving outputs in the same amount of time when I test it with small audio files with similar attributes(time duration, bit-rate, mono/stereo, etc.)

The program run into trouble when I supply it with a large audio file i.e. greater than 1-1.5 hour (wav, 16khz, mono, pcm). The program runs for many hours and sometimes runs forever if the file is excessively large.

I do not know if I'm consuming sphinx the right way. Please guide me solve the problem as it would help me optimize my application's performance to a great extent.

themoonraker13 avatar Oct 09 '15 06:10 themoonraker13

hi, did you success on speaker identification, if you got success can you help me to do that. I m getting error on and please help how to run it.

File voiceFile = new File("output2.wav"); URL url = voiceFile.toURI().toURL(); ArrayList<SpeakerCluster> clusters = sd.cluster(url.openStream());

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.math3.linear.EigenDecomposition.(Lorg/apache/commons/math3/linear/RealMatrix;)at edu.cmu.sphinx.speakerid.SpeakerIdentification.getBICValue(SpeakerIdentification.java:171) at edu.cmu.sphinx.speakerid.SpeakerIdentification.getPoint(SpeakerIdentification.java:126) edu.cmu.sphinx.speakerid.SpeakerIdentification.getAllChangingPoints(SpeakerIdentification.java:151) at edu.cmu.sphinx.speakerid.SpeakerIdentification.cluster(SpeakerIdentification.java:195) at edu.cmu.sphinx.speakerid.SpeakerIdentification.cluster(SpeakerIdentification.java:185) at com.example.speaker.SpeakerIdentificationDemo.main(SpeakerIdentificationDemo.java:131)

Thanks in advance

cris7M avatar Mar 22 '17 09:03 cris7M

Seems like you are consuming the SpeakerIdentification implementation of CMU Sphinx in a wrong way.

I had implemented a SpeakerID java class long back which used to accept a audio file name as command-line argument and print speaker identification/clustering information on console. Hope this might help you.

public class SpeakerID {
    public static void main(String args[]) {
        try {
            SpeakerIdentification speakerIdentification = new SpeakerIdentification();
            InputStream fin = new FileInputStream(new File(args[0]));
            ArrayList<SpeakerCluster> clusters = speakerIdentification.cluster(fin);

            int clusterid=1;
            for (SpeakerCluster cluster : clusters) {
                ArrayList<Segment> segments = cluster.getSpeakerIntervals();
                System.out.println("########################");
                System.out.println("Cluster: " + clusterid);
                int segmentid = 1;
                for (Segment s : segments) {
	            long startTime = s.getStartTime();
	            long endTime = s.getStartTime() + s.getLength();
	            System.out.println("---------------");
	            System.out.println("Segment: " + segmentid);
	            System.out.println("Start Time: " + startTime);
	            System.out.println("End Time: " + endTime);
	            System.out.println("---------------");
	            segmentid++;
               }
               clusterid++;
               System.out.println("########################");
            }
        } catch (Exception e) {
	    e.printStackTrace();
        }
    }
}

themoonraker13 avatar Mar 22 '17 10:03 themoonraker13

Thanks for reply but again i am getting the same error.

InputStream fin = new FileInputStream(new File("test.wav")); ArrayList<SpeakerCluster> clusters = speakerIdentification.cluster(fin);

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.math3.linear.EigenDecomposition.(Lorg/apache/commons/math3/linear/RealMatrix;)at edu.cmu.sphinx.speakerid.SpeakerIdentification.getBICValue(SpeakerIdentification.java:171) at edu.cmu.sphinx.speakerid.SpeakerIdentification.getPoint(SpeakerIdentification.java:126) edu.cmu.sphinx.speakerid.SpeakerIdentification.getAllChangingPoints(SpeakerIdentification.java:151) at edu.cmu.sphinx.speakerid.SpeakerIdentification.cluster(SpeakerIdentification.java:195) at edu.cmu.sphinx.speakerid.SpeakerIdentification.cluster(SpeakerIdentification.java:185) at com.example.speaker.SpeakerIdentificationDemo.main(SpeakerIdentificationDemo.java:131)

cris7M avatar Mar 22 '17 11:03 cris7M

Dear Sir,

Actually i want to make an application in java where if user voice authenticate then it should print welcome else it should say invalid credential, if you have something like this can share with me and that will be great help for me.

Thanks in advance

cris7M avatar Mar 22 '17 11:03 cris7M

@cris7M please read the following to understand about this type of exception in general: http://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderror http://stackoverflow.com/questions/5407250/causes-of-java-lang-nosuchmethoderror-main-exception-in-thread-main

Check the Apache Commons Math API used by CMU Sphinx and verify that the method actually exist. If not, try changing the API version.

themoonraker13 avatar Mar 22 '17 12:03 themoonraker13

@themoonraker13 --while running speakerIdentification I am getting the following error.. please help me out. Exception in thread "main" Property Exception component:'plpFrequencyFilterBank' property:'minimumFrequency' - minimumFrequency is not an annotated sphinx property of 'edu.cmu.sphinx.frontend.frequencywarp.PLPFrequencyFilterBank' ! edu.cmu.sphinx.util.props.InternalConfigurationException: java.lang.ClassCastException: Cannot cast com.sun.proxy.$Proxy1 to edu.cmu.sphinx.util.props.S4Double at edu.cmu.sphinx.util.props.PropertySheet.getProperty(PropertySheet.java:91) at edu.cmu.sphinx.util.props.PropertySheet.getDouble(PropertySheet.java:198) at edu.cmu.sphinx.frontend.frequencywarp.PLPFrequencyFilterBank.newProperties(PLPFrequencyFilterBank.java:82) at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421) at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163) at edu.cmu.sphinx.util.props.PropertySheet.getComponentList(PropertySheet.java:372) at edu.cmu.sphinx.frontend.FrontEnd.newProperties(FrontEnd.java:152) at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421) at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163) at edu.cmu.sphinx.speakerid.SpeakerIdentification.(SpeakerIdentification.java:45) at com.voice.sentimentanalysis.demo.speech.diarizarion.TestSpeakerIdentification.testSpeakerIdentification(TestSpeakerIdentification.java:24) at com.voice.sentimentanalysis.demo.speech.diarizarion.TestSpeakerIdentification.main(TestSpeakerIdentification.java:17) Caused by: java.lang.ClassCastException: Cannot cast com.sun.proxy.$Proxy1 to edu.cmu.sphinx.util.props.S4Double at java.lang.Class.cast(Class.java:3369) at edu.cmu.sphinx.util.props.PropertySheet.getProperty(PropertySheet.java:89) ... 11 more

sandeep06 avatar Oct 24 '17 08:10 sandeep06