Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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 at 7:54

1 Answer 1

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).

BUT

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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