Environment details
- OS: Ubuntu 16.04
- Node.js version: 6.9.2
- npm version: 4.0.5
- google-cloud-node version: latest alpha as on 4/4/2017
Steps to reproduce
- require
google-cloud
const request = {
config: {
encoding: encoding,
sampleRate: sampleRate,
languageCode: 'en-IN-x-longform',
}
};
// Stream the audio to the Google Cloud Speech API
const recognizeStream = speech.createRecognizeStream(request)
.on('error', (error) => {
console.error;
})
.on('data', (data) => {
console.log('Data received: %j', data);
if ('results' in data)
console.log(chalk.bgYellow(data.results));
logger.log(JSON.stringify(data) + '\n');
});
// Stream an audio file from disk to the Speech API, e.g. "./resources/audio.raw"
filename = "./resources/audio.raw";
fs.createReadStream(filename).pipe(recognizeStream);`
var streamBuffers = require('stream-buffers');
function streamingRecognize (audioStream, encoding, sampleRate) {
var defaultFrequency = streamBuffers.DEFAULT_FREQUENCY;
// Initialize stream
var myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({
//frequency: 10 , // in milliseconds.
frequency: defaultFrequency,
chunkSize: 4096 // in bytes.
});
console.log( chalk.red( Buffer.isBuffer(audioStream) ) )
myReadableStreamBuffer.put(audioStream);
}
I am using streamBuffers = require('stream-buffers'); to convert audioBuffer from browser to convert it to stream and then pipe it to speech.createRecognizeStream(request)
Instead of creating stream from file
As i am clueless that what is not working as i am not able to see the logs of the data i am sending
I am using the google-cloud-node client the google-cloud is authenticated in my local system
I am getting results for the demo file with fs.createReadStream(filename).pipe(recognizeStream);
Is there any way to see the logs of the data i am sending( Is the data correct or the problem is there at Buffer to Stream conversion
Thanks!
Environment details
Steps to reproduce
google-cloudI am using streamBuffers = require('stream-buffers'); to convert audioBuffer from browser to convert it to stream and then pipe it to
speech.createRecognizeStream(request)Instead of creating stream from file
As i am clueless that what is not working as i am not able to see the logs of the data i am sending
I am using the google-cloud-node client the google-cloud is authenticated in my local system
I am getting results for the demo file with
fs.createReadStream(filename).pipe(recognizeStream);Is there any way to see the logs of the data i am sending( Is the data correct or the problem is there at Buffer to Stream conversion
Thanks!