input
The text to generate audio for. The maximum length is 4096 characters.
let input: String
The text to generate audio for. The maximum length is 4096 characters.
let input: String
import OpenAI
struct AudioSpeechQuery
Generates audio from the input text. Learn more: OpenAI Speech – Documentation
@frozen struct String
A Unicode string value that is a collection of characters.
init(from decoder: any Decoder) throws
init(model: Model, input: String, voice: AudioSpeechVoice, responseFormat: AudioSpeechResponseFormat = .mp3, speed: Double?)
static func normalizeSpeechSpeed(_ inputSpeed: Double?) -> String
let model: Model
One of the available TTS models: tts-1 or tts-1-hd
let responseFormat: AudioSpeechResponseFormat?
The format to audio in. Supported formats are mp3, opus, aac, flac, and pcm. Defaults to mp3
let speed: String?
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default. Defaults to 1
let voice: AudioSpeechVoice
The voice to use when generating the audio. Supported voices are alloy, echo, fable, onyx, nova, and shimmer. Previews of the voices are available in the Text to speech guide. https://platform.openai.com/docs/guides/text-to-speech/voice-options
enum AudioSpeechResponseFormat
Encapsulates the response formats available for audio data.
enum AudioSpeechVoice
Encapsulates the voices available for audio generation.
enum CodingKeys
enum Speed