Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Stream Timing Out Instantly #626

Closed
dhanud5 opened this issue May 27, 2018 · 1 comment
Closed

Audio Stream Timing Out Instantly #626

dhanud5 opened this issue May 27, 2018 · 1 comment

Comments

@dhanud5
Copy link

dhanud5 commented May 27, 2018

So I'm trying to get Google speech to text to listen to my microphone for transcription. I am using windows and sox. System variable path is set and all google cloud accounts are active. My problem is that the service stops right as it starts. The max amount of time it ran for was around 50ms. Here's a screencap of what I get in the command prompt.
image

Here's my code:

const express = require('express');
const app = express();
const http = require('http');
const server = require('http').createServer(app);
var io = require('socket.io')(server);

const fs = require('fs');

const LISTEN_PORT = 8080;

var transText;

server.listen(LISTEN_PORT);
app.use(express.static(__dirname + '/public'));

console.log("Listening on port: " + LISTEN_PORT);

app.get( '/', function( req, res ){
res.sendFile( __dirname + '/public/index.html' );
});

//////////////////////////////////////////////////////////////////////

// Creates a client
const record = require('node-record-lpcm16');

// Imports the Google Cloud client library
const speech = require('@google-cloud/speech');

// Creates a client
const client = new speech.SpeechClient();

const encoding = 'LINEAR16';
const sampleRateHertz = 16000;
const languageCode = 'en-US';

const request = {
config: {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
},
interimResults: true, // If you want interim results, set this to true
};

// Create a recognize stream
const recognizeStream = client
.streamingRecognize(request)
.on('error', console.error)
.on('data', data =>
console.log(
data.results[0] && data.results[0].alternatives[0]
? Transcription: ${data.results[0].alternatives[0].transcript}\n
: \n\nReached transcription time limit, press Ctrl+C\n
)
);

// Start recording and send the microphone input to the Speech API
record
.start({
sampleRateHertz: 16000,
// Other options, see https://www.npmjs.com/package/node-record-lpcm16#options
verbose: true,
recordProgram: 'sox', // Try also "arecord" or "sox"
silence: '1500000.0',
device: 'plughw:0,0',
})
.on('error', console.error)
.pipe(recognizeStream);

setTimeout(function () {
record.stop()
}, 10000)

console.log('Listening, press Ctrl+C to stop.');

//////////////////////////////////////////////////////////////////////////
io.on('connection', function(socket) {

    io.emit('transcription', transText);

});

@fhinkel
Copy link
Contributor

fhinkel commented Nov 8, 2018

@dhanud5 sorry for the late response. If this is still an issue, please file it here.

@fhinkel fhinkel closed this as completed Nov 8, 2018
grayside pushed a commit that referenced this issue Oct 26, 2022
* chore(main): release 3.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
grayside pushed a commit that referenced this issue Nov 3, 2022
* chore(main): release 3.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
ahrarmonsur pushed a commit that referenced this issue Nov 16, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ahrarmonsur pushed a commit that referenced this issue Nov 16, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ahrarmonsur pushed a commit that referenced this issue Nov 16, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ahrarmonsur pushed a commit that referenced this issue Nov 16, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ahrarmonsur pushed a commit that referenced this issue Nov 16, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore: refactored v3 translate samples so that they wont skip error log

* added missing part
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore: refactored v3 translate samples so that they wont skip error log

* added missing part
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore: refactored v3 translate samples so that they wont skip error log

* added missing part
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore: refactored v3 translate samples so that they wont skip error log

* added missing part
ace-n pushed a commit that referenced this issue Nov 17, 2022
* chore: refactored v3 translate samples so that they wont skip error log

* added missing part
kweinmeister pushed a commit that referenced this issue Nov 18, 2022
* chore(main): release 4.0.3

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
NimJay pushed a commit that referenced this issue Nov 19, 2022
🤖 I have created a release *beep* *boop*
---


## [4.1.0](googleapis/nodejs-dataproc@v4.0.1...v4.1.0) (2022-09-22)


### Features

* Add support for Dataproc metric configuration ([#626](googleapis/nodejs-dataproc#626)) ([79a4958](googleapis/nodejs-dataproc@79a4958))
* Support regapic LRO ([350626e](googleapis/nodejs-dataproc@350626e))


### Bug Fixes

* Allow passing gax instance to client constructor ([#612](googleapis/nodejs-dataproc#612)) ([caba80a](googleapis/nodejs-dataproc@caba80a))
* **deps:** Do not depend on protobufjs ([#607](googleapis/nodejs-dataproc#607)) ([4b62ef6](googleapis/nodejs-dataproc@4b62ef6))
* **deps:** Roll back dependency @google-cloud/dataproc to ^4.0.0 ([#627](googleapis/nodejs-dataproc#627)) ([e1c6d8b](googleapis/nodejs-dataproc@e1c6d8b))
* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-dataproc/issues/1553)) ([#617](googleapis/nodejs-dataproc#617)) ([2e2bea1](googleapis/nodejs-dataproc@2e2bea1))
* Preserve default values in x-goog-request-params header ([#620](googleapis/nodejs-dataproc#620)) ([484a023](googleapis/nodejs-dataproc@484a023))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
NimJay pushed a commit that referenced this issue Nov 19, 2022
🤖 I have created a release *beep* *boop*
---


## [4.1.0](googleapis/nodejs-dataproc@v4.0.1...v4.1.0) (2022-09-22)


### Features

* Add support for Dataproc metric configuration ([#626](googleapis/nodejs-dataproc#626)) ([79a4958](googleapis/nodejs-dataproc@79a4958))
* Support regapic LRO ([350626e](googleapis/nodejs-dataproc@350626e))


### Bug Fixes

* Allow passing gax instance to client constructor ([#612](googleapis/nodejs-dataproc#612)) ([caba80a](googleapis/nodejs-dataproc@caba80a))
* **deps:** Do not depend on protobufjs ([#607](googleapis/nodejs-dataproc#607)) ([4b62ef6](googleapis/nodejs-dataproc@4b62ef6))
* **deps:** Roll back dependency @google-cloud/dataproc to ^4.0.0 ([#627](googleapis/nodejs-dataproc#627)) ([e1c6d8b](googleapis/nodejs-dataproc@e1c6d8b))
* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-dataproc/issues/1553)) ([#617](googleapis/nodejs-dataproc#617)) ([2e2bea1](googleapis/nodejs-dataproc@2e2bea1))
* Preserve default values in x-goog-request-params header ([#620](googleapis/nodejs-dataproc#620)) ([484a023](googleapis/nodejs-dataproc@484a023))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants