NGRP / node-red-contrib-viseo

Node-RED nodes OpenSourced by VISEO Technologies
Apache License 2.0
227 stars 83 forks source link

problem with node-red-contrib-viseo-google-speech #78

Closed mashiah closed 6 years ago

mashiah commented 6 years ago

Im trying to do something very simple: to take recorded files from facebook messanger, covert them into a binary buffer as WAV file (or FLAC) and then send them to your google-speech node,

this is what i already did: converted the url from facebook to a binary buffer (using GET). converted the files to output WAV mono

now it needs to go into the Gspeech node. The problem:

When i choose to send a WAV file , i get this error: "Error: sample_rate_hertz (16000) in RecognitionConfig must either be omitted or match the value in the WAV header ( 22050). "

When i choose FLAC file i get this: "Error: Specify FLAC encoding to match file header."

Now i couldnt find a way to change the sample rate of the audio file itself so i thought i should specify it in the google speech node to change the default values. i tried to do it in the content-type input box but nothing worked. I tried to write in that input box samplerate = 22050 when i used wav file I tried to set something like encoding:FLAC

NOTHING worked. It seems like i just cant make this work and nothing takes effect in this input box.

Please help me if you can.

Thank you, matan

mashiah commented 6 years ago

flow explanation of the flow: The first (left) node is converting the url from facebook to a binary buffer (using GET). The second is just doing msg.payload=msg.url (because the next node input is the payload) The third is converting the file to format WAV mono (i used ffmpeg package) The fourth is suppose to grab the file and output the text. (used node-red-contrib-viseo-google-speech).

problem

61

SBado commented 6 years ago

I think the problem is in file google-speech-text.js, line 31:

let cfg = { encoding: 'LINEAR16', sampleRateHertz: 16000, languageCode: (config.language || 'fr-FR') };

As you can see, the encoding and the sample rate are wired in the code. If you want, you can modify them manually (if you are on linux, you can find this file under ~/.node-red/node_modules/node-red-contrib-viseo-google-speech/):

let cfg = { encoding: 'LINEAR16', sampleRateHertz: 22050, languageCode: (config.language || 'fr-FR') };

or

let cfg = { encoding: 'FLAC', sampleRateHertz: 16000, languageCode: (config.language || 'fr-FR') };

Klervix commented 6 years ago

Hi there! Please update the node version (to 0.2.0), I just corrected that.

(c: