你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
AudioConfig Class
- java.
lang. Object - com.
microsoft. cognitiveservices. speech. audio. AudioConfig
- com.
Implements
public final class AudioConfig
implements java.lang.AutoCloseable
Represents audio input or output configuration. Audio input can be from a microphone, file, or input stream. Audio output can be to a speaker, audio file output in WAV format, or output stream. Note: close() must be called in order to release underlying resources held by the object. Updated in version 1.7.0
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Explicitly frees any external resource attached to the object |
static
Audio |
fromDefaultMicrophoneInput()
Creates an Audio |
static
Audio |
fromDefaultMicrophoneInput(AudioProcessingOptions audioProcessingOptions)
Creates an Audio |
static
Audio |
fromDefaultSpeakerOutput()
Creates an Audio |
static
Audio |
fromMicrophoneInput(String deviceName)
Creates an Audio |
static
Audio |
fromMicrophoneInput(String deviceName, AudioProcessingOptions audioProcessingOptions)
Creates an Audio |
static
Audio |
fromSpeakerOutput(String deviceName)
Creates an Audio |
static
Audio |
fromStreamInput(AudioInputStream audioStream)
Creates an Audio |
static
Audio |
fromStreamInput(AudioInputStream audioStream, AudioProcessingOptions audioProcessingOptions)
Creates an Audio |
static
Audio |
fromStreamInput(PullAudioInputStreamCallback callback)
Creates an Audio |
static
Audio |
fromStreamInput(PullAudioInputStreamCallback callback, AudioProcessingOptions audioProcessingOptions)
Creates an Audio |
static
Audio |
fromStreamOutput(AudioOutputStream audioStream)
Creates an Audio |
static
Audio |
fromWavFileInput(String fileName)
Creates an Audio |
static
Audio |
fromWavFileInput(String fileName, AudioProcessingOptions audioProcessingOptions)
Creates an Audio |
static
Audio |
fromWavFileOutput(String fileName)
Creates an Audio |
Audio |
getAudioProcessingOptions()
Returns an Audio |
Safe |
getImpl()
Returns the audio input configuration. |
void |
setProperty(PropertyId id, String value)
Sets the property by property |
void |
setProperty(String name, String value)
Sets a named property as value. |
Methods inherited from java.lang.Object
Method Details
close
public void close()
Explicitly frees any external resource attached to the object
fromDefaultMicrophoneInput
public static AudioConfig fromDefaultMicrophoneInput()
Creates an AudioConfig object representing the default microphone on the system.
Returns:
fromDefaultMicrophoneInput
public static AudioConfig fromDefaultMicrophoneInput(AudioProcessingOptions audioProcessingOptions)
Creates an AudioConfig object representing the default microphone on the system.
Parameters:
Returns:
fromDefaultSpeakerOutput
public static AudioConfig fromDefaultSpeakerOutput()
Creates an AudioConfig object representing the default speaker on the system. Added in version 1.7.0
Returns:
fromMicrophoneInput
public static AudioConfig fromMicrophoneInput(String deviceName)
Creates an AudioConfig object representing a specific microphone on the system.
Parameters:
Returns:
fromMicrophoneInput
public static AudioConfig fromMicrophoneInput(String deviceName, AudioProcessingOptions audioProcessingOptions)
Creates an AudioConfig object representing a specific microphone on the system.
Parameters:
Returns:
fromSpeakerOutput
public static AudioConfig fromSpeakerOutput(String deviceName)
Creates an AudioConfig object representing a specific speaker on the system.
Parameters:
Returns:
fromStreamInput
public static AudioConfig fromStreamInput(AudioInputStream audioStream)
Creates an AudioConfig object representing the specified stream.
Parameters:
Returns:
fromStreamInput
public static AudioConfig fromStreamInput(AudioInputStream audioStream, AudioProcessingOptions audioProcessingOptions)
Creates an AudioConfig object representing the specified stream.
Parameters:
Returns:
fromStreamInput
public static AudioConfig fromStreamInput(PullAudioInputStreamCallback callback)
Creates an AudioConfig object representing the specified stream.
Parameters:
Returns:
fromStreamInput
public static AudioConfig fromStreamInput(PullAudioInputStreamCallback callback, AudioProcessingOptions audioProcessingOptions)
Creates an AudioConfig object representing the specified stream.
Parameters:
Returns:
fromStreamOutput
public static AudioConfig fromStreamOutput(AudioOutputStream audioStream)
Creates an AudioConfig object representing the specified stream. Added in version 1.7.0
Parameters:
Returns:
fromWavFileInput
public static AudioConfig fromWavFileInput(String fileName)
Creates an AudioConfig object representing the specified file.
Parameters:
Returns:
fromWavFileInput
public static AudioConfig fromWavFileInput(String fileName, AudioProcessingOptions audioProcessingOptions)
Creates an AudioConfig object representing the specified file.
Parameters:
Returns:
fromWavFileOutput
public static AudioConfig fromWavFileOutput(String fileName)
Creates an AudioConfig object representing the specified file. Added in version 1.7.0
Parameters:
Returns:
getAudioProcessingOptions
public AudioProcessingOptions getAudioProcessingOptions()
Returns an AudioProcessingOptions object which contains the parameters used for audio processing.
Returns:
getImpl
public SafeHandle getImpl()
Returns the audio input configuration.
Returns:
setProperty
public void setProperty(PropertyId id, String value)
Sets the property by propertyId.
Parameters:
setProperty
public void setProperty(String name, String value)
Sets a named property as value.
Parameters: