You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to use the record library to transcribe audio in realtime. I want to send the stream of audio in PCM16 format over websockets to a custom server, which will then send it to a Speech-to-Text service. However, doing a stream.listen on
finalAudioRecorder _recorder =AudioRecorder();
final stream =await _recorder.startStream(constRecordConfig(
encoder:AudioEncoder.pcm16bits,
sampleRate:48000,
));
returns a Uint8List which does not work well since the service expects PCM16 to be a 16bit list.
So far, I have tried _recorder.convertBytesToInt16(chunk), a for loop that just sends the data one 8bit int at a time, chunk.buffer.toInt8List(), and just sending the chunk.buffer as is, but nothing has worked.
Expected behavior
Ideally, the resulting stream from the PCM16 encoding should be an Int16List to reflect the true nature of the data, but this oversight seems to be there in all the recording libraries for some reason. How could I go about solving this? How can I extract the 16 bit integers for PCM16 from this Uint8List?
The text was updated successfully, but these errors were encountered:
deleting my previous comment because it was completely off base- @BambooRaptor if you are still working this, try parsing every two int8s into an in16 in little endian. before pushing it to the service.
Why would you convert bytes to integers (16bits) before sending the stream over network? You can only send bytes.
I guess your issue is more about the sample rate which should be 8kHz or 16kHz, shouldn't it? Or something else that isn't written here.
The stream returns Uint8List because it allows to convert it to integers or floats if needed (float (32bits) is not supported at this time).
So far, there's no issue related to this package. Please, use discussion feature for such concern.
Package version: ^5.0.4
Environment
Describe the bug
I am trying to use the
record
library to transcribe audio in realtime. I want to send the stream of audio in PCM16 format over websockets to a custom server, which will then send it to a Speech-to-Text service. However, doing astream.listen
onreturns a
Uint8List
which does not work well since the service expects PCM16 to be a 16bit list.So far, I have tried
_recorder.convertBytesToInt16(chunk)
, a for loop that just sends the data one 8bit int at a time,chunk.buffer.toInt8List()
, and just sending thechunk.buffer
as is, but nothing has worked.Expected behavior
Ideally, the resulting stream from the PCM16 encoding should be an Int16List to reflect the true nature of the data, but this oversight seems to be there in all the recording libraries for some reason. How could I go about solving this? How can I extract the 16 bit integers for PCM16 from this
Uint8List
?The text was updated successfully, but these errors were encountered: