I’m trying to pass the output from the microphone in a Flutter app to a Node server that proxies a Speech to Text service via a websocket. The microphone produces a Uint8list which I’m trying to convert to a javascript ArrayBuffer and send over the websocket. The node service works ok with other clients and on inspection is receiving data that looks like from the websocket:
<Buffer f9 ff fa ff f9 ff f7 ff f5 ff f7 ff f8 ff f5 ff f2 ff f0 ff f5 ff f7 ff f1 ff f2 ff f1 ff f2 ff f6 ff f5 ff f2 ff f4 ff f7 ff f7 ff f7 ff f9 ff fe ff ... 2922 more bytes>
However with the Flutter app it recieves data that looks like:
[
7, 13, 114, 101, 99, 111, 114, 100, 105, 110, 103, 68,
97, 116, 97, 13, 4, 7, 7, 115, 117, 99, 99, 101,
...
]
which can’t be consumed by the STT service. Can anyone help with this? The STT service expects audio data in the following format:
- PCM format
- One channel
- 16 bits per sample, 8,000 or 16,000 samples per second (16,000 bytes or 32,000 bytes per second)
- Two-block aligned (16 bit including padding for a sample)
It’s the last requirement that’s tripping me up I believe.