in reply to Re^2: I need some help with open2
in thread I need some help with open2

So what are you printing to the sox process in the real program? I may be wrong, but it looks to me you're dumping unexpected data to sox that it just doesn't understand and craps out.

See post above about removing the print line.