c# - How to stream STT file to IBM Watson (Unity)? -


i using ibm watson unity sdk

there examples in web on how send file ibm watson.

but no exact examples how stream long file split parts. want do: i have log audio file (about 1-3min) , want sent watson recognize speech.

ibm watson accepts <5mb files, file larger, need split , send parts.

here code:

private void onaudioloaded (audioclip clip) {     debug.log ("audio loaded , starting stream...");     _chunkscount = 0;      float[] clipdata = new float[(int)(clip.length * chunk_size)];     clip.getdata (clipdata, 1);      try {         _speechtotext.startlistening (onrecognize);          (int = 0; < math.ceiling (clip.length / seconds_to_split); i++) {             debug.log ("iteration of recognition #" + i);             _chunkscount++;              // creating array of floats clip array             float[] chunkdata = new float[seconds_to_split * (int)chunk_size];             array.copy (clipdata, * seconds_to_split * (int)chunk_size, chunkdata, 0, clipdata.length - * seconds_to_split * chunk_size < seconds_to_split * chunk_size ? (int)(clipdata.length - * seconds_to_split * chunk_size) : seconds_to_split * (int)chunk_size);              // creating audioclip floats array             audioclip chunk = audioclip.create ("ch", clip.frequency * seconds_to_split, clip.channels, clip.frequency, false);             chunk.setdata (chunkdata, 0);             audiodata audiodata = new audiodata (chunk, chunk.samples);              // sending recognition request             _speechtotext.onlisten (audiodata);         }     } catch (outofmemoryexception e) {         dialogboxes.callerrorbox ("audio recognition error", e.message);     } } 

the problem is:

on line _speechtotext.startlistening (onrecognize); assign callback function onrecognize, should called when recognized, never called.

this file testing on has been recognized, on online website , ok.

any suggestions?


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -