Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When piping operations using SoX, I've noticed that files get shorter than they should:

Works fine:

sox -n -r 44100 silence.wav trim 0 1
sox --combine sequence silence.wav combined.wav
soxi -D combined.wav
> 1.000000

The resulting file gets shorter:

sox -n -r 44100 silence.wav trim 0 1
sox --combine sequence "|sox silence.wav -p" combined.wav
soxi -D combined.wav
> 0.998549 seconds

Tested with SoX version 14.4.1 on Windows 7 64 Family Edition. (On Windows, create a copy of sox.exe named soxi.exe for soxi to work.)

I'll spare you the rest of the details but there's basically a loss of 0.001451 sec for EACH pipe operation. (A little less at higher sampling rates.) For anything where accuracy is important, those milliseconds add up and do become significant, creating lags between where you expect the audio to be and where it really is.

Before I submit a bug report to the SoX team, I'd like to figure out if it really is a bug or isn't rather command-line related. Would anyone be kind enough to run both sets of commands on their system and post the results?

Thanks in advance -

share|improve this question
I do not see this problem with sox v14.4.1 running on a recent GNU/Linux system, i.e. both examples yield 1.000000. – Thor Apr 2 '14 at 7:54

On a windows 7 64 bits:

sox "|sox source -p trim 0 10" "|sox source -p trim 0 10" destination

Indeed gives me the same kind of buggy results (19.997s).


sox -t sox "|sox source -p trim 0 10" -t sox "|sox source -p trim 0 10" destination

Gives me the right results (20.0s).

From what I have read on some websites, you should specify the type of the pipe you use. And since "-p" is equivalent to "-t sox -", you ought to add "-t sox" in the "pipe using" sox call.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .