Marak / say.js

TTS (text to speech) for node.js. send text from node.js to your speakers.
MIT License
1.49k stars 214 forks source link

Heroku doesn't seem to support say.js #105

Open kirstenalice opened 4 years ago

kirstenalice commented 4 years ago

I'm very new to web development, I know next to nothing about what I'm doing. I'm trying to build a small site for my grandfather, he's lost the ability to speak and I figured I could custom-make him a speech interpretation site. I made a simple site, a text box and a button that routes the words from the text box to say.speak(). I tried to host it using heroku, but heroku crashes every time I submit text to be read. It throws errors in the heroku logs when the site launches, and it throws different errors when I submit text to be read.

2020-06-10T20:34:35.312956+00:00 heroku[router]: at=info method=GET path="/" host=word-reader-for-granddad.herokuapp.com request_id=cdbb9407-3b1d-4324-87b4-2ad0a9ac531f fwd="173.63.174.251" dyno=web.1 connect=1ms service=53ms status=304 bytes=237 protocol=https
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at Socket._writeGeneric (net.js:786:11)
at Socket._write (net.js:798:8)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Socket.Writable.end (_stream_writable.js:585:10)
at Socket.end (net.js:590:31)
at SayPlatformLinux.speak (/app/node_modules/say/platform/base.js:39:24) {
 errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
events.js:292
throw er; // Unhandled 'error' event
^

Error: spawn festival ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn festival',
path: 'festival',
spawnargs: [ '--pipe' ]
}
at=error code=H13 desc="Connection closed without response" method=GET path="/?words=why" host=word-reader-for-granddad.herokuapp.com request_id=649afc77-d6a3-4b48-98a5-09ef0cc26704 fwd="173.63.174.251" dyno=web.1 connect=1ms service=82ms status=503 bytes=0 protocol=https
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
npm ERR! speech-site@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the speech-site@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2020-06-10T20_34_38_488Z-debug.log
Process exited with status 1
State changed from up to crashed

I have installed festival with npm. That didn't make a difference, it throws the same errors.

tlhunter commented 4 years ago

I haven't heard of the festival package and just looked it up. It doesn't provide the real festival, it only provides a (very broken) wrapper around festival. It's sort of like a very primitive, alternative version of this say package. To get festival you would need to do somehow download the festival binary and package it with your project when you deploy to Heroku.

Even if you did that, though, you still wouldn't get audio. The say package will speak text on the computer that it is run on. Some people are hobbyists and use this project on a small computer they own. Others just experiment on their laptop. In this case the computer that is running the package is a Heroku server somewhere in a dark, air conditioned basement. You probably don't want your text being read down there.

Maybe you could try to have the server generate the audio and save it to a file, then download that audio to the browser and play it in the browser, but even then the say package currently doesn't allow you to save audio in this manner (see issue #20).

If you want to hear audio played from a computer with a web browser open, you might consider the SpeechSynthesis browser API.

tnpradeep commented 3 years ago

Hi,

Even I'm facing similar issue,

2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR events.js:174 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR throw er; // Unhandled 'error' event 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR ^ 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR Error: write EPIPE 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at afterWriteDispatched (internal/stream_base_commons.js:78:25) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at writeGeneric (internal/stream_base_commons.js:73:3) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket._writeGeneric (net.js:714:5) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket._write (net.js:726:8) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at doWrite (_stream_writable.js:415:12) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at writeOrBuffer (_stream_writable.js:399:5) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket.Writable.write (_stream_writable.js:299:11) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket.Writable.end (_stream_writable.js:584:10) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket.end (net.js:545:31) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at SayPlatformLinux.speak (/home/vcap/app/node_modules/say/platform/base.js:39:24) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR Emitted 'error' event at: 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at errorOrDestroy (internal/streams/destroy.js:107:12) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at onwriteError (_stream_writable.js:430:5) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at onwrite (_stream_writable.js:461:5) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at _destroy (internal/streams/destroy.js:49:7) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket._destroy (net.js:614:3) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket.destroy (internal/streams/destroy.js:37:8) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at afterWriteDispatched (internal/stream_base_commons.js:78:17) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at writeGeneric (internal/stream_base_commons.js:73:3) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket._writeGeneric (net.js:714:5) 2021-04-04T09:01:08.763+0000 [APP/PROC/WEB/0] ERR at Socket._write (net.js:726:8)

And the app is getting crashed in AWS. Please help to resolve this.

Thanks in advance