Package com.azure.ai.openai.models
Class SpeechGenerationOptions
java.lang.Object
com.azure.ai.openai.models.SpeechGenerationOptions
- All Implemented Interfaces:
com.azure.json.JsonSerializable<SpeechGenerationOptions>
public final class SpeechGenerationOptions
extends Object
implements com.azure.json.JsonSerializable<SpeechGenerationOptions>
A representation of the request options that control the behavior of a text-to-speech operation.
-
Constructor Summary
ConstructorsConstructorDescriptionSpeechGenerationOptions(String input, SpeechVoice voice) Creates an instance of SpeechGenerationOptions class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SpeechGenerationOptionsfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of SpeechGenerationOptions from the JsonReader.getInput()Get the input property: The text to generate audio for.getModel()Get the model property: The model to use for this text-to-speech request.Get the responseFormat property: The audio output format for the spoken text.getSpeed()Get the speed property: The speed of speech for generated audio.getVoice()Get the voice property: The voice to use for text-to-speech.Set the model property: The model to use for this text-to-speech request.setResponseFormat(SpeechGenerationResponseFormat responseFormat) Set the responseFormat property: The audio output format for the spoken text.Set the speed property: The speed of speech for generated audio.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter)
-
Constructor Details
-
SpeechGenerationOptions
Creates an instance of SpeechGenerationOptions class.- Parameters:
input- the input value to set.voice- the voice value to set.
-
-
Method Details
-
getInput
Get the input property: The text to generate audio for. The maximum length is 4096 characters.- Returns:
- the input value.
-
getVoice
Get the voice property: The voice to use for text-to-speech.- Returns:
- the voice value.
-
getResponseFormat
Get the responseFormat property: The audio output format for the spoken text. By default, the MP3 format will be used.- Returns:
- the responseFormat value.
-
setResponseFormat
Set the responseFormat property: The audio output format for the spoken text. By default, the MP3 format will be used.- Parameters:
responseFormat- the responseFormat value to set.- Returns:
- the SpeechGenerationOptions object itself.
-
getSpeed
Get the speed property: The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher values corresponding to faster speech.- Returns:
- the speed value.
-
setSpeed
Set the speed property: The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher values corresponding to faster speech.- Parameters:
speed- the speed value to set.- Returns:
- the SpeechGenerationOptions object itself.
-
getModel
Get the model property: The model to use for this text-to-speech request.- Returns:
- the model value.
-
setModel
Set the model property: The model to use for this text-to-speech request.- Parameters:
model- the model value to set.- Returns:
- the SpeechGenerationOptions object itself.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<SpeechGenerationOptions>- Throws:
IOException
-
fromJson
public static SpeechGenerationOptions fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of SpeechGenerationOptions from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of SpeechGenerationOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException- If the deserialized JSON object was missing any required properties.IOException- If an error occurs while reading the SpeechGenerationOptions.
-