Bugs item #3602130, was opened at 2013-01-25 08:59
Message generated for change (Tracker Item Submitted) made by bgrz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3602130&group_id=10706

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: bgr (bgrz)
Assigned to: Nobody/Anonymous (nobody)
Summary: SoX on Windows "Broken pipe" on specific byte values

Initial Comment:
When using sox with |sox pipe subcommands on Windows (tested on Windows 7 
64-bit and Windows XP 32-bit - fails in cmd.exe, works in Cygwin), writing to 
the pipe will terminate prematurely depending on the value of the byte(s) 
currently written. Might be the case of pipes not treated as binary but 
changelogs mention that that's already fixed.
Among affected versions are 14.4.0 and 14.4.1rc2.

After a lot of experimenting I've distilled the following commands that will 
best showcase the problem:

sox -n -b 16 full.wav synth 3 sine 0.5 dcshift 1
sox -t wav -b 16 "|sox full.wav -t wav -b 16 -" wrong.wav

Explanation:
The first command will create the "control" wav file. The second will load it 
and try to dump it through pipe, but it'll fail at some point. Now the 
interesting thing:
The point of failure can be changed by tweaking the frequency of the sine in 
the first command (change 0.5 to something else). The reason I put "dcshift 1" 
and chose that small frequency is to postpone the failure, it has nothing to do 
with the cause of the problem itself. It took me a while to discover it, since 
sines with high frequency fail immediately. If you change 0.5 to 1, the 
resulting wrong wav's size will be the half of the one with freq 0.5, since the 
point of failure happens 2x sooner. If you change 0.5 to 0, the point of 
failure won't appear and the second command won't fail.

Note that this is by no means an edge case, what I actually want to do is 
something as simple as: 
sox "|sox -n -p synth 3 sine 300" out.wav
but that doesn't even output a file, at all (gives "can't open input pipe - 
premature EOF" + "error writing output file: Broken pipe"), only after half a 
day of messing with it I've managed to pinpoint this case that actually outputs 
files, so hopefully it'll help you fix the problem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3602130&group_id=10706

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to