Package edu.cmu.sphinx.frontend.util

Examples of edu.cmu.sphinx.frontend.util.ConcatAudioFileDataSource


     
  //    getContext().getLogger().log("CF File is " + ConfigFile);
     
  //    if(audioIt.hasNext())
     
      ConcatAudioFileDataSource data = (ConcatAudioFileDataSource) cm.lookup("dataSource");
     
      for(String i: audio.getAudioPath().toArray())
        batch.add(new File(i));
     
      data.setBatchFiles(batch);
     
      recognizer.allocate();
     
      getContext().getLogger().log(Level.INFO, "Start recognition of " + audio.getAudioPath().toString(0));
      Long comp1 = System.currentTimeMillis();
View Full Code Here


    }

    @Test
    public void testConcatDataSource() throws DataProcessingException,
            IOException, URISyntaxException {
        ConcatAudioFileDataSource dataSource = ConfigurationManager
                .getInstance(ConcatAudioFileDataSource.class);

        dataSource.addNewFileListener(new AudioFileProcessListener() {

            public void audioFileProcStarted(File audioFile) {
                numFileStarts++;
            }

            public void audioFileProcFinished(File audioFile) {
                numFileEnds++;
            }

            public void newProperties(PropertySheet ps)
                    throws PropertyException {
            }
        });

        File tmpFile = File.createTempFile(getClass().getName(), ".drv");
        tmpFile.deleteOnExit();
        PrintWriter pw = new PrintWriter(tmpFile);
        String path = new File(getClass().getResource("test.wav").toURI()).getPath();
        pw.println(path);
        pw.println(path);
        pw.print(path);
        assertFalse(pw.checkError());
        pw.close();

        dataSource.setBatchFile(tmpFile);
        assertThat(dataSource.getData(), instanceOf(DataStartSignal.class));
        assertThat(dataSource.getData(), instanceOf(DoubleData.class));

        Data d;
        while ((d = dataSource.getData()) instanceof DoubleData);
        assertThat(d, instanceOf(DataEndSignal.class));

        assertThat(numFileStarts, equalTo(3));
        assertThat(numFileEnds, equalTo(3));
    }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.frontend.util.ConcatAudioFileDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.