Package edu.cmu.sphinx.frontend.util

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


    static private void processFile(String inputFile, String outputFile,
            ConfigurationManager cm) throws MalformedURLException, IOException {

        FrontEnd frontend = (FrontEnd) cm.lookup("endpointer");

        AudioFileDataSource dataSource = (AudioFileDataSource) cm
                .lookup("audioFileDataSource");
        System.out.println(inputFile);
        dataSource.setAudioFile(new File(inputFile), null);
        WavWriter wavWriter = (WavWriter) cm.lookup("wavWriter");
        wavWriter.setOutFilePattern(outputFile);

        frontend.initialize();
View Full Code Here


    private AudioFileDataSource source;

    public BandDetector() {

        // standard frontend
        source = new AudioFileDataSource(320, null);
        RaisedCosineWindower windower = new RaisedCosineWindower(0.97f,
                25.625f, 10.0f);
        DiscreteFourierTransform fft = new DiscreteFourierTransform(512, false);
        MelFrequencyFilterBank filterbank = new MelFrequencyFilterBank(130.0,
                6800.0, bands);
View Full Code Here

    public void testElement(String frontendName, String name)
            throws IOException {
        URL url = getClass().getResource("frontend.xml");
        ConfigurationManager cm = new ConfigurationManager(url);

        AudioFileDataSource ds = cm.lookup("audioFileDataSource");
        ds.setAudioFile(getClass().getResource("test-feat.wav"), null);

        FrontEnd frontend = cm.lookup(frontendName);
        compareDump(frontend, name);
    }
View Full Code Here

    }

    @Test
    public void test8KhzSource() throws DataProcessingException,
            URISyntaxException {
        AudioFileDataSource dataSource = ConfigurationManager
                .getInstance(AudioFileDataSource.class);

        // Test simple WAV.
        File file = new File(getClass().getResource("test8k.wav").toURI());
        dataSource.setAudioFile(file, null);
        assertThat(dataSource.getData(), instanceOf(DataStartSignal.class));
        Data d = dataSource.getData();
        assertThat(dataSource.getData(), instanceOf(DoubleData.class));
        assertThat(((DoubleData) d).getSampleRate(), equalTo(8000));

        while ((d = dataSource.getData()) instanceof DoubleData);
        assertThat(d, instanceOf(DataEndSignal.class));
    }
View Full Code Here

        assertThat(numFileEnds, equalTo(3));
    }

    private void runAssert(String fileName) throws DataProcessingException,
            URISyntaxException {
        AudioFileDataSource dataSource = ConfigurationManager
                .getInstance(AudioFileDataSource.class);

        File file = new File(getClass().getResource(fileName).toURI());
        dataSource.setAudioFile(file, null);
        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));
    }
View Full Code Here

TOP

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

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.