
Welcome back. Let's pick up where you left off.
MP3 · 24kHz · 2.1s of audio
[happy] You made it.I was starting to get worried[sigh].[whispering] Quick, before they see us[laugh].
[happy] You made it.I was starting to get worried[sigh].[whispering] Quick, before they see us[laugh].
import { InworldTTS } from '@inworld/tts';
const tts = InworldTTS(); // reads INWORLD_API_KEY
// 1. Stream audio back as NDJSON chunks
const stream = tts.synthesizeStream({
text: 'Welcome back. Let\'s pick up where you left off.',
voiceId: 'Sarah',
modelId: 'inworld-tts-1.5-max',
audioConfig: {
audioEncoding: 'MP3',
sampleRateHertz: 48000,
},
});
for await (const chunk of stream) {
// chunk.result.audioContent is base64 MP3
audioPlayer.append(Buffer.from(chunk.result.audioContent, 'base64'));
}