Unable to run recognize.JS
Hi there ! Whenever i try to execute the recognize.JS file i get the following error command: node recognize listen Result:Listening, press Ctrl+C to stop. events.js:141 throw er; // Unhandled 'error' event ^ Error: spawn rec ENOENT at exports._errnoException (util.js:870:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) at onErrorNT (internal/child_process.js:344:16) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) at Function.Module.runMain (module.js:443:11) at startup (node.js:139:18) at node.js:968:3
I got around this by setting recordProgram to 'sox' in the options passed to record.start()
eg.
record.start({
sampleRateHertz: sampleRateHertz,
threshold: 0,
recordProgram: 'sox'
}).pipe(recognizeStream);
@MarcoThePoro Now i get this error Error: spawn sox ENOENT at exports._errnoException (util.js:870:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) at onErrorNT (internal/child_process.js:344:16) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) at Function.Module.runMain (module.js:443:11) at startup (node.js:139:18) at node.js:968:3
Did you make sure to install SoX and add it to your path?
The speech example readme says this: Note: The listen command requires that you have SoX installed and available in your $PATH. See https://www.npmjs.com/package/node-record-lpcm16#dependencies.
On Sun., 23 Apr. 2017, 11:15 pm Danish Nazir, [email protected] wrote:
@MarcoThePoro https://github.com/MarcoThePoro Now i get this error Error: spawn sox ENOENT at exports._errnoException (util.js:870:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) at onErrorNT (internal/child_process.js:344:16) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) at Function.Module.runMain (module.js:443:11) at startup (node.js:139:18) at node.js:968:3
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues/332#issuecomment-296442534, or mute the thread https://github.com/notifications/unsubscribe-auth/AHazr7u7m9mwAxMfZCG2yNVqU3d0R4_oks5ry07pgaJpZM4Mxyxp .
Hi there yes i have installed it and now that problem is resolved thanks
Hi @MarcoThePoro i have been able to successfully compile it but whenever i run it using the listen option it says Listening, press Ctrl+C to stop. but after this it automatically stop with no error messages! any ideas?
I ran into that issue but just gave up then
On Mon., 24 Apr. 2017, 3:12 am Danish Nazir, [email protected] wrote:
Hi @MarcoThePoro https://github.com/MarcoThePoro i have been able to successfully compile it but whenever i run it using the listen option it says Listening, press Ctrl+C to stop. but after this it automatically stop with no error messages! any ideas?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues/332#issuecomment-296458093, or mute the thread https://github.com/notifications/unsubscribe-auth/AHazr044EM1K86cZNyqY48-lqQDVXp3iks5ry4aWgaJpZM4Mxyxp .
@MarcoThePoro oh i see i am amazed to see that no one from google is helping us in solving this problem i mean where they? i am thoroughly disappointed!!
@danishnazir Can you provide extensive details so we can reproduce the behavior you're experiencing? OS, Node version, @google-cloud/speech version, sox version, node-record-lpcm16 version, etc.
Here are the details sox:v14.4.2 node:v4.4.4 @google-cloud/speech: same version as here in github repo as i am cloning node-record-lpcm16:same version as here in github repo as i am cloning @jmdobry
We just updated this repo yesterday, so you might want to try re-cloning it and re-installing dependencies. You might also try upgrading Node.js to say, 6.10.1
Hi @jmdobry i just reclonned the repo and upgraded my node setup but still same issue
Can you try changing the options (found here) passed to record.start()? In particular, what happens if you change the silence option to "10.0", or what happens if you change the recordProgram option to "sox"?
@jmdobry still the same problem!! Including the extra perimeters didn't help me!
record.start({
sampleRate: sampleRate,
threshold: 0,
recordProgram: 'sox',
silence: 10.0
}).pipe(recognizeStream);
I think the value for silence is supposed to be a string, and did you try different values for recordProgram and threshold?
i tried using string too!! and no i havent manipulated the threshold yet
Hello,
I am having the very same issue whenever I run using node . I just get "Listening, press Ctrl+C to stop" and the program stops running right away. I am using sox: v14.4.2 and nodejs : v6.11.0. Has anyone found a solution to this???
@danishnazir Did you ever get it to work?
No i left for ibm
On 30 Jun 2017 21:13, "josefsandoval" [email protected] wrote:
@danishnazir https://github.com/danishnazir Did you ever get it to work?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues/332#issuecomment-312309763, or mute the thread https://github.com/notifications/unsubscribe-auth/AH6LOiWAPw3OXOG6KAe3u6BmuwB4whz9ks5sJR6cgaJpZM4Mxyxp .
@danishnazir I reached to the same point as you, getting no response, using the function : createRecognizeStream
const recognizeStream = speechClient.createRecognizeStream(request)
rather than streamingRecognize()
Now, using streamingRecognize(), I get the error :
Uncaught TypeError: speechClient.streamingRecognize is not a function
When i try accessing it through the api object of my speechClient instance, i get this error as response :
.google.cloud.speech.v1.StreamingRecognizeRequest#0 is not a field: undefined
Any help please ? @jmdobry ?
I would also like to know how to get the sample https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/speech/recognize.js run please....?
I am using : Win 10 Node js 7.10.0 sox 14.4.2
Thanks for any help on that issues !
I can now run the sample https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/speech/recognize.js but getting no result, no error, as @danishnazir and others stated...
When I try to call the streamingRecognize() method in my own node.js app, the method be found
Uncaught TypeError: speechClient.streamingRecognize is not a function
This is my code :
`// The BCP-47 language code to use, e.g. 'en-US' const languageCode = settingsRecord.language; //'en-US';
// Your Google Cloud Platform project ID
const nathProjectId = 'protocol-recorder-201707';
// Instantiates a client
const speechClient = Speech({
projectId: nathProjectId
,keyFilename: './rsc/credentials/spr-426ec2968cf6.json'
});
// The encoding of the audio file, e.g. 'LINEAR16'
const encoding = 'LINEAR16';
// The sample rate of the audio file in hertz, e.g. 16000
const sampleRateHertz = 16000;
const request = {
config: {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode
},
interimResults: false // If you want interim results, set this to true
};
// Create a recognize stream
var notes = '';
console.log('create the recognize Stream object to be piped..')
//const recognizeStream = speechClient.createRecognizeStream(request)
console.log("speechClient : ",speechClient)
const recognizeStream = speechClient.api.Speech._streamingRecognize(request)
.on('error', console.error)
.on('data', (response) => {
//process.stdout.write(response.results)
process.stdout.write(
(response.results[0] && response.results[0].alternatives[0])
? `Transcription: ${response.results[0].alternatives[0].transcript}\n`
: `\n\nReached transcription time limit, press Ctrl+C\n`);
notes = document.getElementById("notes").value;
notes = notes + response.results;
document.getElementById("notes").value = notes;
});
// Start recording and send the microphone input to the Speech API
console.log('Start recording and send the microphone input to the Speech API..')
record.start({
sampleRateHertz: sampleRateHertz,
threshold: 0,
// Other options, see https://www.npmjs.com/package/node-record-lpcm16#options
verbose: true,
recordProgram: 'sox', // Try also "arecord" or "sox"
silence: '1.0',
device : settingsRecord.audio_input
})
.on('error', console.error)
.pipe(recognizeStream);`
Could anyone clue me on what matters ?
Thanks