1

I use sox for splitting audio stream like this

stream | sox -t raw -r 16k -e signed -b 16 -c 1 - ./chunks/output.wav  silence 1 0.3 0.1% 1 0.3 0.1% trim 0 55 : newfile : restart

Now sox write chunks to chunks folder. Can I pipe them to script for processing without writing to disk?

Something like this

stream | sox | node script.js
1

Unix pipes always pass on byte streams. However, the whole point of your splitting is that you get multiple byte streams, and it's impossible to pass multiple byte streams through a single pipe (unless you concatenate them again into a single byte stream, which defeats the purpose of splitting them).

You can call your script on each of the chunk files in the chunk folder using the usual bash for-loop, or parallel, or whatever you like.

You could also use a program that allows you to call an external program on each split chunk. AFAIK sox can't do that, but there may be other audio splitting programs that can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.