通話中のテキスト読み上げ

このガイドでは、AndroidとiOSのVonageクライアントアプリケーションで音声合成を使用する方法を説明します。始める前に、お使いのアプリにSDKが追加されていることを確認してください。アンドロイド, iOS, JS)で、次のことができる。 作る または 受け取る のコール。

通話中にテキストを音声に変換する

Client SDK say 関数は指定されたテキストを再生する。その say 関数は text パラメータと他のパラメータのデフォルト値が使用されますが、オプションのパラメータを使用してスピーチを変更することもできます。の各パラメータの詳細については テキスト音声ガイド.

// After creating a session
client.say(callId, 'hello world 111' )
    .then(() => {
        console.log("Success sending TTS message.");
    })
    .catch(error => {
        console.error("Error sending TTS message: ", error);
    });

client.say(callId, { 
        text: 'hello world 111',
        voiceName: 'Amy',
        level: 1,
        queue: true,
        loop: 5,
        ssml: false
    })
    .then(() => {
        console.log("Success sending TTS message.");
    })
    .catch(error => {
        console.error("Error sending TTS message: ", error);
    });

client.say(callID, "Hello World") {
    error ->
    when {
        error != null -> {
             // Handle say error
        }
    }
}

client.say(
    callId = callID,
    text = "Hello World",
    level = 0,
    loop = 1,
    queue = false,
    voiceName = "en-US",
    ssml = false) {
    error ->
    when {
        error != null -> {
            // Handle say error
        }
    }
}
client.say(callID, "Hello World", callback: { error in
    if error != nil {
        // Handle say error
    }
})

client.say(
    callID,
    "Hello World",
    level: 0,
    loop: 1,
    queue: false,
    language: "en-US",
    ssml: false,
    callback: { error in
        if error != nil {
            // Handle say error
        }
    }
)

参考