ee.ioc.phon.android.speechutils.RawAudioRecorder Java Examples

The following examples show how to use ee.ioc.phon.android.speechutils.RawAudioRecorder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlexaCommandManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
@Override
public void voiceSearch() {
    // if AlexaManager hasn't started, do nothing
    if (!isEnabled()) {
        return;
    }

    stopListening();

    mRecorder = new RawAudioRecorder(AUDIO_RATE);
    mRecorder.start();

    mAlexaManager.sendAudioRequest(mRequestBody, mAudioRequestCallback);
}
 
Example #2
Source File: AbstractRecognitionService.java    From speechutils with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a recorder based on the encoder type and sample rate. By default returns the raw
 * audio recorder. If an unsupported encoder is specified then throws an exception.
 */
protected static AudioRecorder createAudioRecorder(String encoderType, int sampleRate) throws IOException {
    // TODO: take from an enum
    if ("audio/x-flac".equals(encoderType)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            return new EncodedAudioRecorder(sampleRate);
        }
        throw new IOException(encoderType + " not supported");
    }
    return new RawAudioRecorder(sampleRate);
}