Freigeben über


AudioStreamFormat Class

  • java.lang.Object
    • com.microsoft.cognitiveservices.speech.audio.AudioStreamFormat

public final class AudioStreamFormat

Represents audio stream format used for custom audio input configurations.

Method Summary

Modifier and Type Method and Description
void close()

Explicitly frees any external resource attached to the object

static AudioStreamFormat getCompressedFormat(AudioStreamContainerFormat compressedFormat)

Creates an audio stream format object with the specified compressed audio container format, to be used as input format.

static AudioStreamFormat getDefaultInputFormat()

Creates an audio stream format object representing the default audio stream format (16 kHz, 16 bit, mono PCM).

SafeHandle getImpl()

Returns the audio stream format.

static AudioStreamFormat getWaveFormat(long samplesPerSecond, short bitsPerSample, short channels, AudioStreamWaveFormat waveFormat)

Creates an audio stream format object with the specified pcm waveformat characteristics.

static AudioStreamFormat getWaveFormatPCM(long samplesPerSecond, short bitsPerSample, short channels)

Creates an audio stream format object with the specified pcm waveformat characteristics.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

close

public void close()

Explicitly frees any external resource attached to the object

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.

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.

getImpl

public SafeHandle getImpl()

Returns the audio stream format.

Returns:

The implementation of the format.

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.

Applies to