Text-to-Speech
Audio-only speech from an Experience without avatar rendering.
What is it?
Text-to-speech on Liforma is the same Avatar Experience runtime with audio output only. You use the normal integration surface — <Experience> or Experience.startSession() — and set speechOnly so the player runs TTS (and optional STT) without loading avatar assets,
location scenes, or the visual renderer.
For scripted lines, use presenter mode and call speak() after the
session has started (typically from onStarted).
When to use it
- Voice prompts, IVR-style messages, or accessibility narration
- Apps that already have their own UI and only need spoken output
- Scripted lines via
speak()in presenter mode - When lip-sync, facial animation, and scene backgrounds are not required
Svelte
Add speechOnly to <Experience>. Use presenter mode with speechInputMode="off" when the host drives every line with speak().
<script lang="ts">
import {
Experience,
type ExperienceHandle
} from '@liforma/client/svelte';
let experience: ExperienceHandle | undefined = $state();
async function speakPrompt() {
await experience?.speech.speak({ text: 'Your table is ready.' });
}
<\/script>
<Experience
bind:this={experience}
experienceId="exp_T0I7ACMQLBMPG6K"
speechOnly
mode="presenter"
speechInputMode="off"
onStarted={speakPrompt}
/> JavaScript
import { Experience } from '@liforma/client';
const experience = await Experience.startSession({
experienceId: 'exp_T0I7ACMQLBMPG6K',
speechOnly: true,
mode: 'presenter',
speechInputMode: 'off'
});
experience.on('started', async () => {
await experience.speech.speak({ text: 'Your table is ready.' });
});
await experience.attach({ container: '#voice-shell' }); The hosted player still mounts in your container for audio playback and session UI (start button, close control). It simply skips avatar and location image loading.
Web component
Set speech-only="true" on <liforma-experience> with the same
presenter + speak() flow. See Web component.
When to use a visible character instead
Omit speechOnly (or set it to false) and use the same experience with presenter mode and speak() when speech
should come from an on-screen animated character.