Class AudioStreamFormat
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.audio.AudioStreamFormat
-
public final class AudioStreamFormat extends Object
Represents audio stream format used for custom audio input configurations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Explicitly frees any external resource attached to the objectstatic AudioStreamFormatgetCompressedFormat(AudioStreamContainerFormat compressedFormat)Creates an audio stream format object with the specified compressed audio container format, to be used as input format.static AudioStreamFormatgetDefaultInputFormat()Creates an audio stream format object representing the default audio stream format (16 kHz, 16 bit, mono PCM).SafeHandlegetImpl()Returns the audio stream format.static AudioStreamFormatgetWaveFormat(long samplesPerSecond, short bitsPerSample, short channels, AudioStreamWaveFormat waveFormat)Creates an audio stream format object with the specified pcm waveformat characteristics.static AudioStreamFormatgetWaveFormatPCM(long samplesPerSecond, short bitsPerSample, short channels)Creates an audio stream format object with the specified pcm waveformat characteristics.
-
-
-
Method Detail
-
getDefaultInputFormat
public static AudioStreamFormat getDefaultInputFormat()
Creates an audio stream format object representing the default audio stream format (16 kHz, 16 bit, mono PCM).- Returns:
- The audio stream format being created.
-
getWaveFormat
public static AudioStreamFormat getWaveFormat(long samplesPerSecond, short bitsPerSample, short channels, AudioStreamWaveFormat waveFormat)
Creates an audio stream format object with the specified pcm waveformat characteristics.- Parameters:
samplesPerSecond- Sample rate, in samples per second (Hertz).bitsPerSample- Bits per sample.channels- Number of channels in the waveform-audio data.waveFormat- The format specified inside the WAV container.- Returns:
- The audio stream format being created.
-
getWaveFormatPCM
public static AudioStreamFormat getWaveFormatPCM(long samplesPerSecond, short bitsPerSample, short channels)
Creates an audio stream format object with the specified pcm waveformat characteristics.- Parameters:
samplesPerSecond- Sample rate, in samples per second (Hertz).bitsPerSample- Bits per sample.channels- Number of channels in the waveform-audio data.- Returns:
- The audio stream format being created.
-
getCompressedFormat
public static AudioStreamFormat getCompressedFormat(AudioStreamContainerFormat compressedFormat)
Creates an audio stream format object with the specified compressed audio container format, to be used as input format. Added in version 1.4.0- Parameters:
compressedFormat- are defined in AudioStreamContainerFormat enum- Returns:
- The audio stream format being created.
-
close
public void close()
Explicitly frees any external resource attached to the object
-
getImpl
public SafeHandle getImpl()
Returns the audio stream format.- Returns:
- The implementation of the format.
-
-