-
Notifications
You must be signed in to change notification settings - Fork 143
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
Getting illegal hardware instruction
on speaker.end()
#92
Comments
Having the same issue... |
same problem.. "Illegal Instruction 4" and the Node program just crashes and exits.. any ideas??? |
I'm still getting this error, in node 7.4 and 7.5. A hacky but functional workaround is to spawn a child I used the above approach in a sample app with AWS Polly, if it's useful to anyone: https://github.com/clarkdave/polly-say |
The Issue has to do with this libmpg123 version being quite old. Updating has not been done in a long time as #68 is still open. |
+1 |
2 similar comments
+1 |
+1 |
My workaround:
instead of:
no more crashes |
Your given solution ended up with this flood of error
|
I'm noticing that sometimes this works and sometimes it does not. Maybe some kind of race condition in the way the binding is being used. I think maybe it's the buffer flushing not working correctly. If you write the length of the buffer that gets written after deps/mpg123/src/output/coreaudio.o: static int write_coreaudio(audio_output_t *ao, unsigned char *buf, int len)
{
mpg123_coreaudio_t* ca = (mpg123_coreaudio_t*)ao->userptr;
int written;
/* If there is no room, then sleep for half the length of the FIFO */
while (sfifo_space( &ca->fifo ) < len ) {
warning("sleeping");
usleep( (FIFO_DURATION/2) * 1000000 );
}
/* Store converted audio in ring buffer */
written = sfifo_write( &ca->fifo, (char*)buf, len);
warning2("%u %u", written, len) [../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:264] warning: 1024 1024
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:258] warning: sleeping
[../deps/mpg123/src/output/coreaudio.c:286] warning: closing CORE AUDIO
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4294967277 4096
[../deps/mpg123/src/output/coreaudio.c:267] warning: Failed to write audio to ring buffer But when [../deps/mpg123/src/output/coreaudio.c:264] warning: 1024 1024
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[../deps/mpg123/src/output/coreaudio.c:264] warning: 1536 1536
[../deps/mpg123/src/output/coreaudio.c:258] warning: sleeping
[../deps/mpg123/src/output/coreaudio.c:286] warning: closing CORE AUDIO
[../deps/mpg123/src/output/coreaudio.c:264] warning: 4096 4096
[1] 62834 illegal hardware instruction node test2.js |
I'm beginning to think the problem might be in You can get it working editing - usleep( (FIFO_DURATION/2) * 1000000 );
+ usleep( (FIFO_DURATION/2) * 100000 );
Then in the node-gyp build And you should be able to use: const request = require('request')
const lame = require('lame')
const Speaker = require('speaker')
const url = 'http://aasr-stream.iha.dk:9870/dtr.mp3'
const decoder = new lame.Decoder()
let speaker = new Speaker()
decoder.pipe(speaker)
const req = request.get(url)
var stream = req.pipe(decoder)
setTimeout(() => {
console.log('Closing Speaker')
speaker.close()
}, 2000)
setTimeout(() => {
console.log('Closing Node')
}, 4000) |
any recent workarounds? |
I have a script for playing a remote mp3 source through the
Speaker
module which is working fine. However if I want to stop playing the mp3 stream I am encountering two issues:If I stop streaming the remote source, eg. by calling
stream.pause()
as in line11
of the code below then stdout is flooded with a warning:[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)
The warning in itself makes sense because I'm not providing it with any data anymore, but it is outputting it very frequently which is a big issue because I want to use it for CLI app.
If I attempt to end the speaker calling
speaker.end()
as in line13
of the code below then I get the following error:[1] 8950 illegal hardware instruction node index.js
Am I not supposed to call
end()
on the speaker instance and if not then how can I close it properly?I'm running Node v7.2.0, npm v4.0.3 and Speaker v.0.3.0 on macOS v10.12.1
The text was updated successfully, but these errors were encountered: