IBM Watson Speech to Text using WebSockets

Zaid Amir

I am trying to use the Watson Developer Cloud java SDK to transcribe large audio files. I tried the Sessionless method and it works fine, however when I try the WebSockets method things become unreliable.

Most of the time the method will just return with no SpeechResult passed to the delegates; rarely it works, but it only transcribes the first couple of seconds.

This is what my code looks like:

static SpeechResults transcript = null;
private static String SpeechToText(String audioFile) throws FileNotFoundException {
        SpeechToText service = new SpeechToText();
        service.setUsernameAndPassword("<!!USERNAME!!>", "<!!PASSWORD!!>");
        service.setEndPoint("https://stream.watsonplatform.net/speech-to-text/api");

        RecognizeOptions options = new RecognizeOptions();
        options.contentType("audio/ogg;codecs=opus");
        options.continuous(Boolean.TRUE);
        options.inactivityTimeout(-1);
        options.model(Models.GetModelName(Models.SpeechModelEnums.ArabicBroadband));
        options.timestamps(Boolean.TRUE);
        options.wordAlternativesThreshold(0.5);
        options.wordConfidence(Boolean.TRUE);

        options.interimResults(Boolean.FALSE);

        File audio = new File(audioFile);

        //This is my sessionless call
        //SpeechResults transcript = service.recognize(audio, options);


        service.recognizeUsingWebSockets(new FileInputStream(audio),  options, new BaseRecognizeDelegate()
        {
                @Override
                public void onMessage(SpeechResults speechResults){
                System.out.println(speechResults);                
                }
            }
        );

        return "";//transcript.toString();
    } 

I have continuous enabled. I tried fiddling with interimResults but that did not work.

What am I doing wrong?

German Attanasio

The issue you are mentioning was fixed in the 3.0.0-RC1 version.
I've answered a similar question and added a code snippet that recognizes an audio file using WebSockets.

Starting from the 3.0.0-RC1 there is a WebSocket example in the README.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

IBM Watson Speech to Text Only Returning First Word With Java SDK

分類Dev

ibm-watsonサービスC#を使用したSpeech-to-Text

分類Dev

IBM Watson Speech To Text:SwiftSDKを使用してテキストを書き写すことができません

分類Dev

IBM Watson Speech-to-Text Python、「DetailedResponse」オブジェクトには属性「getResult」がありません

分類Dev

IBM Watson Text-to-Speechは、カスタム単語の後に文末点を発音します

分類Dev

Watson speech to text live stream C# code example

分類Dev

Error in jumps in IBM Watson

分類Dev

Using the AT&T Speech to Text API With Python

分類Dev

Using Chrome text-to-speech in a chrome extension

分類Dev

〜7mbより大きいファイルは、「応答が受信されていません」をスローします。IBM Watson Speech-To-Text asynccreateJob呼び出しで

分類Dev

IBM Watson IAMトークンは、すべてのサービスに適していますか、それとも各サービスに固有ですか(Speech-to-Textなど)?

分類Dev

IBM watson image recognition : time taken for training

分類Dev

IBM Speech to Textに最適なサウンド形式はどれですか?

分類Dev

Watson Speech to Textの精度を向上させるにはどうすればよいですか?

分類Dev

Watson Speech to Text SDKの出力全体をPythonで受信するにはどうすればよいですか?

分類Dev

Watson Speech to Text : Windows 10 でユーザー名とパスワードを設定する方法

分類Dev

Speech to Text api / library

分類Dev

iOS Text To Speech API

分類Dev

Annyang converting speech to text

分類Dev

Speech to text for single word

分類Dev

Text to speech android code

分類Dev

100MBを超える長い音声を使用したSpeechto Text Ibm Watson C#

分類Dev

IBM Text to Speech: ドイツ語のテキストで英語の単語を正しく発音するには?

分類Dev

IBM Watson Assistant-ウムラウト

分類Dev

Is there a way to access IBM cloud watson personality insights service now(19.12.2020)?

分類Dev

IBM Watson VisualRecognitionを使用した顔認識

分類Dev

writing a text file in line by line from the speech recognition method using audio

分類Dev

IBM Watsonでcom.ibm.watson.developer_cloud.service.exception.NotFoundExceptionを解決する方法は?

分類Dev

Calling SpeechAPI for text to speech on Azure

Related 関連記事

  1. 1

    IBM Watson Speech to Text Only Returning First Word With Java SDK

  2. 2

    ibm-watsonサービスC#を使用したSpeech-to-Text

  3. 3

    IBM Watson Speech To Text:SwiftSDKを使用してテキストを書き写すことができません

  4. 4

    IBM Watson Speech-to-Text Python、「DetailedResponse」オブジェクトには属性「getResult」がありません

  5. 5

    IBM Watson Text-to-Speechは、カスタム単語の後に文末点を発音します

  6. 6

    Watson speech to text live stream C# code example

  7. 7

    Error in jumps in IBM Watson

  8. 8

    Using the AT&T Speech to Text API With Python

  9. 9

    Using Chrome text-to-speech in a chrome extension

  10. 10

    〜7mbより大きいファイルは、「応答が受信されていません」をスローします。IBM Watson Speech-To-Text asynccreateJob呼び出しで

  11. 11

    IBM Watson IAMトークンは、すべてのサービスに適していますか、それとも各サービスに固有ですか(Speech-to-Textなど)?

  12. 12

    IBM watson image recognition : time taken for training

  13. 13

    IBM Speech to Textに最適なサウンド形式はどれですか?

  14. 14

    Watson Speech to Textの精度を向上させるにはどうすればよいですか?

  15. 15

    Watson Speech to Text SDKの出力全体をPythonで受信するにはどうすればよいですか?

  16. 16

    Watson Speech to Text : Windows 10 でユーザー名とパスワードを設定する方法

  17. 17

    Speech to Text api / library

  18. 18

    iOS Text To Speech API

  19. 19

    Annyang converting speech to text

  20. 20

    Speech to text for single word

  21. 21

    Text to speech android code

  22. 22

    100MBを超える長い音声を使用したSpeechto Text Ibm Watson C#

  23. 23

    IBM Text to Speech: ドイツ語のテキストで英語の単語を正しく発音するには?

  24. 24

    IBM Watson Assistant-ウムラウト

  25. 25

    Is there a way to access IBM cloud watson personality insights service now(19.12.2020)?

  26. 26

    IBM Watson VisualRecognitionを使用した顔認識

  27. 27

    writing a text file in line by line from the speech recognition method using audio

  28. 28

    IBM Watsonでcom.ibm.watson.developer_cloud.service.exception.NotFoundExceptionを解決する方法は?

  29. 29

    Calling SpeechAPI for text to speech on Azure

ホットタグ

アーカイブ