Menu

Executing Sphinx3_aligner Terminal command in java

Help
2016-03-05
2016-03-05
  • bassem magdy

    bassem magdy - 2016-03-05

    Hello, I am trying to run this command in java but I am facing a problem. The same command works perfectly in terminal but when it comes to eclipse I get this

    Here is the standard output of the command:
    
    Here is the standard error of the command (if any):
    
    FATAL: "main_align.c", line 935: Failed to open file '/home/bassem/Desktop/inputs/text.insent' for reading: No such file or directory
    

    Here is my code.

    public static void main(String[] args) {
    
        String s = null;
    
        try {
    
            Process p = Runtime
                    .getRuntime()
                    .exec("sphinx3_align -hmm '/home/bassem/Downloads/cmusphinx-en-us-5.2' -ctl '/home/bassem/Desktop/inputs/input.ctl' -insent '/home/bassem/Desktop/inputs/text.insent' -adchdr 44 -adcin yes  -phsegdir '/home/bassem/Desktop/outputs' -wdsegdir '/home/bassem/Desktop/outputs' -dict '/home/bassem/Desktop/inputs/en-us/cmudict-en-us.dict' -cepext .wav -cepdir '' -lowerf 130 -upperf 6800 -nfilt 25 -transform dct -lifter 22");
    
            BufferedReader stdInput = new BufferedReader(new InputStreamReader(
                    p.getInputStream()));
    
            BufferedReader stdError = new BufferedReader(new InputStreamReader(
                    p.getErrorStream()));
    
            System.out.println("Here is the standard output of the command:\n");
            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }
    
            System.out
                    .println("Here is the standard error of the command (if any):\n");
            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }
    
            System.exit(0);
        } catch (IOException e) {
            System.out.println("exception happened - here's what I know: ");
            e.printStackTrace();
            System.exit(-1);
        }
    }
    
     
    • Nickolay V. Shmyrev

      You should not put name in single quotes, they are assumed to be the part of the filename.

       
      • bassem magdy

        bassem magdy - 2016-03-05

        Sorry, whar did you mean by name ? If you mean directeroies I tried to remove the single quotes and i got a different error

        Here is the standard output of the command:
        
        
        Here is the standard error of the command (if any):
        
        Initialization of the log add table
        Log-Add table size = 29356 x 2 >> 0
        
        INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
        INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
        Reading Feature Space Transform from: /home/bassem/Downloads/cmusphinx-en-us-5.2/feature_transform
        Reading HMM in Sphinx 3 Model format
        Model Definition File: /home/bassem/Downloads/cmusphinx-en-us-5.2/mdef
        Mean File: /home/bassem/Downloads/cmusphinx-en-us-5.2/means
        Variance File: /home/bassem/Downloads/cmusphinx-en-us-5.2/variances
        Mixture Weight File: /home/bassem/Downloads/cmusphinx-en-us-5.2/mixture_weights
        Transition Matrices File: /home/bassem/Downloads/cmusphinx-en-us-5.2/transition_matrices
        INFO: mdef.c(683): Reading model definition: /home/bassem/Downloads/cmusphinx-en-us-5.2/mdef
        Initialization of mdef_t, report:
        46 CI-phone, 137053 CD-phone, 3 emitstate/phone, 138 CI-sen, 5138 Sen, 29045 Sen-Seq
        
        INFO: kbcore.c(300): Using optimized GMM computation for Continuous HMM, -topn will be ignored
        INFO: cont_mgau.c(167): Reading mixture gaussian file '/home/bassem/Downloads/cmusphinx-en-us-5.2/means'
        INFO: cont_mgau.c(428): 5138 mixture Gaussians, 32 components, 1 streams, veclen 36
        INFO: cont_mgau.c(167): Reading mixture gaussian file '/home/bassem/Downloads/cmusphinx-en-us-5.2/variances'
        INFO: cont_mgau.c(428): 5138 mixture Gaussians, 32 components, 1 streams, veclen 36
        INFO: cont_mgau.c(527): Reading mixture weights file '/home/bassem/Downloads/cmusphinx-en-us-5.2/mixture_weights'
        INFO: cont_mgau.c(682): Read 5138 x 32 mixture weights
        INFO: cont_mgau.c(710): Removing uninitialized Gaussian densities
        WARN: "cont_mgau.c", line 785: 16 densities removed (0 mixtures removed entirely)
        INFO: cont_mgau.c(800): Applying variance floor
        INFO: cont_mgau.c(818): 237 variance values floored
        INFO: cont_mgau.c(866): Precomputing Mahalanobis distance invariants
        INFO: tmat.c(120): Reading HMM transition probability matrices: /home/bassem/Downloads/cmusphinx-en-us-5.2/transition_matrices
        Initialization of tmat_t, report:
        Read 46 transition matrices of size 3x4
        
        INFO: dict.c(385): Reading main dictionary: /home/bassem/Desktop/inputs/en-us/cmudict-en-us.dict
        INFO: dict.c(388): 134522 words read
        INFO: dict.c(393): Reading filler dictionary: /home/bassem/Downloads/cmusphinx-en-us-5.2/noisedict
        INFO: dict.c(396): 9 words read
        INFO: dict.c(429): Added 0 fillers from mdef file
        INFO: s3_align.c(1357): logs3(beam)= -491291
        FATAL: "bio.c", line 616: Failed to open file '''//home/bassem/Desktop/inputs/fout.wav' for reading: No such file or directory
        
         
  • bassem magdy

    bassem magdy - 2016-03-05

    I think it cant get the directory of the input from the ctl file

     

    Last edit: bassem magdy 2016-03-05
    • Nickolay V. Shmyrev

      You need to specify cepdir properly, for example

          -cepdir /home/bassem/Desktop/inputs/
      
       
      • bassem magdy

        bassem magdy - 2016-03-05

        I tried that but I got this

        FATAL: "bio.c", line 616: Failed to open file '/home/bassem/Desktop/inputs//home/bassem/Desktop/inputs/fout.wav' for reading: No such file or directory
        
         
        • Nickolay V. Shmyrev

          You need to specify just file names inside ctl file, instead of /home/bassem/Desktop/inputs/fout, only fout.

           
          • bassem magdy

            bassem magdy - 2016-03-05

            Thank you man for always being helpful.

             

Log in to post a comment.