org.llm4s.speech.tts.provider.OpenAITTSClient
See theOpenAITTSClient companion object
final class OpenAITTSClient(config: TTSConfig, httpClient: Llm4sHttpClient) extends TextToSpeech
OpenAI text-to-speech (POST /v1/audio/speech).
Asks for response_format = pcm, which OpenAI documents as raw 24 kHz, 16-bit, mono little-endian samples, so GeneratedAudio.data is headerless PCM described by an honest AudioMeta - the same shape org.llm4s.speech.tts.Tacotron2TextToSpeech produces. Write it out with org.llm4s.speech.io.WavFileGenerator.saveAsWav.
options.voice overrides the configured voice; options.speakingRate is sent as speed (OpenAI accepts 0.25 to 4.0).
Value parameters
- config
-
configuration from org.llm4s.speech.config.SpeechConfigLoader.tts
- httpClient
-
HTTP transport, replaceable in tests
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
In this article