OpenAITTSClient

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
trait TextToSpeech
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def synthesize(text: String, options: TTSOptions): Result[GeneratedAudio]

Attributes

Definition Classes

Concrete fields

override val name: String