Class RealtimeTranslationInputAudioBufferAppendEvent
-
- All Implemented Interfaces:
public final class RealtimeTranslationInputAudioBufferAppendEventSend this event to append audio bytes to the translation session input audio buffer.
WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono little-endian raw audio bytes. Unsupported websocket audio formats return a validation error because lower-quality audio materially degrades translation quality.
Translation consumes 200 ms engine frames. For best realtime behavior, append audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it has enough audio for one frame. If a chunk is longer, the server splits it into 200 ms frames and enqueues them back-to-back.
Keep appending silence while the session is active. If a client stops sending audio and later resumes, model time treats the resumed audio as contiguous with the previous audio rather than as a real-world pause.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classRealtimeTranslationInputAudioBufferAppendEvent.BuilderA builder for RealtimeTranslationInputAudioBufferAppendEvent.
-
Method Summary
Modifier and Type Method Description final Stringaudio()Base64-encoded 24 kHz PCM16 mono audio bytes. final JsonValue_type()The event type, must be session.input_audio_buffer.append.final Optional<String>eventId()Optional client-generated ID used to identify this event. final JsonField<String>_audio()Returns the raw JSON value of audio. final JsonField<String>_eventId()Returns the raw JSON value of eventId. final Map<String, JsonValue>_additionalProperties()final RealtimeTranslationInputAudioBufferAppendEvent.BuildertoBuilder()final RealtimeTranslationInputAudioBufferAppendEventvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RealtimeTranslationInputAudioBufferAppendEvent.Builderbuilder()Returns a mutable builder for constructing an instance of RealtimeTranslationInputAudioBufferAppendEvent. -
-
Method Detail
-
_type
final JsonValue _type()
The event type, must be
session.input_audio_buffer.append.Expected to always return the following:
JsonValue.from("session.input_audio_buffer.append")However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
_audio
final JsonField<String> _audio()
Returns the raw JSON value of audio.
Unlike audio, this method doesn't throw if the JSON field has an unexpected type.
-
_eventId
final JsonField<String> _eventId()
Returns the raw JSON value of eventId.
Unlike eventId, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final RealtimeTranslationInputAudioBufferAppendEvent.Builder toBuilder()
-
validate
final RealtimeTranslationInputAudioBufferAppendEvent validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static RealtimeTranslationInputAudioBufferAppendEvent.Builder builder()
Returns a mutable builder for constructing an instance of RealtimeTranslationInputAudioBufferAppendEvent.
The following fields are required:
.audio()
-
-
-
-