Convert text to speech with streaming response
Text to speech
Stream speech
テキストを音声に変換し、チャンク化されたオーディオストリームとして出力します。
POST
Convert text to speech with streaming response
このドキュメントは英語の原文から自動翻訳されています。表現に不自然な箇所がある場合があります。正確な内容は英語の原文もあわせてご確認ください。
ストリーミングは現在
sona_speech_1 のみでサポートされています。エンドポイント
パスパラメータ
| Name | Required | Description |
|---|---|---|
voice_id | ✅ | 対象ボイスの ID です。 |
リクエストボディ
Content-Type: application/json
| Name | Required | Description |
|---|---|---|
text | ✅ | 変換対象のテキストです。最大 300 文字。 |
language | ✅ | 言語コードです。サポート: en、ko、ja。 |
style | — | 感情スタイル(例: neutral、happy)です。未指定の場合はボイスのデフォルトスタイルが適用されます。 |
model | — | sona_speech_1 である必要があります(ストリーミングをサポートする唯一のモデル)。 |
output_format | — | wav(デフォルト)または mp3。 |
voice_settings | — | 高度なボイスパラメータです。フィールドと値の範囲は 音声生成 と同じです。 |
include_phonemes | — | true の場合、レスポンスはチャンクごとに音素データを含む NDJSON となります。デフォルト: false。 |
レスポンス
デフォルト(include_phonemes=false): バイナリオーディオストリームを返します。
Content-Type: audio/wavまたはaudio/mpeg(output_formatに対応)。- 最初のチャンクにはオーディオファイルヘッダーが含まれ、以降のチャンクは生のオーディオデータです。
include_phonemes=true の場合: 改行区切りの JSON(NDJSON)で、1 チャンクにつき 1 オブジェクトを返します。
注意事項
- 音声ストリーミングは現在 ベータ 版で、
sona_speech_1のみをサポートします。 textが 300 文字を超えると400を返します。SDK は長い入力を自動でチャンキングし、イテレーターにチャンクを転送します。speedはdurationの後に適用されます(例:duration=5+speed=2で約 10 秒)。styleを省略した場合はボイスのデフォルトスタイルが適用されます。デフォルトは ボイス取得 で確認できます。
関連項目
Docs: Stream speech
ストリーミングを使うべき場面と、各 SDK でのチャンク消費方法。
LLM streaming TTS
OpenAI および Anthropic を用いたエンドツーエンドのレシピ。
Authorizations
Path Parameters
Body
application/json
The text to convert to speech
Maximum string length:
300The language code of the text
Available options:
en, ko, ja, bg, cs, da, el, es, et, fi, hu, it, nl, pl, pt, ro, ar, de, fr, hi, id, ru, vi, hr, lt, lv, sk, sl, sv, tr, uk The style of character to use for the text-to-speech conversion
The model type to use for the text-to-speech conversion
Available options:
sona_speech_1, sona_speech_2, sona_speech_2_flash, supertonic_api_1, supertonic_api_3 The desired output format of the audio file (wav, mp3). Default is wav.
Available options:
wav, mp3 Return phoneme timing data with the audio
Pre-normalized text for TTS. Only used with sona_speech_2 and sona_speech_2_flash models.
Response
Streaming audio data in binary format or NDJSON format with phoneme data based on includePhonemes parameter
Binary audio stream (when includePhonemes=false or omitted)