tencent cloud

Feedback

JavaScript

Last updated: 2024-10-30 11:43:57

    Feature Description

    The voice-to-text feature supports recognizing the voice message you sent successfully or received, converting it into text.
    Note:
    Voice-to-text is a value-added paid feature, which is currently offered for free. You can contact us through the Telegram technical exchange group to enable and experience the full feature.
    It is supported by v3.1.3 or later.

    Effect Display

    

    convertVoiceToText

    The voice-to-text interface. Supported audio formats include wav, pcm, ogg-opus, speex, silk, mp3, m4a, aac, and amr.
    API
    chat.convertVoiceToText(options);
    Parameter
    The options parameter is of the Object type, and includes the following attribute values:
    Name
    Type
    Description
    message
    Message
    Audio message.
    language
    String | undefined
    Language type, defaults to Chinese-English-Cantonese voice-to-text. Other selectable types:
    zh (cmn-Hans-CN), Standard Chinese
    en-US, English
    yue-Hant-HK, Cantonese
    ja-JP, Japanese
    Returned Value
    Promise
    Sample
    // Most commonly used Chinese-English-Cantonese voice-to-text. The language parameter can be omitted.
    let promise = chat.convertVoiceToText({ message });
    promise.then(function(imResponse)) {
    // Voice-to-text conversion succeeded.
    const { result } = imResponse.data;
    }).catch(function(imError) {
    // Voice-to-text conversion failed.
    console.warn('convertVoiceToText error:', imError);
    });
    // Japanese voice-to-text
    let promise = chat.convertVoiceToText({ message, language: 'ja-JP'});
    promise.then(function(imResponse)) {
    // Voice-to-text conversion succeeded.
    const { result } = imResponse.data;
    }).catch(function(imError) {
    // Voice-to-text conversion failed.
    console.warn('convertVoiceToText error:', imError);
    });
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support