Stop Audio Instantly
akashbudhia opened this issue · 7 comments
akashbudhia commented
I pipe a local mp3 file stream via node-lame decoder to the node-speaker instance to play a local mp3 file. What would be the correct way to instantly stop the audio from playing?
var fs = require('fs');
var lame = require('lame');
var Speaker = require('speaker');
fs.createReadStream('audio.mp3').pipe(lame.Decoder()).pipe(new Speaker());
akashbudhia commented
+Bump
akashbudhia commented
+Bump
abigyani commented
Did you get the solution?
Radzell commented
any solution
LinusU commented
Open for suggestions on how an API for this would look!
euguuu commented
Did you get the solution?
lmoesch commented
My suggestion would be to write a custom throughput stream which accepts the piped data and processes them in a small buffered loop which you can stop via a custom control command. (true instant stop is not possible because the audio card uses an internal buffer. But with a size of 1024 samples and 44100 samples per second this is relatively short).