wit-ai / wit

Natural Language Interface for apps and devices
https://wit.ai/
942 stars 91 forks source link

Example of using /speech with Streams and Chunked Transfer-Encoding (nodejs) #2461

Closed dzlandis closed 2 years ago

dzlandis commented 2 years ago

Do you want to request a feature, report a bug, or ask a question about wit? Question

Hey there! I was hoping to get an example of how to use speech recognition with a stream using the Transfer-Encoding Chunked which is specified in the documentation in Node JS:

Streaming audio We accept chunked data, which is a good way to reduce latency. In addition to the Content-type header, you must set a Transfer-encoding header to chunked.

My main question is, will doing this allow for real time live speech recognition? For example, could I be talking with a microphone and the audio packets be sent to wit.ai live in real time as they come into existence?

yuzh174 commented 2 years ago

We support bidirectional streaming, meaning if you stream the data to the server, you can get live transcription back while the user is speaking. This is the header to add "Transfer-encoding: chunked". However it also depends on the client library you are using. It needs to support directional streaming. You can try it if that helps.

patapizza commented 2 years ago

See interactive.js for an example of this. For further Node.js-related questions, please use this repo.