Class VoiceConfig

java.lang.Object
dyntabs.ai.voice.VoiceConfig

public final class VoiceConfig extends Object
Immutable settings for the two voice directions — speech → text (transcription) and text → speech (synthesis).

The one idea that makes this "easy"

Voice settings inherit from your chat settings. If easyai.properties already configures a provider and key for EasyAI.chat(), then forListening() and forSpeaking() reuse that same provider, key and base URL — so adding voice to an app usually costs zero new configuration. You only write an easyai.stt.* or easyai.tts.* key when you want voice to differ from chat.

Resolution order (first non-null wins)

Where each value comes from
SettingListening (forListening())Speaking (forSpeaking())
providereasyai.stt.provider → easyai.provider → "openai" easyai.tts.provider → easyai.provider → "openai"
API keyeasyai.stt.api-key → easyai.api-key easyai.tts.api-key → easyai.api-key
base URLeasyai.stt.base-url → easyai.base-url easyai.tts.base-url → easyai.base-url
modeleasyai.stt.model-name → "whisper-1" easyai.tts.model-name → "tts-1"
extraeasyai.stt.language (ISO-639-1, optional) easyai.tts.voice → "alloy"

Choosing a model name

The defaults are OpenAI's own ("whisper-1", "tts-1"). Deliberately, nothing is guessed from the base URL. If you point the base URL at another OpenAI-compatible service, name its model explicitly — for Groq, for instance, easyai.stt.model-name=whisper-large-v3. A wrong model name fails loudly at the provider, which is easier to debug than a library quietly picking a different one.

Analogy: a household's utility accounts. The lights and the heating bill to the same account unless you deliberately open a second one — and nobody rewires the house to guess which supplier you meant.

See Also:
  • Field Details

    • DEFAULT_TRANSCRIPTION_MODEL

      public static final String DEFAULT_TRANSCRIPTION_MODEL
      Default transcription model (whisper-1 — OpenAI's own).
      See Also:
    • DEFAULT_SPEECH_MODEL

      public static final String DEFAULT_SPEECH_MODEL
      Default speech-synthesis model (tts-1 — OpenAI's own).
      See Also:
    • DEFAULT_VOICE

      public static final String DEFAULT_VOICE
      Default synthesis voice (alloy).
      See Also:
  • Method Details

    • provider

      public String provider()
      Returns:
      the provider id, e.g. "openai" (also covers any OpenAI-compatible endpoint).
    • apiKey

      public String apiKey()
      Returns:
      the API key, or null if none was configured.
    • baseUrl

      public String baseUrl()
      Returns:
      the base URL override, or null to use the provider's default.
    • modelName

      public String modelName()
      Returns:
      the model name to call (never null once loaded from properties).
    • language

      public String language()
      Returns:
      the expected spoken language as an ISO-639-1 code, or null to auto-detect.
    • voice

      public String voice()
      Returns:
      the synthesis voice name, or null for the provider's default.
    • toBuilder

      public VoiceConfig.Builder toBuilder()
      Returns:
      a builder pre-filled with this configuration, for making a modified copy.
    • builder

      public static VoiceConfig.Builder builder()
      Returns:
      a new, empty builder.
    • forListening

      public static VoiceConfig forListening()
      Load the transcription (speech → text) configuration from easyai.properties, falling back to the chat settings as described in the class documentation.
      Returns:
      settings for EasyAI.listen()
    • forSpeaking

      public static VoiceConfig forSpeaking()
      Load the synthesis (text → speech) configuration from easyai.properties, falling back to the chat settings as described in the class documentation.
      Returns:
      settings for EasyAI.speak()
    • toString

      public String toString()
      Overrides:
      toString in class Object