Forcing SoX to process remaining input/flush buffered output without EOF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to use a sox instance that reads from stdin and writes to stdout to process a continuous and potentially endless stream of audio blocks. The only problem is that it seems sox doesn't write to stdout until its buffer is filled. As a result, output blocks smaller than the buffer length are not accessible. Is there a way to alter this behavior using command line flags?

I'm aware that sending an eof would result in the remaining output being flushed, but that's not the behavior I'm looking for. I'd like to keep the sox instance alive to process blocks as needed.

Here's some example python code demonstrating whats happening. Note the output displaying the missing bytes in the comments at the end.
https://pastebin.com/Ejt6EW21 

To run, this snippet requires the soundfile and pexpect packages to be installed, which can be done by using the commands 'pip install soundfile' and 'pip install pexpect' in a terminal.
You'll also need to replace the path in 'file = sf.SoundFile(...)' on line 30 with one of your own, ideally a wav.
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users

[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux