We're trying to implement the transcription of a streamed voice using nodejs 18.17.1 with the library @google-cloud/speech. We're using sockets to transfer data to/from the frontend, sending a request from the backend to the Google Cloud Speech API then sending back the transcription to the frontend.
We're trying to enable the spoken punctuaction using the property in the config object "enableSponePunctuation" using a ProtoBuffer boolean as stated in the docs.
Passing true is resulting in
code: 13,
details: 'Request message serialization failure: .google.cloud.speech.v1.RecognitionConfig.enableSpokenPunctuation: object expected'
We tried different models (also the ones like 'command_and_search' which has enableSpokenPunctuation enabled by default) and in none of them spoken punctuations works.
Every other property works. (e.g. Changing the language, enabling/disabling automatic punctuation)
Thanks, I'll leave a reference of the config used below.
nodejs: 18.17.1
{
"google-protobuf": "^3.21.2",
"@google-cloud/speech": "^6.3.0",
}
const encoding = "LINEAR16";
const sampleRateHertz = 16000;
const languageCode = "it-IT"; //en-US
const model = "default";
const protoBool = new protobuf.BoolValue().setValue(true);
const request = {
config: {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
profanityFilter: false,
model: model,
enableSpokenPunctuation: protoBool,
enableAutomaticPunctuation: false,
},
interimResults: true
};
UPDATE March 4, 2024
We didn't manage to sort it out, however I've successfully implemented the v2 API (which also was giving us a lot of problem due to scarce documentation) using node 18.19.0 and Typescript (for getting help passing the right properties to the various methods).