Banter Voice Transcription and AI Generation

BanterScene exposes voice detection and transcription methods alongside AI image and image-to-3D generation methods. These are separate workflows: voice input produces a transcription event, AiImage() accepts a text prompt, and AiModel() accepts base64 image data.

Asynchronous Request Flow

Register the result event first, start the request with a stable identifier or supported enum, and keep the generated output separate from the request controls.

  1. Wait for BanterScene to be ready.
  2. Register the transcription or generation result handling required by the feature.
  3. Start the voice or AI request using the documented method and values.

Start Voice Detection

The official SDK places these methods under Text-to-Speech, but the documented flow starts voice detection and returns transcription text:

scene.StartTTS(true);

The boolean argument enables voice detection in the official example.

Stop and Request a Transcription

scene.StopTTS("request-1");

The supplied ID is returned with the transcription event so the result can be matched to the request.

Register the listener before stopping:

scene.On("transcription", (event) => {
  console.log(event.detail.id);
  console.log(event.detail.message);
});

The scene also exposes a voice-started event for the start of listening.

Track Requests with Stable IDs

Use a distinct request ID when several interactions can start transcription. This lets the event handler route the returned message to the correct UI, object, or game state.

Generate an AI Image

scene.AiImage(
  "a sunset over mountains",
  BS.AiImageRatio._16_9
);

The official reference currently lists:

  • _1_1
  • _3_2
  • _4_3
  • _16_9
  • _21_9
  • _2_3
  • _3_4
  • _9_16
  • _9_21

Use the enum value rather than a free-form aspect-ratio string.

Generate a 3D Model from Image Data

scene.AiModel(
  base64ImageData,
  BS.AiModelSimplify.med,
  512
);

The documented simplification values are low, med, and high through BS.AiModelSimplify. The third value in the official example is 512.

The input is base64 image data, not a normal image URL.

Connect File Selection to AI Model Generation

The scene utility API exposes:

scene.SelectFile(BS.SelectFileType.Image);

Use the file-selection result flow documented by Banter to obtain image data before calling AiModel(). Do not pass a local filesystem path into the model method.

Common Questions

Why can I not match the Banter transcription to my request?

Pass a stable ID to StopTTS() and compare it with event.detail.id in the transcription listener.

Why does AiModel reject my normal image URL?

The official method example passes base64 image data. Obtain or convert the image through the appropriate Banter file or data workflow before calling AiModel().

Official References

Related Navigation